[PATCH] spl: mmc: Resolve emmc not load image after switched hw partition

KuanLim.Lee kuanlim.lee at starfivetech.com
Wed Oct 18 08:20:55 CEST 2023


On 10/18/23 13:27, Sean Anderson wrote:
> On 10/3/23 00:16, Kuan Lim Lee wrote:
> > When selecting MMCSD_MODE_EMMCBOOT as boot_mode, emmc do not
> load
> > U-boot proper image after switched hardware partition.
> >
> > Signed-off-by: Kuan Lim Lee <kuanlim.lee at starfivetech.com>
> > Reviewed-by: Chee Hong Ang <cheehong.ang at starfivetech.com>
> > Reviewed-by: Wei Liang Lim <weiliang.lim at starfivetech.com>
> > ---
> >   common/spl/spl_mmc.c | 3 +++
> >   1 file changed, 3 insertions(+)
> >
> > diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index
> > 20f687e138..dc8a45222b 100644
> > --- a/common/spl/spl_mmc.c
> > +++ b/common/spl/spl_mmc.c
> > @@ -447,6 +447,9 @@ int spl_mmc_load(struct spl_image_info *spl_image,
> >   #endif
> >   			return err;
> >   		}
> > +		err = mmc_load_image_raw_sector(spl_image, bootdev, mmc,
> 0);
> > +		if (!err)
> > +			return err;
> >   		/* Fall through */
> >   	case MMCSD_MODE_RAW:
> >   		debug("spl: mmc boot mode: raw\n");
> 
> So why doesn't the mmc_load_image_raw_sector below (line 475 or so) work?
boot_mode that  I choose is MMCSD_MODE_EMMCBOOT. This is a switch case method. 
If the case finished execution, program will jump to 'return error;' in line 492.
Since there are no load image function, in boot_mode: MMCSD_MODE_EMMCBOOT, it 
will just switch the hwpartition and quit the process & fail to boot.

	case MMCSD_MODE_EMMCBOOT:
***  here is the case I add mmc_load_image_raw_sector()
/* Fall through */
	case MMCSD_MODE_RAW: 
***  here is the case which execute mmc_load_image_raw_sector() in line 470.
> 
> --Sean
Please correct me if I am wrong.
--KuanLim


More information about the U-Boot mailing list