]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
ARM64: zynqmp: Add support for standard distro boot commands
authorMichal Simek <michal.simek@xilinx.com>
Fri, 22 Apr 2016 12:28:54 +0000 (14:28 +0200)
committerMichal Simek <michal.simek@xilinx.com>
Mon, 6 Jun 2016 09:23:28 +0000 (11:23 +0200)
Nand and QSPI are not defined now but this will be extended.
Based on selected bootmode boot_targets are rewritten.
Patch also contains detection if variables are saved. If yes don't
rewrite boot_targets variable.

Also move variable setup to the end of file because SCSI needs to be
defined before others macros are using it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
board/xilinx/zynqmp/zynqmp.c
include/configs/xilinx_zynqmp.h
include/configs/xilinx_zynqmp_ep.h
include/configs/xilinx_zynqmp_zc1751_xm015_dc1.h
include/configs/xilinx_zynqmp_zc1751_xm016_dc2.h
include/configs/xilinx_zynqmp_zc1751_xm018_dc4.h
include/configs/xilinx_zynqmp_zc1751_xm019_dc5.h
include/configs/xilinx_zynqmp_zcu102.h

index 4623cd49e9c797f309540fb618e5076a2bee82a8..f15dc5d71522231ed478bf3639747781bf9f59cb 100644 (file)
@@ -9,6 +9,7 @@
 #include <sata.h>
 #include <ahci.h>
 #include <scsi.h>
+#include <malloc.h>
 #include <asm/arch/clk.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/sys_proto.h>
@@ -214,6 +215,13 @@ int board_late_init(void)
 {
        u32 reg = 0;
        u8 bootmode;
+       const char *mode;
+       char *new_targets;
+
+       if (!(gd->flags & GD_FLG_ENV_DEFAULT)) {
+               debug("Saved variables - Skipping\n");
+               return 0;
+       }
 
        reg = readl(&crlapb_base->boot_mode);
        bootmode = reg & BOOT_MODES_MASK;
@@ -222,37 +230,49 @@ int board_late_init(void)
        switch (bootmode) {
        case JTAG_MODE:
                puts("JTAG_MODE\n");
-               setenv("modeboot", "jtagboot");
+               mode = "pxe dhcp";
                break;
        case QSPI_MODE_24BIT:
        case QSPI_MODE_32BIT:
-               setenv("modeboot", "qspiboot");
+               mode = "qspi0";
                puts("QSPI_MODE\n");
                break;
        case EMMC_MODE:
                puts("EMMC_MODE\n");
-               setenv("modeboot", "sdboot");
+               mode = "mmc0";
                break;
        case SD_MODE:
                puts("SD_MODE\n");
-               setenv("modeboot", "sdboot");
+               mode = "mmc0";
                break;
        case SD_MODE1:
                puts("SD_MODE1\n");
 #if defined(CONFIG_ZYNQ_SDHCI0) && defined(CONFIG_ZYNQ_SDHCI1)
-               setenv("sdbootdev", "1");
+               mode = "mmc1";
+#else
+               mode = "mmc0";
 #endif
-               setenv("modeboot", "sdboot");
                break;
        case NAND_MODE:
                puts("NAND_MODE\n");
-               setenv("modeboot", "nandboot");
+               mode = "nand0";
                break;
        default:
+               mode = "";
                printf("Invalid Boot Mode:0x%x\n", bootmode);
                break;
        }
 
+       /*
+        * One terminating char + one byte for space between mode
+        * and default boot_targets
+        */
+       new_targets = calloc(1, strlen(mode) +
+                               strlen(getenv("boot_targets")) + 2);
+
+       sprintf(new_targets, "%s %s", mode, getenv("boot_targets"));
+       setenv("boot_targets", new_targets);
+
        return 0;
 }
 
index ac3de0ac811e12e0aad4800f40de3404f399940b..fc2e1f72d0cece2cd36e1aa3cf594f6e92706bed 100644 (file)
 # define DFU_ALT_INFO
 #endif
 
-/* Initial environment variables */
-#ifndef CONFIG_EXTRA_ENV_SETTINGS
-#define CONFIG_EXTRA_ENV_SETTINGS \
-       "kernel_addr=0x80000\0" \
-       "fdt_addr=0x7000000\0" \
-       "fdt_high=0x10000000\0" \
-       CONFIG_KERNEL_FDT_OFST_SIZE \
-       "sdbootdev=0\0"\
-       "sdboot=mmc dev $sdbootdev && mmcinfo && load mmc $sdbootdev:$partid $fdt_addr system.dtb && " \
-               "load mmc $sdbootdev:$partid $kernel_addr Image && " \
-               "booti $kernel_addr - $fdt_addr\0" \
-       DFU_ALT_INFO
-#endif
-
-#define CONFIG_BOOTCOMMAND     "run $modeboot"
 #define CONFIG_BOOTDELAY       3
 
 #define CONFIG_BOARD_LATE_INIT
 #define CONFIG_BOARD_EARLY_INIT_R
 #define CONFIG_CLOCKS
 
+#define ENV_MEM_LAYOUT_SETTINGS \
+       "fdt_high=10000000\0" \
+       "initrd_high=10000000\0" \
+       "fdt_addr_r=0x40000000\0" \
+       "pxefile_addr_r=0x10000000\0" \
+       "kernel_addr_r=0x18000000\0" \
+       "scriptaddr=0x02000000\0" \
+       "ramdisk_addr_r=0x02100000\0" \
+
+#if defined(CONFIG_ZYNQ_SDHCI)
+# define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) func(MMC, mmc, 1)
+#else
+# define BOOT_TARGET_DEVICES_MMC(func)
+#endif
+
+#if defined(CONFIG_SATA_CEVA)
+# define BOOT_TARGET_DEVICES_SCSI(func)        func(SCSI, scsi, 0)
+#else
+# define BOOT_TARGET_DEVICES_SCSI(func)
+#endif
+
+#if defined(CONFIG_ZYNQMP_USB)
+# define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0) func(USB, usb, 1)
+#else
+# define BOOT_TARGET_DEVICES_USB(func)
+#endif
+
+#define BOOT_TARGET_DEVICES(func) \
+       BOOT_TARGET_DEVICES_MMC(func) \
+       BOOT_TARGET_DEVICES_USB(func) \
+       BOOT_TARGET_DEVICES_SCSI(func) \
+       func(PXE, pxe, na) \
+       func(DHCP, dhcp, na)
+
+#include <config_distro_bootcmd.h>
+
+/* Initial environment variables */
+#ifndef CONFIG_EXTRA_ENV_SETTINGS
+#define CONFIG_EXTRA_ENV_SETTINGS \
+       ENV_MEM_LAYOUT_SETTINGS \
+       BOOTENV \
+       DFU_ALT_INFO
+#endif
+
 #define CONFIG_SPL_TEXT_BASE           0xfffc0000
 #define CONFIG_SPL_MAX_SIZE            0x20000
 
index 95063557137bc9e77a026e4ec79351cb5c6fe263..c5bd5da43c5e198697b658d1cb6bf6206d4b9342 100644 (file)
 
 #define COUNTER_FREQUENCY      4000000
 
-#define CONFIG_KERNEL_FDT_OFST_SIZE \
-       "kernel_offset=0x400000\0" \
-       "fdt_offset=0x2400000\0" \
-       "kernel_size=0x2000000\0" \
-       "fdt_size=0x80000\0" \
-       "board=ep108\0"
-
 #include <configs/xilinx_zynqmp.h>
 
 #endif /* __CONFIG_ZYNQMP_EP_H */
index 3c0ba883dbba47f5dc8a1663ee0daf303944b033..c9f443207d905ad6c15bc4c2ada8d71371331405 100644 (file)
 
 #define CONFIG_IDENT_STRING    " Xilinx ZynqMP ZC1751 xm015 dc1"
 
-#define CONFIG_KERNEL_FDT_OFST_SIZE \
-       "kernel_offset=0x400000\0" \
-       "fdt_offset=0x2400000\0" \
-       "kernel_size=0x2000000\0" \
-       "fdt_size=0x80000\0" \
-       "board=zc1751-dc1\0"
-
 #include <configs/xilinx_zynqmp.h>
 
 #endif /* __CONFIG_ZYNQMP_ZC1751_XM015_DC1_H */
index 83ea624c51c4768f8e853243a1595b1842aa145f..526d0bbe5852419d51cfae9a8cc5413628fb5b0b 100644 (file)
 
 #define CONFIG_IDENT_STRING    " Xilinx ZynqMP ZC1751 xm016 dc2"
 
-#define CONFIG_KERNEL_FDT_OFST_SIZE \
-       "kernel_offset=0x400000\0" \
-       "fdt_offset=0x2400000\0" \
-       "kernel_size=0x2000000\0" \
-       "fdt_size=0x80000\0" \
-       "board=zc1751-dc2\0"
-
 #include <configs/xilinx_zynqmp.h>
 
 #endif /* __CONFIG_ZYNQMP_ZC1751_XM016_DC2_H */
index fd2ec6a77516a6e9e6cb66406c4b0f1783617f3e..65277a64c3c4cb8b92005172a588b2f06b24fb46 100644 (file)
 
 #define CONFIG_IDENT_STRING    " Xilinx ZynqMP ZC1751 xm018 dc4"
 
-#define CONFIG_KERNEL_FDT_OFST_SIZE \
-       "kernel_offset=0x400000\0" \
-       "fdt_offset=0x2400000\0" \
-       "kernel_size=0x2000000\0" \
-       "fdt_size=0x80000\0" \
-       "board=zc1751-dc4\0"
-
 #include <configs/xilinx_zynqmp.h>
 
 #endif /* __CONFIG_ZYNQMP_ZC1751_XM018_DC4_H */
index 4f8f5c10536dc8e815c840d006b631599e9cb417..76350d957950a86cd3ae48b5faff649f8b9f6be6 100644 (file)
 
 #define CONFIG_IDENT_STRING    " Xilinx ZynqMP ZC1751 xm019 dc5"
 
-#define CONFIG_KERNEL_FDT_OFST_SIZE \
-       "kernel_offset=0x400000\0" \
-       "fdt_offset=0x2400000\0" \
-       "kernel_size=0x2000000\0" \
-       "fdt_size=0x80000\0" \
-       "board=zc1751-dc5\0"
-
 #include <configs/xilinx_zynqmp.h>
 
 #endif /* __CONFIG_ZYNQMP_ZC1751_XM019_DC5_H */
index 09c4a51a2ec0b26f05314512631e12004dc75252..7ceab3230b8842e923574c3daa3d75c42ea6dc17 100644 (file)
 #define CONFIG_ZYNQ_GEM_EEPROM_ADDR    0x54
 #define CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET 0x20
 
-#define CONFIG_KERNEL_FDT_OFST_SIZE \
-       "kernel_offset=0x180000\0" \
-       "fdt_offset=0x100000\0" \
-       "kernel_size=0x1e00000\0" \
-       "fdt_size=0x80000\0" \
-       "board=zcu102\0"
-
 #include <configs/xilinx_zynqmp.h>
 
 #endif /* __CONFIG_ZYNQMP_ZCU102_H */