xref: /openbmc/linux/arch/arm/mach-sunxi/sunxi.c (revision 14a882df)
13b52634fSMaxime Ripard /*
23b52634fSMaxime Ripard  * Device Tree support for Allwinner A1X SoCs
33b52634fSMaxime Ripard  *
43b52634fSMaxime Ripard  * Copyright (C) 2012 Maxime Ripard
53b52634fSMaxime Ripard  *
63b52634fSMaxime Ripard  * Maxime Ripard <maxime.ripard@free-electrons.com>
73b52634fSMaxime Ripard  *
83b52634fSMaxime Ripard  * This file is licensed under the terms of the GNU General Public
93b52634fSMaxime Ripard  * License version 2.  This program is licensed "as is" without any
103b52634fSMaxime Ripard  * warranty of any kind, whether express or implied.
113b52634fSMaxime Ripard  */
123b52634fSMaxime Ripard 
13751b2ac4SMaxime Ripard #include <linux/clk-provider.h>
14751b2ac4SMaxime Ripard #include <linux/clocksource.h>
15d767af5eSMaxime Ripard #include <linux/init.h>
16f91b7c62SChen-Yu Tsai #include <linux/platform_device.h>
173b52634fSMaxime Ripard 
183b52634fSMaxime Ripard #include <asm/mach/arch.h>
19bc34b5f2SMaxime Ripard 
20f91b7c62SChen-Yu Tsai static void __init sunxi_dt_cpufreq_init(void)
21f91b7c62SChen-Yu Tsai {
22f91b7c62SChen-Yu Tsai 	platform_device_register_simple("cpufreq-dt", -1, NULL, 0);
23f91b7c62SChen-Yu Tsai }
24f91b7c62SChen-Yu Tsai 
253b52634fSMaxime Ripard static const char * const sunxi_board_dt_compat[] = {
2643880f70SMaxime Ripard 	"allwinner,sun4i-a10",
2781265dfbSMaxime Ripard 	"allwinner,sun5i-a10s",
2843880f70SMaxime Ripard 	"allwinner,sun5i-a13",
293b52634fSMaxime Ripard 	NULL,
303b52634fSMaxime Ripard };
313b52634fSMaxime Ripard 
323b52634fSMaxime Ripard DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)")
333b52634fSMaxime Ripard 	.dt_compat	= sunxi_board_dt_compat,
34f91b7c62SChen-Yu Tsai 	.init_late	= sunxi_dt_cpufreq_init,
353b52634fSMaxime Ripard MACHINE_END
3691a31977SMaxime Ripard 
3791a31977SMaxime Ripard static const char * const sun6i_board_dt_compat[] = {
3891a31977SMaxime Ripard 	"allwinner,sun6i-a31",
39b0f2faa5SHans de Goede 	"allwinner,sun6i-a31s",
4091a31977SMaxime Ripard 	NULL,
4191a31977SMaxime Ripard };
4291a31977SMaxime Ripard 
43751b2ac4SMaxime Ripard extern void __init sun6i_reset_init(void);
44751b2ac4SMaxime Ripard static void __init sun6i_timer_init(void)
45751b2ac4SMaxime Ripard {
46751b2ac4SMaxime Ripard 	of_clk_init(NULL);
47e58cf019SArnd Bergmann 	if (IS_ENABLED(CONFIG_RESET_CONTROLLER))
48751b2ac4SMaxime Ripard 		sun6i_reset_init();
49751b2ac4SMaxime Ripard 	clocksource_of_init();
50751b2ac4SMaxime Ripard }
51751b2ac4SMaxime Ripard 
5291a31977SMaxime Ripard DT_MACHINE_START(SUN6I_DT, "Allwinner sun6i (A31) Family")
53751b2ac4SMaxime Ripard 	.init_time	= sun6i_timer_init,
5491a31977SMaxime Ripard 	.dt_compat	= sun6i_board_dt_compat,
55f91b7c62SChen-Yu Tsai 	.init_late	= sunxi_dt_cpufreq_init,
5691a31977SMaxime Ripard MACHINE_END
5791a31977SMaxime Ripard 
5891a31977SMaxime Ripard static const char * const sun7i_board_dt_compat[] = {
5991a31977SMaxime Ripard 	"allwinner,sun7i-a20",
6091a31977SMaxime Ripard 	NULL,
6191a31977SMaxime Ripard };
6291a31977SMaxime Ripard 
6391a31977SMaxime Ripard DT_MACHINE_START(SUN7I_DT, "Allwinner sun7i (A20) Family")
6491a31977SMaxime Ripard 	.dt_compat	= sun7i_board_dt_compat,
65f91b7c62SChen-Yu Tsai 	.init_late	= sunxi_dt_cpufreq_init,
663b52634fSMaxime Ripard MACHINE_END
67ac84b79fSChen-Yu Tsai 
68ac84b79fSChen-Yu Tsai static const char * const sun8i_board_dt_compat[] = {
69ac84b79fSChen-Yu Tsai 	"allwinner,sun8i-a23",
7014a882dfSJens Kuske 	"allwinner,sun8i-h3",
71ac84b79fSChen-Yu Tsai 	NULL,
72ac84b79fSChen-Yu Tsai };
73ac84b79fSChen-Yu Tsai 
7414a882dfSJens Kuske DT_MACHINE_START(SUN8I_DT, "Allwinner sun8i Family")
7514a882dfSJens Kuske 	.init_time	= sun6i_timer_init,
76ac84b79fSChen-Yu Tsai 	.dt_compat	= sun8i_board_dt_compat,
77f91b7c62SChen-Yu Tsai 	.init_late	= sunxi_dt_cpufreq_init,
78ac84b79fSChen-Yu Tsai MACHINE_END
793d4c2f1cSChen-Yu Tsai 
803d4c2f1cSChen-Yu Tsai static const char * const sun9i_board_dt_compat[] = {
813d4c2f1cSChen-Yu Tsai 	"allwinner,sun9i-a80",
823d4c2f1cSChen-Yu Tsai 	NULL,
833d4c2f1cSChen-Yu Tsai };
843d4c2f1cSChen-Yu Tsai 
853d4c2f1cSChen-Yu Tsai DT_MACHINE_START(SUN9I_DT, "Allwinner sun9i Family")
863d4c2f1cSChen-Yu Tsai 	.dt_compat	= sun9i_board_dt_compat,
873d4c2f1cSChen-Yu Tsai MACHINE_END
88