[PATCH] arm: imx: imx9: scmi: Fix booting from USB
Tim Harvey
tharvey at gateworks.com
Fri Aug 22 19:05:45 CEST 2025
On Tue, Aug 5, 2025 at 11:53 PM Frieder Schrempf
<frieder.schrempf at kontron.de> wrote:
>
> Am 31.07.25 um 20:47 schrieb João Paulo Gonçalves:
> > Hello,
> >
> > On Mon, Jul 28, 2025 at 11:25:04AM -0300, Fabio Estevam wrote:
> >> What confuses me about João's patch is that it was not tested against
> >> the mainline U-Boot.
> >
> > In the end, the code is nearly identical between the downstream and
> > mainline U-Boot.
> >
> > On Wed, Jul 30, 2025 at 08:35:40AM +0200, Frieder Schrempf wrote:
> >> I have the below patch in our downstream fork to fix the issue mentioned
> >> here for i.MX93. It is derived from Fabio's patch [1]. I'm not sure if
> >> it's correct, though.
> >
> > We are also doing something similar on our branch.
> >
> > I have two proposals. My goal is to prevent the board from hanging when
> > booting from USB if CONFIG_ENV_IS_NOWHERE=n (since the current code
> > assumes it is always enabled) and/or if the environment is defined
> > elsewhere:
> >
> > 1) Imply CONFIG_ENV_IS_NOWHERE for i.MX9 (as mentioned earlier), to make
> > it clear that it is required by ARCH.
> >
> > or
> >
> > 2) Doing something similar to what Frieder showed for USB boot (which is
> > almost the same on i.MX8MM/i.MX8MP), but preserving the current
> > behavior:
> >
> > diff --git a/arch/arm/mach-imx/imx9/scmi/soc.c b/arch/arm/mach-imx/imx9/scmi/soc.c
> > index 13f13ca7d105..f973652d0cbe 100644
> > --- a/arch/arm/mach-imx/imx9/scmi/soc.c
> > +++ b/arch/arm/mach-imx/imx9/scmi/soc.c
> > @@ -635,7 +635,8 @@ enum env_location env_get_location(enum env_operation op, int prio)
> >
> > switch (dev) {
> > case QSPI_BOOT:
> > - env_loc = ENVL_SPI_FLASH;
> > + if (IS_ENABLED(CONFIG_ENV_IS_IN_SPI_FLASH))
> > + env_loc = ENVL_SPI_FLASH;
> > break;
> > case SD1_BOOT:
> > case SD2_BOOT:
> > @@ -643,10 +644,16 @@ enum env_location env_get_location(enum env_operation op, int prio)
> > case MMC1_BOOT:
> > case MMC2_BOOT:
> > case MMC3_BOOT:
> > - env_loc = ENVL_MMC;
> > + if (IS_ENABLED(CONFIG_ENV_IS_IN_MMC))
> > + env_loc = ENVL_MMC;
> > break;
> > default:
> > - env_loc = ENVL_NOWHERE;
> > + if (IS_ENABLED(CONFIG_ENV_IS_NOWHERE))
> > + env_loc = ENVL_NOWHERE;
> > + else if (IS_ENABLED(CONFIG_ENV_IS_IN_SPI_FLASH))
> > + env_loc = ENVL_SPI_FLASH;
> > + else if (IS_ENABLED(CONFIG_ENV_IS_IN_MMC))
> > + env_loc = ENVL_MMC;
> > break;
> > }
> >
> > With this patch, I believe Peng's concerns are addressed, and it also
> > works for our use case.
> >
> > What do you think?
>
> On first glance, this looks good to me. If possible, can you please also
> send a patch for i.MX93 (arch/arm/mach-imx/imx9/soc.c) to align the
> behavior of both platforms?
>
> Thanks!
>
Hi João,
This does resolve an issue I encountered as well on the imx95 while
booting via USB2 SDP.
Can you submit a formal patch?
Best Regards,
Tim
More information about the U-Boot
mailing list