All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sunxi: fix initial environment loading without MMC
@ 2022-04-21  0:34 Andre Przywara
  2022-04-23 21:01 ` Samuel Holland
  0 siblings, 1 reply; 6+ messages in thread
From: Andre Przywara @ 2022-04-21  0:34 UTC (permalink / raw)
  To: Jagan Teki
  Cc: u-boot, linux-sunxi, Samuel Holland, Jernej Skrabec, Chris Morgan

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


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

end of thread, other threads:[~2022-06-24 16:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-21  0:34 [PATCH] sunxi: fix initial environment loading without MMC Andre Przywara
2022-04-23 21:01 ` 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

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.