spl: spl_mmc: fix getting raw_sect when boot from emmc boot partition
PATCH 1/1 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.
--- common/spl/spl_mmc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
common/spl/spl_mmc.c +3 -2
@@ -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);
Signature · 1 line
2.16.4
PATCH 1/1 spl: spl_mmc: fix getting raw_sect when boot from emmc boot partition
Hi Peng,
Quoted 9 lines
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.
Quoted 6 lines
So we move
spl_mmc_get_uboot_raw_sectorafter eMMC partition switch to address this issue.Anyway put
spl_mmc_get_uboot_raw_sectorbefore eMMC partition switch is not correct, so let's move it after eMMC partition switch.
I assume that this change is not causing regressions on other i.MX boards? (Like i.MX6Q or i.MX53)
Quoted 20 lines
Reported-by Anatolij Gustschin <[email protected]>Signed-off-by Peng Fan <[email protected]>--- common/spl/spl_mmc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)common/spl/spl_mmc.c +0
-2@@ -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) {
common/spl/spl_mmc.c int spl_mmc_load(struct spl_image_info *spl_image, · line 389
Quoted 9 lines
common/spl/spl_mmc.c +3
-0@@ -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);
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191023/8e4e3617/attachment.sig>
PATCH 1/1 spl: spl_mmc: fix getting raw_sect when boot from emmc boot partition
Quoted 16 lines
Subject: Re: [PATCH] spl:
spl_mmc: fix gettingraw_sectwhen boot from emmc boot partitionHi Peng,
Quoted 10 lines
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_sectorafter eMMC partition switchto
Quoted 8 lines
Quoted 5 lines
address this issue.
Anyway put
spl_mmc_get_uboot_raw_sectorbefore eMMC partition switch is not correct, so let's move it after eMMC partition switch.I assume that this change is not causing regressions on other i.MX boards? (Like i.MX6Q or i.MX53)
No regression on other i.MX boards. Only i.MX8QM/8QXP has this issue currently.
Regards,
Peng.
Quoted 46 lines
common/spl/spl_mmc.c int spl_mmc_load(struct spl_image_info
Quoted 12 lines
Reported-by Anatolij Gustschin <[email protected]>Signed-off-by Peng Fan <[email protected]>--- common/spl/spl_mmc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)common/spl/spl_mmc.c index renamed from common/spl/spl_mmc.c +0
-0
34e1e73d80..2ede096e61100644common/spl/spl_mmc.c +0
-0@@ -343,8 +343,6 @@ int spl_mmc_load(struct spl_image_info
*spl_image,common/spl/spl_mmc.c int spl_mmc_load(struct spl_image_info
Quoted 9 lines
common/spl/spl_mmc.c +0
-2} } - 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,common/spl/spl_mmc.c int spl_mmc_load(struct spl_image_info *spl_image, · line 389
Quoted 9 lines
common/spl/spl_mmc.c +3
-0if (!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);Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de