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.schrempf@kontron.de>
Signed-off-by: João Paulo Gonçalves <joao.goncalves@toradex.com>
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:
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;
}
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;
}
}