Skip to contentSkip to conversation

xilinx: Add option to load environment from outside of boot media

PATCH In review Vasileios Amoiridis 2 participants 2 messages May 31, 2024 Arm/Zynq architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xilinx: Add option to load environment from outside of boot media

Currently, if the environment is not in the current boot media, the env_get_location() is returning ENVL_UNKNOWN or ENVL_NOWHERE which is not true (i.e booting from FLASH with environment in eMMC). This commit adds an extra check to find the environment in the other supported boot media, keeping the same priority as of now.

---
 board/xilinx/versal-net/board.c | 47 ++++++++++++++--------------
 board/xilinx/versal/board.c     | 47 ++++++++++++++--------------
 board/xilinx/zynq/board.c       | 49 +++++++++++++++--------------
 board/xilinx/zynqmp/zynqmp.c    | 55 +++++++++++++++++----------------
 4 files changed, 101 insertions(+), 97 deletions(-)
board/xilinx/versal-net/board.c +24 -23
index da03024e16..5295221aaa 100644
@@ -377,29 +377,30 @@ enum env_location env_get_location(enum env_operation op, int prio)
 {
 	u8 bootmode = versal_net_get_bootmode();
 
-	if (prio)
-		return ENVL_UNKNOWN;
-
-	switch (bootmode) {
-	case EMMC_MODE:
-	case SD_MODE:
-	case SD1_LSHFT_MODE:
-	case SD_MODE1:
-		if (IS_ENABLED(CONFIG_ENV_IS_IN_FAT))
-			return ENVL_FAT;
-		if (IS_ENABLED(CONFIG_ENV_IS_IN_EXT4))
-			return ENVL_EXT4;
-		return ENVL_NOWHERE;
-	case OSPI_MODE:
-	case QSPI_MODE_24BIT:
-	case QSPI_MODE_32BIT:
-		if (IS_ENABLED(CONFIG_ENV_IS_IN_SPI_FLASH))
-			return ENVL_SPI_FLASH;
-		return ENVL_NOWHERE;
-	case JTAG_MODE:
-	case SELECTMAP_MODE:
-	default:
-		return ENVL_NOWHERE;
+	if (!prio) {
+		switch (bootmode) {
+		case EMMC_MODE:
+		case SD_MODE:
+		case SD1_LSHFT_MODE:
+		case SD_MODE1:
+			if (IS_ENABLED(CONFIG_ENV_IS_IN_FAT))
+				return ENVL_FAT;
+			if (IS_ENABLED(CONFIG_ENV_IS_IN_EXT4))
+				return ENVL_EXT4;
+			break;
+		case OSPI_MODE:
+		case QSPI_MODE_24BIT:
+		case QSPI_MODE_32BIT:
+			if (IS_ENABLED(CONFIG_ENV_IS_IN_SPI_FLASH))
+				return ENVL_SPI_FLASH;
+			break;
+		case JTAG_MODE:
+		case SELECTMAP_MODE:
+		default:
+			return ENVL_NOWHERE;
+		}
 	}
+
+	return arch_env_get_location(op, prio);
 }
 #endif
board/xilinx/versal/board.c +24 -23

53 lines not on this page · raw message

board/xilinx/zynq/board.c +25 -24

56 lines not on this page · raw message

board/xilinx/zynqmp/zynqmp.c +28 -27

62 lines not on this page · raw message

base-commit: a7f0154c412859323396111dd0c09dbafbc153cb

Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 7 lines · Vasileios Amoiridis

Currently, if the environment is not in the current boot media, the env_get_location() is returning ENVL_UNKNOWN or ENVL_NOWHERE which is not true (i.e booting from FLASH with environment in eMMC). This commit adds an extra check to find the environment in the other supported boot media, keeping the same priority as of now.

This is v2 right? Please label it like that with also change log.

M