]> git.sur5r.net Git - u-boot/commitdiff
SPL: Add CONFIG_SUPPORT_EMMC_BOOT support to CONFIG_SPL_FRAMEWORK
authorTom Rini <trini@ti.com>
Wed, 5 Feb 2014 15:24:18 +0000 (10:24 -0500)
committerPantelis Antoniou <panto@antoniou-consulting.com>
Fri, 7 Feb 2014 16:17:48 +0000 (18:17 +0200)
We use the switch CONFIG_SUPPORT_EMMC_BOOT today to enable some
additional features of the eMMC boot partitions.  Add support for being
told that we have booted from one of these partitions to the spl
framework and implement this on TI OMAP/related.

Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
Signed-off-by: Tom Rini <trini@ti.com>
Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
arch/arm/cpu/armv7/omap-common/boot-common.c
common/spl/spl_mmc.c
include/spl.h

index 69fff323d3602163784da3898b6c2e0c16ba0dc9..52e0f4a6cf52a21e8b78d52f5b87c6fae3965d57 100644 (file)
@@ -66,7 +66,18 @@ u32 spl_boot_device(void)
 
 u32 spl_boot_mode(void)
 {
-       return gd->arch.omap_boot_params.omap_bootmode;
+       u32 val = gd->arch.omap_boot_params.omap_bootmode;
+
+       if (val == MMCSD_MODE_RAW)
+               return MMCSD_MODE_RAW;
+       else if (val == MMCSD_MODE_FAT)
+               return MMCSD_MODE_FAT;
+       else
+#ifdef CONFIG_SUPPORT_EMMC_BOOT
+               return MMCSD_MODE_EMMCBOOT;
+#else
+               return MMCSD_MODE_UNDEFINED;
+#endif
 }
 
 void spl_board_init(void)
index 13fbff082cfe48bc4b846228d6463db3e7b342f0..fa6f891bc805e30bd64723a9ca98f352cf38af45 100644 (file)
@@ -110,6 +110,30 @@ void spl_mmc_load_image(void)
                err = spl_load_image_fat(&mmc->block_dev,
                                        CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION,
                                        CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME);
+#endif
+#ifdef CONFIG_SUPPORT_EMMC_BOOT
+       } else if (boot_mode == MMCSD_MODE_EMMCBOOT) {
+               /*
+                * We need to check what the partition is configured to.
+                * 1 and 2 match up to boot0 / boot1 and 7 is user data
+                * which is the first physical partition (0).
+                */
+               int part = (mmc->part_config >> 3) & PART_ACCESS_MASK;
+
+               if (part == 7)
+                       part = 0;
+
+               if (mmc_switch_part(0, part)) {
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
+                       puts("MMC partition switch failed\n");
+#endif
+                       hang();
+               }
+#ifdef CONFIG_SPL_OS_BOOT
+               if (spl_start_uboot() || mmc_load_image_raw_os(mmc))
+#endif
+               err = mmc_load_image_raw(mmc,
+                       CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR);
 #endif
        } else {
 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
index 5e248561f13791ade05d69dea96f5315410cb20c..dad00c0075d9b6904d1db8248c8464e6cd7e2e03 100644 (file)
@@ -16,6 +16,7 @@
 #define MMCSD_MODE_UNDEFINED   0
 #define MMCSD_MODE_RAW         1
 #define MMCSD_MODE_FAT         2
+#define MMCSD_MODE_EMMCBOOT    3
 
 struct spl_image_info {
        const char *name;