xref: /linux/arch/arm/mach-sunxi/sunxi.c (revision 7cb82b985f6e74733e32ec301a010533c7ce2f63)
1*7cb82b98SJason Wang // SPDX-License-Identifier: GPL-2.0
23b52634fSMaxime Ripard /*
33b52634fSMaxime Ripard  * Device Tree support for Allwinner A1X SoCs
43b52634fSMaxime Ripard  *
53b52634fSMaxime Ripard  * Copyright (C) 2012 Maxime Ripard
63b52634fSMaxime Ripard  *
73b52634fSMaxime Ripard  * Maxime Ripard <maxime.ripard@free-electrons.com>
83b52634fSMaxime Ripard  *
93b52634fSMaxime Ripard  */
103b52634fSMaxime Ripard 
11751b2ac4SMaxime Ripard #include <linux/clocksource.h>
12d767af5eSMaxime Ripard #include <linux/init.h>
13614215c8SGeert Uytterhoeven #include <linux/of_clk.h>
14f91b7c62SChen-Yu Tsai #include <linux/platform_device.h>
15fdce6078SPhilipp Zabel #include <linux/reset/sunxi.h>
163b52634fSMaxime Ripard 
173b52634fSMaxime Ripard #include <asm/mach/arch.h>
1846ebbfcbSMylène Josserand #include <asm/secure_cntvoff.h>
19bc34b5f2SMaxime Ripard 
203b52634fSMaxime Ripard static const char * const sunxi_board_dt_compat[] = {
2143880f70SMaxime Ripard 	"allwinner,sun4i-a10",
2281265dfbSMaxime Ripard 	"allwinner,sun5i-a10s",
2343880f70SMaxime Ripard 	"allwinner,sun5i-a13",
24bef6229fSMaxime Ripard 	"allwinner,sun5i-r8",
25c1efda12SMaxime Ripard 	"nextthing,gr8",
263b52634fSMaxime Ripard 	NULL,
273b52634fSMaxime Ripard };
283b52634fSMaxime Ripard 
29bef6229fSMaxime Ripard DT_MACHINE_START(SUNXI_DT, "Allwinner sun4i/sun5i Families")
303b52634fSMaxime Ripard 	.dt_compat	= sunxi_board_dt_compat,
313b52634fSMaxime Ripard MACHINE_END
3291a31977SMaxime Ripard 
3391a31977SMaxime Ripard static const char * const sun6i_board_dt_compat[] = {
3491a31977SMaxime Ripard 	"allwinner,sun6i-a31",
35b0f2faa5SHans de Goede 	"allwinner,sun6i-a31s",
3691a31977SMaxime Ripard 	NULL,
3791a31977SMaxime Ripard };
3891a31977SMaxime Ripard 
39751b2ac4SMaxime Ripard static void __init sun6i_timer_init(void)
40751b2ac4SMaxime Ripard {
41751b2ac4SMaxime Ripard 	of_clk_init(NULL);
42e58cf019SArnd Bergmann 	if (IS_ENABLED(CONFIG_RESET_CONTROLLER))
43751b2ac4SMaxime Ripard 		sun6i_reset_init();
44ba5d08c0SDaniel Lezcano 	timer_probe();
45751b2ac4SMaxime Ripard }
46751b2ac4SMaxime Ripard 
4791a31977SMaxime Ripard DT_MACHINE_START(SUN6I_DT, "Allwinner sun6i (A31) Family")
48751b2ac4SMaxime Ripard 	.init_time	= sun6i_timer_init,
4991a31977SMaxime Ripard 	.dt_compat	= sun6i_board_dt_compat,
5091a31977SMaxime Ripard MACHINE_END
5191a31977SMaxime Ripard 
5291a31977SMaxime Ripard static const char * const sun7i_board_dt_compat[] = {
5391a31977SMaxime Ripard 	"allwinner,sun7i-a20",
5491a31977SMaxime Ripard 	NULL,
5591a31977SMaxime Ripard };
5691a31977SMaxime Ripard 
5791a31977SMaxime Ripard DT_MACHINE_START(SUN7I_DT, "Allwinner sun7i (A20) Family")
5891a31977SMaxime Ripard 	.dt_compat	= sun7i_board_dt_compat,
593b52634fSMaxime Ripard MACHINE_END
60ac84b79fSChen-Yu Tsai 
61ac84b79fSChen-Yu Tsai static const char * const sun8i_board_dt_compat[] = {
62ac84b79fSChen-Yu Tsai 	"allwinner,sun8i-a23",
63159870d2SVishnu Patekar 	"allwinner,sun8i-a33",
6416fa9629SIcenowy Zheng 	"allwinner,sun8i-h2-plus",
6514a882dfSJens Kuske 	"allwinner,sun8i-h3",
6614e25a03SIcenowy Zheng 	"allwinner,sun8i-r40",
67ad2091f8SPaul Kocialkowski 	"allwinner,sun8i-v3",
68b074fedeSIcenowy Zheng 	"allwinner,sun8i-v3s",
69ac84b79fSChen-Yu Tsai 	NULL,
70ac84b79fSChen-Yu Tsai };
71ac84b79fSChen-Yu Tsai 
7214a882dfSJens Kuske DT_MACHINE_START(SUN8I_DT, "Allwinner sun8i Family")
7314a882dfSJens Kuske 	.init_time	= sun6i_timer_init,
74ac84b79fSChen-Yu Tsai 	.dt_compat	= sun8i_board_dt_compat,
75ac84b79fSChen-Yu Tsai MACHINE_END
763d4c2f1cSChen-Yu Tsai 
7746ebbfcbSMylène Josserand static void __init sun8i_a83t_cntvoff_init(void)
7846ebbfcbSMylène Josserand {
7946ebbfcbSMylène Josserand #ifdef CONFIG_SMP
8046ebbfcbSMylène Josserand 	secure_cntvoff_init();
8146ebbfcbSMylène Josserand #endif
8246ebbfcbSMylène Josserand }
8346ebbfcbSMylène Josserand 
8446ebbfcbSMylène Josserand static const char * const sun8i_a83t_cntvoff_board_dt_compat[] = {
8546ebbfcbSMylène Josserand 	"allwinner,sun8i-a83t",
8646ebbfcbSMylène Josserand 	NULL,
8746ebbfcbSMylène Josserand };
8846ebbfcbSMylène Josserand 
8946ebbfcbSMylène Josserand DT_MACHINE_START(SUN8I_A83T_CNTVOFF_DT, "Allwinner A83t board")
9046ebbfcbSMylène Josserand 	.init_early	= sun8i_a83t_cntvoff_init,
9146ebbfcbSMylène Josserand 	.init_time	= sun6i_timer_init,
9246ebbfcbSMylène Josserand 	.dt_compat	= sun8i_a83t_cntvoff_board_dt_compat,
9346ebbfcbSMylène Josserand MACHINE_END
9446ebbfcbSMylène Josserand 
953d4c2f1cSChen-Yu Tsai static const char * const sun9i_board_dt_compat[] = {
963d4c2f1cSChen-Yu Tsai 	"allwinner,sun9i-a80",
973d4c2f1cSChen-Yu Tsai 	NULL,
983d4c2f1cSChen-Yu Tsai };
993d4c2f1cSChen-Yu Tsai 
1003d4c2f1cSChen-Yu Tsai DT_MACHINE_START(SUN9I_DT, "Allwinner sun9i Family")
1013d4c2f1cSChen-Yu Tsai 	.dt_compat	= sun9i_board_dt_compat,
1023d4c2f1cSChen-Yu Tsai MACHINE_END
103ba08dcc8SMesih Kilinc 
104ba08dcc8SMesih Kilinc static const char * const suniv_board_dt_compat[] = {
105ba08dcc8SMesih Kilinc 	"allwinner,suniv-f1c100s",
106ba08dcc8SMesih Kilinc 	NULL,
107ba08dcc8SMesih Kilinc };
108ba08dcc8SMesih Kilinc 
109ba08dcc8SMesih Kilinc DT_MACHINE_START(SUNIV_DT, "Allwinner suniv Family")
110ba08dcc8SMesih Kilinc 	.dt_compat	= suniv_board_dt_compat,
111ba08dcc8SMesih Kilinc MACHINE_END
112