All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm: imx: imx9: scmi: Fix booting from USB
@ 2025-07-22 14:04 João Paulo Gonçalves
  2025-07-24  3:38 ` Peng Fan
  0 siblings, 1 reply; 13+ messages in thread
From: João Paulo Gonçalves @ 2025-07-22 14:04 UTC (permalink / raw)
  To: Stefano Babic, Fabio Estevam, NXP i.MX U-Boot Team, Tom Rini
  Cc: u-boot, Alice Guo, Ye Li, Peng Fan,
	João Paulo Gonçalves

From: João Paulo Gonçalves <joao.goncalves@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;
 		break;
 	}
 

---
base-commit: bd0ade7d090a334b3986936d63a34001d99722ad
change-id: 20250722-v1-fix-imx95-usb-boot-9e6d760be10e

Best regards,
-- 
João Paulo Gonçalves <joao.goncalves@toradex.com>


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2025-08-25 16:28 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-22 14:04 [PATCH] arm: imx: imx9: scmi: Fix booting from USB João Paulo Gonçalves
2025-07-24  3:38 ` Peng Fan
2025-07-24 11:28   ` João Paulo Gonçalves
2025-07-28 10:29     ` Francesco Dolcini
2025-07-28 14:25       ` Fabio Estevam
2025-07-28 16:44         ` Francesco Dolcini
2025-07-30  6:35           ` Frieder Schrempf
2025-07-31 18:47             ` João Paulo Gonçalves
2025-08-05 23:07               ` Fabio Estevam
2025-08-06  6:53               ` Frieder Schrempf
2025-08-22 17:05                 ` Tim Harvey
2025-08-25  7:50                   ` Frieder Schrempf
2025-08-25 16:27                     ` Tim Harvey

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.