diff --git a/arch/arm/mach-omap/am33xx_generic.c b/arch/arm/mach-omap/am33xx_generic.c index 059c55e..96432c9 100644 --- a/arch/arm/mach-omap/am33xx_generic.c +++ b/arch/arm/mach-omap/am33xx_generic.c @@ -19,12 +19,13 @@ */ #include +#include +#include #include #include #include #include #include -#include #include void __noreturn reset_cpu(unsigned long addr) @@ -94,10 +95,13 @@ return 0; /* running in SRAM or FLASH */ } -enum omap_boot_src am33xx_bootsrc(void) +static int am33xx_bootsource(void) { - return OMAP_BOOTSRC_MMC1; /* only MMC for now */ + bootsource_set(BOOTSOURCE_MMC); /* only MMC for now */ + bootsource_set_instance(0); + return 0; } +postcore_initcall(am33xx_bootsource); int am33xx_register_ethaddr(int eth_id, int mac_id) { diff --git a/arch/arm/mach-omap/include/mach/generic.h b/arch/arm/mach-omap/include/mach/generic.h index 7455404..5a10a54 100644 --- a/arch/arm/mach-omap/include/mach/generic.h +++ b/arch/arm/mach-omap/include/mach/generic.h @@ -27,17 +27,4 @@ #define cpu_is_omap4xxx() (0) #endif -enum omap_boot_src { - OMAP_BOOTSRC_UNKNOWN, - OMAP_BOOTSRC_MMC1, - OMAP_BOOTSRC_NAND, - OMAP_BOOTSRC_SPI1, - OMAP_BOOTSRC_USB1, -}; - -enum omap_boot_src omap_bootsrc(void); -enum omap_boot_src am33xx_bootsrc(void); -enum omap_boot_src omap3_bootsrc(void); -enum omap_boot_src omap4_bootsrc(void); - #endif diff --git a/arch/arm/mach-omap/omap3_generic.c b/arch/arm/mach-omap/omap3_generic.c index 10e03ae..f144813 100644 --- a/arch/arm/mach-omap/omap3_generic.c +++ b/arch/arm/mach-omap/omap3_generic.c @@ -28,6 +28,7 @@ */ #include +#include #include #include #include @@ -40,7 +41,6 @@ #include #include #include -#include /** * @brief Reset the CPU @@ -461,21 +461,25 @@ #ifdef CONFIG_OMAP3_CLOCK_CONFIG prcm_init(); #endif - } #define OMAP3_TRACING_VECTOR1 0x4020ffb4 -enum omap_boot_src omap3_bootsrc(void) +static int omap3_bootsource(void) { + enum bootsource src = BOOTSOURCE_UNKNOWN; u32 bootsrc = readl(OMAP3_TRACING_VECTOR1); if (bootsrc & (1 << 2)) - return OMAP_BOOTSRC_NAND; + src = BOOTSOURCE_NAND; if (bootsrc & (1 << 6)) - return OMAP_BOOTSRC_MMC1; - return OMAP_BOOTSRC_UNKNOWN; + src = BOOTSOURCE_MMC; + bootsource_set(src); + bootsource_set_instance(0); + + return 0; } +postcore_initcall(omap3_bootsource); /* GPMC timing for OMAP3 nand device */ const struct gpmc_config omap3_nand_cfg = { diff --git a/arch/arm/mach-omap/omap4_generic.c b/arch/arm/mach-omap/omap4_generic.c index 790746b..3d6ec25 100644 --- a/arch/arm/mach-omap/omap4_generic.c +++ b/arch/arm/mach-omap/omap4_generic.c @@ -1,11 +1,11 @@ #include +#include #include #include #include #include #include #include -#include #include #include #include @@ -359,7 +359,7 @@ /* PHY control values */ sr32(CM_MEMIF_EMIF_1_CLKCTRL, 0, 32, 0x1); - sr32(CM_MEMIF_EMIF_2_CLKCTRL, 0, 32, 0x1); + sr32(CM_MEMIF_EMIF_2_CLKCTRL, 0, 32, 0x1); /* Put the Core Subsystem PD to ON State */ @@ -486,7 +486,7 @@ * The ROM code uses interrupts for the transfers, so do not modify the * interrupt vectors in this case. */ - if (omap4_bootsrc() != OMAP_BOOTSRC_USB1) { + if (bootsource_get() != BOOTSOURCE_USB) { __asm__ __volatile__ ( "mov r0, #0;" "mcr p15, #0, r0, c12, c0, #0;" @@ -498,22 +498,28 @@ return 0; } -core_initcall(omap_vector_init); #define OMAP4_TRACING_VECTOR3 0x4030d048 -enum omap_boot_src omap4_bootsrc(void) +static int omap4_bootsource(void) { + enum bootsource src = BOOTSOURCE_UNKNOWN; u32 bootsrc = readl(OMAP4_TRACING_VECTOR3); if (bootsrc & (1 << 5)) - return OMAP_BOOTSRC_MMC1; + src = BOOTSOURCE_MMC; if (bootsrc & (1 << 3)) - return OMAP_BOOTSRC_NAND; + src = BOOTSOURCE_NAND; if (bootsrc & (1<<20)) - return OMAP_BOOTSRC_USB1; - return OMAP_BOOTSRC_UNKNOWN; + src = BOOTSOURCE_USB; + bootsource_set(src); + bootsource_set_instance(0); + + omap_vector_init(); + + return 0; } +core_initcall(omap4_bootsource); #define GPIO_MASK 0x1f diff --git a/arch/arm/mach-omap/omap_generic.c b/arch/arm/mach-omap/omap_generic.c index 580ed3e..cfd3dec 100644 --- a/arch/arm/mach-omap/omap_generic.c +++ b/arch/arm/mach-omap/omap_generic.c @@ -13,23 +13,12 @@ * */ #include +#include #include #include #include #include #include -#include - -enum omap_boot_src omap_bootsrc(void) -{ -#if defined(CONFIG_ARCH_OMAP3) - return omap3_bootsrc(); -#elif defined(CONFIG_ARCH_OMAP4) - return omap4_bootsrc(); -#elif defined(CONFIG_ARCH_AM33XX) - return am33xx_bootsrc(); -#endif -} #if defined(CONFIG_DEFAULT_ENVIRONMENT) && defined(CONFIG_MCI_STARTUP) static int omap_env_init(void) @@ -38,7 +27,7 @@ char *diskdev = "/dev/disk0.0"; int ret; - if (omap_bootsrc() != OMAP_BOOTSRC_MMC1) + if (bootsource_get() != BOOTSOURCE_MMC) return 0; ret = stat(diskdev, &s); diff --git a/arch/arm/mach-omap/xload.c b/arch/arm/mach-omap/xload.c index 72aa379..3cce3f2 100644 --- a/arch/arm/mach-omap/xload.c +++ b/arch/arm/mach-omap/xload.c @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -6,7 +7,6 @@ #include #include #include -#include #include #include @@ -165,30 +165,32 @@ { int (*func)(void) = NULL; - switch (omap_bootsrc()) + switch (bootsource_get()) { - case OMAP_BOOTSRC_MMC1: - printf("booting from MMC1\n"); + case BOOTSOURCE_MMC: + printf("booting from MMC\n"); func = omap_xload_boot_mmc(); break; - case OMAP_BOOTSRC_USB1: + case BOOTSOURCE_USB: if (IS_ENABLED(CONFIG_FS_OMAP4_USBBOOT)) { - printf("booting from USB1\n"); + printf("booting from USB\n"); func = omap4_xload_boot_usb(); break; } else { - printf("booting from usb1 not enabled\n"); + printf("booting from USB not enabled\n"); } - case OMAP_BOOTSRC_UNKNOWN: - printf("unknown boot source. Fall back to nand\n"); - case OMAP_BOOTSRC_NAND: + case BOOTSOURCE_NAND: printf("booting from NAND\n"); func = omap_xload_boot_nand(SZ_128K); break; - case OMAP_BOOTSRC_SPI1: - printf("booting from SPI1\n"); + case BOOTSOURCE_SPI: + printf("booting from SPI\n"); func = omap_xload_boot_spi(SZ_128K); break; + default: + printf("unknown boot source. Fall back to nand\n"); + func = omap_xload_boot_nand(SZ_128K); + break; } if (!func) {