diff options
author | Nikita Kiryanov <nikita@compulab.co.il> | 2015-11-08 17:11:48 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2015-11-18 14:50:02 -0500 |
commit | 83cdf6faa677ff8ff39d7852126aad3207fac021 (patch) | |
tree | 05496748051e481b728fd3278c7d6bd95652b95a | |
parent | f52b729393c4ec2af22f3a51a193362fc4f55e4f (diff) | |
download | u-boot-imx-83cdf6faa677ff8ff39d7852126aad3207fac021.zip u-boot-imx-83cdf6faa677ff8ff39d7852126aad3207fac021.tar.gz u-boot-imx-83cdf6faa677ff8ff39d7852126aad3207fac021.tar.bz2 |
spl: mmc: get rid of emmc boot code duplication
Get rid of emmc boot code duplication in spl_mmc_load_image() using a switch
case fallthrough into MMCSD_MODE_RAW. Since the #ifdef CONFIG_SUPPORT_EMMC_BOOT
check is not really necessary, remove it in the process.
No functional changes.
Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
Cc: Igor Grinberg <grinberg@compulab.co.il>
Cc: Paul Kocialkowski <contact@paulk.fr>
Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
-rw-r--r-- | common/spl/spl_mmc.c | 54 |
1 files changed, 18 insertions, 36 deletions
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index 5dc576b..7d100fa 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -240,6 +240,24 @@ void spl_mmc_load_image(void) boot_mode = spl_boot_mode(); switch (boot_mode) { + case 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). + */ + 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("spl: mmc partition switch failed\n"); +#endif + hang(); + } + /* Fall through */ case MMCSD_MODE_RAW: debug("spl: mmc boot mode: raw\n"); @@ -268,42 +286,6 @@ void spl_mmc_load_image(void) return; break; -#ifdef CONFIG_SUPPORT_EMMC_BOOT - case 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). - */ - 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("spl: mmc partition switch failed\n"); -#endif - hang(); - } - - if (!spl_start_uboot()) { - err = mmc_load_image_raw_os(mmc); - if (!err) - return; - } - err = mmc_load_image_raw_partition(mmc, - CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION); - if (!err) - return; -#if defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR) - err = mmc_load_image_raw_sector(mmc, - CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR); - if (!err) - return; -#endif - break; -#endif case MMCSD_MODE_UNDEFINED: #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT default: |