summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrieder Schrempf <frieder.schrempf@kontron.de>2026-08-11 11:34:20 +0200
committerFabio Estevam <festevam@gmail.com>2026-08-14 16:19:51 -0300
commitf0ddc167f547eede89d34e3f22a1fbd646f39d58 (patch)
treee29720ad14db11a80078665821f4a5b9b2035481
parent768053b2922cf8b413ca9ada6677f22bc62c215c (diff)
downloadu-boot-f0ddc167f547eede89d34e3f22a1fbd646f39d58.tar.gz
u-boot-f0ddc167f547eede89d34e3f22a1fbd646f39d58.zip
board: imx6dl-sielaff: Enable environment on SD card
Enable storing the environment on SD card and choose the env location according to the boot device. Assisted-by: Claude:claude-opus-5 Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
-rw-r--r--board/sielaff/imx6dl-sielaff/imx6dl-sielaff.c30
-rw-r--r--configs/imx6dl_sielaff_defconfig2
2 files changed, 32 insertions, 0 deletions
diff --git a/board/sielaff/imx6dl-sielaff/imx6dl-sielaff.c b/board/sielaff/imx6dl-sielaff/imx6dl-sielaff.c
index 4da084ed91c..f2c206cfeb0 100644
--- a/board/sielaff/imx6dl-sielaff/imx6dl-sielaff.c
+++ b/board/sielaff/imx6dl-sielaff/imx6dl-sielaff.c
@@ -9,6 +9,7 @@
#include <asm/arch/crm_regs.h>
#include <asm/arch/mx6-pins.h>
#include <asm/io.h>
+#include <env_internal.h>
#include <init.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -109,3 +110,32 @@ int board_init(void)
return 0;
}
+
+/*
+ * Keep the environment on the device we were booted from. The boot fuses
+ * use the SD card as primary boot device and the SPI NOR as the ECSPI
+ * recovery device, so both are valid places for the environment to live.
+ */
+enum env_location env_get_location(enum env_operation op, int prio)
+{
+ u32 bmode;
+
+ if (prio > 0)
+ return ENVL_UNKNOWN;
+
+ if (imx6_is_ecspi_recovery_boot())
+ return ENVL_SPI_FLASH;
+
+ bmode = (imx6_src_get_boot_mode() & IMX6_BMODE_MASK) >>
+ IMX6_BMODE_SHIFT;
+
+ switch (bmode) {
+ case IMX6_BMODE_SD:
+ case IMX6_BMODE_ESD:
+ case IMX6_BMODE_MMC:
+ case IMX6_BMODE_EMMC:
+ return ENVL_MMC;
+ default:
+ return ENVL_SPI_FLASH;
+ }
+}
diff --git a/configs/imx6dl_sielaff_defconfig b/configs/imx6dl_sielaff_defconfig
index bfa4c4aa1d8..615c2935844 100644
--- a/configs/imx6dl_sielaff_defconfig
+++ b/configs/imx6dl_sielaff_defconfig
@@ -61,8 +61,10 @@ CONFIG_EFI_PARTITION=y
# CONFIG_SPL_EFI_PARTITION is not set
CONFIG_OF_CONTROL=y
CONFIG_OF_UPSTREAM=y
+CONFIG_ENV_IS_IN_MMC=y
CONFIG_ENV_IS_IN_SPI_FLASH=y
CONFIG_ENV_RELOC_GD_ENV_ADDR=y
+CONFIG_ENV_MMC_DEVICE_INDEX=2
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
CONFIG_BOUNCE_BUFFER=y
CONFIG_USB_FUNCTION_FASTBOOT=y