MLK-16047 imx8mq_evk: Enable eMMC boot support
authorYe Li <ye.li@nxp.com>
Fri, 21 Jul 2017 03:58:29 +0000 (22:58 -0500)
committerJason Liu <jason.hui.liu@nxp.com>
Thu, 2 Nov 2017 18:37:03 +0000 (02:37 +0800)
Enable the CONFIG_SUPPORT_EMMC_BOOT, so that for eMMC boot SPL can switch
to boot partition for u-boot.img loading.

Signed-off-by: Ye Li <ye.li@nxp.com>
arch/arm/imx-common/spl.c
include/configs/imx8mq_evk.h

index 3eed956..486f0f0 100644 (file)
@@ -71,6 +71,30 @@ u32 spl_boot_device(void)
        }
        return BOOT_DEVICE_NONE;
 }
+
+#if defined(CONFIG_SPL_MMC_SUPPORT)
+/* called from spl_mmc to see type of boot mode for storage (RAW or FAT) */
+u32 spl_boot_mode(const u32 boot_device)
+{
+       switch (spl_boot_device()) {
+       /* for MMC return either RAW or FAT mode */
+       case BOOT_DEVICE_MMC1:
+       case BOOT_DEVICE_MMC2:
+#if defined(CONFIG_SPL_FAT_SUPPORT)
+               return MMCSD_MODE_FS;
+#elif defined(CONFIG_SUPPORT_EMMC_BOOT)
+               return MMCSD_MODE_EMMCBOOT;
+#else
+               return MMCSD_MODE_RAW;
+#endif
+               break;
+       default:
+               puts("spl: ERROR:  unsupported device\n");
+               hang();
+       }
+}
+#endif
+
 #elif defined(CONFIG_IMX8M)
 u32 spl_boot_device(void)
 {
@@ -91,16 +115,24 @@ u32 spl_boot_device(void)
                return BOOT_DEVICE_NONE;
        }
 }
-#endif
 
 #if defined(CONFIG_SPL_MMC_SUPPORT)
 /* called from spl_mmc to see type of boot mode for storage (RAW or FAT) */
 u32 spl_boot_mode(const u32 boot_device)
 {
-       switch (spl_boot_device()) {
+       switch (get_boot_device()) {
        /* for MMC return either RAW or FAT mode */
-       case BOOT_DEVICE_MMC1:
-       case BOOT_DEVICE_MMC2:
+       case SD1_BOOT:
+       case SD2_BOOT:
+#if defined(CONFIG_SPL_FAT_SUPPORT)
+               return MMCSD_MODE_FS;
+#else
+               return MMCSD_MODE_RAW;
+#endif
+               break;
+
+       case MMC1_BOOT:
+       case MMC2_BOOT:
 #if defined(CONFIG_SPL_FAT_SUPPORT)
                return MMCSD_MODE_FS;
 #elif defined(CONFIG_SUPPORT_EMMC_BOOT)
@@ -116,6 +148,8 @@ u32 spl_boot_mode(const u32 boot_device)
 }
 #endif
 
+#endif
+
 #if defined(CONFIG_SECURE_BOOT)
 
 __weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
index 143de3a..19dc702 100644 (file)
 #define CONFIG_CMD_EXT4_WRITE
 #define CONFIG_CMD_FAT
 
-#ifndef CONFIG_SPL_BUILD
 #define CONFIG_SUPPORT_EMMC_BOOT       /* eMMC specific */
-#endif
 #define CONFIG_SYS_MMC_IMG_LOAD_PART   1
 
 #define CONFIG_FSL_QSPI    /* enable the QUADSPI driver */