static int omap_init(void) { int ret; struct device_node *root; root = of_get_root_node(); if (root) { __omap_cpu_type = omap_soc_from_dt(); if (!__omap_cpu_type) hang(); } if (cpu_is_omap3()) ret = omap3_init(); else if (cpu_is_omap4()) ret = omap4_init(); else if (cpu_is_am33xx()) ret = am33xx_init(); else return -EINVAL; if (root) return ret; if (cpu_is_omap3()) ret = omap3_devices_init(); else if (cpu_is_omap4()) ret = omap4_devices_init(); else if (cpu_is_am33xx()) ret = am33xx_devices_init(); else return -EINVAL; return ret; }
/* * Replaces the default shell in xload configuration */ static __noreturn int omap_xload(void) { void *func; if (!barebox_part) barebox_part = &default_part; switch (bootsource_get()) { case BOOTSOURCE_MMC: printf("booting from MMC\n"); func = omap_xload_boot_mmc(); break; case BOOTSOURCE_USB: if (IS_ENABLED(CONFIG_OMAP3_USBBOOT) && cpu_is_omap3()) { printf("booting from USB\n"); func = omap3_xload_boot_usb(); } else if (IS_ENABLED(CONFIG_FS_OMAP4_USBBOOT)) { printf("booting from USB\n"); func = omap4_xload_boot_usb(); } else { printf("booting from USB not enabled\n"); func = NULL; } break; case BOOTSOURCE_NAND: printf("booting from NAND\n"); func = omap_xload_boot_nand(barebox_part); break; case BOOTSOURCE_SPI: printf("booting from SPI\n"); func = omap_xload_boot_spi(barebox_part); break; case BOOTSOURCE_SERIAL: if (IS_ENABLED(CONFIG_OMAP_SERIALBOOT)) { printf("booting from serial\n"); func = omap_serial_boot(); break; } case BOOTSOURCE_NET: if (IS_ENABLED(CONFIG_AM33XX_NET_BOOT)) { printf("booting from NET\n"); func = am33xx_net_boot(); break; } else { printf("booting from network not enabled\n"); } default: printf("unknown boot source. Fall back to nand\n"); func = omap_xload_boot_nand(barebox_part); break; } if (!func) { printf("booting failed\n"); while (1); } omap_start_barebox(func); }
static void *omap_scratch_space_start(void) { if (cpu_is_am33xx()) return (void *)AM33XX_SRAM_SCRATCH_SPACE; if (cpu_is_omap3()) return (void *)OMAP3_SRAM_SCRATCH_SPACE; if (cpu_is_omap4()) return (void *)OMAP44XX_SRAM_SCRATCH_SPACE; return NULL; }
static void *omap_sram_start(void) { if (cpu_is_am33xx()) return (void *)AM33XX_SRAM0_START; if (cpu_is_omap3()) return (void *)OMAP3_SRAM_BASE; if (cpu_is_omap4()) return (void *)OMAP44XX_SRAM_BASE; return NULL; }
void __noreturn reset_cpu(unsigned long addr) { if (cpu_is_omap3()) omap3_reset_cpu(addr); if (cpu_is_omap4()) omap4_reset_cpu(addr); if (cpu_is_am33xx()) am33xx_reset_cpu(addr); while (1); }