xref: /openbmc/linux/arch/arm/mach-sunxi/sunxi.c (revision 4f3db074)
1 /*
2  * Device Tree support for Allwinner A1X SoCs
3  *
4  * Copyright (C) 2012 Maxime Ripard
5  *
6  * Maxime Ripard <maxime.ripard@free-electrons.com>
7  *
8  * This file is licensed under the terms of the GNU General Public
9  * License version 2.  This program is licensed "as is" without any
10  * warranty of any kind, whether express or implied.
11  */
12 
13 #include <linux/clk-provider.h>
14 #include <linux/clocksource.h>
15 #include <linux/init.h>
16 #include <linux/platform_device.h>
17 
18 #include <asm/mach/arch.h>
19 
20 static void __init sunxi_dt_cpufreq_init(void)
21 {
22 	platform_device_register_simple("cpufreq-dt", -1, NULL, 0);
23 }
24 
25 static const char * const sunxi_board_dt_compat[] = {
26 	"allwinner,sun4i-a10",
27 	"allwinner,sun5i-a10s",
28 	"allwinner,sun5i-a13",
29 	NULL,
30 };
31 
32 DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)")
33 	.dt_compat	= sunxi_board_dt_compat,
34 	.init_late	= sunxi_dt_cpufreq_init,
35 MACHINE_END
36 
37 static const char * const sun6i_board_dt_compat[] = {
38 	"allwinner,sun6i-a31",
39 	"allwinner,sun6i-a31s",
40 	NULL,
41 };
42 
43 extern void __init sun6i_reset_init(void);
44 static void __init sun6i_timer_init(void)
45 {
46 	of_clk_init(NULL);
47 	if (IS_ENABLED(CONFIG_RESET_CONTROLLER))
48 		sun6i_reset_init();
49 	clocksource_of_init();
50 }
51 
52 DT_MACHINE_START(SUN6I_DT, "Allwinner sun6i (A31) Family")
53 	.init_time	= sun6i_timer_init,
54 	.dt_compat	= sun6i_board_dt_compat,
55 	.init_late	= sunxi_dt_cpufreq_init,
56 MACHINE_END
57 
58 static const char * const sun7i_board_dt_compat[] = {
59 	"allwinner,sun7i-a20",
60 	NULL,
61 };
62 
63 DT_MACHINE_START(SUN7I_DT, "Allwinner sun7i (A20) Family")
64 	.dt_compat	= sun7i_board_dt_compat,
65 	.init_late	= sunxi_dt_cpufreq_init,
66 MACHINE_END
67 
68 static const char * const sun8i_board_dt_compat[] = {
69 	"allwinner,sun8i-a23",
70 	NULL,
71 };
72 
73 DT_MACHINE_START(SUN8I_DT, "Allwinner sun8i (A23) Family")
74 	.dt_compat	= sun8i_board_dt_compat,
75 	.init_late	= sunxi_dt_cpufreq_init,
76 MACHINE_END
77 
78 static const char * const sun9i_board_dt_compat[] = {
79 	"allwinner,sun9i-a80",
80 	NULL,
81 };
82 
83 DT_MACHINE_START(SUN9I_DT, "Allwinner sun9i Family")
84 	.dt_compat	= sun9i_board_dt_compat,
85 MACHINE_END
86