public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Fabio Estevam <festevam@gmail.com>
To: sbabic@denx.de
Cc: peng.fan@nxp.com, u-boot@lists.denx.de, aford173@gmail.com,
	michael@amarulasolutions.com, marex@denx.de,
	Fabio Estevam <festevam@denx.de>
Subject: [PATCH v3 2/2] imx8mn/8mp: Allow booting via USB
Date: Thu, 21 Apr 2022 15:05:23 -0300	[thread overview]
Message-ID: <20220421180523.1328390-2-festevam@gmail.com> (raw)
In-Reply-To: <20220421180523.1328390-1-festevam@gmail.com>

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 v2:
- Handle explicitly the CONFIG_ENV_IS_NOWHERE case and return
ENVL_UNKNOWN as fallback (Marek).

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

diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c
index 7059d87e336b..34a07b53e57a 100644
--- a/arch/arm/mach-imx/imx8m/soc.c
+++ b/arch/arm/mach-imx/imx8m/soc.c
@@ -1536,6 +1536,16 @@ 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;
+		if (IS_ENABLED(CONFIG_ENV_IS_NOWHERE))
+			return ENVL_NOWHERE;
+		return ENVL_UNKNOWN;
 	case QSPI_BOOT:
 	case SPI_NOR_BOOT:
 		if (IS_ENABLED(CONFIG_ENV_IS_IN_SPI_FLASH))
-- 
2.25.1


  reply	other threads:[~2022-04-21 18:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21 18:05 [PATCH v3 1/2] imx8mn_ddr4_evk: Add USB Mass Storage support Fabio Estevam
2022-04-21 18:05 ` Fabio Estevam [this message]
2022-04-25 19:41   ` [PATCH v3 2/2] imx8mn/8mp: Allow booting via USB Tim Harvey
2022-04-25 22:47     ` Fabio Estevam
2022-04-25 23:15       ` Tim Harvey
2022-04-26  1:57         ` Fabio Estevam
2022-04-26  5:40           ` Michael Nazzareno Trimarchi
2022-05-20 13:44   ` sbabic
2022-05-20 13:41 ` [PATCH v3 1/2] imx8mn_ddr4_evk: Add USB Mass Storage support sbabic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220421180523.1328390-2-festevam@gmail.com \
    --to=festevam@gmail.com \
    --cc=aford173@gmail.com \
    --cc=festevam@denx.de \
    --cc=marex@denx.de \
    --cc=michael@amarulasolutions.com \
    --cc=peng.fan@nxp.com \
    --cc=sbabic@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox