aboutsummaryrefslogtreecommitdiff
path: root/env/mmc.c
diff options
context:
space:
mode:
authorPatrick Delaunay2022-11-10 11:49:01 +0100
committerTom Rini2023-01-10 12:37:09 -0500
commitd2103e20a9f6cf92b689c1399c8a432365f94899 (patch)
treedf199bc5b8e6aa131fb2b7d779241d8e16e5b448 /env/mmc.c
parent8566050e247bacb734a57a2529f49139f2c63dce (diff)
env: mmc: add CONFIG_ENV_MMC_USE_DT
Add a new config CONFIG_ENV_MMC_USE_DT to force configuration of the U-Boot environment offset with device tree config node. This patch avoids issues when several CONFIG_ENV_IS_IN_XXX are activated, the defconfig file uses the same value for CONFIG_ENV_OFFSET or CONFIG_ENV_OFFSET_REDUND for the several ENV backends (SPI_FLASH, EEPROM NAND, SATA, MMC). After this patch a bad offset value is not possible when the selected partition in device tree is not found. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Diffstat (limited to 'env/mmc.c')
-rw-r--r--env/mmc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/env/mmc.c b/env/mmc.c
index 661a268ea07..1894b648322 100644
--- a/env/mmc.c
+++ b/env/mmc.c
@@ -26,6 +26,12 @@
#define ENV_MMC_INVALID_OFFSET ((s64)-1)
+#if defined(CONFIG_ENV_MMC_USE_DT)
+/* ENV offset is invalid when not defined in Device Tree */
+#define ENV_MMC_OFFSET ENV_MMC_INVALID_OFFSET
+#define ENV_MMC_OFFSET_REDUND ENV_MMC_INVALID_OFFSET
+
+#else
/* Default ENV offset when not defined in Device Tree */
#define ENV_MMC_OFFSET CONFIG_ENV_OFFSET
@@ -34,6 +40,7 @@
#else
#define ENV_MMC_OFFSET_REDUND ENV_MMC_INVALID_OFFSET
#endif
+#endif
DECLARE_GLOBAL_DATA_PTR;