Skip to contentSkip to conversation

ARM: zynq: Boot variables cleanup

PATCH New Michal Simek 2 participants 7 messages Sep 11, 2019 – Oct 8, 2019 Arm/Zynq architecture

lore
Share & tools
lore
#0 lore raw

cover ARM: zynq: Boot variables cleanup

Hi,

for quite a long time Xilinx was using private boot method. Pretty long time ago we have enabled distribution boot method and provided time to do transition to it. Right now it is good time to remove old methods and move to distro boot fully.
It is also the part of unification between Xilinx Zynq/ZynqMP and Versal SoCs to use the same boot methods.
This series convert Zynq.

Variable modeboot is still setup because Topic boards and Syzygy are using it.

Thanks,
Michal

Michal Simek (5):
ARM: zynq: Specify MMC controller number for boot sequence
ARM: zynq: Enable USB1 as secondary boot device
ARM: zynq: Fix NOR boot mode
ARM: zynq: Use {} around variables for qspi and nand boot cmds
ARM: zynq: Remove all Xilinx private commands

 board/xilinx/zynq/board.c     |  2 +-
 include/configs/zynq-common.h | 66 +++++------------------------------
 2 files changed, 10 insertions(+), 58 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/5 ARM: zynq: Specify MMC controller number for boot sequence

Xilinx Zynq SoC has two sdhci controllers but boot is only possible from the first one. That's why there is a need to specify controller number. mmc1 is supposed to be secondary boot device and should be also listed in distribution boot.

---

 board/xilinx/zynq/board.c     | 2 +-
 include/configs/zynq-common.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
board/xilinx/zynq/board.c +1 -1
index 35191b2f813b..7cfe69db6935 100644
@@ -52,7 +52,7 @@ int board_late_init(void)
 		env_set("modeboot", "norboot");
 		break;
 	case ZYNQ_BM_SD:
-		mode = "mmc";
+		mode = "mmc0";
 		env_set("modeboot", "sdboot");
 		break;
 	case ZYNQ_BM_JTAG:
include/configs/zynq-common.h +1 -1
index 283a78494116..824efa9c004b 100644
@@ -111,7 +111,7 @@
 #else
 
 #ifdef CONFIG_CMD_MMC
-#define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0)
+#define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) func(MMC, mmc, 1)
 #else
 #define BOOT_TARGET_DEVICES_MMC(func)
 #endif
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/5 ARM: zynq: Enable USB1 as secondary boot device

In reply to Michal Simek

Xilinx Zynq SoC has two usb controllers and both could be used as secondary boot method.

---

 include/configs/zynq-common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/configs/zynq-common.h +1 -1
index 824efa9c004b..de6c06ba3ce7 100644
@@ -117,7 +117,7 @@
 #endif
 
 #ifdef CONFIG_CMD_USB
-#define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0)
+#define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0) func(USB, usb, 1)
 #else
 #define BOOT_TARGET_DEVICES_USB(func)
 #endif
Signature · 1 line
2.17.1
#3 lore raw

PATCH 3/5 ARM: zynq: Fix NOR boot mode

In reply to Michal Simek

There are two typos in this command that's why it couldn't work properly. This bootmode is almost unused from the beggining on this SoC.

Fixes 90e97ab31e02 ("arm: zynq: Define distro boot commnads for qspi, nand and nor")

---

 include/configs/zynq-common.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/configs/zynq-common.h +2 -2
index de6c06ba3ce7..09eada39023c 100644
@@ -175,7 +175,8 @@
 	"nand "
 
 #define BOOTENV_DEV_NOR(devtypeu, devtypel, instance) \
-	"bootcmd_nor=cp.b $scropt_offset_nor $scriptaddr $script_size_f && " \
+	"script_offset_nor=0xE2FC0000\0"        \
+	"bootcmd_nor=cp.b ${script_offset_nor} ${scriptaddr} ${script_size_f} && " \
 		     "source ${scriptaddr}; echo SCRIPT FAILED: continuing...;\0"
 
 #define BOOTENV_DEV_NAME_NOR(devtypeu, devtypel, instance) \
@@ -205,7 +206,6 @@
 	"fdt_high=0x20000000\0"		\
 	"initrd_high=0x20000000\0"	\
 	"scriptaddr=0x20000\0"	\
-	"script_offser_nor=0xE2FC0000\0"	\
 	"script_offset_f=0xFC0000\0"	\
 	"script_size_f=0x40000\0"	\
 	"loadbootenv_addr=0x2000000\0" \
Signature · 1 line
2.17.1
#4 lore raw

PATCH 4/5 ARM: zynq: Use {} around variables for qspi and nand boot cmds

In reply to Michal Simek

Follow conventions and used {} around variables.

Fixes 90e97ab31e02 ("arm: zynq: Define distro boot commnads for qspi, nand and nor")

---

 include/configs/zynq-common.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/configs/zynq-common.h +2 -2
index 09eada39023c..4b12be30c8aa 100644
@@ -160,7 +160,7 @@
 
 #define BOOTENV_DEV_QSPI(devtypeu, devtypel, instance) \
 	"bootcmd_qspi=sf probe 0 0 0 && " \
-		      "sf read $scriptaddr $script_offset_f $script_size_f && " \
+		      "sf read ${scriptaddr} ${script_offset_f} ${script_size_f} && " \
 		      "source ${scriptaddr}; echo SCRIPT FAILED: continuing...;\0"
 
 #define BOOTENV_DEV_NAME_QSPI(devtypeu, devtypel, instance) \
@@ -168,7 +168,7 @@
 
 #define BOOTENV_DEV_NAND(devtypeu, devtypel, instance) \
 	"bootcmd_nand=nand info && " \
-		      "nand read $scriptaddr $script_offset_f $script_size_f && " \
+		      "nand read ${scriptaddr} ${script_offset_f} ${script_size_f} && " \
 		      "source ${scriptaddr}; echo SCRIPT FAILED: continuing...;\0"
 
 #define BOOTENV_DEV_NAME_NAND(devtypeu, devtypel, instance) \
Signature · 1 line
2.17.1
#5 lore raw

PATCH 5/5 ARM: zynq: Remove all Xilinx private commands

In reply to Michal Simek

All platforms have been moved to distro boot that's why remove the rest of configurations to have unified boot flow.

---

 include/configs/zynq-common.h | 54 ++---------------------------------
 1 file changed, 3 insertions(+), 51 deletions(-)
include/configs/zynq-common.h +3 -51
index 4b12be30c8aa..b6c9f2c8dd5b 100644
@@ -152,12 +152,6 @@
 # define BOOT_TARGET_DEVICES_NOR(func)
 #endif
 
-#define BOOTENV_DEV_XILINX(devtypeu, devtypel, instance) \
-	"bootcmd_xilinx=run $modeboot\0"
-
-#define BOOTENV_DEV_NAME_XILINX(devtypeu, devtypel, instance) \
-	"xilinx "
-
 #define BOOTENV_DEV_QSPI(devtypeu, devtypel, instance) \
 	"bootcmd_qspi=sf probe 0 0 0 && " \
 		      "sf read ${scriptaddr} ${script_offset_f} ${script_size_f} && " \
@@ -189,8 +183,7 @@
 	BOOT_TARGET_DEVICES_NOR(func) \
 	BOOT_TARGET_DEVICES_USB(func) \
 	BOOT_TARGET_DEVICES_PXE(func) \
-	BOOT_TARGET_DEVICES_DHCP(func) \
-	func(XILINX, xilinx, na)
+	BOOT_TARGET_DEVICES_DHCP(func)
 
 #include <config_distro_bootcmd.h>
 #endif /* CONFIG_SPL_BUILD */
@@ -198,59 +191,18 @@
 /* Default environment */
 #ifndef CONFIG_EXTRA_ENV_SETTINGS
 #define CONFIG_EXTRA_ENV_SETTINGS	\
-	"fit_image=fit.itb\0"		\
-	"load_addr=0x2000000\0"		\
-	"fit_size=0x800000\0"		\
-	"flash_off=0x100000\0"		\
-	"nor_flash_off=0xE2100000\0"	\
 	"fdt_high=0x20000000\0"		\
 	"initrd_high=0x20000000\0"	\
 	"scriptaddr=0x20000\0"	\
 	"script_offset_f=0xFC0000\0"	\
 	"script_size_f=0x40000\0"	\
-	"loadbootenv_addr=0x2000000\0" \
 	"fdt_addr_r=0x1f00000\0"        \
 	"pxefile_addr_r=0x2000000\0"    \
 	"kernel_addr_r=0x2000000\0"     \
 	"scriptaddr=0x3000000\0"        \
 	"ramdisk_addr_r=0x3100000\0"    \
-	"bootenv=uEnv.txt\0" \
-	"bootenv_dev=mmc\0" \
-	"loadbootenv=load ${bootenv_dev} 0 ${loadbootenv_addr} ${bootenv}\0" \
-	"importbootenv=echo Importing environment from ${bootenv_dev} ...; " \
-		"env import -t ${loadbootenv_addr} $filesize\0" \
-	"bootenv_existence_test=test -e ${bootenv_dev} 0 /${bootenv}\0" \
-	"setbootenv=if env run bootenv_existence_test; then " \
-			"if env run loadbootenv; then " \
-				"env run importbootenv; " \
-			"fi; " \
-		"fi; \0" \
-	"sd_loadbootenv=setenv bootenv_dev mmc && " \
-			"run setbootenv \0" \
-	"usb_loadbootenv=setenv bootenv_dev usb && usb start && run setbootenv \0" \
-	"preboot=if test $modeboot = sdboot; then " \
-			"run sd_loadbootenv; " \
-			"echo Checking if uenvcmd is set ...; " \
-			"if test -n $uenvcmd; then " \
-				"echo Running uenvcmd ...; " \
-				"run uenvcmd; " \
-			"fi; " \
-		"fi; \0" \
-	"norboot=echo Copying FIT from NOR flash to RAM... && " \
-		"cp.b ${nor_flash_off} ${load_addr} ${fit_size} && " \
-		"bootm ${load_addr}\0" \
-	"sdboot=echo Copying FIT from SD to RAM... && " \
-		"load mmc 0 ${load_addr} ${fit_image} && " \
-		"bootm ${load_addr}\0" \
-	"jtagboot=echo TFTPing FIT to RAM... && " \
-		"tftpboot ${load_addr} ${fit_image} && " \
-		"bootm ${load_addr}\0" \
-	"usbboot=if usb start; then " \
-			"echo Copying FIT from USB to RAM... && " \
-			"load usb 0 ${load_addr} ${fit_image} && " \
-			"bootm ${load_addr}; fi\0" \
-		DFU_ALT_INFO \
-		BOOTENV
+	DFU_ALT_INFO \
+	BOOTENV
 #endif
 
 /* Miscellaneous configurable options */
Signature · 1 line
2.17.1
#6 lore raw

cover ARM: zynq: Boot variables cleanup

In reply to Michal Simek

st 11. 9. 2019 v 13:28 odesílatel Michal Simek <[email protected]> napsal:

Quoted 24 lines

Hi,

for quite a long time Xilinx was using private boot method. Pretty long time ago we have enabled distribution boot method and provided time to do transition to it. Right now it is good time to remove old methods and move to distro boot fully.
It is also the part of unification between Xilinx Zynq/ZynqMP and Versal SoCs to use the same boot methods.
This series convert Zynq.

Variable modeboot is still setup because Topic boards and Syzygy are using it.

Thanks,
Michal

Michal Simek (5):
ARM: zynq: Specify MMC controller number for boot sequence
ARM: zynq: Enable USB1 as secondary boot device
ARM: zynq: Fix NOR boot mode
ARM: zynq: Use {} around variables for qspi and nand boot cmds
ARM: zynq: Remove all Xilinx private commands

Quoted 7 lines
 board/xilinx/zynq/board.c     |  2 +-
 include/configs/zynq-common.h | 66 +++++------------------------------
 2 files changed, 10 insertions(+), 58 deletions(-)

--
2.17.1

Applied all.
M

Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs