1 /*
2  * Copyright (C) 2005 Nokia Corporation
3  * Author: Paul Mundt <paul.mundt@nokia.com>
4  *
5  * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6  *
7  * Modified from the original mach-omap/omap2/board-generic.c did by Paul
8  * to support the OMAP2+ device tree boards with an unique board file.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License version 2 as
12  * published by the Free Software Foundation.
13  */
14 #include <linux/io.h>
15 #include <linux/of_irq.h>
16 #include <linux/of_platform.h>
17 #include <linux/irqdomain.h>
18 
19 #include <asm/mach/arch.h>
20 
21 #include "common.h"
22 
23 #if !(defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3))
24 #define intc_of_init	NULL
25 #endif
26 #ifndef CONFIG_ARCH_OMAP4
27 #define gic_of_init		NULL
28 #endif
29 
30 static const struct of_device_id omap_dt_match_table[] __initconst = {
31 	{ .compatible = "simple-bus", },
32 	{ .compatible = "ti,omap-infra", },
33 	{ }
34 };
35 
36 static void __init omap_generic_init(void)
37 {
38 	omapdss_early_init_of();
39 
40 	pdata_quirks_init(omap_dt_match_table);
41 
42 	omapdss_init_of();
43 }
44 
45 #ifdef CONFIG_SOC_OMAP2420
46 static const char *const omap242x_boards_compat[] __initconst = {
47 	"ti,omap2420",
48 	NULL,
49 };
50 
51 DT_MACHINE_START(OMAP242X_DT, "Generic OMAP2420 (Flattened Device Tree)")
52 	.reserve	= omap_reserve,
53 	.map_io		= omap242x_map_io,
54 	.init_early	= omap2420_init_early,
55 	.init_machine	= omap_generic_init,
56 	.init_time	= omap2_sync32k_timer_init,
57 	.dt_compat	= omap242x_boards_compat,
58 	.restart	= omap2xxx_restart,
59 MACHINE_END
60 #endif
61 
62 #ifdef CONFIG_SOC_OMAP2430
63 static const char *const omap243x_boards_compat[] __initconst = {
64 	"ti,omap2430",
65 	NULL,
66 };
67 
68 DT_MACHINE_START(OMAP243X_DT, "Generic OMAP2430 (Flattened Device Tree)")
69 	.reserve	= omap_reserve,
70 	.map_io		= omap243x_map_io,
71 	.init_early	= omap2430_init_early,
72 	.init_machine	= omap_generic_init,
73 	.init_time	= omap2_sync32k_timer_init,
74 	.dt_compat	= omap243x_boards_compat,
75 	.restart	= omap2xxx_restart,
76 MACHINE_END
77 #endif
78 
79 #ifdef CONFIG_ARCH_OMAP3
80 static const char *const omap3_boards_compat[] __initconst = {
81 	"ti,omap3430",
82 	"ti,omap3",
83 	NULL,
84 };
85 
86 DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
87 	.reserve	= omap_reserve,
88 	.map_io		= omap3_map_io,
89 	.init_early	= omap3430_init_early,
90 	.init_machine	= omap_generic_init,
91 	.init_late	= omap3_init_late,
92 	.init_time	= omap3_sync32k_timer_init,
93 	.dt_compat	= omap3_boards_compat,
94 	.restart	= omap3xxx_restart,
95 MACHINE_END
96 
97 static const char *const omap36xx_boards_compat[] __initconst = {
98 	"ti,omap36xx",
99 	NULL,
100 };
101 
102 DT_MACHINE_START(OMAP36XX_DT, "Generic OMAP36xx (Flattened Device Tree)")
103 	.reserve	= omap_reserve,
104 	.map_io		= omap3_map_io,
105 	.init_early	= omap3630_init_early,
106 	.init_machine	= omap_generic_init,
107 	.init_late	= omap3_init_late,
108 	.init_time	= omap3_sync32k_timer_init,
109 	.dt_compat	= omap36xx_boards_compat,
110 	.restart	= omap3xxx_restart,
111 MACHINE_END
112 
113 static const char *const omap3_gp_boards_compat[] __initconst = {
114 	"ti,omap3-beagle",
115 	"timll,omap3-devkit8000",
116 	NULL,
117 };
118 
119 DT_MACHINE_START(OMAP3_GP_DT, "Generic OMAP3-GP (Flattened Device Tree)")
120 	.reserve	= omap_reserve,
121 	.map_io		= omap3_map_io,
122 	.init_early	= omap3430_init_early,
123 	.init_machine	= omap_generic_init,
124 	.init_late	= omap3_init_late,
125 	.init_time	= omap3_secure_sync32k_timer_init,
126 	.dt_compat	= omap3_gp_boards_compat,
127 	.restart	= omap3xxx_restart,
128 MACHINE_END
129 
130 static const char *const am3517_boards_compat[] __initconst = {
131 	"ti,am3517",
132 	NULL,
133 };
134 
135 DT_MACHINE_START(AM3517_DT, "Generic AM3517 (Flattened Device Tree)")
136 	.reserve	= omap_reserve,
137 	.map_io		= omap3_map_io,
138 	.init_early	= am35xx_init_early,
139 	.init_machine	= omap_generic_init,
140 	.init_late	= omap3_init_late,
141 	.init_time	= omap3_gptimer_timer_init,
142 	.dt_compat	= am3517_boards_compat,
143 	.restart	= omap3xxx_restart,
144 MACHINE_END
145 #endif
146 
147 #ifdef CONFIG_SOC_AM33XX
148 static const char *const am33xx_boards_compat[] __initconst = {
149 	"ti,am33xx",
150 	NULL,
151 };
152 
153 DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)")
154 	.reserve	= omap_reserve,
155 	.map_io		= am33xx_map_io,
156 	.init_early	= am33xx_init_early,
157 	.init_machine	= omap_generic_init,
158 	.init_late	= am33xx_init_late,
159 	.init_time	= omap3_gptimer_timer_init,
160 	.dt_compat	= am33xx_boards_compat,
161 	.restart	= am33xx_restart,
162 MACHINE_END
163 #endif
164 
165 #ifdef CONFIG_ARCH_OMAP4
166 static const char *const omap4_boards_compat[] __initconst = {
167 	"ti,omap4460",
168 	"ti,omap4430",
169 	"ti,omap4",
170 	NULL,
171 };
172 
173 DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)")
174 	.reserve	= omap_reserve,
175 	.smp		= smp_ops(omap4_smp_ops),
176 	.map_io		= omap4_map_io,
177 	.init_early	= omap4430_init_early,
178 	.init_irq	= omap_gic_of_init,
179 	.init_machine	= omap_generic_init,
180 	.init_late	= omap4430_init_late,
181 	.init_time	= omap4_local_timer_init,
182 	.dt_compat	= omap4_boards_compat,
183 	.restart	= omap44xx_restart,
184 MACHINE_END
185 #endif
186 
187 #ifdef CONFIG_SOC_OMAP5
188 static const char *const omap5_boards_compat[] __initconst = {
189 	"ti,omap5432",
190 	"ti,omap5430",
191 	"ti,omap5",
192 	NULL,
193 };
194 
195 DT_MACHINE_START(OMAP5_DT, "Generic OMAP5 (Flattened Device Tree)")
196 	.reserve	= omap_reserve,
197 	.smp		= smp_ops(omap4_smp_ops),
198 	.map_io		= omap5_map_io,
199 	.init_early	= omap5_init_early,
200 	.init_irq	= omap_gic_of_init,
201 	.init_machine	= omap_generic_init,
202 	.init_late	= omap5_init_late,
203 	.init_time	= omap5_realtime_timer_init,
204 	.dt_compat	= omap5_boards_compat,
205 	.restart	= omap44xx_restart,
206 MACHINE_END
207 #endif
208 
209 #ifdef CONFIG_SOC_AM43XX
210 static const char *const am43_boards_compat[] __initconst = {
211 	"ti,am4372",
212 	"ti,am43",
213 	NULL,
214 };
215 
216 DT_MACHINE_START(AM43_DT, "Generic AM43 (Flattened Device Tree)")
217 	.map_io		= am33xx_map_io,
218 	.init_early	= am43xx_init_early,
219 	.init_late	= am43xx_init_late,
220 	.init_irq	= omap_gic_of_init,
221 	.init_machine	= omap_generic_init,
222 	.init_time	= omap3_gptimer_timer_init,
223 	.dt_compat	= am43_boards_compat,
224 	.restart	= omap44xx_restart,
225 MACHINE_END
226 #endif
227 
228 #ifdef CONFIG_SOC_DRA7XX
229 static const char *const dra74x_boards_compat[] __initconst = {
230 	"ti,am5728",
231 	"ti,am5726",
232 	"ti,dra742",
233 	"ti,dra7",
234 	NULL,
235 };
236 
237 DT_MACHINE_START(DRA74X_DT, "Generic DRA74X (Flattened Device Tree)")
238 	.reserve	= omap_reserve,
239 	.smp		= smp_ops(omap4_smp_ops),
240 	.map_io		= omap5_map_io,
241 	.init_early	= dra7xx_init_early,
242 	.init_late	= dra7xx_init_late,
243 	.init_irq	= omap_gic_of_init,
244 	.init_machine	= omap_generic_init,
245 	.init_time	= omap5_realtime_timer_init,
246 	.dt_compat	= dra74x_boards_compat,
247 	.restart	= omap44xx_restart,
248 MACHINE_END
249 
250 static const char *const dra72x_boards_compat[] __initconst = {
251 	"ti,am5718",
252 	"ti,am5716",
253 	"ti,dra722",
254 	NULL,
255 };
256 
257 DT_MACHINE_START(DRA72X_DT, "Generic DRA72X (Flattened Device Tree)")
258 	.reserve	= omap_reserve,
259 	.map_io		= omap5_map_io,
260 	.init_early	= dra7xx_init_early,
261 	.init_late	= dra7xx_init_late,
262 	.init_irq	= omap_gic_of_init,
263 	.init_machine	= omap_generic_init,
264 	.init_time	= omap5_realtime_timer_init,
265 	.dt_compat	= dra72x_boards_compat,
266 	.restart	= omap44xx_restart,
267 MACHINE_END
268 #endif
269