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