1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Device Tree support for Allwinner A1X SoCs
4  *
5  * Copyright (C) 2012 Maxime Ripard
6  *
7  * Maxime Ripard <maxime.ripard@free-electrons.com>
8  *
9  */
10 
11 #include <linux/clocksource.h>
12 #include <linux/init.h>
13 #include <linux/of_clk.h>
14 #include <linux/platform_device.h>
15 #include <linux/reset/sunxi.h>
16 
17 #include <asm/mach/arch.h>
18 #include <asm/secure_cntvoff.h>
19 
20 static const char * const sunxi_board_dt_compat[] = {
21 	"allwinner,sun4i-a10",
22 	"allwinner,sun5i-a10s",
23 	"allwinner,sun5i-a13",
24 	"allwinner,sun5i-r8",
25 	"nextthing,gr8",
26 	NULL,
27 };
28 
29 DT_MACHINE_START(SUNXI_DT, "Allwinner sun4i/sun5i Families")
30 	.dt_compat	= sunxi_board_dt_compat,
31 MACHINE_END
32 
33 static const char * const sun6i_board_dt_compat[] = {
34 	"allwinner,sun6i-a31",
35 	"allwinner,sun6i-a31s",
36 	NULL,
37 };
38 
sun6i_timer_init(void)39 static void __init sun6i_timer_init(void)
40 {
41 	of_clk_init(NULL);
42 	if (IS_ENABLED(CONFIG_RESET_CONTROLLER))
43 		sun6i_reset_init();
44 	timer_probe();
45 }
46 
47 DT_MACHINE_START(SUN6I_DT, "Allwinner sun6i (A31) Family")
48 	.init_time	= sun6i_timer_init,
49 	.dt_compat	= sun6i_board_dt_compat,
50 MACHINE_END
51 
52 static const char * const sun7i_board_dt_compat[] = {
53 	"allwinner,sun7i-a20",
54 	NULL,
55 };
56 
57 DT_MACHINE_START(SUN7I_DT, "Allwinner sun7i (A20) Family")
58 	.dt_compat	= sun7i_board_dt_compat,
59 MACHINE_END
60 
61 static const char * const sun8i_board_dt_compat[] = {
62 	"allwinner,sun8i-a23",
63 	"allwinner,sun8i-a33",
64 	"allwinner,sun8i-h2-plus",
65 	"allwinner,sun8i-h3",
66 	"allwinner,sun8i-r40",
67 	"allwinner,sun8i-v3",
68 	"allwinner,sun8i-v3s",
69 	NULL,
70 };
71 
72 DT_MACHINE_START(SUN8I_DT, "Allwinner sun8i Family")
73 	.init_time	= sun6i_timer_init,
74 	.dt_compat	= sun8i_board_dt_compat,
75 MACHINE_END
76 
77 static void __init sun8i_a83t_cntvoff_init(void)
78 {
79 #ifdef CONFIG_SMP
80 	secure_cntvoff_init();
81 #endif
82 }
83 
84 static const char * const sun8i_a83t_cntvoff_board_dt_compat[] = {
85 	"allwinner,sun8i-a83t",
86 	NULL,
87 };
88 
89 DT_MACHINE_START(SUN8I_A83T_CNTVOFF_DT, "Allwinner A83t board")
90 	.init_early	= sun8i_a83t_cntvoff_init,
91 	.init_time	= sun6i_timer_init,
92 	.dt_compat	= sun8i_a83t_cntvoff_board_dt_compat,
93 MACHINE_END
94 
95 static const char * const sun9i_board_dt_compat[] = {
96 	"allwinner,sun9i-a80",
97 	NULL,
98 };
99 
100 DT_MACHINE_START(SUN9I_DT, "Allwinner sun9i Family")
101 	.dt_compat	= sun9i_board_dt_compat,
102 MACHINE_END
103 
104 static const char * const suniv_board_dt_compat[] = {
105 	"allwinner,suniv-f1c100s",
106 	NULL,
107 };
108 
109 DT_MACHINE_START(SUNIV_DT, "Allwinner suniv Family")
110 	.dt_compat	= suniv_board_dt_compat,
111 MACHINE_END
112