From: T Karthik Reddy <[email protected]>

ENV_OFFSET_REDUND config is by default set to 0 for flashes. Saving the env
variables is overwriting data at 0 offset, which is wrong. So add default
redund env offset for Zynq, ZynqMP, Versal and microblaze platforms.
Configured ENV_OFFSET_REDUND offsets by ENV_OFFSET + (2 * ENV_SIZE).

In case of versal, we configured ENV_OFFSET_REDUND at 0x7F00000 instead
of 0x7F80000. As BOOT_SCRIPT_OFFSET is already configured at 0x7F80000.

Added ENV_OFFSET_REDUND in Kconfig for microblaze due to dependency of
ENV_IS_IN_SPI_FLASH config.

Below table specifies platform specific env and env redund offsets.

PLAT            ENV_OFFSET      ENV_OFFSET_REDUND
----            ----------      -----------------
ZYNQ            0xE0000         0xE40000
ZYNQMP          0x1E00000       0x1E80000
VERSAL          0x7F40000       0x7F00000
MICROBLAZE      0x1080000       0x10C0000

Signed-off-by: T Karthik Reddy <[email protected]>
Signed-off-by: Michal Simek <[email protected]>
---

 configs/xilinx_versal_virt_defconfig | 1 +
 configs/xilinx_zynq_virt_defconfig   | 1 +
 configs/xilinx_zynqmp_virt_defconfig | 1 +
 env/Kconfig                          | 1 +
 4 files changed, 4 insertions(+)

diff --git a/configs/xilinx_versal_virt_defconfig 
b/configs/xilinx_versal_virt_defconfig
index ffd8bea81c36..7b96c4fbd999 100644
--- a/configs/xilinx_versal_virt_defconfig
+++ b/configs/xilinx_versal_virt_defconfig
@@ -7,6 +7,7 @@ CONFIG_SYS_TEXT_BASE=0x8000000
 CONFIG_SYS_MALLOC_F_LEN=0x100000
 CONFIG_DEFAULT_DEVICE_TREE="xilinx-versal-virt"
 CONFIG_SYS_PROMPT="Versal> "
+CONFIG_ENV_OFFSET_REDUND=0x7F00000
 CONFIG_CMD_FRU=y
 CONFIG_DEFINE_TCM_OCM_MMAP=y
 CONFIG_SYS_LOAD_ADDR=0x8000000
diff --git a/configs/xilinx_zynq_virt_defconfig 
b/configs/xilinx_zynq_virt_defconfig
index e6f8e221a5d5..b8e16cab6e8b 100644
--- a/configs/xilinx_zynq_virt_defconfig
+++ b/configs/xilinx_zynq_virt_defconfig
@@ -8,6 +8,7 @@ CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="zynq-zc706"
 CONFIG_SPL_STACK_R_ADDR=0x200000
 CONFIG_SPL=y
+CONFIG_ENV_OFFSET_REDUND=0xE40000
 CONFIG_CMD_FRU=y
 CONFIG_CMD_ZYNQ_AES=y
 CONFIG_SYS_LOAD_ADDR=0x0
diff --git a/configs/xilinx_zynqmp_virt_defconfig 
b/configs/xilinx_zynqmp_virt_defconfig
index e5ac26e0381f..e242884d3f6f 100644
--- a/configs/xilinx_zynqmp_virt_defconfig
+++ b/configs/xilinx_zynqmp_virt_defconfig
@@ -10,6 +10,7 @@ CONFIG_SPL_STACK_R_ADDR=0x18000000
 CONFIG_SPL_SIZE_LIMIT=0x2a000
 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x0
 CONFIG_SPL=y
+CONFIG_ENV_OFFSET_REDUND=0x1E80000
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI=y
 CONFIG_ZYNQ_MAC_IN_EEPROM=y
diff --git a/env/Kconfig b/env/Kconfig
index 238e4c70cf05..5329f7585be5 100644
--- a/env/Kconfig
+++ b/env/Kconfig
@@ -570,6 +570,7 @@ config ENV_OFFSET_REDUND
        hex "Redundant environment offset"
        depends on (ENV_IS_IN_EEPROM || ENV_IS_IN_MMC || ENV_IS_IN_NAND || \
                    ENV_IS_IN_SPI_FLASH) && SYS_REDUNDAND_ENVIRONMENT
+       default 0x10C0000 if MICROBLAZE
        default 0
        help
          Offset from the start of the device (or partition) of the redundant
-- 
2.36.1

Reply via email to