xref: /openbmc/linux/arch/arm/mach-sunxi/sunxi.c (revision ad2091f8)
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/clocksource.h>
14d767af5eSMaxime Ripard #include <linux/init.h>
15614215c8SGeert Uytterhoeven #include <linux/of_clk.h>
16f91b7c62SChen-Yu Tsai #include <linux/platform_device.h>
17fdce6078SPhilipp Zabel #include <linux/reset/sunxi.h>
183b52634fSMaxime Ripard 
193b52634fSMaxime Ripard #include <asm/mach/arch.h>
2046ebbfcbSMylène Josserand #include <asm/secure_cntvoff.h>
21bc34b5f2SMaxime Ripard 
223b52634fSMaxime Ripard static const char * const sunxi_board_dt_compat[] = {
2343880f70SMaxime Ripard 	"allwinner,sun4i-a10",
2481265dfbSMaxime Ripard 	"allwinner,sun5i-a10s",
2543880f70SMaxime Ripard 	"allwinner,sun5i-a13",
26bef6229fSMaxime Ripard 	"allwinner,sun5i-r8",
27c1efda12SMaxime Ripard 	"nextthing,gr8",
283b52634fSMaxime Ripard 	NULL,
293b52634fSMaxime Ripard };
303b52634fSMaxime Ripard 
31bef6229fSMaxime Ripard DT_MACHINE_START(SUNXI_DT, "Allwinner sun4i/sun5i Families")
323b52634fSMaxime Ripard 	.dt_compat	= sunxi_board_dt_compat,
333b52634fSMaxime Ripard MACHINE_END
3491a31977SMaxime Ripard 
3591a31977SMaxime Ripard static const char * const sun6i_board_dt_compat[] = {
3691a31977SMaxime Ripard 	"allwinner,sun6i-a31",
37b0f2faa5SHans de Goede 	"allwinner,sun6i-a31s",
3891a31977SMaxime Ripard 	NULL,
3991a31977SMaxime Ripard };
4091a31977SMaxime Ripard 
41751b2ac4SMaxime Ripard static void __init sun6i_timer_init(void)
42751b2ac4SMaxime Ripard {
43751b2ac4SMaxime Ripard 	of_clk_init(NULL);
44e58cf019SArnd Bergmann 	if (IS_ENABLED(CONFIG_RESET_CONTROLLER))
45751b2ac4SMaxime Ripard 		sun6i_reset_init();
46ba5d08c0SDaniel Lezcano 	timer_probe();
47751b2ac4SMaxime Ripard }
48751b2ac4SMaxime Ripard 
4991a31977SMaxime Ripard DT_MACHINE_START(SUN6I_DT, "Allwinner sun6i (A31) Family")
50751b2ac4SMaxime Ripard 	.init_time	= sun6i_timer_init,
5191a31977SMaxime Ripard 	.dt_compat	= sun6i_board_dt_compat,
5291a31977SMaxime Ripard MACHINE_END
5391a31977SMaxime Ripard 
5491a31977SMaxime Ripard static const char * const sun7i_board_dt_compat[] = {
5591a31977SMaxime Ripard 	"allwinner,sun7i-a20",
5691a31977SMaxime Ripard 	NULL,
5791a31977SMaxime Ripard };
5891a31977SMaxime Ripard 
5991a31977SMaxime Ripard DT_MACHINE_START(SUN7I_DT, "Allwinner sun7i (A20) Family")
6091a31977SMaxime Ripard 	.dt_compat	= sun7i_board_dt_compat,
613b52634fSMaxime Ripard MACHINE_END
62ac84b79fSChen-Yu Tsai 
63ac84b79fSChen-Yu Tsai static const char * const sun8i_board_dt_compat[] = {
64ac84b79fSChen-Yu Tsai 	"allwinner,sun8i-a23",
65159870d2SVishnu Patekar 	"allwinner,sun8i-a33",
6616fa9629SIcenowy Zheng 	"allwinner,sun8i-h2-plus",
6714a882dfSJens Kuske 	"allwinner,sun8i-h3",
6814e25a03SIcenowy Zheng 	"allwinner,sun8i-r40",
69ad2091f8SPaul Kocialkowski 	"allwinner,sun8i-v3",
70b074fedeSIcenowy Zheng 	"allwinner,sun8i-v3s",
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,
77ac84b79fSChen-Yu Tsai MACHINE_END
783d4c2f1cSChen-Yu Tsai 
7946ebbfcbSMylène Josserand static void __init sun8i_a83t_cntvoff_init(void)
8046ebbfcbSMylène Josserand {
8146ebbfcbSMylène Josserand #ifdef CONFIG_SMP
8246ebbfcbSMylène Josserand 	secure_cntvoff_init();
8346ebbfcbSMylène Josserand #endif
8446ebbfcbSMylène Josserand }
8546ebbfcbSMylène Josserand 
8646ebbfcbSMylène Josserand static const char * const sun8i_a83t_cntvoff_board_dt_compat[] = {
8746ebbfcbSMylène Josserand 	"allwinner,sun8i-a83t",
8846ebbfcbSMylène Josserand 	NULL,
8946ebbfcbSMylène Josserand };
9046ebbfcbSMylène Josserand 
9146ebbfcbSMylène Josserand DT_MACHINE_START(SUN8I_A83T_CNTVOFF_DT, "Allwinner A83t board")
9246ebbfcbSMylène Josserand 	.init_early	= sun8i_a83t_cntvoff_init,
9346ebbfcbSMylène Josserand 	.init_time	= sun6i_timer_init,
9446ebbfcbSMylène Josserand 	.dt_compat	= sun8i_a83t_cntvoff_board_dt_compat,
9546ebbfcbSMylène Josserand MACHINE_END
9646ebbfcbSMylène Josserand 
973d4c2f1cSChen-Yu Tsai static const char * const sun9i_board_dt_compat[] = {
983d4c2f1cSChen-Yu Tsai 	"allwinner,sun9i-a80",
993d4c2f1cSChen-Yu Tsai 	NULL,
1003d4c2f1cSChen-Yu Tsai };
1013d4c2f1cSChen-Yu Tsai 
1023d4c2f1cSChen-Yu Tsai DT_MACHINE_START(SUN9I_DT, "Allwinner sun9i Family")
1033d4c2f1cSChen-Yu Tsai 	.dt_compat	= sun9i_board_dt_compat,
1043d4c2f1cSChen-Yu Tsai MACHINE_END
105ba08dcc8SMesih Kilinc 
106ba08dcc8SMesih Kilinc static const char * const suniv_board_dt_compat[] = {
107ba08dcc8SMesih Kilinc 	"allwinner,suniv-f1c100s",
108ba08dcc8SMesih Kilinc 	NULL,
109ba08dcc8SMesih Kilinc };
110ba08dcc8SMesih Kilinc 
111ba08dcc8SMesih Kilinc DT_MACHINE_START(SUNIV_DT, "Allwinner suniv Family")
112ba08dcc8SMesih Kilinc 	.dt_compat	= suniv_board_dt_compat,
113ba08dcc8SMesih Kilinc MACHINE_END
114