diff options
author | Ashok Reddy Soma <ashok.reddy.soma@xilinx.com> | 2021-02-23 08:07:46 -0700 |
---|---|---|
committer | Michal Simek <michal.simek@xilinx.com> | 2021-04-23 08:43:25 +0200 |
commit | 4fb83c9c2b2659b9493e271542c1c4568f97380c (patch) | |
tree | 54d38fa1a6a99d36772b36c273336b9f24d8b3c6 /board/xilinx | |
parent | cd08513b051890e6e426d902570a07467b6d2318 (diff) | |
download | u-boot-4fb83c9c2b2659b9493e271542c1c4568f97380c.zip u-boot-4fb83c9c2b2659b9493e271542c1c4568f97380c.tar.gz u-boot-4fb83c9c2b2659b9493e271542c1c4568f97380c.tar.bz2 |
xilinx: versal: Add support for saving env based on bootmode
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.
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'board/xilinx')
-rw-r--r-- | board/xilinx/versal/board.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c index e2f9d13..b175064 100644 --- a/board/xilinx/versal/board.c +++ b/board/xilinx/versal/board.c @@ -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(void) { } + +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; + } +} |