diff options
author | Paul Kocialkowski <contact@paulk.fr> | 2015-06-08 23:05:09 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2015-06-18 16:11:42 -0400 |
commit | 3ae8f4c8ae7b745ff3f881dce3d22f636528fc5f (patch) | |
tree | bea7742b8cc4fe70219f6fc2171a339ca612b6c2 | |
parent | 1ec264695f746dd033a14762344aefff0aa3e3b5 (diff) | |
download | u-boot-imx-3ae8f4c8ae7b745ff3f881dce3d22f636528fc5f.zip u-boot-imx-3ae8f4c8ae7b745ff3f881dce3d22f636528fc5f.tar.gz u-boot-imx-3ae8f4c8ae7b745ff3f881dce3d22f636528fc5f.tar.bz2 |
spl: spl_mmc: MMC boot mode provisions checks
This allows using only one of either raw or fs mode for SPL mmc boot, without
the need to have provisions for the other. In particular, a device may have
U-Boot installed on a file system on the mmc, without ever needing to read
U-Boot from raw memory. Thus, there is no reason to provide a sector or
partition for raw mode. This allows this behaviour and still provides a robust
fallback mechanism in case provisions for both modes are defined.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
-rw-r--r-- | common/spl/spl_mmc.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index f5ac844..552f80d 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -130,19 +130,21 @@ void spl_mmc_load_image(void) return; } #endif -#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION +#if defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION) err = mmc_load_image_raw_partition(mmc, CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION); -#else + if (!err) + return; +#elif defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR) err = mmc_load_image_raw_sector(mmc, CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR); -#endif if (!err) return; -#if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT) +#endif case MMCSD_MODE_FS: debug("spl: mmc boot mode: fs\n"); +#ifdef CONFIG_SYS_MMCSD_FS_BOOT_PARTITION #ifdef CONFIG_SPL_FAT_SUPPORT #ifdef CONFIG_SPL_OS_BOOT if (!spl_start_uboot()) { @@ -152,12 +154,14 @@ void spl_mmc_load_image(void) return; } #endif +#ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME err = spl_load_image_fat(&mmc->block_dev, CONFIG_SYS_MMCSD_FS_BOOT_PARTITION, CONFIG_SPL_FS_LOAD_PAYLOAD_NAME); if (!err) return; #endif +#endif #ifdef CONFIG_SPL_EXT_SUPPORT #ifdef CONFIG_SPL_OS_BOOT if (!spl_start_uboot()) { @@ -167,6 +171,7 @@ void spl_mmc_load_image(void) return; } #endif +#ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME err = spl_load_image_ext(&mmc->block_dev, CONFIG_SYS_MMCSD_FS_BOOT_PARTITION, CONFIG_SPL_FS_LOAD_PAYLOAD_NAME); @@ -174,6 +179,7 @@ void spl_mmc_load_image(void) return; #endif #endif +#endif #ifdef CONFIG_SUPPORT_EMMC_BOOT case MMCSD_MODE_EMMCBOOT: /* @@ -200,16 +206,18 @@ void spl_mmc_load_image(void) return; } #endif -#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION +#if defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION) err = mmc_load_image_raw_partition(mmc, CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION); -#else + if (!err) + return; +#elif defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR) err = mmc_load_image_raw_sector(mmc, CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR); -#endif if (!err) return; #endif +#endif case MMCSD_MODE_UNDEFINED: default: #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT |