summaryrefslogtreecommitdiff
path: root/board/xilinx/zynq
diff options
context:
space:
mode:
authorAshok Reddy Soma <ashok.reddy.soma@xilinx.com>2021-02-23 18:07:45 +0300
committerMichal Simek <michal.simek@xilinx.com>2021-04-23 09:43:18 +0300
commitcd08513b051890e6e426d902570a07467b6d2318 (patch)
treef71aeecd9c9202d6c781f471f6107c2844fff596 /board/xilinx/zynq
parentec217210f351c5c5089063f42eeb5e967a8ea5ba (diff)
downloadu-boot-cd08513b051890e6e426d902570a07467b6d2318.tar.xz
xilinx: zynq: Add support for saving env based on bootmode
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). 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/zynq')
-rw-r--r--board/xilinx/zynq/board.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c
index 7533dddb9b..e2e9b3f0f7 100644
--- a/board/xilinx/zynq/board.c
+++ b/board/xilinx/zynq/board.c
@@ -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;
+ }
+}