diff mbox series

[v2,2/2] imx8mn/8mp: Allow booting via USB

Message ID 20220421172411.1319053-2-festevam@gmail.com
State Superseded
Delegated to: Stefano Babic
Headers show
Series [v2,1/2] imx8mn_ddr4_evk: Add USB Mass Storage support | expand

Commit Message

Fabio Estevam April 21, 2022, 5:24 p.m. UTC
From: Fabio Estevam <festevam@denx.de>

When trying to boot via USB on i.MX8MN it is necessary to specify
the U-Boot environment location, otherwise the boot process simply
hangs.

Specify the environment location when booting from USB.

Tested on a imx8mn-evk.

Suggested-by: Michael Nazzareno Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Fabio Estevam <festevam@denx.de>
---
Changes since v1:
- Handle the env selection for the USB_BOOT case (Michael).

 arch/arm/mach-imx/imx8m/soc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Marek Vasut April 21, 2022, 5:26 p.m. UTC | #1
On 4/21/22 19:24, Fabio Estevam wrote:
> From: Fabio Estevam <festevam@denx.de>
> 
> When trying to boot via USB on i.MX8MN it is necessary to specify
> the U-Boot environment location, otherwise the boot process simply
> hangs.
> 
> Specify the environment location when booting from USB.
> 
> Tested on a imx8mn-evk.
> 
> Suggested-by: Michael Nazzareno Trimarchi <michael@amarulasolutions.com>
> Signed-off-by: Fabio Estevam <festevam@denx.de>
> ---
> Changes since v1:
> - Handle the env selection for the USB_BOOT case (Michael).
> 
>   arch/arm/mach-imx/imx8m/soc.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c
> index 7059d87e336b..34f8475bca46 100644
> --- a/arch/arm/mach-imx/imx8m/soc.c
> +++ b/arch/arm/mach-imx/imx8m/soc.c
> @@ -1536,6 +1536,14 @@ enum env_location arch_env_get_location(enum env_operation op, int prio)
>   		return ENVL_UNKNOWN;
>   
>   	switch (dev) {
> +	case USB_BOOT:
> +		if (IS_ENABLED(CONFIG_ENV_IS_IN_SPI_FLASH))
> +			return ENVL_SPI_FLASH;
> +		if (IS_ENABLED(CONFIG_ENV_IS_IN_NAND))
> +			return ENVL_NAND;
> +		if (IS_ENABLED(CONFIG_ENV_IS_IN_MMC))
> +			return ENVL_MMC;
> +		return ENVL_NOWHERE;

Shouldn't this last entry also be

if (IS_ENABLED(CONFIG_ENV_IS_NOWHERE))
	return ENVL_NOWHERE;

?
diff mbox series

Patch

diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c
index 7059d87e336b..34f8475bca46 100644
--- a/arch/arm/mach-imx/imx8m/soc.c
+++ b/arch/arm/mach-imx/imx8m/soc.c
@@ -1536,6 +1536,14 @@  enum env_location arch_env_get_location(enum env_operation op, int prio)
 		return ENVL_UNKNOWN;
 
 	switch (dev) {
+	case USB_BOOT:
+		if (IS_ENABLED(CONFIG_ENV_IS_IN_SPI_FLASH))
+			return ENVL_SPI_FLASH;
+		if (IS_ENABLED(CONFIG_ENV_IS_IN_NAND))
+			return ENVL_NAND;
+		if (IS_ENABLED(CONFIG_ENV_IS_IN_MMC))
+			return ENVL_MMC;
+		return ENVL_NOWHERE;
 	case QSPI_BOOT:
 	case SPI_NOR_BOOT:
 		if (IS_ENABLED(CONFIG_ENV_IS_IN_SPI_FLASH))