public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] spl: spl_mmc: fix getting raw_sect when boot from emmc boot partition
Date: Wed, 23 Oct 2019 09:23:19 +0200	[thread overview]
Message-ID: <20191023092319.12866e98@jawa> (raw)
In-Reply-To: <20191023015959.4051-1-peng.fan@nxp.com>

Hi Peng,

> 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.
> 

I assume that this change is not causing regressions on other i.MX
boards? (Like i.MX6Q or i.MX53)

> Reported-by: Anatolij Gustschin <agust@denx.de>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  common/spl/spl_mmc.c | 5 +++--
>  1 file 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);




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>

  reply	other threads:[~2019-10-23  7:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-23  1:43 [U-Boot] [PATCH] spl: spl_mmc: fix getting raw_sect when boot from emmc boot partition Peng Fan
2019-10-23  7:23 ` Lukasz Majewski [this message]
2019-10-23 10:29   ` Peng Fan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191023092319.12866e98@jawa \
    --to=lukma@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox