Skip to contentSkip to conversation

ARM: zynq: Run distribution boot commands first

PATCH New Michal Simek 2 participants 9 messages Jan 24, 2019 – Jan 25, 2019 Arm/Zynq architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ARM: zynq: Run distribution boot commands first

This patch is doing two things.
1. Exchanging order of boot commands. distro_bootcmd is run first followed by Xilinx boot command.
2. Remove CONFIG_BOOTCOMMAND from configs (and follow mainline) by creating Xilinx distribution bootcommand and wiring it as the last bootcommand.

QSPI, NAND distribution boot command will be added later.

---

 configs/syzygy_hub_defconfig           | 1 -
 configs/topic_miami_defconfig          | 1 -
 configs/topic_miamilite_defconfig      | 1 -
 configs/topic_miamiplus_defconfig      | 1 -
 configs/zynq_cc108_defconfig           | 1 -
 configs/zynq_dlc20_rev1_0_defconfig    | 1 -
 configs/zynq_microzed_defconfig        | 1 -
 configs/zynq_minized_defconfig         | 1 -
 configs/zynq_picozed_defconfig         | 1 -
 configs/zynq_z_turn_defconfig          | 1 -
 configs/zynq_zc702_defconfig           | 1 -
 configs/zynq_zc706_defconfig           | 1 -
 configs/zynq_zc770_xm010_defconfig     | 1 -
 configs/zynq_zc770_xm011_defconfig     | 1 -
 configs/zynq_zc770_xm011_x16_defconfig | 1 -
 configs/zynq_zc770_xm012_defconfig     | 1 -
 configs/zynq_zc770_xm013_defconfig     | 1 -
 configs/zynq_zed_defconfig             | 1 -
 configs/zynq_zybo_defconfig            | 1 -
 configs/zynq_zybo_z7_defconfig         | 1 -
 include/configs/zynq-common.h          | 9 ++++++++-
 21 files changed, 8 insertions(+), 21 deletions(-)
configs/syzygy_hub_defconfig +0 -1
index 793156520021..131f8f16607b 100644
@@ -13,7 +13,6 @@ CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_IMAGE_FORMAT_LEGACY=y
-CONFIG_BOOTCOMMAND="run $modeboot || run distro_bootcmd"
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SYS_PROMPT="Zynq> "
configs/topic_miami_defconfig +0 -1
index 927ce9ad2848..64ebfaed35fc 100644
@@ -11,7 +11,6 @@ CONFIG_BOOT_INIT_FILE="board/topic/zynq/zynq-topic-miami/ps7_regs.txt"
 CONFIG_DEBUG_UART=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTDELAY=0
-CONFIG_BOOTCOMMAND="run $modeboot || run distro_bootcmd"
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_PROMPT="zynq-uboot> "
configs/topic_miamilite_defconfig +0 -1
index e4d52f6a915e..83d2327c8a8f 100644
@@ -11,7 +11,6 @@ CONFIG_BOOT_INIT_FILE="board/topic/zynq/zynq-topic-miamilite/ps7_regs.txt"
 CONFIG_DEBUG_UART=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTDELAY=0
-CONFIG_BOOTCOMMAND="run $modeboot || run distro_bootcmd"
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_PROMPT="zynq-uboot> "
configs/topic_miamiplus_defconfig +0 -1
index f742838d7c1f..c8365d531d12 100644
@@ -11,7 +11,6 @@ CONFIG_BOOT_INIT_FILE="board/topic/zynq/zynq-topic-miamiplus/ps7_regs.txt"
 CONFIG_DEBUG_UART=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTDELAY=0
-CONFIG_BOOTCOMMAND="run $modeboot || run distro_bootcmd"
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_PROMPT="zynq-uboot> "
configs/zynq_cc108_defconfig +0 -1
index 5a930d6a3856..ff1c87a21d4e 100644
@@ -11,7 +11,6 @@ CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_IMAGE_FORMAT_LEGACY=y
-CONFIG_BOOTCOMMAND="run $modeboot || run distro_bootcmd"
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_PROMPT="Zynq> "
configs/zynq_dlc20_rev1_0_defconfig +0 -1
index 489d54773c8a..07101e53a67b 100644
@@ -12,7 +12,6 @@ CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_IMAGE_FORMAT_LEGACY=y
-CONFIG_BOOTCOMMAND="run $modeboot || run distro_bootcmd"
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_OS_BOOT=y
configs/zynq_microzed_defconfig +0 -1
index 206938584bc0..f3c27086cbbd 100644
@@ -8,7 +8,6 @@ CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_IMAGE_FORMAT_LEGACY=y
-CONFIG_BOOTCOMMAND="run $modeboot || run distro_bootcmd"
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SPL_SPI_LOAD=y
configs/zynq_minized_defconfig +0 -1
index 1b8604076031..d5421df06590 100644
@@ -10,7 +10,6 @@ CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
 CONFIG_FIT_VERBOSE=y
-CONFIG_BOOTCOMMAND="run $modeboot || run distro_bootcmd"
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SYS_PROMPT="Zynq> "
configs/zynq_picozed_defconfig +0 -1
index 226f0f7f3a45..98db04559f11 100644
@@ -4,7 +4,6 @@ CONFIG_SYS_TEXT_BASE=0x4000000
 CONFIG_SPL=y
 CONFIG_SPL_STACK_R_ADDR=0x200000
 CONFIG_DISTRO_DEFAULTS=y
-CONFIG_BOOTCOMMAND="run $modeboot || run distro_bootcmd"
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SYS_PROMPT="Zynq> "
configs/zynq_z_turn_defconfig +0 -1
index ff3322cf85b7..0cba1274ba7e 100644
@@ -11,7 +11,6 @@ CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_IMAGE_FORMAT_LEGACY=y
-CONFIG_BOOTCOMMAND="run $modeboot || run distro_bootcmd"
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SPL_SPI_LOAD=y
configs/zynq_zc702_defconfig +0 -1
index d6c602b73b6e..c713e8f353c6 100644
@@ -12,7 +12,6 @@ CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_IMAGE_FORMAT_LEGACY=y
-CONFIG_BOOTCOMMAND="run $modeboot || run distro_bootcmd"
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SPL_SPI_LOAD=y
configs/zynq_zc706_defconfig +0 -1
index 4f14636b912d..b8fc657a80c2 100644
@@ -14,7 +14,6 @@ CONFIG_FIT_VERBOSE=y
 CONFIG_SPL_FIT_PRINT=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_IMAGE_FORMAT_LEGACY=y
-CONFIG_BOOTCOMMAND="run $modeboot || run distro_bootcmd"
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_FPGA_SUPPORT=y
 CONFIG_SPL_OS_BOOT=y
configs/zynq_zc770_xm010_defconfig +0 -1
index fed1502d1b6b..47e07cd6d157 100644
@@ -12,7 +12,6 @@ CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_IMAGE_FORMAT_LEGACY=y
-CONFIG_BOOTCOMMAND="run $modeboot || run distro_bootcmd"
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SPL_SPI_LOAD=y
configs/zynq_zc770_xm011_defconfig +0 -1
index c15877d0ad9d..ffdce7bf7316 100644
@@ -13,7 +13,6 @@ CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_IMAGE_FORMAT_LEGACY=y
-CONFIG_BOOTCOMMAND="run $modeboot || run distro_bootcmd"
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SYS_PROMPT="Zynq> "
configs/zynq_zc770_xm011_x16_defconfig +0 -1
index 60627da8e5b7..0c6c5803a66b 100644
@@ -13,7 +13,6 @@ CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_IMAGE_FORMAT_LEGACY=y
-CONFIG_BOOTCOMMAND="run $modeboot || run distro_bootcmd"
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SYS_PROMPT="Zynq> "
configs/zynq_zc770_xm012_defconfig +0 -1
index aa20971e4413..cfed141cdc6e 100644
@@ -10,7 +10,6 @@ CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_IMAGE_FORMAT_LEGACY=y
-CONFIG_BOOTCOMMAND="run $modeboot || run distro_bootcmd"
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SYS_PROMPT="Zynq> "
configs/zynq_zc770_xm013_defconfig +0 -1
index a08bd2993385..1c917d79ed10 100644
@@ -10,7 +10,6 @@ CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_IMAGE_FORMAT_LEGACY=y
-CONFIG_BOOTCOMMAND="run $modeboot || run distro_bootcmd"
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SPL_SPI_LOAD=y
configs/zynq_zed_defconfig +0 -1
index dbf5c4173972..bf521eef680d 100644
@@ -11,7 +11,6 @@ CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_IMAGE_FORMAT_LEGACY=y
-CONFIG_BOOTCOMMAND="run $modeboot || run distro_bootcmd"
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SPL_SPI_LOAD=y
configs/zynq_zybo_defconfig +0 -1
index 9e44e82549f7..64b635bfd68b 100644
@@ -11,7 +11,6 @@ CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_IMAGE_FORMAT_LEGACY=y
-CONFIG_BOOTCOMMAND="run $modeboot || run distro_bootcmd"
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SPL_SPI_LOAD=y
configs/zynq_zybo_z7_defconfig +0 -1
index d729ca340c36..be693d3569a8 100644
@@ -11,7 +11,6 @@ CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_IMAGE_FORMAT_LEGACY=y
-CONFIG_BOOTCOMMAND="run $modeboot || run distro_bootcmd"
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SPL_SPI_LOAD=y
include/configs/zynq-common.h +8 -1
index 884f3cf01c8e..fc5c8ddbd877 100644
@@ -139,11 +139,18 @@
 #define BOOT_TARGET_DEVICES_DHCP(func)
 #endif
 
+#define BOOTENV_DEV_XILINX(devtypeu, devtypel, instance) \
+	"bootcmd_xilinx=run $modeboot\0"
+
+#define BOOTENV_DEV_NAME_XILINX(devtypeu, devtypel, instance) \
+	"xilinx "
+
 #define BOOT_TARGET_DEVICES(func) \
 	BOOT_TARGET_DEVICES_MMC(func) \
 	BOOT_TARGET_DEVICES_USB(func) \
 	BOOT_TARGET_DEVICES_PXE(func) \
-	BOOT_TARGET_DEVICES_DHCP(func)
+	BOOT_TARGET_DEVICES_DHCP(func) \
+	func(XILINX, xilinx, na)
 
 #include <config_distro_bootcmd.h>
 #endif /* CONFIG_SPL_BUILD */
Signature · 1 line
1.9.1
#1 lore raw

PATCH 2/2 arm64: zynqmp: Define distro boot commnads for qspi and nand

From: Siva Durga Prasad Paladugu <[email protected]>

This patch adds distro boot commands for qspi and nand. The distro boot commands now reads the script from flash offset of 63.5MB and executes it.

Setup default location via script_offset_f to 63.5MB to match the most xilinx reference boards. 512kB allocated space for script size (script_size_f) should be more than enough to cover custom boot logic.

---

 include/configs/xilinx_zynqmp.h | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
include/configs/xilinx_zynqmp.h +32 -0
index d0515fa9bc46..5eeae6331e1c 100644
@@ -129,6 +129,8 @@
 	"kernel_addr_r=0x18000000\0" \
 	"scriptaddr=0x02000000\0" \
 	"ramdisk_addr_r=0x02100000\0" \
+	"script_offset_f=0x3e80000\0" \
+	"script_size_f=0x80000\0" \
 
 #if defined(CONFIG_MMC_SDHCI_ZYNQ)
 # define BOOT_TARGET_DEVICES_MMC(func)	func(MMC, mmc, 0) func(MMC, mmc, 1)
@@ -160,8 +162,38 @@
 # define BOOT_TARGET_DEVICES_DHCP(func)
 #endif
 
+#if defined(CONFIG_ZYNQMP_GQSPI)
+# define BOOT_TARGET_DEVICES_QSPI(func)	func(QSPI, qspi, 0)
+#else
+# define BOOT_TARGET_DEVICES_QSPI(func)
+#endif
+
+#if defined(CONFIG_NAND_ARASAN)
+# define BOOT_TARGET_DEVICES_NAND(func)	func(NAND, nand, 0)
+#else
+# define BOOT_TARGET_DEVICES_NAND(func)
+#endif
+
+#define BOOTENV_DEV_QSPI(devtypeu, devtypel, instance) \
+	"bootcmd_qspi0=sf probe 0 0 0 && " \
+		       "sf read $scriptaddr $script_offset_f $script_size_f && " \
+		       "source ${scriptaddr}; echo SCRIPT FAILED: continuing...;\0"
+
+#define BOOTENV_DEV_NAME_QSPI(devtypeu, devtypel, instance) \
+	"qspi "
+
+#define BOOTENV_DEV_NAND(devtypeu, devtypel, instance) \
+	"bootcmd_nand0= nand info && " \
+		       "nand read $scriptaddr $script_offset_f $script_size_f && " \
+		       "source ${scriptaddr}; echo SCRIPT FAILED: continuing...;\0"
+
+#define BOOTENV_DEV_NAME_NAND(devtypeu, devtypel, instance) \
+	"nand "
+
 #define BOOT_TARGET_DEVICES(func) \
 	BOOT_TARGET_DEVICES_MMC(func) \
+	BOOT_TARGET_DEVICES_QSPI(func) \
+	BOOT_TARGET_DEVICES_NAND(func) \
 	BOOT_TARGET_DEVICES_USB(func) \
 	BOOT_TARGET_DEVICES_SCSI(func) \
 	BOOT_TARGET_DEVICES_PXE(func) \
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/2 arm64: zynqmp: Define distro boot commnads for qspi and nand

Quoted 38 lines · Michal Simek

From: Siva Durga Prasad Paladugu <[email protected]>

This patch adds distro boot commands for qspi and nand. The distro boot commands now reads the script from flash offset of 63.5MB and executes it.

Setup default location via script_offset_f to 63.5MB to match the most xilinx reference boards. 512kB allocated space for script size (script_size_f) should be more than enough to cover custom boot logic.

---

 include/configs/xilinx_zynqmp.h | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
include/configs/xilinx_zynqmp.h +6 -0
index d0515fa9bc46..5eeae6331e1c 100644
@@ -129,6 +129,8 @@
 	"kernel_addr_r=0x18000000\0" \
 	"scriptaddr=0x02000000\0" \
 	"ramdisk_addr_r=0x02100000\0" \
+	"script_offset_f=0x3e80000\0" \
+	"script_size_f=0x80000\0" \
 
 #if defined(CONFIG_MMC_SDHCI_ZYNQ)
 # define BOOT_TARGET_DEVICES_MMC(func)	func(MMC, mmc, 0) func(MMC, mmc, 1)
@@ -160,8 +162,38 @@
 # define BOOT_TARGET_DEVICES_DHCP(func)
 #endif
 
+#if defined(CONFIG_ZYNQMP_GQSPI)
+# define BOOT_TARGET_DEVICES_QSPI(func)	func(QSPI, qspi, 0)
+#else
+# define BOOT_TARGET_DEVICES_QSPI(func)

include/configs/xilinx_zynqmp.h line 178

Quoted 10 lines
include/configs/xilinx_zynqmp.h +10 -0
+#endif
+
+#if defined(CONFIG_NAND_ARASAN)
+# define BOOT_TARGET_DEVICES_NAND(func)	func(NAND, nand, 0)
+#else
+# define BOOT_TARGET_DEVICES_NAND(func)
+#endif
+
+#define BOOTENV_DEV_QSPI(devtypeu, devtypel, instance) \
+	"bootcmd_qspi0=sf probe 0 0 0 && " \

This

include/configs/xilinx_zynqmp.h line 186

Quoted 8 lines
include/configs/xilinx_zynqmp.h +8 -0
+		       "sf read $scriptaddr $script_offset_f $script_size_f && " \
+		       "source ${scriptaddr}; echo SCRIPT FAILED: continuing...;\0"
+
+#define BOOTENV_DEV_NAME_QSPI(devtypeu, devtypel, instance) \
+	"qspi "
+
+#define BOOTENV_DEV_NAND(devtypeu, devtypel, instance) \
+	"bootcmd_nand0= nand info && " \

and this will emit errors if no device was found, right? That might be confusing for a user, if all he sees is a scary "device not found" message which simply only occurs because he doesn't have nand populated.

Alex

Quoted 14 lines
include/configs/xilinx_zynqmp.h +8 -0
+		       "nand read $scriptaddr $script_offset_f $script_size_f && " \
+		       "source ${scriptaddr}; echo SCRIPT FAILED: continuing...;\0"
+
+#define BOOTENV_DEV_NAME_NAND(devtypeu, devtypel, instance) \
+	"nand "
+
 #define BOOT_TARGET_DEVICES(func) \
 	BOOT_TARGET_DEVICES_MMC(func) \
+	BOOT_TARGET_DEVICES_QSPI(func) \
+	BOOT_TARGET_DEVICES_NAND(func) \
 	BOOT_TARGET_DEVICES_USB(func) \
 	BOOT_TARGET_DEVICES_SCSI(func) \
 	BOOT_TARGET_DEVICES_PXE(func) \
#3 lore raw

PATCH 2/2 arm64: zynqmp: Define distro boot commnads for qspi and nand

Quoted 54 lines · Alexander Graf
Quoted 38 lines · Michal Simek

From: Siva Durga Prasad Paladugu <[email protected]>

This patch adds distro boot commands for qspi and nand. The distro boot commands now reads the script from flash offset of 63.5MB and executes it.

Setup default location via script_offset_f to 63.5MB to match the most xilinx reference boards. 512kB allocated space for script size (script_size_f) should be more than enough to cover custom boot logic.

---

 include/configs/xilinx_zynqmp.h | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
include/configs/xilinx_zynqmp.h +6 -0
index d0515fa9bc46..5eeae6331e1c 100644
@@ -129,6 +129,8 @@
 	"kernel_addr_r=0x18000000\0" \
 	"scriptaddr=0x02000000\0" \
 	"ramdisk_addr_r=0x02100000\0" \
+	"script_offset_f=0x3e80000\0" \
+	"script_size_f=0x80000\0" \
 
 #if defined(CONFIG_MMC_SDHCI_ZYNQ)
 # define BOOT_TARGET_DEVICES_MMC(func)	func(MMC, mmc, 0) func(MMC, mmc, 1)
@@ -160,8 +162,38 @@
 # define BOOT_TARGET_DEVICES_DHCP(func)
 #endif
 
+#if defined(CONFIG_ZYNQMP_GQSPI)
+# define BOOT_TARGET_DEVICES_QSPI(func)	func(QSPI, qspi, 0)
+#else
+# define BOOT_TARGET_DEVICES_QSPI(func)

include/configs/xilinx_zynqmp.h line 178

Quoted 10 lines
include/configs/xilinx_zynqmp.h +10 -0
+#endif
+
+#if defined(CONFIG_NAND_ARASAN)
+# define BOOT_TARGET_DEVICES_NAND(func)	func(NAND, nand, 0)
+#else
+# define BOOT_TARGET_DEVICES_NAND(func)
+#endif
+
+#define BOOTENV_DEV_QSPI(devtypeu, devtypel, instance) \
+	"bootcmd_qspi0=sf probe 0 0 0 && " \

This

Quoted 12 lines

include/configs/xilinx_zynqmp.h line 186

Quoted 8 lines
include/configs/xilinx_zynqmp.h +8 -0
+		       "sf read $scriptaddr $script_offset_f $script_size_f && " \
+		       "source ${scriptaddr}; echo SCRIPT FAILED: continuing...;\0"
+
+#define BOOTENV_DEV_NAME_QSPI(devtypeu, devtypel, instance) \
+	"qspi "
+
+#define BOOTENV_DEV_NAND(devtypeu, devtypel, instance) \
+	"bootcmd_nand0= nand info && " \

and this will emit errors if no device was found, right? That might be confusing for a user, if all he sees is a scary "device not found" message which simply only occurs because he doesn't have nand populated.

As you see above it is enabled only when devices are enabled. For generic u-boot for all zynqmp targets it should be correct to emit error message that nand is not detected if it is not present on the board. :-)
All these boot modes will be tried if the first boot mode fails.

I don't think it is an issue to report that booting from flash fails if it is not detected and it shouldn't matter if flash is broken or it is not even on the board because simply booting from flash fails.

Thanks,
Michal

#4 lore raw

PATCH 2/2 arm64: zynqmp: Define distro boot commnads for qspi and nand

Quoted 68 lines · Michal Simek
Quoted 54 lines · Alexander Graf
Quoted 38 lines · Michal Simek

From: Siva Durga Prasad Paladugu <[email protected]>

This patch adds distro boot commands for qspi and nand. The distro boot commands now reads the script from flash offset of 63.5MB and executes it.

Setup default location via script_offset_f to 63.5MB to match the most xilinx reference boards. 512kB allocated space for script size (script_size_f) should be more than enough to cover custom boot logic.

---

 include/configs/xilinx_zynqmp.h | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
include/configs/xilinx_zynqmp.h +6 -0
index d0515fa9bc46..5eeae6331e1c 100644
@@ -129,6 +129,8 @@
 	"kernel_addr_r=0x18000000\0" \
 	"scriptaddr=0x02000000\0" \
 	"ramdisk_addr_r=0x02100000\0" \
+	"script_offset_f=0x3e80000\0" \
+	"script_size_f=0x80000\0" \
 
 #if defined(CONFIG_MMC_SDHCI_ZYNQ)
 # define BOOT_TARGET_DEVICES_MMC(func)	func(MMC, mmc, 0) func(MMC, mmc, 1)
@@ -160,8 +162,38 @@
 # define BOOT_TARGET_DEVICES_DHCP(func)
 #endif
 
+#if defined(CONFIG_ZYNQMP_GQSPI)
+# define BOOT_TARGET_DEVICES_QSPI(func)	func(QSPI, qspi, 0)
+#else
+# define BOOT_TARGET_DEVICES_QSPI(func)

include/configs/xilinx_zynqmp.h line 178

Quoted 10 lines
include/configs/xilinx_zynqmp.h +10 -0
+#endif
+
+#if defined(CONFIG_NAND_ARASAN)
+# define BOOT_TARGET_DEVICES_NAND(func)	func(NAND, nand, 0)
+#else
+# define BOOT_TARGET_DEVICES_NAND(func)
+#endif
+
+#define BOOTENV_DEV_QSPI(devtypeu, devtypel, instance) \
+	"bootcmd_qspi0=sf probe 0 0 0 && " \

This

Quoted 12 lines

include/configs/xilinx_zynqmp.h line 186

Quoted 8 lines
include/configs/xilinx_zynqmp.h +8 -0
+		       "sf read $scriptaddr $script_offset_f $script_size_f && " \
+		       "source ${scriptaddr}; echo SCRIPT FAILED: continuing...;\0"
+
+#define BOOTENV_DEV_NAME_QSPI(devtypeu, devtypel, instance) \
+	"qspi "
+
+#define BOOTENV_DEV_NAND(devtypeu, devtypel, instance) \
+	"bootcmd_nand0= nand info && " \

and this will emit errors if no device was found, right? That might be confusing for a user, if all he sees is a scary "device not found" message which simply only occurs because he doesn't have nand populated.

Quoted 5 lines

As you see above it is enabled only when devices are enabled. For generic u-boot for all zynqmp targets it should be correct to emit error message that nand is not detected if it is not present on the board. :-)
All these boot modes will be tried if the first boot mode fails.

Well, it's conditional on whether the driver is available, not whether the board actually exposes a flash device, right?

So think about the generic case - one U-Boot binary for all targets. What are you going to do there? That needs to have all possible boot target devices enabled, but how do you know whether an actual QSPI chip is attached to the SPI controller?

I also think this problem is bigger than this patch, so don't take my comment as a nack. I'm just trying to raise that we should start to think about cases where "probe fails" is not an error and thus should not print an error message.

Alex

Quoted 7 lines

I don't think it is an issue to report that booting from flash fails if it is not detected and it shouldn't matter if flash is broken or it is not even on the board because simply booting from flash fails.

Thanks,
Michal

#5 lore raw

PATCH 2/2 arm64: zynqmp: Define distro boot commnads for qspi and nand

Quoted 77 lines · Alexander Graf
Quoted 68 lines · Michal Simek
Quoted 54 lines · Alexander Graf
Quoted 38 lines · Michal Simek

From: Siva Durga Prasad Paladugu <[email protected]>

This patch adds distro boot commands for qspi and nand. The distro boot commands now reads the script from flash offset of 63.5MB and executes it.

Setup default location via script_offset_f to 63.5MB to match the most xilinx reference boards. 512kB allocated space for script size (script_size_f) should be more than enough to cover custom boot logic.

---

 include/configs/xilinx_zynqmp.h | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
include/configs/xilinx_zynqmp.h +6 -0
index d0515fa9bc46..5eeae6331e1c 100644
@@ -129,6 +129,8 @@
 	"kernel_addr_r=0x18000000\0" \
 	"scriptaddr=0x02000000\0" \
 	"ramdisk_addr_r=0x02100000\0" \
+	"script_offset_f=0x3e80000\0" \
+	"script_size_f=0x80000\0" \
 
 #if defined(CONFIG_MMC_SDHCI_ZYNQ)
 # define BOOT_TARGET_DEVICES_MMC(func)	func(MMC, mmc, 0) func(MMC, mmc, 1)
@@ -160,8 +162,38 @@
 # define BOOT_TARGET_DEVICES_DHCP(func)
 #endif
 
+#if defined(CONFIG_ZYNQMP_GQSPI)
+# define BOOT_TARGET_DEVICES_QSPI(func)	func(QSPI, qspi, 0)
+#else
+# define BOOT_TARGET_DEVICES_QSPI(func)

include/configs/xilinx_zynqmp.h line 178

Quoted 10 lines
include/configs/xilinx_zynqmp.h +10 -0
+#endif
+
+#if defined(CONFIG_NAND_ARASAN)
+# define BOOT_TARGET_DEVICES_NAND(func)	func(NAND, nand, 0)
+#else
+# define BOOT_TARGET_DEVICES_NAND(func)
+#endif
+
+#define BOOTENV_DEV_QSPI(devtypeu, devtypel, instance) \
+	"bootcmd_qspi0=sf probe 0 0 0 && " \

This

Quoted 12 lines

include/configs/xilinx_zynqmp.h line 186

Quoted 8 lines
include/configs/xilinx_zynqmp.h +8 -0
+		       "sf read $scriptaddr $script_offset_f $script_size_f && " \
+		       "source ${scriptaddr}; echo SCRIPT FAILED: continuing...;\0"
+
+#define BOOTENV_DEV_NAME_QSPI(devtypeu, devtypel, instance) \
+	"qspi "
+
+#define BOOTENV_DEV_NAND(devtypeu, devtypel, instance) \
+	"bootcmd_nand0= nand info && " \

and this will emit errors if no device was found, right? That might be confusing for a user, if all he sees is a scary "device not found" message which simply only occurs because he doesn't have nand populated.

Quoted 5 lines

As you see above it is enabled only when devices are enabled. For generic u-boot for all zynqmp targets it should be correct to emit error message that nand is not detected if it is not present on the board. :-)
All these boot modes will be tried if the first boot mode fails.

Quoted 7 lines

Well, it's conditional on whether the driver is available, not whether the board actually exposes a flash device, right?

So think about the generic case - one U-Boot binary for all targets. What are you going to do there? That needs to have all possible boot target devices enabled, but how do you know whether an actual QSPI chip is attached to the SPI controller?

yes - sure all devices needs to be enabled. You don't know that. You need to try to probe it and access it.

Quoted 5 lines

I also think this problem is bigger than this patch, so don't take my comment as a nack. I'm just trying to raise that we should start to think about cases where "probe fails" is not an error and thus should not print an error message.

What is the current behavior if you failed to access network or SD and images is on SATA which is the last (or different order).
I expect that scanning finds nothing.
Nand/qspi should be just behave the same.

Thanks,
Michal

#6 lore raw

PATCH 2/2 arm64: zynqmp: Define distro boot commnads for qspi and nand

Quoted 95 lines · Michal Simek
Quoted 77 lines · Alexander Graf
Quoted 68 lines · Michal Simek
Quoted 54 lines · Alexander Graf
Quoted 38 lines · Michal Simek

From: Siva Durga Prasad Paladugu <[email protected]>

This patch adds distro boot commands for qspi and nand. The distro boot commands now reads the script from flash offset of 63.5MB and executes it.

Setup default location via script_offset_f to 63.5MB to match the most xilinx reference boards. 512kB allocated space for script size (script_size_f) should be more than enough to cover custom boot logic.

---

 include/configs/xilinx_zynqmp.h | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
include/configs/xilinx_zynqmp.h +6 -0
index d0515fa9bc46..5eeae6331e1c 100644
@@ -129,6 +129,8 @@
 	"kernel_addr_r=0x18000000\0" \
 	"scriptaddr=0x02000000\0" \
 	"ramdisk_addr_r=0x02100000\0" \
+	"script_offset_f=0x3e80000\0" \
+	"script_size_f=0x80000\0" \
 
 #if defined(CONFIG_MMC_SDHCI_ZYNQ)
 # define BOOT_TARGET_DEVICES_MMC(func)	func(MMC, mmc, 0) func(MMC, mmc, 1)
@@ -160,8 +162,38 @@
 # define BOOT_TARGET_DEVICES_DHCP(func)
 #endif
 
+#if defined(CONFIG_ZYNQMP_GQSPI)
+# define BOOT_TARGET_DEVICES_QSPI(func)	func(QSPI, qspi, 0)
+#else
+# define BOOT_TARGET_DEVICES_QSPI(func)

include/configs/xilinx_zynqmp.h line 178

Quoted 10 lines
include/configs/xilinx_zynqmp.h +10 -0
+#endif
+
+#if defined(CONFIG_NAND_ARASAN)
+# define BOOT_TARGET_DEVICES_NAND(func)	func(NAND, nand, 0)
+#else
+# define BOOT_TARGET_DEVICES_NAND(func)
+#endif
+
+#define BOOTENV_DEV_QSPI(devtypeu, devtypel, instance) \
+	"bootcmd_qspi0=sf probe 0 0 0 && " \

This

Quoted 12 lines

include/configs/xilinx_zynqmp.h line 186

Quoted 8 lines
include/configs/xilinx_zynqmp.h +8 -0
+		       "sf read $scriptaddr $script_offset_f $script_size_f && " \
+		       "source ${scriptaddr}; echo SCRIPT FAILED: continuing...;\0"
+
+#define BOOTENV_DEV_NAME_QSPI(devtypeu, devtypel, instance) \
+	"qspi "
+
+#define BOOTENV_DEV_NAND(devtypeu, devtypel, instance) \
+	"bootcmd_nand0= nand info && " \

and this will emit errors if no device was found, right? That might be confusing for a user, if all he sees is a scary "device not found" message which simply only occurs because he doesn't have nand populated.

Quoted 5 lines

As you see above it is enabled only when devices are enabled. For generic u-boot for all zynqmp targets it should be correct to emit error message that nand is not detected if it is not present on the board. :-)
All these boot modes will be tried if the first boot mode fails.

Quoted 7 lines

Well, it's conditional on whether the driver is available, not whether the board actually exposes a flash device, right?

So think about the generic case - one U-Boot binary for all targets. What are you going to do there? That needs to have all possible boot target devices enabled, but how do you know whether an actual QSPI chip is attached to the SPI controller?

yes - sure all devices needs to be enabled. You don't know that. You need to try to probe it and access it.

Quoted 5 lines

I also think this problem is bigger than this patch, so don't take my comment as a nack. I'm just trying to raise that we should start to think about cases where "probe fails" is not an error and thus should not print an error message.

Quoted 4 lines

What is the current behavior if you failed to access network or SD and images is on SATA which is the last (or different order).
I expect that scanning finds nothing.
Nand/qspi should be just behave the same.

It depends on the target; some will just not complain if no device was found, others will.

It's a bigger task, let's defer it to later :)

Alex

#7 lore raw

PATCH 1/2 ARM: zynq: Run distribution boot commands first

In reply to Michal Simek
Quoted 10 lines · Michal Simek

This patch is doing two things.
1. Exchanging order of boot commands. distro_bootcmd is run first followed by Xilinx boot command.
2. Remove CONFIG_BOOTCOMMAND from configs (and follow mainline) by creating Xilinx distribution bootcommand and wiring it as the last bootcommand.

QSPI, NAND distribution boot command will be added later.

This means that boot order wise, users may try to boot from external devices before internal ones ($modeboot) now, correct? I'm not sure everyone will be happy about that. I definitely am, so

Alex

#8 lore raw

PATCH 1/2 ARM: zynq: Run distribution boot commands first

Quoted 12 lines · Alexander Graf
Quoted 9 lines · Michal Simek

This patch is doing two things.
1. Exchanging order of boot commands. distro_bootcmd is run first followed by Xilinx boot command.
2. Remove CONFIG_BOOTCOMMAND from configs (and follow mainline) by creating Xilinx distribution bootcommand and wiring it as the last bootcommand.

QSPI, NAND distribution boot command will be added later.

Quoted 7 lines
Quoted 1 line

This means that boot order wise, users may try to boot from external devices before internal ones ($modeboot) now, correct? I'm not sure everyone will be happy about that. I definitely am, so

I just got patches from DP to include qspi/nand similar to what was in 2/2 but for Zynq.
There shouldn't be any product affected because they should have all variables already saved.

M