Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * Copyright (C) 2005 Nokia Corporation
0004  * Author: Paul Mundt <paul.mundt@nokia.com>
0005  *
0006  * Copyright (C) 2011 Texas Instruments Incorporated - https://www.ti.com/
0007  *
0008  * Modified from the original mach-omap/omap2/board-generic.c did by Paul
0009  * to support the OMAP2+ device tree boards with an unique board file.
0010  */
0011 #include <linux/io.h>
0012 #include <linux/of_irq.h>
0013 #include <linux/of_platform.h>
0014 #include <linux/irqdomain.h>
0015 #include <linux/clocksource.h>
0016 
0017 #include <asm/setup.h>
0018 #include <asm/mach/arch.h>
0019 #include <asm/system_info.h>
0020 
0021 #include "common.h"
0022 
0023 static const struct of_device_id omap_dt_match_table[] __initconst = {
0024     { .compatible = "simple-bus", },
0025     { .compatible = "ti,omap-infra", },
0026     { }
0027 };
0028 
0029 static void __init __maybe_unused omap_generic_init(void)
0030 {
0031     pdata_quirks_init(omap_dt_match_table);
0032     omap_soc_device_init();
0033 }
0034 
0035 /* Clocks are needed early, see drivers/clocksource for the rest */
0036 static void __init __maybe_unused omap_init_time_of(void)
0037 {
0038     omap_clk_init();
0039     timer_probe();
0040 }
0041 
0042 /* Used by am437x for ARM timer in non-SMP configurations */
0043 #if !defined(CONFIG_SMP) && defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST)
0044 void tick_broadcast(const struct cpumask *mask)
0045 {
0046 }
0047 #endif
0048 
0049 #ifdef CONFIG_SOC_OMAP2420
0050 static const char *const omap242x_boards_compat[] __initconst = {
0051     "ti,omap2420",
0052     NULL,
0053 };
0054 
0055 DT_MACHINE_START(OMAP242X_DT, "Generic OMAP2420 (Flattened Device Tree)")
0056     .reserve    = omap_reserve,
0057     .map_io     = omap242x_map_io,
0058     .init_early = omap2420_init_early,
0059     .init_machine   = omap_generic_init,
0060     .init_time  = omap_init_time_of,
0061     .dt_compat  = omap242x_boards_compat,
0062     .restart    = omap2xxx_restart,
0063 MACHINE_END
0064 #endif
0065 
0066 #ifdef CONFIG_SOC_OMAP2430
0067 static const char *const omap243x_boards_compat[] __initconst = {
0068     "ti,omap2430",
0069     NULL,
0070 };
0071 
0072 DT_MACHINE_START(OMAP243X_DT, "Generic OMAP2430 (Flattened Device Tree)")
0073     .reserve    = omap_reserve,
0074     .map_io     = omap243x_map_io,
0075     .init_early = omap2430_init_early,
0076     .init_machine   = omap_generic_init,
0077     .init_time  = omap_init_time_of,
0078     .dt_compat  = omap243x_boards_compat,
0079     .restart    = omap2xxx_restart,
0080 MACHINE_END
0081 #endif
0082 
0083 #ifdef CONFIG_ARCH_OMAP3
0084 /* Some boards need board name for legacy userspace in /proc/cpuinfo */
0085 static const char *const n900_boards_compat[] __initconst = {
0086     "nokia,omap3-n900",
0087     NULL,
0088 };
0089 
0090 /* Set system_rev from atags */
0091 static void __init rx51_set_system_rev(const struct tag *tags)
0092 {
0093     const struct tag *tag;
0094 
0095     if (tags->hdr.tag != ATAG_CORE)
0096         return;
0097 
0098     for_each_tag(tag, tags) {
0099         if (tag->hdr.tag == ATAG_REVISION) {
0100             system_rev = tag->u.revision.rev;
0101             break;
0102         }
0103     }
0104 }
0105 
0106 /* Legacy userspace on Nokia N900 needs ATAGS exported in /proc/atags,
0107  * save them while the data is still not overwritten
0108  */
0109 static void __init rx51_reserve(void)
0110 {
0111     const struct tag *tags = (const struct tag *)(PAGE_OFFSET + 0x100);
0112 
0113     save_atags(tags);
0114     rx51_set_system_rev(tags);
0115     omap_reserve();
0116 }
0117 
0118 DT_MACHINE_START(OMAP3_N900_DT, "Nokia RX-51 board")
0119     .reserve    = rx51_reserve,
0120     .map_io     = omap3_map_io,
0121     .init_early = omap3430_init_early,
0122     .init_machine   = omap_generic_init,
0123     .init_late  = omap3_init_late,
0124     .init_time  = omap_init_time_of,
0125     .dt_compat  = n900_boards_compat,
0126     .restart    = omap3xxx_restart,
0127 MACHINE_END
0128 
0129 /* Generic omap3 boards, most boards can use these */
0130 static const char *const omap3_boards_compat[] __initconst = {
0131     "ti,omap3430",
0132     "ti,omap3",
0133     NULL,
0134 };
0135 
0136 DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
0137     .reserve    = omap_reserve,
0138     .map_io     = omap3_map_io,
0139     .init_early = omap3430_init_early,
0140     .init_machine   = omap_generic_init,
0141     .init_late  = omap3_init_late,
0142     .init_time  = omap_init_time_of,
0143     .dt_compat  = omap3_boards_compat,
0144     .restart    = omap3xxx_restart,
0145 MACHINE_END
0146 
0147 static const char *const omap36xx_boards_compat[] __initconst = {
0148     "ti,omap3630",
0149     "ti,omap36xx",
0150     NULL,
0151 };
0152 
0153 DT_MACHINE_START(OMAP36XX_DT, "Generic OMAP36xx (Flattened Device Tree)")
0154     .reserve    = omap_reserve,
0155     .map_io     = omap3_map_io,
0156     .init_early = omap3630_init_early,
0157     .init_machine   = omap_generic_init,
0158     .init_late  = omap3_init_late,
0159     .init_time  = omap_init_time_of,
0160     .dt_compat  = omap36xx_boards_compat,
0161     .restart    = omap3xxx_restart,
0162 MACHINE_END
0163 
0164 static const char *const omap3_gp_boards_compat[] __initconst = {
0165     "ti,omap3-beagle",
0166     "timll,omap3-devkit8000",
0167     NULL,
0168 };
0169 
0170 DT_MACHINE_START(OMAP3_GP_DT, "Generic OMAP3-GP (Flattened Device Tree)")
0171     .reserve    = omap_reserve,
0172     .map_io     = omap3_map_io,
0173     .init_early = omap3430_init_early,
0174     .init_machine   = omap_generic_init,
0175     .init_late  = omap3_init_late,
0176     .init_time  = omap_init_time_of,
0177     .dt_compat  = omap3_gp_boards_compat,
0178     .restart    = omap3xxx_restart,
0179 MACHINE_END
0180 
0181 static const char *const am3517_boards_compat[] __initconst = {
0182     "ti,am3517",
0183     NULL,
0184 };
0185 
0186 DT_MACHINE_START(AM3517_DT, "Generic AM3517 (Flattened Device Tree)")
0187     .reserve    = omap_reserve,
0188     .map_io     = omap3_map_io,
0189     .init_early = am35xx_init_early,
0190     .init_machine   = omap_generic_init,
0191     .init_late  = omap3_init_late,
0192     .init_time  = omap_init_time_of,
0193     .dt_compat  = am3517_boards_compat,
0194     .restart    = omap3xxx_restart,
0195 MACHINE_END
0196 #endif
0197 
0198 #ifdef CONFIG_SOC_TI81XX
0199 static const char *const ti814x_boards_compat[] __initconst = {
0200     "ti,dm8148",
0201     "ti,dm814",
0202     NULL,
0203 };
0204 
0205 DT_MACHINE_START(TI814X_DT, "Generic ti814x (Flattened Device Tree)")
0206     .reserve    = omap_reserve,
0207     .map_io     = ti81xx_map_io,
0208     .init_early = ti814x_init_early,
0209     .init_machine   = omap_generic_init,
0210     .init_late  = ti81xx_init_late,
0211     .init_time  = omap_init_time_of,
0212     .dt_compat  = ti814x_boards_compat,
0213     .restart    = ti81xx_restart,
0214 MACHINE_END
0215 
0216 static const char *const ti816x_boards_compat[] __initconst = {
0217     "ti,dm8168",
0218     "ti,dm816",
0219     NULL,
0220 };
0221 
0222 DT_MACHINE_START(TI816X_DT, "Generic ti816x (Flattened Device Tree)")
0223     .reserve    = omap_reserve,
0224     .map_io     = ti81xx_map_io,
0225     .init_early = ti816x_init_early,
0226     .init_machine   = omap_generic_init,
0227     .init_late  = ti81xx_init_late,
0228     .init_time  = omap_init_time_of,
0229     .dt_compat  = ti816x_boards_compat,
0230     .restart    = ti81xx_restart,
0231 MACHINE_END
0232 #endif
0233 
0234 #ifdef CONFIG_SOC_AM33XX
0235 static const char *const am33xx_boards_compat[] __initconst = {
0236     "ti,am33xx",
0237     NULL,
0238 };
0239 
0240 DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)")
0241     .reserve    = omap_reserve,
0242     .map_io     = am33xx_map_io,
0243     .init_early = am33xx_init_early,
0244     .init_machine   = omap_generic_init,
0245     .init_late  = am33xx_init_late,
0246     .init_time  = omap_init_time_of,
0247     .dt_compat  = am33xx_boards_compat,
0248     .restart    = am33xx_restart,
0249 MACHINE_END
0250 #endif
0251 
0252 #ifdef CONFIG_ARCH_OMAP4
0253 static const char *const omap4_boards_compat[] __initconst = {
0254     "ti,omap4460",
0255     "ti,omap4430",
0256     "ti,omap4",
0257     NULL,
0258 };
0259 
0260 DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)")
0261     .l2c_aux_val    = OMAP_L2C_AUX_CTRL,
0262     .l2c_aux_mask   = 0xcf9fffff,
0263     .l2c_write_sec  = omap4_l2c310_write_sec,
0264     .reserve    = omap_reserve,
0265     .smp        = smp_ops(omap4_smp_ops),
0266     .map_io     = omap4_map_io,
0267     .init_early = omap4430_init_early,
0268     .init_irq   = omap_gic_of_init,
0269     .init_machine   = omap_generic_init,
0270     .init_late  = omap4430_init_late,
0271     .init_time  = omap_init_time_of,
0272     .dt_compat  = omap4_boards_compat,
0273     .restart    = omap44xx_restart,
0274 MACHINE_END
0275 #endif
0276 
0277 #ifdef CONFIG_SOC_OMAP5
0278 static const char *const omap5_boards_compat[] __initconst = {
0279     "ti,omap5432",
0280     "ti,omap5430",
0281     "ti,omap5",
0282     NULL,
0283 };
0284 
0285 DT_MACHINE_START(OMAP5_DT, "Generic OMAP5 (Flattened Device Tree)")
0286 #if defined(CONFIG_ZONE_DMA) && defined(CONFIG_ARM_LPAE)
0287     .dma_zone_size  = SZ_2G,
0288 #endif
0289     .reserve    = omap_reserve,
0290     .smp        = smp_ops(omap4_smp_ops),
0291     .map_io     = omap5_map_io,
0292     .init_early = omap5_init_early,
0293     .init_irq   = omap_gic_of_init,
0294     .init_machine   = omap_generic_init,
0295     .init_late  = omap5_init_late,
0296     .init_time  = omap5_realtime_timer_init,
0297     .dt_compat  = omap5_boards_compat,
0298     .restart    = omap44xx_restart,
0299 MACHINE_END
0300 #endif
0301 
0302 #ifdef CONFIG_SOC_AM43XX
0303 static const char *const am43_boards_compat[] __initconst = {
0304     "ti,am4372",
0305     "ti,am43",
0306     NULL,
0307 };
0308 
0309 DT_MACHINE_START(AM43_DT, "Generic AM43 (Flattened Device Tree)")
0310     .l2c_aux_val    = OMAP_L2C_AUX_CTRL,
0311     .l2c_aux_mask   = 0xcf9fffff,
0312     .l2c_write_sec  = omap4_l2c310_write_sec,
0313     .map_io     = am33xx_map_io,
0314     .init_early = am43xx_init_early,
0315     .init_late  = am43xx_init_late,
0316     .init_irq   = omap_gic_of_init,
0317     .init_machine   = omap_generic_init,
0318     .init_time  = omap_init_time_of,
0319     .dt_compat  = am43_boards_compat,
0320     .restart    = omap44xx_restart,
0321 MACHINE_END
0322 #endif
0323 
0324 #ifdef CONFIG_SOC_DRA7XX
0325 static const char *const dra74x_boards_compat[] __initconst = {
0326     "ti,dra762",
0327     "ti,am5728",
0328     "ti,am5726",
0329     "ti,dra742",
0330     "ti,dra7",
0331     NULL,
0332 };
0333 
0334 DT_MACHINE_START(DRA74X_DT, "Generic DRA74X (Flattened Device Tree)")
0335 #if defined(CONFIG_ZONE_DMA) && defined(CONFIG_ARM_LPAE)
0336     .dma_zone_size  = SZ_2G,
0337 #endif
0338     .reserve    = omap_reserve,
0339     .smp        = smp_ops(omap4_smp_ops),
0340     .map_io     = dra7xx_map_io,
0341     .init_early = dra7xx_init_early,
0342     .init_late  = dra7xx_init_late,
0343     .init_irq   = omap_gic_of_init,
0344     .init_machine   = omap_generic_init,
0345     .init_time  = omap5_realtime_timer_init,
0346     .dt_compat  = dra74x_boards_compat,
0347     .restart    = omap44xx_restart,
0348 MACHINE_END
0349 
0350 static const char *const dra72x_boards_compat[] __initconst = {
0351     "ti,am5718",
0352     "ti,am5716",
0353     "ti,dra722",
0354     "ti,dra718",
0355     NULL,
0356 };
0357 
0358 DT_MACHINE_START(DRA72X_DT, "Generic DRA72X (Flattened Device Tree)")
0359 #if defined(CONFIG_ZONE_DMA) && defined(CONFIG_ARM_LPAE)
0360     .dma_zone_size  = SZ_2G,
0361 #endif
0362     .reserve    = omap_reserve,
0363     .map_io     = dra7xx_map_io,
0364     .init_early = dra7xx_init_early,
0365     .init_late  = dra7xx_init_late,
0366     .init_irq   = omap_gic_of_init,
0367     .init_machine   = omap_generic_init,
0368     .init_time  = omap5_realtime_timer_init,
0369     .dt_compat  = dra72x_boards_compat,
0370     .restart    = omap44xx_restart,
0371 MACHINE_END
0372 #endif