1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2005 Nokia Corporation
4 * Author: Paul Mundt <paul.mundt@nokia.com>
6 * Copyright (C) 2011 Texas Instruments Incorporated - https://www.ti.com/
8 * Modified from the original mach-omap/omap2/board-generic.c did by Paul
9 * to support the OMAP2+ device tree boards with an unique board file.
12 #include <linux/of_irq.h>
13 #include <linux/of_platform.h>
14 #include <linux/irqdomain.h>
15 #include <linux/clocksource.h>
16 #include <linux/clockchips.h>
18 #include <asm/setup.h>
19 #include <asm/mach/arch.h>
20 #include <asm/system_info.h>
24 static const struct of_device_id omap_dt_match_table[] __initconst = {
25 { .compatible = "simple-bus", },
26 { .compatible = "ti,omap-infra", },
30 static void __init __maybe_unused omap_generic_init(void)
32 pdata_quirks_init(omap_dt_match_table);
33 omap_soc_device_init();
36 /* Clocks are needed early, see drivers/clocksource for the rest */
37 static void __init __maybe_unused omap_init_time_of(void)
43 /* Used by am437x for ARM timer in non-SMP configurations */
44 #if !defined(CONFIG_SMP) && defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST)
45 void tick_broadcast(const struct cpumask *mask)
50 #ifdef CONFIG_SOC_OMAP2420
51 static const char *const omap242x_boards_compat[] __initconst = {
56 DT_MACHINE_START(OMAP242X_DT, "Generic OMAP2420 (Flattened Device Tree)")
57 .reserve = omap_reserve,
58 .map_io = omap242x_map_io,
59 .init_early = omap2420_init_early,
60 .init_machine = omap_generic_init,
61 .init_time = omap_init_time_of,
62 .dt_compat = omap242x_boards_compat,
63 .restart = omap2xxx_restart,
67 #ifdef CONFIG_SOC_OMAP2430
68 static const char *const omap243x_boards_compat[] __initconst = {
73 DT_MACHINE_START(OMAP243X_DT, "Generic OMAP2430 (Flattened Device Tree)")
74 .reserve = omap_reserve,
75 .map_io = omap243x_map_io,
76 .init_early = omap2430_init_early,
77 .init_machine = omap_generic_init,
78 .init_time = omap_init_time_of,
79 .dt_compat = omap243x_boards_compat,
80 .restart = omap2xxx_restart,
84 #ifdef CONFIG_ARCH_OMAP3
85 /* Some boards need board name for legacy userspace in /proc/cpuinfo */
86 static const char *const n900_boards_compat[] __initconst = {
91 /* Set system_rev from atags */
92 static void __init rx51_set_system_rev(const struct tag *tags)
94 const struct tag *tag;
96 if (tags->hdr.tag != ATAG_CORE)
99 for_each_tag(tag, tags) {
100 if (tag->hdr.tag == ATAG_REVISION) {
101 system_rev = tag->u.revision.rev;
107 /* Legacy userspace on Nokia N900 needs ATAGS exported in /proc/atags,
108 * save them while the data is still not overwritten
110 static void __init rx51_reserve(void)
112 const struct tag *tags = (const struct tag *)(PAGE_OFFSET + 0x100);
115 rx51_set_system_rev(tags);
119 DT_MACHINE_START(OMAP3_N900_DT, "Nokia RX-51 board")
120 .reserve = rx51_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 = omap_init_time_of,
126 .dt_compat = n900_boards_compat,
127 .restart = omap3xxx_restart,
130 /* Generic omap3 boards, most boards can use these */
131 static const char *const omap3_boards_compat[] __initconst = {
137 DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
138 .reserve = omap_reserve,
139 .map_io = omap3_map_io,
140 .init_early = omap3430_init_early,
141 .init_machine = omap_generic_init,
142 .init_late = omap3_init_late,
143 .init_time = omap_init_time_of,
144 .dt_compat = omap3_boards_compat,
145 .restart = omap3xxx_restart,
148 static const char *const omap36xx_boards_compat[] __initconst = {
154 DT_MACHINE_START(OMAP36XX_DT, "Generic OMAP36xx (Flattened Device Tree)")
155 .reserve = omap_reserve,
156 .map_io = omap3_map_io,
157 .init_early = omap3630_init_early,
158 .init_machine = omap_generic_init,
159 .init_late = omap3_init_late,
160 .init_time = omap_init_time_of,
161 .dt_compat = omap36xx_boards_compat,
162 .restart = omap3xxx_restart,
165 static const char *const omap3_gp_boards_compat[] __initconst = {
167 "timll,omap3-devkit8000",
171 DT_MACHINE_START(OMAP3_GP_DT, "Generic OMAP3-GP (Flattened Device Tree)")
172 .reserve = omap_reserve,
173 .map_io = omap3_map_io,
174 .init_early = omap3430_init_early,
175 .init_machine = omap_generic_init,
176 .init_late = omap3_init_late,
177 .init_time = omap_init_time_of,
178 .dt_compat = omap3_gp_boards_compat,
179 .restart = omap3xxx_restart,
182 static const char *const am3517_boards_compat[] __initconst = {
187 DT_MACHINE_START(AM3517_DT, "Generic AM3517 (Flattened Device Tree)")
188 .reserve = omap_reserve,
189 .map_io = omap3_map_io,
190 .init_early = am35xx_init_early,
191 .init_machine = omap_generic_init,
192 .init_late = omap3_init_late,
193 .init_time = omap_init_time_of,
194 .dt_compat = am3517_boards_compat,
195 .restart = omap3xxx_restart,
199 #ifdef CONFIG_SOC_TI81XX
200 static const char *const ti814x_boards_compat[] __initconst = {
206 DT_MACHINE_START(TI814X_DT, "Generic ti814x (Flattened Device Tree)")
207 .reserve = omap_reserve,
208 .map_io = ti81xx_map_io,
209 .init_early = ti814x_init_early,
210 .init_machine = omap_generic_init,
211 .init_late = ti81xx_init_late,
212 .init_time = omap_init_time_of,
213 .dt_compat = ti814x_boards_compat,
214 .restart = ti81xx_restart,
217 static const char *const ti816x_boards_compat[] __initconst = {
223 DT_MACHINE_START(TI816X_DT, "Generic ti816x (Flattened Device Tree)")
224 .reserve = omap_reserve,
225 .map_io = ti81xx_map_io,
226 .init_early = ti816x_init_early,
227 .init_machine = omap_generic_init,
228 .init_late = ti81xx_init_late,
229 .init_time = omap_init_time_of,
230 .dt_compat = ti816x_boards_compat,
231 .restart = ti81xx_restart,
235 #ifdef CONFIG_SOC_AM33XX
236 static const char *const am33xx_boards_compat[] __initconst = {
241 DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)")
242 .reserve = omap_reserve,
243 .map_io = am33xx_map_io,
244 .init_early = am33xx_init_early,
245 .init_machine = omap_generic_init,
246 .init_late = am33xx_init_late,
247 .init_time = omap_init_time_of,
248 .dt_compat = am33xx_boards_compat,
249 .restart = am33xx_restart,
253 #ifdef CONFIG_ARCH_OMAP4
254 static const char *const omap4_boards_compat[] __initconst = {
261 DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)")
262 .l2c_aux_val = OMAP_L2C_AUX_CTRL,
263 .l2c_aux_mask = 0xcf9fffff,
264 .l2c_write_sec = omap4_l2c310_write_sec,
265 .reserve = omap_reserve,
266 .smp = smp_ops(omap4_smp_ops),
267 .map_io = omap4_map_io,
268 .init_early = omap4430_init_early,
269 .init_irq = omap_gic_of_init,
270 .init_machine = omap_generic_init,
271 .init_late = omap4430_init_late,
272 .init_time = omap_init_time_of,
273 .dt_compat = omap4_boards_compat,
274 .restart = omap44xx_restart,
278 #ifdef CONFIG_SOC_OMAP5
279 static const char *const omap5_boards_compat[] __initconst = {
286 DT_MACHINE_START(OMAP5_DT, "Generic OMAP5 (Flattened Device Tree)")
287 #if defined(CONFIG_ZONE_DMA) && defined(CONFIG_ARM_LPAE)
288 .dma_zone_size = SZ_2G,
290 .reserve = omap_reserve,
291 .smp = smp_ops(omap4_smp_ops),
292 .map_io = omap5_map_io,
293 .init_early = omap5_init_early,
294 .init_irq = omap_gic_of_init,
295 .init_machine = omap_generic_init,
296 .init_late = omap5_init_late,
297 .init_time = omap5_realtime_timer_init,
298 .dt_compat = omap5_boards_compat,
299 .restart = omap44xx_restart,
303 #ifdef CONFIG_SOC_AM43XX
304 static const char *const am43_boards_compat[] __initconst = {
310 DT_MACHINE_START(AM43_DT, "Generic AM43 (Flattened Device Tree)")
311 .l2c_aux_val = OMAP_L2C_AUX_CTRL,
312 .l2c_aux_mask = 0xcf9fffff,
313 .l2c_write_sec = omap4_l2c310_write_sec,
314 .map_io = am33xx_map_io,
315 .init_early = am43xx_init_early,
316 .init_late = am43xx_init_late,
317 .init_irq = omap_gic_of_init,
318 .init_machine = omap_generic_init,
319 .init_time = omap_init_time_of,
320 .dt_compat = am43_boards_compat,
321 .restart = omap44xx_restart,
325 #ifdef CONFIG_SOC_DRA7XX
326 static const char *const dra74x_boards_compat[] __initconst = {
335 DT_MACHINE_START(DRA74X_DT, "Generic DRA74X (Flattened Device Tree)")
336 #if defined(CONFIG_ZONE_DMA) && defined(CONFIG_ARM_LPAE)
337 .dma_zone_size = SZ_2G,
339 .reserve = omap_reserve,
340 .smp = smp_ops(omap4_smp_ops),
341 .map_io = dra7xx_map_io,
342 .init_early = dra7xx_init_early,
343 .init_late = dra7xx_init_late,
344 .init_irq = omap_gic_of_init,
345 .init_machine = omap_generic_init,
346 .init_time = omap5_realtime_timer_init,
347 .dt_compat = dra74x_boards_compat,
348 .restart = omap44xx_restart,
351 static const char *const dra72x_boards_compat[] __initconst = {
359 DT_MACHINE_START(DRA72X_DT, "Generic DRA72X (Flattened Device Tree)")
360 #if defined(CONFIG_ZONE_DMA) && defined(CONFIG_ARM_LPAE)
361 .dma_zone_size = SZ_2G,
363 .reserve = omap_reserve,
364 .map_io = dra7xx_map_io,
365 .init_early = dra7xx_init_early,
366 .init_late = dra7xx_init_late,
367 .init_irq = omap_gic_of_init,
368 .init_machine = omap_generic_init,
369 .init_time = omap5_realtime_timer_init,
370 .dt_compat = dra72x_boards_compat,
371 .restart = omap44xx_restart,