ARM Sunxi Platform Development
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@arm.com>
To: Jagan Teki <jagan@amarulasolutions.com>
Cc: u-boot@lists.denx.de, linux-sunxi@lists.linux.dev,
	Samuel Holland <samuel@sholland.org>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Chris Morgan <macroalpha82@gmail.com>
Subject: [PATCH] sunxi: fix initial environment loading without MMC
Date: Thu, 21 Apr 2022 01:34:48 +0100	[thread overview]
Message-ID: <20220421003448.4517-1-andre.przywara@arm.com> (raw)

Commit e42dad4168fe ("sunxi: use boot source for determining environment
location") changed our implementation of env_get_location() and enabled
it for every board, even those without MMC support (like the C.H.I.P.
boards). However the default fallback location of ENVL_FAT does not cope
very well without MMC support compiled in, so the board hangs when trying
to initially load the environment.

Change the default fallback location to be ENVL_FAT only when the FAT
environment support is enabled, and use ENVL_NOWHERE and ENVL_UBI as
alternative fallbacks, when those sources are enabled.

This fixes U-Boot loading on the C.H.I.P. boards.

Fixes: e42dad4168fe ("sunxi: use boot source for determining environment location")
Reported-by: Chris Morgan <macroalpha82@gmail.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
 board/sunxi/board.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 89324159d55..befb6076ca6 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -132,7 +132,14 @@ void i2c_init_board(void)
  */
 enum env_location env_get_location(enum env_operation op, int prio)
 {
-	enum env_location boot_loc = ENVL_FAT;
+	enum env_location boot_loc;
+
+	if (IS_ENABLED(CONFIG_ENV_IS_NOWHERE))
+		boot_loc = ENVL_NOWHERE;
+	else if (IS_ENABLED(CONFIG_ENV_IS_IN_FAT))
+		boot_loc = ENVL_FAT;
+	else if (IS_ENABLED(CONFIG_ENV_IS_IN_UBI))
+		boot_loc = ENVL_UBI;
 
 	gd->env_load_prio = prio;
 
-- 
2.35.3


             reply	other threads:[~2022-04-21  0:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21  0:34 Andre Przywara [this message]
2022-04-23 21:01 ` [PATCH] sunxi: fix initial environment loading without MMC Samuel Holland
2022-04-26 14:25   ` Andre Przywara
2022-06-24  1:00     ` Andre Przywara
2022-06-24  1:21       ` Samuel Holland
2022-06-24 16:03         ` Tom Rini

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=20220421003448.4517-1-andre.przywara@arm.com \
    --to=andre.przywara@arm.com \
    --cc=jagan@amarulasolutions.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=macroalpha82@gmail.com \
    --cc=samuel@sholland.org \
    --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