summaryrefslogtreecommitdiff
path: root/env/mmc.c
diff options
context:
space:
mode:
authorEmmanuel Di Fede <emmanuel.difede@cysec.com>2023-06-14 12:05:28 +0200
committerTom Rini <trini@konsulko.com>2023-07-14 15:21:07 -0400
commit9e70676cf5281f0e37736ea42b59ef2e02907051 (patch)
tree2cf15417f1656c0bd2d48c42074b914ec5d6f4d4 /env/mmc.c
parentb1d774bb8749151293a700173c79b9501ac72a2c (diff)
downloadu-boot-9e70676cf5281f0e37736ea42b59ef2e02907051.tar.gz
u-boot-9e70676cf5281f0e37736ea42b59ef2e02907051.tar.bz2
u-boot-9e70676cf5281f0e37736ea42b59ef2e02907051.zip
env: mmc: statically set the environment partition name
The new opt-out setting, CONFIG_ENV_MMC_PARTITION, statically sets the MMC environment partition name. Prior to this patch, the only way to declare this partition name was by creating a 'u-boot,mmc-env-partition' parameter in the device-tree's /config node. This setting provides additional flexibility, particularly in cases where accessing the device-tree is not straightforward (e.g. QEMU). If undeclared, the device-tree's setting will be used. Signed-off-by: Emmanuel Di Fede <emmanuel.difede@cysec.com> Cc: Joe Hershberger <joe.hershberger@ni.com> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Diffstat (limited to 'env/mmc.c')
-rw-r--r--env/mmc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/env/mmc.c b/env/mmc.c
index 7a5836ad66..cb14bbb58f 100644
--- a/env/mmc.c
+++ b/env/mmc.c
@@ -114,8 +114,13 @@ static inline s64 mmc_offset(struct mmc *mmc, int copy)
if (IS_ENABLED(CONFIG_SYS_MMC_ENV_PART))
hwpart = mmc_get_env_part(mmc);
+#if defined(CONFIG_ENV_MMC_PARTITION)
+ str = CONFIG_ENV_MMC_PARTITION;
+#else
/* look for the partition in mmc CONFIG_SYS_MMC_ENV_DEV */
str = ofnode_conf_read_str(dt_prop.partition);
+#endif
+
if (str) {
/* try to place the environment at end of the partition */
err = mmc_offset_try_partition(str, copy, &val);