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 
308d61649dSBenoit Cousson static struct of_device_id omap_dt_match_table[] __initdata = {
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 {
388651bd8cSTony Lindgren 	pdata_quirks_init(omap_dt_match_table);
39dcdf407bSTomi Valkeinen 
40dcdf407bSTomi Valkeinen 	omapdss_init_of();
411dbae815STony Lindgren }
421dbae815STony Lindgren 
430e02a8c1SBenoit Cousson #ifdef CONFIG_SOC_OMAP2420
448d61649dSBenoit Cousson static const char *omap242x_boards_compat[] __initdata = {
458d61649dSBenoit Cousson 	"ti,omap2420",
468d61649dSBenoit Cousson 	NULL,
478d61649dSBenoit Cousson };
481dbae815STony Lindgren 
498d61649dSBenoit Cousson DT_MACHINE_START(OMAP242X_DT, "Generic OMAP2420 (Flattened Device Tree)")
5071ee7dadSRussell King 	.reserve	= omap_reserve,
518d61649dSBenoit Cousson 	.map_io		= omap242x_map_io,
528d61649dSBenoit Cousson 	.init_early	= omap2420_init_early,
53c4082d49SR Sricharan 	.init_irq	= omap_intc_of_init,
54b755706cSBenoit Cousson 	.handle_irq	= omap2_intc_handle_irq,
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
638d61649dSBenoit Cousson static const char *omap243x_boards_compat[] __initdata = {
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,
72c4082d49SR Sricharan 	.init_irq	= omap_intc_of_init,
736b2f55d7SMarc Zyngier 	.handle_irq	= omap2_intc_handle_irq,
748d61649dSBenoit Cousson 	.init_machine	= omap_generic_init,
756bb27d73SStephen Warren 	.init_time	= omap2_sync32k_timer_init,
768d61649dSBenoit Cousson 	.dt_compat	= omap243x_boards_compat,
77187e3e06SPaul Walmsley 	.restart	= omap2xxx_restart,
788d61649dSBenoit Cousson MACHINE_END
798d61649dSBenoit Cousson #endif
808d61649dSBenoit Cousson 
810e02a8c1SBenoit Cousson #ifdef CONFIG_ARCH_OMAP3
828d61649dSBenoit Cousson static const char *omap3_boards_compat[] __initdata = {
83b83a08feSNishanth Menon 	"ti,omap3430",
848d61649dSBenoit Cousson 	"ti,omap3",
858d61649dSBenoit Cousson 	NULL,
868d61649dSBenoit Cousson };
878d61649dSBenoit Cousson 
888d61649dSBenoit Cousson DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
898d61649dSBenoit Cousson 	.reserve	= omap_reserve,
908d61649dSBenoit Cousson 	.map_io		= omap3_map_io,
918d61649dSBenoit Cousson 	.init_early	= omap3430_init_early,
92c4082d49SR Sricharan 	.init_irq	= omap_intc_of_init,
93b755706cSBenoit Cousson 	.handle_irq	= omap3_intc_handle_irq,
9493651b85SBenoit Cousson 	.init_machine	= omap_generic_init,
95990fa4f5SRajendra Nayak 	.init_late	= omap3_init_late,
966bb27d73SStephen Warren 	.init_time	= omap3_sync32k_timer_init,
978d61649dSBenoit Cousson 	.dt_compat	= omap3_boards_compat,
98187e3e06SPaul Walmsley 	.restart	= omap3xxx_restart,
998d61649dSBenoit Cousson MACHINE_END
1007dd9d502SJon Hunter 
101016c12d2SNishanth Menon static const char *omap36xx_boards_compat[] __initdata = {
102016c12d2SNishanth Menon 	"ti,omap36xx",
103016c12d2SNishanth Menon 	NULL,
104016c12d2SNishanth Menon };
105016c12d2SNishanth Menon 
106016c12d2SNishanth Menon DT_MACHINE_START(OMAP36XX_DT, "Generic OMAP36xx (Flattened Device Tree)")
107016c12d2SNishanth Menon 	.reserve	= omap_reserve,
108016c12d2SNishanth Menon 	.map_io		= omap3_map_io,
109016c12d2SNishanth Menon 	.init_early	= omap3630_init_early,
110016c12d2SNishanth Menon 	.init_irq	= omap_intc_of_init,
111016c12d2SNishanth Menon 	.handle_irq	= omap3_intc_handle_irq,
112016c12d2SNishanth Menon 	.init_machine	= omap_generic_init,
113016c12d2SNishanth Menon 	.init_late	= omap3_init_late,
114016c12d2SNishanth Menon 	.init_time	= omap3_sync32k_timer_init,
115016c12d2SNishanth Menon 	.dt_compat	= omap36xx_boards_compat,
116016c12d2SNishanth Menon 	.restart	= omap3xxx_restart,
117016c12d2SNishanth Menon MACHINE_END
118016c12d2SNishanth Menon 
1197dd9d502SJon Hunter static const char *omap3_gp_boards_compat[] __initdata = {
1207dd9d502SJon Hunter 	"ti,omap3-beagle",
1214bfe6341SAnil Kumar 	"timll,omap3-devkit8000",
1227dd9d502SJon Hunter 	NULL,
1237dd9d502SJon Hunter };
1247dd9d502SJon Hunter 
1257dd9d502SJon Hunter DT_MACHINE_START(OMAP3_GP_DT, "Generic OMAP3-GP (Flattened Device Tree)")
1267dd9d502SJon Hunter 	.reserve	= omap_reserve,
1277dd9d502SJon Hunter 	.map_io		= omap3_map_io,
1287dd9d502SJon Hunter 	.init_early	= omap3430_init_early,
1297dd9d502SJon Hunter 	.init_irq	= omap_intc_of_init,
1307dd9d502SJon Hunter 	.handle_irq	= omap3_intc_handle_irq,
1317dd9d502SJon Hunter 	.init_machine	= omap_generic_init,
132990fa4f5SRajendra Nayak 	.init_late	= omap3_init_late,
1336bb27d73SStephen Warren 	.init_time	= omap3_secure_sync32k_timer_init,
1347dd9d502SJon Hunter 	.dt_compat	= omap3_gp_boards_compat,
135d01e4afdSLinus Torvalds 	.restart	= omap3xxx_restart,
1368d61649dSBenoit Cousson MACHINE_END
137caef4ee8SNishanth Menon 
138caef4ee8SNishanth Menon static const char *am3517_boards_compat[] __initdata = {
139caef4ee8SNishanth Menon 	"ti,am3517",
140caef4ee8SNishanth Menon 	NULL,
141caef4ee8SNishanth Menon };
142caef4ee8SNishanth Menon 
143caef4ee8SNishanth Menon DT_MACHINE_START(AM3517_DT, "Generic AM3517 (Flattened Device Tree)")
144caef4ee8SNishanth Menon 	.reserve	= omap_reserve,
145caef4ee8SNishanth Menon 	.map_io		= omap3_map_io,
146caef4ee8SNishanth Menon 	.init_early	= am35xx_init_early,
147caef4ee8SNishanth Menon 	.init_irq	= omap_intc_of_init,
148caef4ee8SNishanth Menon 	.handle_irq	= omap3_intc_handle_irq,
149caef4ee8SNishanth Menon 	.init_machine	= omap_generic_init,
150caef4ee8SNishanth Menon 	.init_late	= omap3_init_late,
151caef4ee8SNishanth Menon 	.init_time	= omap3_gptimer_timer_init,
152caef4ee8SNishanth Menon 	.dt_compat	= am3517_boards_compat,
153caef4ee8SNishanth Menon 	.restart	= omap3xxx_restart,
154caef4ee8SNishanth Menon MACHINE_END
1558d61649dSBenoit Cousson #endif
1568d61649dSBenoit Cousson 
15708f30989SAfzal Mohammed #ifdef CONFIG_SOC_AM33XX
15808f30989SAfzal Mohammed static const char *am33xx_boards_compat[] __initdata = {
15908f30989SAfzal Mohammed 	"ti,am33xx",
16008f30989SAfzal Mohammed 	NULL,
16108f30989SAfzal Mohammed };
16208f30989SAfzal Mohammed 
16308f30989SAfzal Mohammed DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)")
16408f30989SAfzal Mohammed 	.reserve	= omap_reserve,
16508f30989SAfzal Mohammed 	.map_io		= am33xx_map_io,
16608f30989SAfzal Mohammed 	.init_early	= am33xx_init_early,
167c4082d49SR Sricharan 	.init_irq	= omap_intc_of_init,
16808f30989SAfzal Mohammed 	.handle_irq	= omap3_intc_handle_irq,
16908f30989SAfzal Mohammed 	.init_machine	= omap_generic_init,
170765e7a06SNishanth Menon 	.init_late	= am33xx_init_late,
17100ea4d56SJon Hunter 	.init_time	= omap3_gptimer_timer_init,
17208f30989SAfzal Mohammed 	.dt_compat	= am33xx_boards_compat,
17314e067c1SJean-Sebastien A. Beaudry 	.restart	= am33xx_restart,
17408f30989SAfzal Mohammed MACHINE_END
17508f30989SAfzal Mohammed #endif
17608f30989SAfzal Mohammed 
1770e02a8c1SBenoit Cousson #ifdef CONFIG_ARCH_OMAP4
1788d61649dSBenoit Cousson static const char *omap4_boards_compat[] __initdata = {
179b83a08feSNishanth Menon 	"ti,omap4460",
180b83a08feSNishanth Menon 	"ti,omap4430",
1818d61649dSBenoit Cousson 	"ti,omap4",
1828d61649dSBenoit Cousson 	NULL,
1838d61649dSBenoit Cousson };
1848d61649dSBenoit Cousson 
1858d61649dSBenoit Cousson DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)")
1868d61649dSBenoit Cousson 	.reserve	= omap_reserve,
18706915321SMarc Zyngier 	.smp		= smp_ops(omap4_smp_ops),
1888d61649dSBenoit Cousson 	.map_io		= omap4_map_io,
1898d61649dSBenoit Cousson 	.init_early	= omap4430_init_early,
190c4082d49SR Sricharan 	.init_irq	= omap_gic_of_init,
19193651b85SBenoit Cousson 	.init_machine	= omap_generic_init,
192bbd707acSShawn Guo 	.init_late	= omap4430_init_late,
1936bb27d73SStephen Warren 	.init_time	= omap4_local_timer_init,
1948d61649dSBenoit Cousson 	.dt_compat	= omap4_boards_compat,
195187e3e06SPaul Walmsley 	.restart	= omap44xx_restart,
1968d61649dSBenoit Cousson MACHINE_END
1978d61649dSBenoit Cousson #endif
1980c1b6facSR Sricharan 
1990c1b6facSR Sricharan #ifdef CONFIG_SOC_OMAP5
2000c1b6facSR Sricharan static const char *omap5_boards_compat[] __initdata = {
201b83a08feSNishanth Menon 	"ti,omap5432",
202b83a08feSNishanth Menon 	"ti,omap5430",
2030c1b6facSR Sricharan 	"ti,omap5",
2040c1b6facSR Sricharan 	NULL,
2050c1b6facSR Sricharan };
2060c1b6facSR Sricharan 
2070c1b6facSR Sricharan DT_MACHINE_START(OMAP5_DT, "Generic OMAP5 (Flattened Device Tree)")
2080c1b6facSR Sricharan 	.reserve	= omap_reserve,
20906915321SMarc Zyngier 	.smp		= smp_ops(omap4_smp_ops),
2100c1b6facSR Sricharan 	.map_io		= omap5_map_io,
2110c1b6facSR Sricharan 	.init_early	= omap5_init_early,
2120c1b6facSR Sricharan 	.init_irq	= omap_gic_of_init,
2130c1b6facSR Sricharan 	.init_machine	= omap_generic_init,
214765e7a06SNishanth Menon 	.init_late	= omap5_init_late,
2156bb27d73SStephen Warren 	.init_time	= omap5_realtime_timer_init,
2160c1b6facSR Sricharan 	.dt_compat	= omap5_boards_compat,
217187e3e06SPaul Walmsley 	.restart	= omap44xx_restart,
2180c1b6facSR Sricharan MACHINE_END
2190c1b6facSR Sricharan #endif
220bb256f80SAfzal Mohammed 
221bb256f80SAfzal Mohammed #ifdef CONFIG_SOC_AM43XX
222bb256f80SAfzal Mohammed static const char *am43_boards_compat[] __initdata = {
223b83a08feSNishanth Menon 	"ti,am4372",
224bb256f80SAfzal Mohammed 	"ti,am43",
225bb256f80SAfzal Mohammed 	NULL,
226bb256f80SAfzal Mohammed };
227bb256f80SAfzal Mohammed 
228bb256f80SAfzal Mohammed DT_MACHINE_START(AM43_DT, "Generic AM43 (Flattened Device Tree)")
229bb256f80SAfzal Mohammed 	.map_io		= am33xx_map_io,
230bb256f80SAfzal Mohammed 	.init_early	= am43xx_init_early,
231765e7a06SNishanth Menon 	.init_late	= am43xx_init_late,
232bb256f80SAfzal Mohammed 	.init_irq	= omap_gic_of_init,
233bb256f80SAfzal Mohammed 	.init_machine	= omap_generic_init,
234bb256f80SAfzal Mohammed 	.init_time	= omap3_sync32k_timer_init,
235bb256f80SAfzal Mohammed 	.dt_compat	= am43_boards_compat,
236bb256f80SAfzal Mohammed MACHINE_END
237bb256f80SAfzal Mohammed #endif
238439bf39eSR Sricharan 
239439bf39eSR Sricharan #ifdef CONFIG_SOC_DRA7XX
240439bf39eSR Sricharan static const char *dra7xx_boards_compat[] __initdata = {
241b83a08feSNishanth Menon 	"ti,dra7xx",
242439bf39eSR Sricharan 	"ti,dra7",
243439bf39eSR Sricharan 	NULL,
244439bf39eSR Sricharan };
245439bf39eSR Sricharan 
246439bf39eSR Sricharan DT_MACHINE_START(DRA7XX_DT, "Generic DRA7XX (Flattened Device Tree)")
247439bf39eSR Sricharan 	.reserve	= omap_reserve,
248439bf39eSR Sricharan 	.smp		= smp_ops(omap4_smp_ops),
249439bf39eSR Sricharan 	.map_io		= omap5_map_io,
250439bf39eSR Sricharan 	.init_early	= dra7xx_init_early,
251765e7a06SNishanth Menon 	.init_late	= dra7xx_init_late,
252439bf39eSR Sricharan 	.init_irq	= omap_gic_of_init,
253439bf39eSR Sricharan 	.init_machine	= omap_generic_init,
254439bf39eSR Sricharan 	.init_time	= omap5_realtime_timer_init,
255439bf39eSR Sricharan 	.dt_compat	= dra7xx_boards_compat,
2561d597b07SRajendra Nayak 	.restart	= omap44xx_restart,
257439bf39eSR Sricharan MACHINE_END
258439bf39eSR Sricharan #endif
259