xilinx: Enable redundant variables for all Xilinx SoCs
cover xilinx: Enable redundant variables for all Xilinx SoCs
Hi,
based on discussion with Tom here
https://lists.denx.de/pipermail/u-boot/2021-January/437234.html
I decided to enable redundant variables on all Xilinx SoCs. Users who don't want to use it can disable this option. But having extended structure for variable storing is based on that thread above the right way to go. It means switch to the right approach is better to do earlier rather than later.
Thanks,
Michal
Ashok Reddy Soma (2):
xilinx: zynq: Add support for saving env based on bootmode
xilinx: versal: Add support for saving env based on bootmode
Michal Simek (2):
env: Setup default value for ENV_OFFSET_REDUND
xilinx: Enable redundant variable handling
board/xilinx/versal/board.c | 30 ++++++++++++++++++++++++++ board/xilinx/zynq/board.c | 32 ++++++++++++++++++++++++++++ configs/microblaze-generic_defconfig | 1 + configs/xilinx_versal_virt_defconfig | 4 ++++ configs/xilinx_zynq_virt_defconfig | 6 +++++- configs/xilinx_zynqmp_virt_defconfig | 1 + env/Kconfig | 3 ++- 7 files changed, 75 insertions(+), 2 deletions(-)
Signature · 1 line
2.31.0
PATCH 1/4 env: Setup default value for ENV_OFFSET_REDUND
This variable is used for pointing to location where redundant variables are located. There is no default value. And it doesn't need to be specified which is showing as warning when savedefconfig is called.
make xilinx_zynqmp_virt_defconfig
#
# configuration written to .config # make savedefconfig scripts/kconfig/conf --savedefconfig=defconfig Kconfig .config:199:warning: symbol value '' invalid for ENV_OFFSET_REDUND
---
env/Kconfig | 1 + 1 file changed, 1 insertion(+)
env/Kconfig +1 -0
@@ -534,6 +534,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 0 help Offset from the start of the device (or partition) of the redundant environment location.
Signature · 1 line
2.31.0
PATCH 2/4 xilinx: zynq: Add support for saving env based on bootmode
In reply to Michal SimekFrom: Ashok Reddy Soma <[email protected]>
Enable saving variables to MMC(FAT), NAND, SPI based on primary bootmode. If bootmode is JTAG, dont save env anywhere(NOWHERE).
Since most of the flashes on zynq evaluation boards are 16MB in size, set default ENV_OFFSET to 15MB(0xE00000).
---
board/xilinx/zynq/board.c | 32 ++++++++++++++++++++++++++++++ configs/xilinx_zynq_virt_defconfig | 5 ++++- 2 files changed, 36 insertions(+), 1 deletion(-)
board/xilinx/zynq/board.c +32 -0
@@ -9,6 +9,7 @@#include <log.h> #include <dm/uclass.h> #include <env.h> +#include <env_internal.h> #include <fdtdec.h> #include <fpga.h> #include <malloc.h>
@@ -119,3 +120,34 @@ int dram_init(void) return 0; }#endif + +enum env_location env_get_location (enum env_operation op,int prio) +{ +u32 bootmode =zynq_slcr_get_boot_mode () &ZYNQ_BM_MASK ; + +if (prio) +return ENVL_UNKNOWN ; + +switch (bootmode) { +case ZYNQ_BM_SD : +if (IS_ENABLED (CONFIG_ENV_IS_IN_FAT )) +return ENVL_FAT ; +if (IS_ENABLED (CONFIG_ENV_IS_IN_EXT4 )) +return ENVL_EXT4 ; +return ENVL_UNKNOWN ; +case ZYNQ_BM_NAND : +if (IS_ENABLED (CONFIG_ENV_IS_IN_NAND )) +return ENVL_NAND ; +if (IS_ENABLED (CONFIG_ENV_IS_IN_UBI )) +return ENVL_UBI ; +return ENVL_UNKNOWN ; +case ZYNQ_BM_NOR : +case ZYNQ_BM_QSPI : +if (IS_ENABLED (CONFIG_ENV_IS_IN_SPI_FLASH )) +return ENVL_SPI_FLASH ; +return ENVL_UNKNOWN ; +case ZYNQ_BM_JTAG : +default : +return ENVL_NOWHERE ; + } +}
configs/xilinx_zynq_virt_defconfig +4 -1
@@ -4,6 +4,7 @@ CONFIG_ARCH_ZYNQ=y CONFIG_SYS_TEXT_BASE=0x4000000 CONFIG_SYS_MEMTEST_START=0x00000000 CONFIG_SYS_MEMTEST_END=0x00001000 +CONFIG_ENV_OFFSET=0xE00000 CONFIG_SYS_SPI_U_BOOT_OFFS=0x100000 CONFIG_DM_GPIO=y CONFIG_SPL_STACK_R_ADDR=0x200000
@@ -55,7 +56,9 @@ CONFIG_CMD_MTDPARTS_SPREAD=y CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES=y CONFIG_CMD_UBI=y CONFIG_OF_LIST="zynq-zc702 zynq-zc706 zynq-zc770-xm010 zynq-zc770-xm011 zynq-zc770-xm011-x16 zynq-zc770-xm012 zynq-zc770-xm013 zynq-cc108 zynq-microzed zynq-minized zynq-picozed zynq-zed zynq-zturn zynq-zturn-v5 zynq-zybo zynq-zybo-z7 zynq-dlc20-rev1.0" -CONFIG_ENV_OVERWRITE=y +CONFIG_ENV_IS_NOWHERE=y +CONFIG_ENV_IS_IN_FAT=y +CONFIG_ENV_IS_IN_NAND=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_NET_RANDOM_ETHADDR=y
Signature · 1 line
2.31.0
PATCH 3/4 xilinx: versal: Add support for saving env based on bootmode
In reply to Michal SimekFrom: Ashok Reddy Soma <[email protected]>
Enable saving variables to MMC(FAT) and SPI based on primary bootmode. If bootmode is JTAG, dont save env anywhere(NOWHERE).
Enable ENV_FAT_DEVICE_AND_PART="0:auto" for Versal platforms as well.
---
board/xilinx/versal/board.c | 30 ++++++++++++++++++++++++++++ configs/xilinx_versal_virt_defconfig | 3 +++ env/Kconfig | 2 +- 3 files changed, 34 insertions(+), 1 deletion(-)
board/xilinx/versal/board.c +30 -0
@@ -9,6 +9,7 @@#include <env.h> #include <fdtdec.h> #include <init.h> +#include <env_internal.h> #include <log.h> #include <malloc.h> #include <time.h>
@@ -245,3 +246,32 @@ int dram_init(void)void reset_cpu (ulong addr) { } + +enum env_location env_get_location (enum env_operation op,int prio) +{ +u32 bootmode =versal_get_bootmode (); + +if (prio) +return ENVL_UNKNOWN ; + +switch (bootmode) { +case EMMC_MODE : +case SD_MODE : +case SD1_LSHFT_MODE : +case SD_MODE1 : +if (IS_ENABLED (CONFIG_ENV_IS_IN_FAT )) +return ENVL_FAT ; +if (IS_ENABLED (CONFIG_ENV_IS_IN_EXT4 )) +return ENVL_EXT4 ; +return ENVL_UNKNOWN ; +case OSPI_MODE : +case QSPI_MODE_24BIT : +case QSPI_MODE_32BIT : +if (IS_ENABLED (CONFIG_ENV_IS_IN_SPI_FLASH )) +return ENVL_SPI_FLASH ; +return ENVL_UNKNOWN ; +case JTAG_MODE : +default : +return ENVL_NOWHERE ; + } +}
configs/xilinx_versal_virt_defconfig +3 -0
@@ -39,6 +39,9 @@ CONFIG_CMD_EXT4_WRITE=y CONFIG_CMD_MTDPARTS=y CONFIG_CMD_UBI=y CONFIG_OF_BOARD=y +CONFIG_ENV_IS_NOWHERE=y +CONFIG_ENV_IS_IN_FAT=y +CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_NETCONSOLE=y
env/Kconfig +1 -1
@@ -431,7 +431,7 @@ config ENV_FAT_DEVICE_AND_PART string "Device and partition for where to store the environemt in FAT" depends on ENV_IS_IN_FAT default "0:1" if TI_COMMON_CMD_OPTIONS - default "0:auto" if ARCH_ZYNQ || ARCH_ZYNQMP + default "0:auto" if ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_VERSAL default "0:auto" if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA = -1 default "1:auto" if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA != -1 default "0" if ARCH_AT91
Signature · 1 line
2.31.0
PATCH 4/4 xilinx: Enable redundant variable handling
In reply to Michal SimekEnable this feature by default to be able to work with env import/export commands which are done in this slightly changed variable format (There is addtional flag fields in variable file which is changing CRC calculation).
---
configs/microblaze-generic_defconfig | 1 + configs/xilinx_versal_virt_defconfig | 1 + configs/xilinx_zynq_virt_defconfig | 1 + configs/xilinx_zynqmp_virt_defconfig | 1 + 4 files changed, 4 insertions(+)
configs/microblaze-generic_defconfig +1 -0
@@ -40,6 +40,7 @@ CONFIG_CMD_CACHE=y CONFIG_CMD_JFFS2=y CONFIG_SPL_OF_CONTROL=y CONFIG_OF_EMBED=y +CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_NETCONSOLE=y CONFIG_SPL_DM=y
configs/xilinx_versal_virt_defconfig +1 -0
@@ -42,6 +42,7 @@ CONFIG_OF_BOARD=y CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_FAT=y CONFIG_ENV_IS_IN_SPI_FLASH=y +CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_NETCONSOLE=y
configs/xilinx_zynq_virt_defconfig +1 -0
@@ -60,6 +60,7 @@ CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_FAT=y CONFIG_ENV_IS_IN_NAND=y CONFIG_ENV_IS_IN_SPI_FLASH=y +CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_NETCONSOLE=y
configs/xilinx_zynqmp_virt_defconfig +1 -0
@@ -74,6 +74,7 @@ CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_FAT=y CONFIG_ENV_IS_IN_NAND=y CONFIG_ENV_IS_IN_SPI_FLASH=y +CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_NETCONSOLE=y
Signature · 1 line
2.31.0
Michal Simek
Appliedcover xilinx: Enable redundant variables for all Xilinx SoCs
In reply to Michal Simek?t 30. 3. 2021 v 12:10 odes?latel Michal Simek <[email protected]> napsal:
Quoted 32 lines
Hi,
based on discussion with Tom here
https://lists.denx.de/pipermail/u-boot/2021-January/437234.html
I decided to enable redundant variables on all Xilinx SoCs. Users who don't want to use it can disable this option. But having extended structure for variable storing is based on that thread above the right way to go. It means switch to the right approach is better to do earlier rather than later.Thanks,
MichalAshok Reddy Soma (2):
xilinx: zynq: Add support for saving env based on bootmode
xilinx: versal: Add support for saving env based on bootmodeMichal Simek (2):
env: Setup default value forENV_OFFSET_REDUND
xilinx: Enable redundant variable handlingboard/xilinx/versal/board.c | 30 ++++++++++++++++++++++++++ board/xilinx/zynq/board.c | 32 ++++++++++++++++++++++++++++ configs/microblaze-generic_defconfig | 1 + configs/xilinx_versal_virt_defconfig | 4 ++++ configs/xilinx_zynq_virt_defconfig | 6 +++++- configs/xilinx_zynqmp_virt_defconfig | 1 + env/Kconfig | 3 ++- 7 files changed, 75 insertions(+), 2 deletions(-)
Quoted 3 lines
--
2.31.0
Applied.
M
Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Xilinx Microblaze Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs