[U-Boot] [PATCH 1/5] arm64: zynqmp: Add support for QSPI boot

This patch is enabling support for SPL QSPI boot.
First of all it is necessary to generate atf-spi.ub which is different format than atf-uboot.ub (this can be made as legacy image too)
ADDR=`arm-xilinx-linux-gnueabi-readelf -a bl31.elf | grep "Entry point address" | cut -d ':' -f 2 | sed -e 's/^[ \t]*//'` aarch64-linux-gnu-objcopy -O binary bl31.elf bl31.bin ./tools/mkimage -f auto -A arm64 -T firmware -C none -O u-boot -a $ADDR -e $ADDR -n "atf1" -E -b arch/arm/dts/zynqmp-zcu102.dtb -d bl31.bin atf-uboot.ub ./tools/mkimage -A arm64 -T firmware -C none -O u-boot -a $ADDR -e $ADDR -n "atf-for-qspi" -E -d bl31.bin atf-spi.ub
This patch is using this QSPI layout with offsets: 0 boot.bin 512k atf-ub 640k u-boot.bin 1280k u-boot.img
Which corresponding by writing these images(read from MMC) mmcinfo sf probe load mmc 0 10000000 boot.bin sf erase 0 +$filesize sf write 10000000 0 $filesize load mmc 0 10000000 atf-spi.ub sf erase 0x80000 +$filesize sf write 10000000 0x80000 $filesize load mmc 0 10000000 u-boot.bin sf erase 0xa0000 +$filesize sf write 10000000 0xa0000 $filesize load mmc 0 10000000 u-boot.img sf erase 0x140000 +$filesize sf write 10000000 0x140000 $filesize
For testing u-boot running in EL3 you can break atf-spi.ub like this: sf probe sf erase 0x80000 +4
Then u-boot.img is executed.
Signed-off-by: Michal Simek michal.simek@xilinx.com ---
arch/arm/cpu/armv8/zynqmp/spl.c | 5 +++++ arch/arm/dts/zynqmp.dtsi | 1 + include/configs/xilinx_zynqmp.h | 7 +++++++ 3 files changed, 13 insertions(+)
diff --git a/arch/arm/cpu/armv8/zynqmp/spl.c b/arch/arm/cpu/armv8/zynqmp/spl.c index 0a5f4306e822..c9fe260c8da6 100644 --- a/arch/arm/cpu/armv8/zynqmp/spl.c +++ b/arch/arm/cpu/armv8/zynqmp/spl.c @@ -96,6 +96,11 @@ u32 spl_boot_device(void) case SW_SATA_MODE: return BOOT_DEVICE_SATA; #endif +#ifdef CONFIG_SPL_SPI_SUPPORT + case QSPI_MODE_24BIT: + case QSPI_MODE_32BIT: + return BOOT_DEVICE_SPI; +#endif default: printf("Invalid Boot Mode:0x%x\n", bootmode); break; diff --git a/arch/arm/dts/zynqmp.dtsi b/arch/arm/dts/zynqmp.dtsi index 96118e31521a..6786fd44092d 100644 --- a/arch/arm/dts/zynqmp.dtsi +++ b/arch/arm/dts/zynqmp.dtsi @@ -701,6 +701,7 @@ };
qspi: spi@ff0f0000 { + u-boot,dm-pre-reloc; compatible = "xlnx,zynqmp-qspi-1.0"; status = "disabled"; clock-names = "ref_clk", "pclk"; diff --git a/include/configs/xilinx_zynqmp.h b/include/configs/xilinx_zynqmp.h index c2e2a51f0faf..35ce0157b92b 100644 --- a/include/configs/xilinx_zynqmp.h +++ b/include/configs/xilinx_zynqmp.h @@ -266,6 +266,13 @@ #define CONFIG_SPL_FRAMEWORK #define CONFIG_SPL_BOARD_INIT
+#define CONFIG_SPL_SPI_LOAD +#define CONFIG_SYS_SPI_KERNEL_OFFS 0x80000 +#define CONFIG_SYS_SPI_ARGS_OFFS 0xa0000 +#define CONFIG_SYS_SPI_ARGS_SIZE 0xa0000 + +#define CONFIG_SYS_SPI_U_BOOT_OFFS 0x140000 + /* u-boot is like dtb */ #define CONFIG_SPL_FS_LOAD_ARGS_NAME "u-boot.bin" #define CONFIG_SYS_SPL_ARGS_ADDR 0x8000000

Add missing SD boot mode to SPL. zcu102-rev1.0 is supporting this boot mode.
Signed-off-by: Michal Simek michal.simek@xilinx.com ---
arch/arm/cpu/armv8/zynqmp/spl.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/arm/cpu/armv8/zynqmp/spl.c b/arch/arm/cpu/armv8/zynqmp/spl.c index c9fe260c8da6..a316ce557084 100644 --- a/arch/arm/cpu/armv8/zynqmp/spl.c +++ b/arch/arm/cpu/armv8/zynqmp/spl.c @@ -83,6 +83,7 @@ u32 spl_boot_device(void) case JTAG_MODE: return BOOT_DEVICE_RAM; #ifdef CONFIG_SPL_MMC_SUPPORT + case SD1_LSHFT_MODE: case EMMC_MODE: case SD_MODE: case SD_MODE1:

From: Jean-Francois Dagenais jeff.dagenais@gmail.com
When enabling both SDHCI controllers, spl_mmc.c would actually choose device sdhci0 even if booted from sdhci1 (boot_device). This is because spl_mmc_get_device_index(boot_device) expects BOOT_DEVICE_MMC2[_2] in order to return index 1 instead of 0.
The #if defined(...) statement is copied from board/xilinx/zynqmp/zynqmp.c
So the key to properly enabling both controllers as boot sources is defining both CONFIG_ZYNQ_SDHCI0 and CONFIG_ZYNQ_SDHCI1 in your board's include/configs/*.h.
Signed-off-by: Jean-Francois Dagenais jeff.dagenais@gmail.com Signed-off-by: Michal Simek michal.simek@xilinx.com ---
arch/arm/cpu/armv8/zynqmp/spl.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/arch/arm/cpu/armv8/zynqmp/spl.c b/arch/arm/cpu/armv8/zynqmp/spl.c index a316ce557084..5ea731cd3018 100644 --- a/arch/arm/cpu/armv8/zynqmp/spl.c +++ b/arch/arm/cpu/armv8/zynqmp/spl.c @@ -83,10 +83,15 @@ u32 spl_boot_device(void) case JTAG_MODE: return BOOT_DEVICE_RAM; #ifdef CONFIG_SPL_MMC_SUPPORT + case SD_MODE1: case SD1_LSHFT_MODE: - case EMMC_MODE: +/* if both controllers enabled, then these two are the second controller */ +#if defined(CONFIG_ZYNQ_SDHCI0) && defined(CONFIG_ZYNQ_SDHCI1) + return BOOT_DEVICE_MMC2; +/* else, fall through, the one SDHCI controller that is enabled is number 1 */ +#endif case SD_MODE: - case SD_MODE1: + case EMMC_MODE: return BOOT_DEVICE_MMC1; #endif #ifdef CONFIG_SPL_DFU_SUPPORT @@ -116,6 +121,7 @@ u32 spl_boot_mode(const u32 boot_device) case BOOT_DEVICE_RAM: return 0; case BOOT_DEVICE_MMC1: + case BOOT_DEVICE_MMC2: return MMCSD_MODE_FS; default: puts("spl: error: unsupported device\n");

From: Jean-Francois Dagenais jeff.dagenais@gmail.com
The boot_device argument to spl_boot_mode was massively added without actually modifying the existing functions.
This commit actually makes use of the handed value, which is the same.
Signed-off-by: Jean-Francois Dagenais jeff.dagenais@gmail.com Signed-off-by: Michal Simek michal.simek@xilinx.com ---
arch/arm/cpu/armv8/zynqmp/spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/cpu/armv8/zynqmp/spl.c b/arch/arm/cpu/armv8/zynqmp/spl.c index 5ea731cd3018..e5a413954a5b 100644 --- a/arch/arm/cpu/armv8/zynqmp/spl.c +++ b/arch/arm/cpu/armv8/zynqmp/spl.c @@ -117,7 +117,7 @@ u32 spl_boot_device(void)
u32 spl_boot_mode(const u32 boot_device) { - switch (spl_boot_device()) { + switch (boot_device) { case BOOT_DEVICE_RAM: return 0; case BOOT_DEVICE_MMC1:

In older vivado version some psu_init* files didn't contain mask*() which were missing.
Signed-off-by: Michal Simek michal.simek@xilinx.com ---
board/xilinx/zynqmp/xil_io.h | 3 --- 1 file changed, 3 deletions(-)
diff --git a/board/xilinx/zynqmp/xil_io.h b/board/xilinx/zynqmp/xil_io.h index 6bbc000da828..679d234b0709 100644 --- a/board/xilinx/zynqmp/xil_io.h +++ b/board/xilinx/zynqmp/xil_io.h @@ -33,12 +33,9 @@ int Xil_In32(unsigned long addr) return readl(addr); }
-void mask_delay(u32 delay); void usleep(u32 sleep) { udelay(sleep); } -int mask_poll(u32 add, u32 mask); -int mask_pollOnValue(u32 add, u32 mask, u32 value);
#endif /* XIL_IO_H */
participants (1)
-
Michal Simek