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 static const struct of_device_id omap_dt_match_table[] __initconst = {
24 	{ .compatible = "simple-bus", },
25 	{ .compatible = "ti,omap-infra", },
26 	{ }
27 };
28 
29 static void __init omap_generic_init(void)
30 {
31 	omapdss_early_init_of();
32 
33 	pdata_quirks_init(omap_dt_match_table);
34 
35 	omapdss_init_of();
36 }
37 
38 #ifdef CONFIG_SOC_OMAP2420
39 static const char *const omap242x_boards_compat[] __initconst = {
40 	"ti,omap2420",
41 	NULL,
42 };
43 
44 DT_MACHINE_START(OMAP242X_DT, "Generic OMAP2420 (Flattened Device Tree)")
45 	.reserve	= omap_reserve,
46 	.map_io		= omap242x_map_io,
47 	.init_early	= omap2420_init_early,
48 	.init_machine	= omap_generic_init,
49 	.init_time	= omap2_sync32k_timer_init,
50 	.dt_compat	= omap242x_boards_compat,
51 	.restart	= omap2xxx_restart,
52 MACHINE_END
53 #endif
54 
55 #ifdef CONFIG_SOC_OMAP2430
56 static const char *const omap243x_boards_compat[] __initconst = {
57 	"ti,omap2430",
58 	NULL,
59 };
60 
61 DT_MACHINE_START(OMAP243X_DT, "Generic OMAP2430 (Flattened Device Tree)")
62 	.reserve	= omap_reserve,
63 	.map_io		= omap243x_map_io,
64 	.init_early	= omap2430_init_early,
65 	.init_machine	= omap_generic_init,
66 	.init_time	= omap2_sync32k_timer_init,
67 	.dt_compat	= omap243x_boards_compat,
68 	.restart	= omap2xxx_restart,
69 MACHINE_END
70 #endif
71 
72 #ifdef CONFIG_ARCH_OMAP3
73 /* Some boards need board name for legacy userspace in /proc/cpuinfo */
74 static const char *const n900_boards_compat[] __initconst = {
75 	"nokia,omap3-n900",
76 	NULL,
77 };
78 
79 DT_MACHINE_START(OMAP3_N900_DT, "Nokia RX-51 board")
80 	.reserve	= omap_reserve,
81 	.map_io		= omap3_map_io,
82 	.init_early	= omap3430_init_early,
83 	.init_machine	= omap_generic_init,
84 	.init_late	= omap3_init_late,
85 	.init_time	= omap3_sync32k_timer_init,
86 	.dt_compat	= n900_boards_compat,
87 	.restart	= omap3xxx_restart,
88 MACHINE_END
89 
90 /* Generic omap3 boards, most boards can use these */
91 static const char *const omap3_boards_compat[] __initconst = {
92 	"ti,omap3430",
93 	"ti,omap3",
94 	NULL,
95 };
96 
97 DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
98 	.reserve	= omap_reserve,
99 	.map_io		= omap3_map_io,
100 	.init_early	= omap3430_init_early,
101 	.init_machine	= omap_generic_init,
102 	.init_late	= omap3_init_late,
103 	.init_time	= omap3_sync32k_timer_init,
104 	.dt_compat	= omap3_boards_compat,
105 	.restart	= omap3xxx_restart,
106 MACHINE_END
107 
108 static const char *const omap36xx_boards_compat[] __initconst = {
109 	"ti,omap36xx",
110 	NULL,
111 };
112 
113 DT_MACHINE_START(OMAP36XX_DT, "Generic OMAP36xx (Flattened Device Tree)")
114 	.reserve	= omap_reserve,
115 	.map_io		= omap3_map_io,
116 	.init_early	= omap3630_init_early,
117 	.init_machine	= omap_generic_init,
118 	.init_late	= omap3_init_late,
119 	.init_time	= omap3_sync32k_timer_init,
120 	.dt_compat	= omap36xx_boards_compat,
121 	.restart	= omap3xxx_restart,
122 MACHINE_END
123 
124 static const char *const omap3_gp_boards_compat[] __initconst = {
125 	"ti,omap3-beagle",
126 	"timll,omap3-devkit8000",
127 	NULL,
128 };
129 
130 DT_MACHINE_START(OMAP3_GP_DT, "Generic OMAP3-GP (Flattened Device Tree)")
131 	.reserve	= omap_reserve,
132 	.map_io		= omap3_map_io,
133 	.init_early	= omap3430_init_early,
134 	.init_machine	= omap_generic_init,
135 	.init_late	= omap3_init_late,
136 	.init_time	= omap3_secure_sync32k_timer_init,
137 	.dt_compat	= omap3_gp_boards_compat,
138 	.restart	= omap3xxx_restart,
139 MACHINE_END
140 
141 static const char *const am3517_boards_compat[] __initconst = {
142 	"ti,am3517",
143 	NULL,
144 };
145 
146 DT_MACHINE_START(AM3517_DT, "Generic AM3517 (Flattened Device Tree)")
147 	.reserve	= omap_reserve,
148 	.map_io		= omap3_map_io,
149 	.init_early	= am35xx_init_early,
150 	.init_machine	= omap_generic_init,
151 	.init_late	= omap3_init_late,
152 	.init_time	= omap3_gptimer_timer_init,
153 	.dt_compat	= am3517_boards_compat,
154 	.restart	= omap3xxx_restart,
155 MACHINE_END
156 #endif
157 
158 #ifdef CONFIG_SOC_TI81XX
159 static const char *const ti814x_boards_compat[] __initconst = {
160 	"ti,dm8148",
161 	"ti,dm814",
162 	NULL,
163 };
164 
165 DT_MACHINE_START(TI814X_DT, "Generic ti814x (Flattened Device Tree)")
166 	.reserve	= omap_reserve,
167 	.map_io		= ti81xx_map_io,
168 	.init_early	= ti814x_init_early,
169 	.init_machine	= omap_generic_init,
170 	.init_late	= ti81xx_init_late,
171 	.init_time	= omap3_gptimer_timer_init,
172 	.dt_compat	= ti814x_boards_compat,
173 	.restart	= ti81xx_restart,
174 MACHINE_END
175 
176 static const char *const ti816x_boards_compat[] __initconst = {
177 	"ti,dm8168",
178 	"ti,dm816",
179 	NULL,
180 };
181 
182 DT_MACHINE_START(TI816X_DT, "Generic ti816x (Flattened Device Tree)")
183 	.reserve	= omap_reserve,
184 	.map_io		= ti81xx_map_io,
185 	.init_early	= ti816x_init_early,
186 	.init_machine	= omap_generic_init,
187 	.init_late	= ti81xx_init_late,
188 	.init_time	= omap3_gptimer_timer_init,
189 	.dt_compat	= ti816x_boards_compat,
190 	.restart	= ti81xx_restart,
191 MACHINE_END
192 #endif
193 
194 #ifdef CONFIG_SOC_AM33XX
195 static const char *const am33xx_boards_compat[] __initconst = {
196 	"ti,am33xx",
197 	NULL,
198 };
199 
200 DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)")
201 	.reserve	= omap_reserve,
202 	.map_io		= am33xx_map_io,
203 	.init_early	= am33xx_init_early,
204 	.init_machine	= omap_generic_init,
205 	.init_late	= am33xx_init_late,
206 	.init_time	= omap3_gptimer_timer_init,
207 	.dt_compat	= am33xx_boards_compat,
208 	.restart	= am33xx_restart,
209 MACHINE_END
210 #endif
211 
212 #ifdef CONFIG_ARCH_OMAP4
213 static const char *const omap4_boards_compat[] __initconst = {
214 	"ti,omap4460",
215 	"ti,omap4430",
216 	"ti,omap4",
217 	NULL,
218 };
219 
220 DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)")
221 	.l2c_aux_val	= OMAP_L2C_AUX_CTRL,
222 	.l2c_aux_mask	= 0xcf9fffff,
223 	.l2c_write_sec	= omap4_l2c310_write_sec,
224 	.reserve	= omap_reserve,
225 	.smp		= smp_ops(omap4_smp_ops),
226 	.map_io		= omap4_map_io,
227 	.init_early	= omap4430_init_early,
228 	.init_irq	= omap_gic_of_init,
229 	.init_machine	= omap_generic_init,
230 	.init_late	= omap4430_init_late,
231 	.init_time	= omap4_local_timer_init,
232 	.dt_compat	= omap4_boards_compat,
233 	.restart	= omap44xx_restart,
234 MACHINE_END
235 #endif
236 
237 #ifdef CONFIG_SOC_OMAP5
238 static const char *const omap5_boards_compat[] __initconst = {
239 	"ti,omap5432",
240 	"ti,omap5430",
241 	"ti,omap5",
242 	NULL,
243 };
244 
245 DT_MACHINE_START(OMAP5_DT, "Generic OMAP5 (Flattened Device Tree)")
246 	.reserve	= omap_reserve,
247 	.smp		= smp_ops(omap4_smp_ops),
248 	.map_io		= omap5_map_io,
249 	.init_early	= omap5_init_early,
250 	.init_irq	= omap_gic_of_init,
251 	.init_machine	= omap_generic_init,
252 	.init_late	= omap5_init_late,
253 	.init_time	= omap5_realtime_timer_init,
254 	.dt_compat	= omap5_boards_compat,
255 	.restart	= omap44xx_restart,
256 MACHINE_END
257 #endif
258 
259 #ifdef CONFIG_SOC_AM43XX
260 static const char *const am43_boards_compat[] __initconst = {
261 	"ti,am4372",
262 	"ti,am43",
263 	NULL,
264 };
265 
266 DT_MACHINE_START(AM43_DT, "Generic AM43 (Flattened Device Tree)")
267 	.l2c_aux_val	= OMAP_L2C_AUX_CTRL,
268 	.l2c_aux_mask	= 0xcf9fffff,
269 	.l2c_write_sec	= omap4_l2c310_write_sec,
270 	.map_io		= am33xx_map_io,
271 	.init_early	= am43xx_init_early,
272 	.init_late	= am43xx_init_late,
273 	.init_irq	= omap_gic_of_init,
274 	.init_machine	= omap_generic_init,
275 	.init_time	= omap3_gptimer_timer_init,
276 	.dt_compat	= am43_boards_compat,
277 	.restart	= omap44xx_restart,
278 MACHINE_END
279 #endif
280 
281 #ifdef CONFIG_SOC_DRA7XX
282 static const char *const dra74x_boards_compat[] __initconst = {
283 	"ti,am5728",
284 	"ti,am5726",
285 	"ti,dra742",
286 	"ti,dra7",
287 	NULL,
288 };
289 
290 DT_MACHINE_START(DRA74X_DT, "Generic DRA74X (Flattened Device Tree)")
291 	.reserve	= omap_reserve,
292 	.smp		= smp_ops(omap4_smp_ops),
293 	.map_io		= dra7xx_map_io,
294 	.init_early	= dra7xx_init_early,
295 	.init_late	= dra7xx_init_late,
296 	.init_irq	= omap_gic_of_init,
297 	.init_machine	= omap_generic_init,
298 	.init_time	= omap5_realtime_timer_init,
299 	.dt_compat	= dra74x_boards_compat,
300 	.restart	= omap44xx_restart,
301 MACHINE_END
302 
303 static const char *const dra72x_boards_compat[] __initconst = {
304 	"ti,am5718",
305 	"ti,am5716",
306 	"ti,dra722",
307 	NULL,
308 };
309 
310 DT_MACHINE_START(DRA72X_DT, "Generic DRA72X (Flattened Device Tree)")
311 	.reserve	= omap_reserve,
312 	.map_io		= dra7xx_map_io,
313 	.init_early	= dra7xx_init_early,
314 	.init_late	= dra7xx_init_late,
315 	.init_irq	= omap_gic_of_init,
316 	.init_machine	= omap_generic_init,
317 	.init_time	= omap5_realtime_timer_init,
318 	.dt_compat	= dra72x_boards_compat,
319 	.restart	= omap44xx_restart,
320 MACHINE_END
321 #endif
322