summaryrefslogtreecommitdiff
path: root/common/spl
diff options
context:
space:
mode:
authorPeng Fan <peng.fan@nxp.com>2019-10-23 01:43:30 +0000
committerPeng Fan <peng.fan@nxp.com>2019-10-29 10:09:44 +0800
commita335f80502131e9e2b58a0281f5fc78018295ea4 (patch)
tree281802acf5f6939333c867fc05093b77ea5e9594 /common/spl
parent5d336d1701567e5025c3010b325e633a677c30a2 (diff)
spl: spl_mmc: fix getting raw_sect when boot from emmc boot partition
On i.MX8, when booting from eMMC boot partition, the whole flash.bin is stored in boot partition, however SPL switches to user partition during the init of mmc driver: spl_mmc_load() -> mmc_init() Then it tries to load the container image in spl_mmc_get_uboot_raw_sector(), but here it reads the data from user partition and the header is not recognized as a valid header. So we move spl_mmc_get_uboot_raw_sector after eMMC partition switch to address this issue. Anyway put spl_mmc_get_uboot_raw_sector before eMMC partition switch is not correct, so let's move it after eMMC partition switch. Reported-by: Anatolij Gustschin <agust@denx.de> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Diffstat (limited to 'common/spl')
-rw-r--r--common/spl/spl_mmc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index 34e1e73d80..2ede096e61 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -343,8 +343,6 @@ int spl_mmc_load(struct spl_image_info *spl_image,
}
}
- raw_sect = spl_mmc_get_uboot_raw_sector(mmc);
-
boot_mode = spl_boot_mode(bootdev->boot_device);
err = -EINVAL;
switch (boot_mode) {
@@ -383,6 +381,9 @@ int spl_mmc_load(struct spl_image_info *spl_image,
if (!err)
return err;
}
+
+ raw_sect = spl_mmc_get_uboot_raw_sector(mmc);
+
#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
err = mmc_load_image_raw_partition(spl_image, mmc, raw_part,
raw_sect);