env: mmc: Make redundant env in both eMMC boot partitions consider DT properties
authorMarek Vasut <marex@denx.de>
Fri, 21 Feb 2025 18:47:23 +0000 (19:47 +0100)
committerTom Rini <trini@konsulko.com>
Fri, 28 Feb 2025 14:35:52 +0000 (08:35 -0600)
commit5ce1d026b10e9cba8a22c83e826234cd8d48044b
treedcb620f236d0b3ff5384d551b727aa483111c5e9
parenta9842ac6347e2e0e7f6f8b66b5fe254739cdd298
env: mmc: Make redundant env in both eMMC boot partitions consider DT properties

Introduce a new function mmc_env_is_redundant_in_both_boot_hwparts()
which replaces IS_ENABLED(ENV_MMC_HWPART_REDUND) and internally does
almost the same check as the macro which assigned ENV_MMC_HWPART_REDUND
did, and call it in place of IS_ENABLED(ENV_MMC_HWPART_REDUND).

The difference compared to IS_ENABLED(ENV_MMC_HWPART_REDUND) is
in the last conditional, which does not do plain macro compare
(CONFIG_ENV_OFFSET == CONFIG_ENV_OFFSET_REDUND), but instead does
mmc_offset(mmc, 0) == mmc_offset(mmc, 1). If OF_CONTROL is not
in use, this gets optimized back to original macro compare, but
if OF_CONTROL is in use, this also takes into account the DT
properties u-boot,mmc-env-offset and u-boot,mmc-env-offset-redundant.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
env/mmc.c