summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 76b640c)
raw | patch | inline | side by side (parent: 76b640c)
author | Patrick Delaunay <patrick.delaunay@st.com> | |
Mon, 15 Jun 2020 08:38:57 +0000 (10:38 +0200) | ||
committer | Tom Rini <trini@konsulko.com> | |
Sun, 26 Jul 2020 18:35:30 +0000 (14:35 -0400) |
Manage 2 copy at the end of the partition selected by config
"u-boot,mmc-env-partition" to save the U-Boot environment,
with CONFIG_ENV_SIZE and 2*CONFIG_ENV_SIZE offset.
This patch allows to support redundancy (CONFIG_ENV_OFFSET_REDUND).
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
"u-boot,mmc-env-partition" to save the U-Boot environment,
with CONFIG_ENV_SIZE and 2*CONFIG_ENV_SIZE offset.
This patch allows to support redundancy (CONFIG_ENV_OFFSET_REDUND).
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
env/mmc.c | patch | blob | history |
diff --git a/env/mmc.c b/env/mmc.c
index 5de4a458171c283abab35fabf345ab6dcebdb300..aca61b75e999f9601b5da043c378a2244c9817c8 100644 (file)
--- a/env/mmc.c
+++ b/env/mmc.c
}
#if CONFIG_IS_ENABLED(OF_CONTROL)
-static inline int mmc_offset_try_partition(const char *str, s64 *val)
+static inline int mmc_offset_try_partition(const char *str, int copy, s64 *val)
{
struct disk_partition info;
struct blk_desc *desc;
len = DIV_ROUND_UP(CONFIG_ENV_SIZE, info.blksz);
/* use the top of the partion for the environment */
- *val = (info.start + info.size - len) * info.blksz;
+ *val = (info.start + info.size - (1 + copy) * len) * info.blksz;
return 0;
}
str = fdtdec_get_config_string(gd->fdt_blob, dt_prop.partition);
if (str) {
/* try to place the environment at end of the partition */
- err = mmc_offset_try_partition(str, &val);
+ err = mmc_offset_try_partition(str, copy, &val);
if (!err)
return val;
}