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
8058cda01eSUwe Kleine-König static const char *const omap3_boards_compat[] __initconst = {
81b83a08feSNishanth Menon 	"ti,omap3430",
828d61649dSBenoit Cousson 	"ti,omap3",
838d61649dSBenoit Cousson 	NULL,
848d61649dSBenoit Cousson };
858d61649dSBenoit Cousson 
868d61649dSBenoit Cousson DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
878d61649dSBenoit Cousson 	.reserve	= omap_reserve,
888d61649dSBenoit Cousson 	.map_io		= omap3_map_io,
898d61649dSBenoit Cousson 	.init_early	= omap3430_init_early,
9093651b85SBenoit Cousson 	.init_machine	= omap_generic_init,
91990fa4f5SRajendra Nayak 	.init_late	= omap3_init_late,
926bb27d73SStephen Warren 	.init_time	= omap3_sync32k_timer_init,
938d61649dSBenoit Cousson 	.dt_compat	= omap3_boards_compat,
94187e3e06SPaul Walmsley 	.restart	= omap3xxx_restart,
958d61649dSBenoit Cousson MACHINE_END
967dd9d502SJon Hunter 
9758cda01eSUwe Kleine-König static const char *const omap36xx_boards_compat[] __initconst = {
98016c12d2SNishanth Menon 	"ti,omap36xx",
99016c12d2SNishanth Menon 	NULL,
100016c12d2SNishanth Menon };
101016c12d2SNishanth Menon 
102016c12d2SNishanth Menon DT_MACHINE_START(OMAP36XX_DT, "Generic OMAP36xx (Flattened Device Tree)")
103016c12d2SNishanth Menon 	.reserve	= omap_reserve,
104016c12d2SNishanth Menon 	.map_io		= omap3_map_io,
105016c12d2SNishanth Menon 	.init_early	= omap3630_init_early,
106016c12d2SNishanth Menon 	.init_machine	= omap_generic_init,
107016c12d2SNishanth Menon 	.init_late	= omap3_init_late,
108016c12d2SNishanth Menon 	.init_time	= omap3_sync32k_timer_init,
109016c12d2SNishanth Menon 	.dt_compat	= omap36xx_boards_compat,
110016c12d2SNishanth Menon 	.restart	= omap3xxx_restart,
111016c12d2SNishanth Menon MACHINE_END
112016c12d2SNishanth Menon 
11358cda01eSUwe Kleine-König static const char *const omap3_gp_boards_compat[] __initconst = {
1147dd9d502SJon Hunter 	"ti,omap3-beagle",
1154bfe6341SAnil Kumar 	"timll,omap3-devkit8000",
1167dd9d502SJon Hunter 	NULL,
1177dd9d502SJon Hunter };
1187dd9d502SJon Hunter 
1197dd9d502SJon Hunter DT_MACHINE_START(OMAP3_GP_DT, "Generic OMAP3-GP (Flattened Device Tree)")
1207dd9d502SJon Hunter 	.reserve	= omap_reserve,
1217dd9d502SJon Hunter 	.map_io		= omap3_map_io,
1227dd9d502SJon Hunter 	.init_early	= omap3430_init_early,
1237dd9d502SJon Hunter 	.init_machine	= omap_generic_init,
124990fa4f5SRajendra Nayak 	.init_late	= omap3_init_late,
1256bb27d73SStephen Warren 	.init_time	= omap3_secure_sync32k_timer_init,
1267dd9d502SJon Hunter 	.dt_compat	= omap3_gp_boards_compat,
127d01e4afdSLinus Torvalds 	.restart	= omap3xxx_restart,
1288d61649dSBenoit Cousson MACHINE_END
129caef4ee8SNishanth Menon 
13058cda01eSUwe Kleine-König static const char *const am3517_boards_compat[] __initconst = {
131caef4ee8SNishanth Menon 	"ti,am3517",
132caef4ee8SNishanth Menon 	NULL,
133caef4ee8SNishanth Menon };
134caef4ee8SNishanth Menon 
135caef4ee8SNishanth Menon DT_MACHINE_START(AM3517_DT, "Generic AM3517 (Flattened Device Tree)")
136caef4ee8SNishanth Menon 	.reserve	= omap_reserve,
137caef4ee8SNishanth Menon 	.map_io		= omap3_map_io,
138caef4ee8SNishanth Menon 	.init_early	= am35xx_init_early,
139caef4ee8SNishanth Menon 	.init_machine	= omap_generic_init,
140caef4ee8SNishanth Menon 	.init_late	= omap3_init_late,
141caef4ee8SNishanth Menon 	.init_time	= omap3_gptimer_timer_init,
142caef4ee8SNishanth Menon 	.dt_compat	= am3517_boards_compat,
143caef4ee8SNishanth Menon 	.restart	= omap3xxx_restart,
144caef4ee8SNishanth Menon MACHINE_END
1458d61649dSBenoit Cousson #endif
1468d61649dSBenoit Cousson 
147abf8cc1dSTony Lindgren #ifdef CONFIG_SOC_TI81XX
148abf8cc1dSTony Lindgren static const char *const ti814x_boards_compat[] __initconst = {
149abf8cc1dSTony Lindgren 	"ti,dm8148",
150abf8cc1dSTony Lindgren 	"ti,dm814",
151abf8cc1dSTony Lindgren 	NULL,
152abf8cc1dSTony Lindgren };
153abf8cc1dSTony Lindgren 
154abf8cc1dSTony Lindgren DT_MACHINE_START(TI81XX_DT, "Generic ti814x (Flattened Device Tree)")
155abf8cc1dSTony Lindgren 	.reserve	= omap_reserve,
156abf8cc1dSTony Lindgren 	.map_io		= ti81xx_map_io,
157abf8cc1dSTony Lindgren 	.init_early	= ti814x_init_early,
158abf8cc1dSTony Lindgren 	.init_machine	= omap_generic_init,
159abf8cc1dSTony Lindgren 	.init_late	= ti81xx_init_late,
160abf8cc1dSTony Lindgren 	.init_time	= omap3_gptimer_timer_init,
161abf8cc1dSTony Lindgren 	.dt_compat	= ti814x_boards_compat,
162abf8cc1dSTony Lindgren 	.restart	= ti81xx_restart,
163abf8cc1dSTony Lindgren MACHINE_END
164abf8cc1dSTony Lindgren 
165abf8cc1dSTony Lindgren static const char *const ti816x_boards_compat[] __initconst = {
166abf8cc1dSTony Lindgren 	"ti,dm8168",
167abf8cc1dSTony Lindgren 	"ti,dm816",
168abf8cc1dSTony Lindgren 	NULL,
169abf8cc1dSTony Lindgren };
170abf8cc1dSTony Lindgren 
171abf8cc1dSTony Lindgren DT_MACHINE_START(TI816X_DT, "Generic ti816x (Flattened Device Tree)")
172abf8cc1dSTony Lindgren 	.reserve	= omap_reserve,
173abf8cc1dSTony Lindgren 	.map_io		= ti81xx_map_io,
174abf8cc1dSTony Lindgren 	.init_early	= ti816x_init_early,
175abf8cc1dSTony Lindgren 	.init_machine	= omap_generic_init,
176abf8cc1dSTony Lindgren 	.init_late	= ti81xx_init_late,
177abf8cc1dSTony Lindgren 	.init_time	= omap3_gptimer_timer_init,
178abf8cc1dSTony Lindgren 	.dt_compat	= ti816x_boards_compat,
179abf8cc1dSTony Lindgren 	.restart	= ti81xx_restart,
180abf8cc1dSTony Lindgren MACHINE_END
181abf8cc1dSTony Lindgren #endif
182abf8cc1dSTony Lindgren 
18308f30989SAfzal Mohammed #ifdef CONFIG_SOC_AM33XX
18458cda01eSUwe Kleine-König static const char *const am33xx_boards_compat[] __initconst = {
18508f30989SAfzal Mohammed 	"ti,am33xx",
18608f30989SAfzal Mohammed 	NULL,
18708f30989SAfzal Mohammed };
18808f30989SAfzal Mohammed 
18908f30989SAfzal Mohammed DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)")
19008f30989SAfzal Mohammed 	.reserve	= omap_reserve,
19108f30989SAfzal Mohammed 	.map_io		= am33xx_map_io,
19208f30989SAfzal Mohammed 	.init_early	= am33xx_init_early,
19308f30989SAfzal Mohammed 	.init_machine	= omap_generic_init,
194765e7a06SNishanth Menon 	.init_late	= am33xx_init_late,
19500ea4d56SJon Hunter 	.init_time	= omap3_gptimer_timer_init,
19608f30989SAfzal Mohammed 	.dt_compat	= am33xx_boards_compat,
19714e067c1SJean-Sebastien A. Beaudry 	.restart	= am33xx_restart,
19808f30989SAfzal Mohammed MACHINE_END
19908f30989SAfzal Mohammed #endif
20008f30989SAfzal Mohammed 
2010e02a8c1SBenoit Cousson #ifdef CONFIG_ARCH_OMAP4
20258cda01eSUwe Kleine-König static const char *const omap4_boards_compat[] __initconst = {
203b83a08feSNishanth Menon 	"ti,omap4460",
204b83a08feSNishanth Menon 	"ti,omap4430",
2058d61649dSBenoit Cousson 	"ti,omap4",
2068d61649dSBenoit Cousson 	NULL,
2078d61649dSBenoit Cousson };
2088d61649dSBenoit Cousson 
2098d61649dSBenoit Cousson DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)")
2108d61649dSBenoit Cousson 	.reserve	= omap_reserve,
21106915321SMarc Zyngier 	.smp		= smp_ops(omap4_smp_ops),
2128d61649dSBenoit Cousson 	.map_io		= omap4_map_io,
2138d61649dSBenoit Cousson 	.init_early	= omap4430_init_early,
214c4082d49SR Sricharan 	.init_irq	= omap_gic_of_init,
21593651b85SBenoit Cousson 	.init_machine	= omap_generic_init,
216bbd707acSShawn Guo 	.init_late	= omap4430_init_late,
2176bb27d73SStephen Warren 	.init_time	= omap4_local_timer_init,
2188d61649dSBenoit Cousson 	.dt_compat	= omap4_boards_compat,
219187e3e06SPaul Walmsley 	.restart	= omap44xx_restart,
2208d61649dSBenoit Cousson MACHINE_END
2218d61649dSBenoit Cousson #endif
2220c1b6facSR Sricharan 
2230c1b6facSR Sricharan #ifdef CONFIG_SOC_OMAP5
22458cda01eSUwe Kleine-König static const char *const omap5_boards_compat[] __initconst = {
225b83a08feSNishanth Menon 	"ti,omap5432",
226b83a08feSNishanth Menon 	"ti,omap5430",
2270c1b6facSR Sricharan 	"ti,omap5",
2280c1b6facSR Sricharan 	NULL,
2290c1b6facSR Sricharan };
2300c1b6facSR Sricharan 
2310c1b6facSR Sricharan DT_MACHINE_START(OMAP5_DT, "Generic OMAP5 (Flattened Device Tree)")
2320c1b6facSR Sricharan 	.reserve	= omap_reserve,
23306915321SMarc Zyngier 	.smp		= smp_ops(omap4_smp_ops),
2340c1b6facSR Sricharan 	.map_io		= omap5_map_io,
2350c1b6facSR Sricharan 	.init_early	= omap5_init_early,
2360c1b6facSR Sricharan 	.init_irq	= omap_gic_of_init,
2370c1b6facSR Sricharan 	.init_machine	= omap_generic_init,
238765e7a06SNishanth Menon 	.init_late	= omap5_init_late,
2396bb27d73SStephen Warren 	.init_time	= omap5_realtime_timer_init,
2400c1b6facSR Sricharan 	.dt_compat	= omap5_boards_compat,
241187e3e06SPaul Walmsley 	.restart	= omap44xx_restart,
2420c1b6facSR Sricharan MACHINE_END
2430c1b6facSR Sricharan #endif
244bb256f80SAfzal Mohammed 
245bb256f80SAfzal Mohammed #ifdef CONFIG_SOC_AM43XX
24658cda01eSUwe Kleine-König static const char *const am43_boards_compat[] __initconst = {
247b83a08feSNishanth Menon 	"ti,am4372",
248bb256f80SAfzal Mohammed 	"ti,am43",
249bb256f80SAfzal Mohammed 	NULL,
250bb256f80SAfzal Mohammed };
251bb256f80SAfzal Mohammed 
252bb256f80SAfzal Mohammed DT_MACHINE_START(AM43_DT, "Generic AM43 (Flattened Device Tree)")
253bb256f80SAfzal Mohammed 	.map_io		= am33xx_map_io,
254bb256f80SAfzal Mohammed 	.init_early	= am43xx_init_early,
255765e7a06SNishanth Menon 	.init_late	= am43xx_init_late,
256bb256f80SAfzal Mohammed 	.init_irq	= omap_gic_of_init,
257bb256f80SAfzal Mohammed 	.init_machine	= omap_generic_init,
2585b5c0135SRajendra Nayak 	.init_time	= omap3_gptimer_timer_init,
259bb256f80SAfzal Mohammed 	.dt_compat	= am43_boards_compat,
260a7daf64aSLokesh Vutla 	.restart	= omap44xx_restart,
261bb256f80SAfzal Mohammed MACHINE_END
262bb256f80SAfzal Mohammed #endif
263439bf39eSR Sricharan 
264439bf39eSR Sricharan #ifdef CONFIG_SOC_DRA7XX
26558cda01eSUwe Kleine-König static const char *const dra74x_boards_compat[] __initconst = {
2660e0cb99dSNishanth Menon 	"ti,am5728",
2670e0cb99dSNishanth Menon 	"ti,am5726",
26844e97ff6SRajendra Nayak 	"ti,dra742",
269439bf39eSR Sricharan 	"ti,dra7",
270439bf39eSR Sricharan 	NULL,
271439bf39eSR Sricharan };
272439bf39eSR Sricharan 
27344e97ff6SRajendra Nayak DT_MACHINE_START(DRA74X_DT, "Generic DRA74X (Flattened Device Tree)")
274439bf39eSR Sricharan 	.reserve	= omap_reserve,
275439bf39eSR Sricharan 	.smp		= smp_ops(omap4_smp_ops),
276439bf39eSR Sricharan 	.map_io		= omap5_map_io,
277439bf39eSR Sricharan 	.init_early	= dra7xx_init_early,
278765e7a06SNishanth Menon 	.init_late	= dra7xx_init_late,
279439bf39eSR Sricharan 	.init_irq	= omap_gic_of_init,
280439bf39eSR Sricharan 	.init_machine	= omap_generic_init,
281439bf39eSR Sricharan 	.init_time	= omap5_realtime_timer_init,
28244e97ff6SRajendra Nayak 	.dt_compat	= dra74x_boards_compat,
28344e97ff6SRajendra Nayak 	.restart	= omap44xx_restart,
28444e97ff6SRajendra Nayak MACHINE_END
28544e97ff6SRajendra Nayak 
28658cda01eSUwe Kleine-König static const char *const dra72x_boards_compat[] __initconst = {
2870e0cb99dSNishanth Menon 	"ti,am5718",
2880e0cb99dSNishanth Menon 	"ti,am5716",
28944e97ff6SRajendra Nayak 	"ti,dra722",
29044e97ff6SRajendra Nayak 	NULL,
29144e97ff6SRajendra Nayak };
29244e97ff6SRajendra Nayak 
29344e97ff6SRajendra Nayak DT_MACHINE_START(DRA72X_DT, "Generic DRA72X (Flattened Device Tree)")
29444e97ff6SRajendra Nayak 	.reserve	= omap_reserve,
29544e97ff6SRajendra Nayak 	.map_io		= omap5_map_io,
29644e97ff6SRajendra Nayak 	.init_early	= dra7xx_init_early,
29744e97ff6SRajendra Nayak 	.init_late	= dra7xx_init_late,
29844e97ff6SRajendra Nayak 	.init_irq	= omap_gic_of_init,
29944e97ff6SRajendra Nayak 	.init_machine	= omap_generic_init,
30044e97ff6SRajendra Nayak 	.init_time	= omap5_realtime_timer_init,
30144e97ff6SRajendra Nayak 	.dt_compat	= dra72x_boards_compat,
3021d597b07SRajendra Nayak 	.restart	= omap44xx_restart,
303439bf39eSR Sricharan MACHINE_END
304439bf39eSR Sricharan #endif
305