]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
xilinx: zynqmp: Add support for saving variables
authorMichal Simek <michal.simek@xilinx.com>
Thu, 30 Jul 2020 11:37:49 +0000 (13:37 +0200)
committerMichal Simek <michal.simek@xilinx.com>
Wed, 23 Sep 2020 08:31:40 +0000 (10:31 +0200)
Enabling saving variables to MMC(FAT), NAND, SPI based on primary bootmode.
Maybe that logic can be tuned for more complicated use cases and better
tested for different bootmodes.

Tested on zcu104 to SD(FAT) and JTAG(NOWHERE).

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
board/xilinx/zynqmp/zynqmp.c
configs/xilinx_zynqmp_virt_defconfig

index 439244833410a0a38edbcabdbcebaae80f7fc939..e95d13a14cd3496481f63c0fe22d857d6aa7fb7e 100644 (file)
@@ -9,6 +9,7 @@
 #include <cpu_func.h>
 #include <debug_uart.h>
 #include <env.h>
+#include <env_internal.h>
 #include <init.h>
 #include <log.h>
 #include <net.h>
@@ -679,3 +680,37 @@ int checkboard(void)
        puts("Board: Xilinx ZynqMP\n");
        return 0;
 }
+
+enum env_location env_get_location(enum env_operation op, int prio)
+{
+       u32 bootmode = zynqmp_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 NAND_MODE:
+               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 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;
+       }
+}
index fe4b39a9bca0e76cdcf9f2883aaeefc03c1b6088..f1432af7ece6da73400a827f4f624b060bbf2419 100644 (file)
@@ -58,6 +58,10 @@ CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES=y
 CONFIG_CMD_UBI=y
 CONFIG_SPL_OF_CONTROL=y
 CONFIG_OF_LIST="avnet-ultra96-rev1 zynqmp-a2197-revA zynqmp-e-a2197-00-revA zynqmp-g-a2197-00-revA zynqmp-m-a2197-01-revA zynqmp-m-a2197-02-revA zynqmp-m-a2197-03-revA zynqmp-p-a2197-00-revA zynqmp-zc1232-revA zynqmp-zc1254-revA zynqmp-zc1751-xm015-dc1 zynqmp-zc1751-xm016-dc2 zynqmp-zc1751-xm017-dc3 zynqmp-zc1751-xm018-dc4 zynqmp-zc1751-xm019-dc5 zynqmp-zcu100-revC zynqmp-zcu102-rev1.1 zynqmp-zcu102-rev1.0 zynqmp-zcu102-revA zynqmp-zcu102-revB zynqmp-zcu104-revA zynqmp-zcu104-revC zynqmp-zcu106-revA zynqmp-zcu111-revA zynqmp-zcu1275-revA zynqmp-zcu1275-revB zynqmp-zcu1285-revA zynqmp-zcu208-revA zynqmp-zcu216-revA zynqmp-topic-miamimp-xilinx-xdp-v1r1"
+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
 CONFIG_NETCONSOLE=y