]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
add return code to spl_nand_load_image()
authorLothar Waßmann <LW@KARO-electronics.de>
Fri, 19 Oct 2012 06:58:51 +0000 (08:58 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 19 Oct 2012 06:58:51 +0000 (08:58 +0200)
arch/arm/cpu/armv7/omap-common/spl_nand.c
arch/arm/include/asm/omap_common.h

index 8cf55c9a1c8b9956193aa25ed1d618cb3b5434fe..7cf41742c84383574969325157d75975e3e36f8c 100644 (file)
 #include <version.h>
 #include <asm/omap_common.h>
 
-void spl_nand_load_image(void)
+int spl_nand_load_image(void)
 {
+       int ret;
        struct image_header *header;
        int *src __attribute__((unused));
        int *dst __attribute__((unused));
 
-       switch (omap_boot_mode()) {
-       case NAND_MODE_HW_ECC:
-               debug("spl: nand - using hw ecc\n");
-               gpmc_init();
-               nand_init();
-               break;
-       default:
-               puts("spl: ERROR: This bootmode is not implemented - hanging");
-               hang();
-       }
+       debug("spl: nand - using hw ecc\n");
+       gpmc_init();
+       nand_init();
 
        /*use CONFIG_SYS_TEXT_BASE as temporary storage area */
-       header = (struct image_header *)(CONFIG_SYS_TEXT_BASE);
+       header = (struct image_header *)CONFIG_SYS_TEXT_BASE;
 #ifdef CONFIG_SPL_OS_BOOT
        if (!spl_start_uboot()) {
                /*
@@ -78,7 +72,7 @@ void spl_nand_load_image(void)
                        nand_spl_load_image(CONFIG_SYS_NAND_SPL_KERNEL_OFFS,
                                spl_image.size, (void *)spl_image.load_addr);
                        nand_deselect();
-                       return;
+                       return 0;
                } else {
                        printf("The Expected Linux image was not"
                                "found. Please check your NAND"
@@ -102,10 +96,13 @@ void spl_nand_load_image(void)
 #endif
 #endif
        /* Load u-boot */
-       nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
-               CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);
-       spl_parse_image_header(header);
-       nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
-               spl_image.size, (void *)spl_image.load_addr);
+       ret = nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
+                               CONFIG_SYS_NAND_PAGE_SIZE, (void *)header);
+       if (ret == 0) {
+               spl_parse_image_header(header);
+               ret = nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
+                                       spl_image.size, (void *)spl_image.load_addr);
+       }
        nand_deselect();
+       return ret;
 }
index 459b6b16e24e1902055f103748d810b68c097e03..29755c8ceec622768db2a3adfb4def53af40546e 100644 (file)
@@ -67,7 +67,7 @@ void preloader_console_init(void);
 #elif defined(CONFIG_AM33XX)   /* AM33XX */
 #define BOOT_DEVICE_NAND       5
 #define BOOT_DEVICE_MMC1       8
-#define BOOT_DEVICE_MMC2       0
+#define BOOT_DEVICE_MMC2       9 /* eMMC or daughter card */
 #define BOOT_DEVICE_UART       65
 #define BOOT_DEVICE_MMC2_2      0xFF
 #endif
@@ -99,7 +99,7 @@ void spl_board_prepare_for_linux(void);
 int spl_start_uboot(void);
 
 /* NAND SPL functions */
-void spl_nand_load_image(void);
+int spl_nand_load_image(void);
 
 /* MMC SPL functions */
 void spl_mmc_load_image(void);