From: Siva Durga Prasad Paladugu Date: Mon, 9 Jun 2014 10:08:36 +0000 (+0530) Subject: ultrascale: Added QSPI and SD autoboot support X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3913cb66b7c39bded56f9899ab294e2ca7b8e00d;p=thirdparty%2Fu-boot.git ultrascale: Added QSPI and SD autoboot support Added QSPI and SD autoboot support. Signed-off-by: Siva Durga Prasad Paladugu Signed-off-by: Michal Simek --- diff --git a/arch/arm/include/asm/arch-ultrascale/hardware.h b/arch/arm/include/asm/arch-ultrascale/hardware.h index ed56f45453a..f6ede5b050d 100644 --- a/arch/arm/include/asm/arch-ultrascale/hardware.h +++ b/arch/arm/include/asm/arch-ultrascale/hardware.h @@ -21,4 +21,20 @@ #define ZYNQ_SDHCI_BASEADDR0 0xFF014000 #define ZYNQ_SDHCI_BASEADDR1 0xFF015000 +#define ZYNQMP_CRL_APB_BASEADDR 0xFF400000 + +struct crlapb_regs { + u32 reserved0[128]; + u32 boot_mode; + u32 reserved1[26]; +}; + +#define crlapb_base ((struct crlapb_regs *)ZYNQMP_CRL_APB_BASEADDR) + +/* Bootmode setting values */ +#define BOOT_MODES_MASK 0x0000000F +#define QSPI_MODE 0x00000001 +#define SD_MODE 0x00000005 +#define JTAG_MODE 0x00000000 + #endif /* _ASM_ARCH_HARDWARE_H */ diff --git a/board/xilinx/ultrascale/ultrascale.c b/board/xilinx/ultrascale/ultrascale.c index c26bf85a672..d477402753f 100644 --- a/board/xilinx/ultrascale/ultrascale.c +++ b/board/xilinx/ultrascale/ultrascale.c @@ -9,6 +9,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -74,3 +75,29 @@ int board_mmc_init(bd_t *bd) return ret; } #endif + +int board_late_init(void) +{ + u32 reg = 0; + u8 bootmode; + + reg = readl(&crlapb_base->boot_mode); + bootmode = reg & BOOT_MODES_MASK; + + switch (bootmode) { + case JTAG_MODE: + setenv("modeboot", "netboot"); + break; + case QSPI_MODE: + setenv("modeboot", "qspiboot"); + break; + case SD_MODE: + setenv("modeboot", "sdboot"); + break; + default: + printf("Invalid Boot Mode:0x%x\n", bootmode); + break; + } + + return 0; +} diff --git a/include/configs/xilinx_ultrascale.h b/include/configs/xilinx_ultrascale.h index c0fe01b16c4..ff1ebe1ce6e 100644 --- a/include/configs/xilinx_ultrascale.h +++ b/include/configs/xilinx_ultrascale.h @@ -138,9 +138,11 @@ "bootm 1000000 - 20000000\0" #define CONFIG_BOOTARGS "console=ttyPS0" -#define CONFIG_BOOTCOMMAND "echo Hello Xilinx UltraScale MP; run netboot" +#define CONFIG_BOOTCOMMAND "echo Hello Xilinx UltraScale MP; run $modeboot" #define CONFIG_BOOTDELAY 5 +#define CONFIG_BOARD_LATE_INIT + /* Do not preserve environment */ #define CONFIG_ENV_IS_NOWHERE 1 #define CONFIG_ENV_SIZE 0x1000