On Tue, Jul 22, 2025 at 11:04:45AM -0300, João Paulo Gonçalves wrote: >From: João Paulo Gonçalves <joao.goncal...@toradex.com> > >On i.MX95, 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, set the environment location based on the ENV >config and not solely based on the boot device type. > >--- >Hello all, > >The change was not tested on mainline, but with downstream >`toradex_imx_lf_v2024.04` U-Boot branch. In the past, i.MX8M had the >same problem and the solution was similar. > >Best Regards, >João Paulo Gonçalves >--- > arch/arm/mach-imx/imx9/scmi/soc.c | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > >diff --git a/arch/arm/mach-imx/imx9/scmi/soc.c >b/arch/arm/mach-imx/imx9/scmi/soc.c >index >13f13ca7d1056ac5a9f1b529b13e0d8dbe2462f1..2c052c38521793e1f6ab2dc5125afa3b5ca63d0f > 100644 >--- a/arch/arm/mach-imx/imx9/scmi/soc.c >+++ b/arch/arm/mach-imx/imx9/scmi/soc.c >@@ -633,9 +633,13 @@ enum env_location env_get_location(enum env_operation op, >int prio) > if (prio) > return env_loc; > >+ if (IS_ENABLED(CONFIG_ENV_IS_NOWHERE)) >+ env_loc = ENVL_NOWHERE; >+ > 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 +647,14 @@ 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_IN_SPI_FLASH)) >+ env_loc = ENVL_SPI_FLASH; >+ else if (IS_ENABLED(CONFIG_ENV_IS_IN_MMC)) >+ env_loc = ENVL_MMC;
If boot from USB, this means env_loc will be override here. NXP boards always use RAM env when booting from USB. If your boards has different settings, I think we may need to introduce board_env_get_location. Or add some device tree properties to specify the env settings. Thanks, Peng > break; > } > > >--- >base-commit: bd0ade7d090a334b3986936d63a34001d99722ad >change-id: 20250722-v1-fix-imx95-usb-boot-9e6d760be10e > >Best regards, >-- >João Paulo Gonçalves <joao.goncal...@toradex.com> >