Am 11.08.25 um 14:57 schrieb João Paulo Gonçalves: > From: João Paulo Gonçalves <joao.goncal...@toradex.com> > > On i.MX9 platforms, when booting from USB, the U-Boot environment is > always assumed to be in RAM. However, this causes the boot to hang when > `CONFIG_ENV_IS_NOWHERE` is not enabled. The boot also hangs even if the > environment is present in another storage media (for example, eMMC). Fix > the issue by correctly handling the U-Boot environment's location when > booting from USB. Also for i.MX95, set the environment location based on > the ENV config and not solely based on the boot device type. > > Suggested-by: Frieder Schrempf <frieder.schre...@kontron.de> > Signed-off-by: João Paulo Gonçalves <joao.goncal...@toradex.com>
Thanks! It works fine for the USB boot case for me on i.MX93 with both CONFIG_ENV_IS_NOWHERE enabled and disabled. One thing I noticed, though: For the SCMI case (i.MX95) we will leave env_get_location() with ENVL_UNKNOWN in case of QSPI/SD/MMC boot if the corresponding env device is not enabled. For i.MX93 instead we return ENVL_NOWHERE (again without checking if ENVL_NOWHERE is enabled). What would be the "correct" approach and can we align both platforms? > --- > v2: > - Changed the env location order on USB boot to maintain current > behavior on i.MX9 > - Applied the fix to other i.MX9 platforms, not only i.MX95 > - Added Suggested-by: Frieder Schrempf > v1: > https://lore.kernel.org/u-boot/20250722-v1-fix-imx95-usb-boot-v1-1-dec7f2384...@toradex.com/ > --- > arch/arm/mach-imx/imx9/scmi/soc.c | 13 ++++++++++--- > arch/arm/mach-imx/imx9/soc.c | 8 +++++++- > 2 files changed, 17 insertions(+), 4 deletions(-) > > diff --git a/arch/arm/mach-imx/imx9/scmi/soc.c > b/arch/arm/mach-imx/imx9/scmi/soc.c > index > 13f13ca7d1056ac5a9f1b529b13e0d8dbe2462f1..f973652d0cbe8723b0cdc1a6235fbdd719146065 > 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; > } > > diff --git a/arch/arm/mach-imx/imx9/soc.c b/arch/arm/mach-imx/imx9/soc.c > index > 9fb82644f126b8717b2f2ba1c9e77fb75d2e7757..3f7dafdcce5d3c6df102fe0a2a5d0b61c394937b > 100644 > --- a/arch/arm/mach-imx/imx9/soc.c > +++ b/arch/arm/mach-imx/imx9/soc.c > @@ -809,7 +809,13 @@ enum env_location env_get_location(enum env_operation > op, int prio) > return ENVL_FAT; > return ENVL_NOWHERE; > default: > - return ENVL_NOWHERE; > + if (IS_ENABLED(CONFIG_ENV_IS_NOWHERE)) > + return ENVL_NOWHERE; > + else if (IS_ENABLED(CONFIG_ENV_IS_IN_SPI_FLASH)) > + return ENVL_SPI_FLASH; > + else if (IS_ENABLED(CONFIG_ENV_IS_IN_MMC)) > + return ENVL_MMC; > + return ENVL_UNKNOWN; > } > } > > > --- > base-commit: b6e2cfca1a6fd10c8f12016a40d690d2ec61796c > change-id: 20250811-v2-fix-imx9-usb-boot-48679993463d > > Best regards,