11dbae815STony Lindgren /*
21dbae815STony Lindgren  * Copyright (C) 2005 Nokia Corporation
31dbae815STony Lindgren  * Author: Paul Mundt <paul.mundt@nokia.com>
41dbae815STony Lindgren  *
58d61649dSBenoit Cousson  * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
61dbae815STony Lindgren  *
78d61649dSBenoit Cousson  * Modified from the original mach-omap/omap2/board-generic.c did by Paul
88d61649dSBenoit Cousson  * to support the OMAP2+ device tree boards with an unique board file.
91dbae815STony Lindgren  *
101dbae815STony Lindgren  * This program is free software; you can redistribute it and/or modify
111dbae815STony Lindgren  * it under the terms of the GNU General Public License version 2 as
121dbae815STony Lindgren  * published by the Free Software Foundation.
131dbae815STony Lindgren  */
148d61649dSBenoit Cousson #include <linux/io.h>
15fbf75da7SBenoit Cousson #include <linux/of_irq.h>
168d61649dSBenoit Cousson #include <linux/of_platform.h>
178d61649dSBenoit Cousson #include <linux/irqdomain.h>
181dbae815STony Lindgren 
191dbae815STony Lindgren #include <asm/mach/arch.h>
201dbae815STony Lindgren 
214e65331cSTony Lindgren #include "common.h"
221dbae815STony Lindgren 
2375a57fe9STony Lindgren #if !(defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3))
24c4082d49SR Sricharan #define intc_of_init	NULL
2575a57fe9STony Lindgren #endif
2675a57fe9STony Lindgren #ifndef CONFIG_ARCH_OMAP4
2775a57fe9STony Lindgren #define gic_of_init		NULL
2875a57fe9STony Lindgren #endif
2975a57fe9STony Lindgren 
3031957609SUwe Kleine-König static const struct of_device_id omap_dt_match_table[] __initconst = {
318d61649dSBenoit Cousson 	{ .compatible = "simple-bus", },
328d61649dSBenoit Cousson 	{ .compatible = "ti,omap-infra", },
338d61649dSBenoit Cousson 	{ }
34b3c6df3aSPaul Walmsley };
35b3c6df3aSPaul Walmsley 
361dbae815STony Lindgren static void __init omap_generic_init(void)
371dbae815STony Lindgren {
386a0e6b38STomi Valkeinen 	omapdss_early_init_of();
396a0e6b38STomi Valkeinen 
408651bd8cSTony Lindgren 	pdata_quirks_init(omap_dt_match_table);
41dcdf407bSTomi Valkeinen 
42dcdf407bSTomi Valkeinen 	omapdss_init_of();
431dbae815STony Lindgren }
441dbae815STony Lindgren 
450e02a8c1SBenoit Cousson #ifdef CONFIG_SOC_OMAP2420
4658cda01eSUwe Kleine-König static const char *const omap242x_boards_compat[] __initconst = {
478d61649dSBenoit Cousson 	"ti,omap2420",
488d61649dSBenoit Cousson 	NULL,
498d61649dSBenoit Cousson };
501dbae815STony Lindgren 
518d61649dSBenoit Cousson DT_MACHINE_START(OMAP242X_DT, "Generic OMAP2420 (Flattened Device Tree)")
5271ee7dadSRussell King 	.reserve	= omap_reserve,
538d61649dSBenoit Cousson 	.map_io		= omap242x_map_io,
548d61649dSBenoit Cousson 	.init_early	= omap2420_init_early,
551dbae815STony Lindgren 	.init_machine	= omap_generic_init,
566bb27d73SStephen Warren 	.init_time	= omap2_sync32k_timer_init,
578d61649dSBenoit Cousson 	.dt_compat	= omap242x_boards_compat,
58187e3e06SPaul Walmsley 	.restart	= omap2xxx_restart,
591dbae815STony Lindgren MACHINE_END
608d61649dSBenoit Cousson #endif
618d61649dSBenoit Cousson 
620e02a8c1SBenoit Cousson #ifdef CONFIG_SOC_OMAP2430
6358cda01eSUwe Kleine-König static const char *const omap243x_boards_compat[] __initconst = {
648d61649dSBenoit Cousson 	"ti,omap2430",
658d61649dSBenoit Cousson 	NULL,
668d61649dSBenoit Cousson };
678d61649dSBenoit Cousson 
688d61649dSBenoit Cousson DT_MACHINE_START(OMAP243X_DT, "Generic OMAP2430 (Flattened Device Tree)")
698d61649dSBenoit Cousson 	.reserve	= omap_reserve,
708d61649dSBenoit Cousson 	.map_io		= omap243x_map_io,
718d61649dSBenoit Cousson 	.init_early	= omap2430_init_early,
728d61649dSBenoit Cousson 	.init_machine	= omap_generic_init,
736bb27d73SStephen Warren 	.init_time	= omap2_sync32k_timer_init,
748d61649dSBenoit Cousson 	.dt_compat	= omap243x_boards_compat,
75187e3e06SPaul Walmsley 	.restart	= omap2xxx_restart,
768d61649dSBenoit Cousson MACHINE_END
778d61649dSBenoit Cousson #endif
788d61649dSBenoit Cousson 
790e02a8c1SBenoit Cousson #ifdef CONFIG_ARCH_OMAP3
8071c4f602STony Lindgren /* Some boards need board name for legacy userspace in /proc/cpuinfo */
8171c4f602STony Lindgren static const char *const n900_boards_compat[] __initconst = {
8271c4f602STony Lindgren 	"nokia,omap3-n900",
8371c4f602STony Lindgren 	NULL,
8471c4f602STony Lindgren };
8571c4f602STony Lindgren 
8671c4f602STony Lindgren DT_MACHINE_START(OMAP3_N900_DT, "Nokia RX-51 board")
8771c4f602STony Lindgren 	.reserve	= omap_reserve,
8871c4f602STony Lindgren 	.map_io		= omap3_map_io,
8971c4f602STony Lindgren 	.init_early	= omap3430_init_early,
9071c4f602STony Lindgren 	.init_machine	= omap_generic_init,
9171c4f602STony Lindgren 	.init_late	= omap3_init_late,
9271c4f602STony Lindgren 	.init_time	= omap3_sync32k_timer_init,
9371c4f602STony Lindgren 	.dt_compat	= n900_boards_compat,
9471c4f602STony Lindgren 	.restart	= omap3xxx_restart,
9571c4f602STony Lindgren MACHINE_END
9671c4f602STony Lindgren 
9771c4f602STony Lindgren /* Generic omap3 boards, most boards can use these */
9858cda01eSUwe Kleine-König static const char *const omap3_boards_compat[] __initconst = {
99b83a08feSNishanth Menon 	"ti,omap3430",
1008d61649dSBenoit Cousson 	"ti,omap3",
1018d61649dSBenoit Cousson 	NULL,
1028d61649dSBenoit Cousson };
1038d61649dSBenoit Cousson 
1048d61649dSBenoit Cousson DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
1058d61649dSBenoit Cousson 	.reserve	= omap_reserve,
1068d61649dSBenoit Cousson 	.map_io		= omap3_map_io,
1078d61649dSBenoit Cousson 	.init_early	= omap3430_init_early,
10893651b85SBenoit Cousson 	.init_machine	= omap_generic_init,
109990fa4f5SRajendra Nayak 	.init_late	= omap3_init_late,
1106bb27d73SStephen Warren 	.init_time	= omap3_sync32k_timer_init,
1118d61649dSBenoit Cousson 	.dt_compat	= omap3_boards_compat,
112187e3e06SPaul Walmsley 	.restart	= omap3xxx_restart,
1138d61649dSBenoit Cousson MACHINE_END
1147dd9d502SJon Hunter 
11558cda01eSUwe Kleine-König static const char *const omap36xx_boards_compat[] __initconst = {
116016c12d2SNishanth Menon 	"ti,omap36xx",
117016c12d2SNishanth Menon 	NULL,
118016c12d2SNishanth Menon };
119016c12d2SNishanth Menon 
120016c12d2SNishanth Menon DT_MACHINE_START(OMAP36XX_DT, "Generic OMAP36xx (Flattened Device Tree)")
121016c12d2SNishanth Menon 	.reserve	= omap_reserve,
122016c12d2SNishanth Menon 	.map_io		= omap3_map_io,
123016c12d2SNishanth Menon 	.init_early	= omap3630_init_early,
124016c12d2SNishanth Menon 	.init_machine	= omap_generic_init,
125016c12d2SNishanth Menon 	.init_late	= omap3_init_late,
126016c12d2SNishanth Menon 	.init_time	= omap3_sync32k_timer_init,
127016c12d2SNishanth Menon 	.dt_compat	= omap36xx_boards_compat,
128016c12d2SNishanth Menon 	.restart	= omap3xxx_restart,
129016c12d2SNishanth Menon MACHINE_END
130016c12d2SNishanth Menon 
13158cda01eSUwe Kleine-König static const char *const omap3_gp_boards_compat[] __initconst = {
1327dd9d502SJon Hunter 	"ti,omap3-beagle",
1334bfe6341SAnil Kumar 	"timll,omap3-devkit8000",
1347dd9d502SJon Hunter 	NULL,
1357dd9d502SJon Hunter };
1367dd9d502SJon Hunter 
1377dd9d502SJon Hunter DT_MACHINE_START(OMAP3_GP_DT, "Generic OMAP3-GP (Flattened Device Tree)")
1387dd9d502SJon Hunter 	.reserve	= omap_reserve,
1397dd9d502SJon Hunter 	.map_io		= omap3_map_io,
1407dd9d502SJon Hunter 	.init_early	= omap3430_init_early,
1417dd9d502SJon Hunter 	.init_machine	= omap_generic_init,
142990fa4f5SRajendra Nayak 	.init_late	= omap3_init_late,
1436bb27d73SStephen Warren 	.init_time	= omap3_secure_sync32k_timer_init,
1447dd9d502SJon Hunter 	.dt_compat	= omap3_gp_boards_compat,
145d01e4afdSLinus Torvalds 	.restart	= omap3xxx_restart,
1468d61649dSBenoit Cousson MACHINE_END
147caef4ee8SNishanth Menon 
14858cda01eSUwe Kleine-König static const char *const am3517_boards_compat[] __initconst = {
149caef4ee8SNishanth Menon 	"ti,am3517",
150caef4ee8SNishanth Menon 	NULL,
151caef4ee8SNishanth Menon };
152caef4ee8SNishanth Menon 
153caef4ee8SNishanth Menon DT_MACHINE_START(AM3517_DT, "Generic AM3517 (Flattened Device Tree)")
154caef4ee8SNishanth Menon 	.reserve	= omap_reserve,
155caef4ee8SNishanth Menon 	.map_io		= omap3_map_io,
156caef4ee8SNishanth Menon 	.init_early	= am35xx_init_early,
157caef4ee8SNishanth Menon 	.init_machine	= omap_generic_init,
158caef4ee8SNishanth Menon 	.init_late	= omap3_init_late,
159caef4ee8SNishanth Menon 	.init_time	= omap3_gptimer_timer_init,
160caef4ee8SNishanth Menon 	.dt_compat	= am3517_boards_compat,
161caef4ee8SNishanth Menon 	.restart	= omap3xxx_restart,
162caef4ee8SNishanth Menon MACHINE_END
1638d61649dSBenoit Cousson #endif
1648d61649dSBenoit Cousson 
165abf8cc1dSTony Lindgren #ifdef CONFIG_SOC_TI81XX
166abf8cc1dSTony Lindgren static const char *const ti814x_boards_compat[] __initconst = {
167abf8cc1dSTony Lindgren 	"ti,dm8148",
168abf8cc1dSTony Lindgren 	"ti,dm814",
169abf8cc1dSTony Lindgren 	NULL,
170abf8cc1dSTony Lindgren };
171abf8cc1dSTony Lindgren 
1729fd274c0STony Lindgren DT_MACHINE_START(TI814X_DT, "Generic ti814x (Flattened Device Tree)")
173abf8cc1dSTony Lindgren 	.reserve	= omap_reserve,
174abf8cc1dSTony Lindgren 	.map_io		= ti81xx_map_io,
175abf8cc1dSTony Lindgren 	.init_early	= ti814x_init_early,
176abf8cc1dSTony Lindgren 	.init_machine	= omap_generic_init,
177abf8cc1dSTony Lindgren 	.init_late	= ti81xx_init_late,
178abf8cc1dSTony Lindgren 	.init_time	= omap3_gptimer_timer_init,
179abf8cc1dSTony Lindgren 	.dt_compat	= ti814x_boards_compat,
180abf8cc1dSTony Lindgren 	.restart	= ti81xx_restart,
181abf8cc1dSTony Lindgren MACHINE_END
182abf8cc1dSTony Lindgren 
183abf8cc1dSTony Lindgren static const char *const ti816x_boards_compat[] __initconst = {
184abf8cc1dSTony Lindgren 	"ti,dm8168",
185abf8cc1dSTony Lindgren 	"ti,dm816",
186abf8cc1dSTony Lindgren 	NULL,
187abf8cc1dSTony Lindgren };
188abf8cc1dSTony Lindgren 
189abf8cc1dSTony Lindgren DT_MACHINE_START(TI816X_DT, "Generic ti816x (Flattened Device Tree)")
190abf8cc1dSTony Lindgren 	.reserve	= omap_reserve,
191abf8cc1dSTony Lindgren 	.map_io		= ti81xx_map_io,
192abf8cc1dSTony Lindgren 	.init_early	= ti816x_init_early,
193abf8cc1dSTony Lindgren 	.init_machine	= omap_generic_init,
194abf8cc1dSTony Lindgren 	.init_late	= ti81xx_init_late,
195abf8cc1dSTony Lindgren 	.init_time	= omap3_gptimer_timer_init,
196abf8cc1dSTony Lindgren 	.dt_compat	= ti816x_boards_compat,
197abf8cc1dSTony Lindgren 	.restart	= ti81xx_restart,
198abf8cc1dSTony Lindgren MACHINE_END
199abf8cc1dSTony Lindgren #endif
200abf8cc1dSTony Lindgren 
20108f30989SAfzal Mohammed #ifdef CONFIG_SOC_AM33XX
20258cda01eSUwe Kleine-König static const char *const am33xx_boards_compat[] __initconst = {
20308f30989SAfzal Mohammed 	"ti,am33xx",
20408f30989SAfzal Mohammed 	NULL,
20508f30989SAfzal Mohammed };
20608f30989SAfzal Mohammed 
20708f30989SAfzal Mohammed DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)")
20808f30989SAfzal Mohammed 	.reserve	= omap_reserve,
20908f30989SAfzal Mohammed 	.map_io		= am33xx_map_io,
21008f30989SAfzal Mohammed 	.init_early	= am33xx_init_early,
21108f30989SAfzal Mohammed 	.init_machine	= omap_generic_init,
212765e7a06SNishanth Menon 	.init_late	= am33xx_init_late,
21300ea4d56SJon Hunter 	.init_time	= omap3_gptimer_timer_init,
21408f30989SAfzal Mohammed 	.dt_compat	= am33xx_boards_compat,
21514e067c1SJean-Sebastien A. Beaudry 	.restart	= am33xx_restart,
21608f30989SAfzal Mohammed MACHINE_END
21708f30989SAfzal Mohammed #endif
21808f30989SAfzal Mohammed 
2190e02a8c1SBenoit Cousson #ifdef CONFIG_ARCH_OMAP4
22058cda01eSUwe Kleine-König static const char *const omap4_boards_compat[] __initconst = {
221b83a08feSNishanth Menon 	"ti,omap4460",
222b83a08feSNishanth Menon 	"ti,omap4430",
2238d61649dSBenoit Cousson 	"ti,omap4",
2248d61649dSBenoit Cousson 	NULL,
2258d61649dSBenoit Cousson };
2268d61649dSBenoit Cousson 
2278d61649dSBenoit Cousson DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)")
228944e9df1SMarek Szyprowski 	.l2c_aux_val	= OMAP_L2C_AUX_CTRL,
229944e9df1SMarek Szyprowski 	.l2c_aux_mask	= 0xcf9fffff,
230944e9df1SMarek Szyprowski 	.l2c_write_sec	= omap4_l2c310_write_sec,
2318d61649dSBenoit Cousson 	.reserve	= omap_reserve,
23206915321SMarc Zyngier 	.smp		= smp_ops(omap4_smp_ops),
2338d61649dSBenoit Cousson 	.map_io		= omap4_map_io,
2348d61649dSBenoit Cousson 	.init_early	= omap4430_init_early,
235c4082d49SR Sricharan 	.init_irq	= omap_gic_of_init,
23693651b85SBenoit Cousson 	.init_machine	= omap_generic_init,
237bbd707acSShawn Guo 	.init_late	= omap4430_init_late,
2386bb27d73SStephen Warren 	.init_time	= omap4_local_timer_init,
2398d61649dSBenoit Cousson 	.dt_compat	= omap4_boards_compat,
240187e3e06SPaul Walmsley 	.restart	= omap44xx_restart,
2418d61649dSBenoit Cousson MACHINE_END
2428d61649dSBenoit Cousson #endif
2430c1b6facSR Sricharan 
2440c1b6facSR Sricharan #ifdef CONFIG_SOC_OMAP5
24558cda01eSUwe Kleine-König static const char *const omap5_boards_compat[] __initconst = {
246b83a08feSNishanth Menon 	"ti,omap5432",
247b83a08feSNishanth Menon 	"ti,omap5430",
2480c1b6facSR Sricharan 	"ti,omap5",
2490c1b6facSR Sricharan 	NULL,
2500c1b6facSR Sricharan };
2510c1b6facSR Sricharan 
2520c1b6facSR Sricharan DT_MACHINE_START(OMAP5_DT, "Generic OMAP5 (Flattened Device Tree)")
2530c1b6facSR Sricharan 	.reserve	= omap_reserve,
25406915321SMarc Zyngier 	.smp		= smp_ops(omap4_smp_ops),
2550c1b6facSR Sricharan 	.map_io		= omap5_map_io,
2560c1b6facSR Sricharan 	.init_early	= omap5_init_early,
2570c1b6facSR Sricharan 	.init_irq	= omap_gic_of_init,
2580c1b6facSR Sricharan 	.init_machine	= omap_generic_init,
259765e7a06SNishanth Menon 	.init_late	= omap5_init_late,
2606bb27d73SStephen Warren 	.init_time	= omap5_realtime_timer_init,
2610c1b6facSR Sricharan 	.dt_compat	= omap5_boards_compat,
262187e3e06SPaul Walmsley 	.restart	= omap44xx_restart,
2630c1b6facSR Sricharan MACHINE_END
2640c1b6facSR Sricharan #endif
265bb256f80SAfzal Mohammed 
266bb256f80SAfzal Mohammed #ifdef CONFIG_SOC_AM43XX
26758cda01eSUwe Kleine-König static const char *const am43_boards_compat[] __initconst = {
268b83a08feSNishanth Menon 	"ti,am4372",
269bb256f80SAfzal Mohammed 	"ti,am43",
270bb256f80SAfzal Mohammed 	NULL,
271bb256f80SAfzal Mohammed };
272bb256f80SAfzal Mohammed 
273bb256f80SAfzal Mohammed DT_MACHINE_START(AM43_DT, "Generic AM43 (Flattened Device Tree)")
274944e9df1SMarek Szyprowski 	.l2c_aux_val	= OMAP_L2C_AUX_CTRL,
275944e9df1SMarek Szyprowski 	.l2c_aux_mask	= 0xcf9fffff,
276944e9df1SMarek Szyprowski 	.l2c_write_sec	= omap4_l2c310_write_sec,
277bb256f80SAfzal Mohammed 	.map_io		= am33xx_map_io,
278bb256f80SAfzal Mohammed 	.init_early	= am43xx_init_early,
279765e7a06SNishanth Menon 	.init_late	= am43xx_init_late,
280bb256f80SAfzal Mohammed 	.init_irq	= omap_gic_of_init,
281bb256f80SAfzal Mohammed 	.init_machine	= omap_generic_init,
2825b5c0135SRajendra Nayak 	.init_time	= omap3_gptimer_timer_init,
283bb256f80SAfzal Mohammed 	.dt_compat	= am43_boards_compat,
284a7daf64aSLokesh Vutla 	.restart	= omap44xx_restart,
285bb256f80SAfzal Mohammed MACHINE_END
286bb256f80SAfzal Mohammed #endif
287439bf39eSR Sricharan 
288439bf39eSR Sricharan #ifdef CONFIG_SOC_DRA7XX
28958cda01eSUwe Kleine-König static const char *const dra74x_boards_compat[] __initconst = {
2900e0cb99dSNishanth Menon 	"ti,am5728",
2910e0cb99dSNishanth Menon 	"ti,am5726",
29244e97ff6SRajendra Nayak 	"ti,dra742",
293439bf39eSR Sricharan 	"ti,dra7",
294439bf39eSR Sricharan 	NULL,
295439bf39eSR Sricharan };
296439bf39eSR Sricharan 
29744e97ff6SRajendra Nayak DT_MACHINE_START(DRA74X_DT, "Generic DRA74X (Flattened Device Tree)")
298439bf39eSR Sricharan 	.reserve	= omap_reserve,
299439bf39eSR Sricharan 	.smp		= smp_ops(omap4_smp_ops),
300439bf39eSR Sricharan 	.map_io		= omap5_map_io,
301439bf39eSR Sricharan 	.init_early	= dra7xx_init_early,
302765e7a06SNishanth Menon 	.init_late	= dra7xx_init_late,
303439bf39eSR Sricharan 	.init_irq	= omap_gic_of_init,
304439bf39eSR Sricharan 	.init_machine	= omap_generic_init,
305439bf39eSR Sricharan 	.init_time	= omap5_realtime_timer_init,
30644e97ff6SRajendra Nayak 	.dt_compat	= dra74x_boards_compat,
30744e97ff6SRajendra Nayak 	.restart	= omap44xx_restart,
30844e97ff6SRajendra Nayak MACHINE_END
30944e97ff6SRajendra Nayak 
31058cda01eSUwe Kleine-König static const char *const dra72x_boards_compat[] __initconst = {
3110e0cb99dSNishanth Menon 	"ti,am5718",
3120e0cb99dSNishanth Menon 	"ti,am5716",
31344e97ff6SRajendra Nayak 	"ti,dra722",
31444e97ff6SRajendra Nayak 	NULL,
31544e97ff6SRajendra Nayak };
31644e97ff6SRajendra Nayak 
31744e97ff6SRajendra Nayak DT_MACHINE_START(DRA72X_DT, "Generic DRA72X (Flattened Device Tree)")
31844e97ff6SRajendra Nayak 	.reserve	= omap_reserve,
31944e97ff6SRajendra Nayak 	.map_io		= omap5_map_io,
32044e97ff6SRajendra Nayak 	.init_early	= dra7xx_init_early,
32144e97ff6SRajendra Nayak 	.init_late	= dra7xx_init_late,
32244e97ff6SRajendra Nayak 	.init_irq	= omap_gic_of_init,
32344e97ff6SRajendra Nayak 	.init_machine	= omap_generic_init,
32444e97ff6SRajendra Nayak 	.init_time	= omap5_realtime_timer_init,
32544e97ff6SRajendra Nayak 	.dt_compat	= dra72x_boards_compat,
3261d597b07SRajendra Nayak 	.restart	= omap44xx_restart,
327439bf39eSR Sricharan MACHINE_END
328439bf39eSR Sricharan #endif
329