ARM64: zynqmp: Add support for DFU from SPL
authorMichal Simek <michal.simek@xilinx.com>
Fri, 19 Aug 2016 12:14:52 +0000 (14:14 +0200)
committerMichal Simek <michal.simek@xilinx.com>
Thu, 22 Sep 2016 05:33:21 +0000 (07:33 +0200)
SPL needs to have bigger stack size because of USB.
Simple malloc needs to be disabled because dfu code requires different
allocation functions. There is no space in OCM that's why random place
in DDR is used.

BOOTD must be disabled because it is causing compilation error.

All variables are disabled and used only variables valid for DFU because
they are simple huge. Including automatic variables added by
CONFIG_ENV_VARS_UBOOT_CONFIG.
Hardcode addresses for u-boot, atf, kernel and dtb
just for SPL DFU code.

Enable SPL DFU for zcu100.
Create new usb_dfu_spl variable just to run Linux kernel loaded in SPL.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
arch/arm/cpu/armv8/zynqmp/spl.c
board/xilinx/zynqmp/zynqmp.c
include/configs/xilinx_zynqmp.h

index 4b6fdc259341ab615894a16e531d35b964184f4c..3ad5de1408786a191cdd032e512d987d23a3ff0f 100644 (file)
@@ -66,6 +66,10 @@ u32 spl_boot_device(void)
        case SD_MODE:
        case SD_MODE1:
                return BOOT_DEVICE_MMC1;
+#endif
+#ifdef CONFIG_SPL_DFU_SUPPORT
+       case USB_MODE:
+               return BOOT_DEVICE_DFU;
 #endif
        default:
                printf("Invalid Boot Mode:0x%x\n", bootmode);
index 4aed97a72f3b79b951ca6b3e73843f52790a4629..df4fc901c1c7a8ec5a1240fbefa311c8dd4842c2 100644 (file)
@@ -229,6 +229,10 @@ int board_late_init(void)
 
        puts("Bootmode: ");
        switch (bootmode) {
+       case USB_MODE:
+               puts("USB_MODE\n");
+               mode = "usb";
+               break;
        case JTAG_MODE:
                puts("JTAG_MODE\n");
                mode = "pxe dhcp";
index 9bf9e24b363cbbd1c85b795e4d754a6053ae34fd..60d6b60d9ebe91e6345f77c0045d947c8adef69c 100644 (file)
@@ -75,7 +75,9 @@
 
 /* Diff from config_distro_defaults.h */
 #define CONFIG_SUPPORT_RAW_INITRD
+#if !defined(CONFIG_SPL_BUILD)
 #define CONFIG_ENV_VARS_UBOOT_CONFIG
+#endif
 #define CONFIG_AUTO_COMPLETE
 
 /* PXE */
 # define DFU_ALT_INFO
 #endif
 
-
 #define CONFIG_BOARD_LATE_INIT
 
 /* Do not preserve environment */
        DFU_ALT_INFO
 #endif
 
+/* SPL can't handle all huge variables - define just DFU */
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_DFU_SUPPORT)
+#undef CONFIG_EXTRA_ENV_SETTINGS
+# define CONFIG_EXTRA_ENV_SETTINGS \
+       "dfu_alt_info_ram=uboot.bin ram 0x8000000 0x1000000;" \
+                         "atf-uboot.ub ram 0x10000000 0x1000000;" \
+                         "Image ram 0x80000 0x3f80000;" \
+                         "system.dtb ram 0x4000000 0x100000\0" \
+       "dfu_bufsiz=0x1000\0"
+#endif
+
 #define CONFIG_SPL_TEXT_BASE           0xfffc0000
 #define CONFIG_SPL_STACK               0xfffffffc
-#define CONFIG_SPL_MAX_SIZE            0x20000
+#define CONFIG_SPL_MAX_SIZE            0x40000
 
 /* Just random location in OCM */
 #define CONFIG_SPL_BSS_START_ADDR      0x0
 # define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME       "u-boot.img"
 #endif
 
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_DFU_SUPPORT)
+# undef CONFIG_CMD_BOOTD
+# define CONFIG_SPL_ENV_SUPPORT
+# define CONFIG_SPL_HASH_SUPPORT
+# define CONFIG_ENV_MAX_ENTRIES        10
+
+# define CONFIG_SYS_SPL_MALLOC_START   0x20000000
+# define CONFIG_SYS_SPL_MALLOC_SIZE    0x10000000
+
+#ifdef CONFIG_SPL_SYS_MALLOC_SIMPLE
+# error "Disable CONFIG_SPL_SYS_MALLOC_SIMPLE. Full malloc needs to be used"
+#endif
+#endif
+
 #endif /* __XILINX_ZYNQMP_H */