]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
ARM64: zynqmp: Force certain bootmode for SPL
authorMichal Simek <michal.simek@xilinx.com>
Tue, 30 Aug 2016 14:17:27 +0000 (16:17 +0200)
committerMichal Simek <michal.simek@xilinx.com>
Wed, 26 Oct 2016 07:13:57 +0000 (09:13 +0200)
ZynqMP provides an option to overwrite bootmode setting which
can change SPL behavior.
For example: boot SPL via JTAG and then SPL loads images from SD.

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

index c170e31323142eafefe364d9b7df1bdd65a31d5d..17da48e71b080e05687f3355441f7e8410775426 100644 (file)
@@ -24,4 +24,53 @@ config ZYNQMP_QSPI
 config ZYNQMP_USB
        bool "Configure ZynqMP USB"
 
+config SPL_ZYNQMP_ALT_BOOTMODE_ENABLED
+       bool "Overwrite SPL bootmode"
+       depends on SPL
+       help
+         Overwrite bootmode selected via boot mode pins to tell SPL what should
+         be the next boot device.
+
+config SPL_ZYNQMP_ALT_BOOTMODE
+       hex
+       default 0x0 if JTAG_MODE
+       default 0x1 if QSPI_MODE_24BIT
+       default 0x2 if QSPI_MODE_32BIT
+       default 0x3 if SD_MODE
+       default 0x4 if NAND_MODE
+       default 0x5 if SD_MODE1
+       default 0x6 if EMMC_MODE
+       default 0x7 if USB_MODE
+
+choice
+       prompt "Boot mode"
+       depends on SPL_ZYNQMP_ALT_BOOTMODE_ENABLED
+       default JTAG
+
+config JTAG_MODE
+       bool "JTAG_MODE"
+
+config QSPI_MODE_24BIT
+       bool "QSPI_MODE_24BIT"
+
+config QSPI_MODE_32BIT
+       bool "QSPI_MODE_32BIT"
+
+config SD_MODE
+       bool "SD_MODE"
+
+config SD_MODE1
+       bool "SD_MODE1"
+
+config NAND_MODE
+       bool "NAND_MODE"
+
+config EMMC_MODE
+       bool "EMMC_MODE"
+
+config USB_MODE
+       bool "USB"
+
+endchoice
+
 endif
index fa647013b63c53a5db1c87bcdc13940aa0750f50..04e190537d15c47e9b976fd1a1fb14c73c9da41c 100644 (file)
@@ -67,6 +67,13 @@ u32 spl_boot_device(void)
        u32 reg = 0;
        u8 bootmode;
 
+#if defined(CONFIG_SPL_ZYNQMP_ALT_BOOTMODE_ENABLED)
+       /* Change default boot mode at run-time */
+       writel(BOOT_MODE_USE_ALT |
+              CONFIG_SPL_ZYNQMP_ALT_BOOTMODE << BOOT_MODE_ALT_SHIFT,
+              &crlapb_base->boot_mode);
+#endif
+
        reg = readl(&crlapb_base->boot_mode);
        bootmode = reg & BOOT_MODES_MASK;
 
index f0420106ceb613ccf7604c7a9b8021d478e18993..e7738faaf896d4b04576acd90c8ce817fb12fa0a 100644 (file)
@@ -81,6 +81,8 @@ struct iou_scntr_secure {
 #define USB_MODE       0x00000007
 #define SD1_LSHFT_MODE 0x0000000E /* SD1 Level shifter */
 #define JTAG_MODE      0x00000000
+#define BOOT_MODE_USE_ALT      0x100
+#define BOOT_MODE_ALT_SHIFT    12
 
 #define ZYNQMP_IOU_SLCR_BASEADDR       0xFF180000