]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
xilinx: versal-net: Add support for saving env based on bootmode
authorVenkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Tue, 12 Mar 2024 11:34:21 +0000 (17:04 +0530)
committerMichal Simek <michal.simek@amd.com>
Fri, 22 Mar 2024 11:41:31 +0000 (12:41 +0100)
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-net platform as well.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20240312113421.7394-1-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
board/xilinx/versal-net/board.c
configs/xilinx_versal_net_virt_defconfig
env/Kconfig

index 990ca1650aa4bef9b83eee0e5b5a198e30ab6ea0..aecaeb65745360c4424b789417c8b5e3c94ec812 100644 (file)
@@ -371,3 +371,33 @@ int dram_init(void)
 void reset_cpu(void)
 {
 }
+
+enum env_location env_get_location(enum env_operation op, int prio)
+{
+       u8 bootmode = versal_net_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_NOWHERE;
+       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_NOWHERE;
+       case JTAG_MODE:
+       case SELECTMAP_MODE:
+       default:
+               return ENVL_NOWHERE;
+       }
+}
index 0f1d990936f3a84cd2d10491a33e082c40173009..b639a81b2b0ea5e13af2233df6117f816e5fc61c 100644 (file)
@@ -64,6 +64,9 @@ CONFIG_PARTITION_TYPE_GUID=y
 CONFIG_OF_BOARD=y
 CONFIG_DTB_RESELECT=y
 CONFIG_MULTI_DTB_FIT=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
index 7885c8bf83114d99338fbdd5982abd51f597f113..1f8e90af55e537577faf129fad000c654794120c 100644 (file)
@@ -472,7 +472,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 || ARCH_VERSAL
+       default "0:auto" if ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_VERSAL || ARCH_VERSAL_NET
        default ":auto" if ARCH_SUNXI
        default "0" if ARCH_AT91
        help