Skip to contentSkip to conversation

ARM64: zynqmp: Add support for standard distro boot commands

PATCH New Michal Simek 2 participants 5 messages Jun 1, 2016 – Jun 2, 2016 Arm/Zynq architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM64: zynqmp: Add support for standard distro boot commands

Nand and QSPI are not defined now but this will be extended. Based on selected bootmode boot_targets are rewritten. Patch also contains detection if variables are saved. If yes don't rewrite boot_targets variable.

Also move variable setup to the end of file because SCSI needs to be defined before others macros are using it.

---

Patch depends on
"env: Setup GD_FLG_ENV_DEFAULT flag when default environment are used"

---
 board/xilinx/zynqmp/zynqmp.c    | 20 +++++++++-----
 include/configs/xilinx_zynqmp.h | 59 ++++++++++++++++++++++++++++++-----------
 2 files changed, 57 insertions(+), 22 deletions(-)
board/xilinx/zynqmp/zynqmp.c +13 -7
index 4623cd49e9c7..46c332215b6b 100644
@@ -215,6 +215,11 @@ int board_late_init(void)
 	u32 reg = 0;
 	u8 bootmode;
 
+	if (!(gd->flags & GD_FLG_ENV_DEFAULT)) {
+		debug("Saved variables - Skipping\n");
+		return 0;
+	}
+
 	reg = readl(&crlapb_base->boot_mode);
 	bootmode = reg & BOOT_MODES_MASK;
 
@@ -222,31 +227,32 @@ int board_late_init(void)
 	switch (bootmode) {
 	case JTAG_MODE:
 		puts("JTAG_MODE\n");
-		setenv("modeboot", "jtagboot");
+		setenv("boot_targets", "pxe dhcp");
 		break;
 	case QSPI_MODE_24BIT:
 	case QSPI_MODE_32BIT:
-		setenv("modeboot", "qspiboot");
+		setenv("boot_targets", "qspi0");
 		puts("QSPI_MODE\n");
 		break;
 	case EMMC_MODE:
 		puts("EMMC_MODE\n");
-		setenv("modeboot", "sdboot");
+		setenv("boot_targets", "mmc0");
 		break;
 	case SD_MODE:
 		puts("SD_MODE\n");
-		setenv("modeboot", "sdboot");
+		setenv("boot_targets", "mmc0");
 		break;
 	case SD_MODE1:
 		puts("SD_MODE1\n");
 #if defined(CONFIG_ZYNQ_SDHCI0) && defined(CONFIG_ZYNQ_SDHCI1)
-		setenv("sdbootdev", "1");
+		setenv("boot_targets", "mmc1");
+#else
+		setenv("boot_targets", "mmc0");
 #endif
-		setenv("modeboot", "sdboot");
 		break;
 	case NAND_MODE:
 		puts("NAND_MODE\n");
-		setenv("modeboot", "nandboot");
+		setenv("boot_targets", "nand0");
 		break;
 	default:
 		printf("Invalid Boot Mode:0x%x\n", bootmode);
include/configs/xilinx_zynqmp.h +44 -15

71 lines not on this page · raw message

Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 ARM64: zynqmp: Add support for standard distro boot commands

Quoted 36 lines · Michal Simek

Nand and QSPI are not defined now but this will be extended. Based on selected bootmode boot_targets are rewritten. Patch also contains detection if variables are saved. If yes don't rewrite boot_targets variable.

Also move variable setup to the end of file because SCSI needs to be defined before others macros are using it.

---

Patch depends on
"env: Setup GD_FLG_ENV_DEFAULT flag when default environment are used"

---
 board/xilinx/zynqmp/zynqmp.c    | 20 +++++++++-----
 include/configs/xilinx_zynqmp.h | 59 ++++++++++++++++++++++++++++++-----------
 2 files changed, 57 insertions(+), 22 deletions(-)
board/xilinx/zynqmp/zynqmp.c +5 -0
index 4623cd49e9c7..46c332215b6b 100644
@@ -215,6 +215,11 @@ int board_late_init(void)
 	u32 reg = 0;
 	u8 bootmode;
 
+	if (!(gd->flags & GD_FLG_ENV_DEFAULT)) {
+		debug("Saved variables - Skipping\n");
+		return 0;
+	}
+
 	reg = readl(&crlapb_base->boot_mode);
 	bootmode = reg & BOOT_MODES_MASK;
 

board/xilinx/zynqmp/zynqmp.c int board_late_init(void) · line 230

Quoted 5 lines
board/xilinx/zynqmp/zynqmp.c +1 -1
@@ -222,31 +227,32 @@ int board_late_init(void)
 	switch (bootmode) {
 	case JTAG_MODE:
 		puts("JTAG_MODE\n");
-		setenv("modeboot", "jtagboot");
+		setenv("boot_targets", "pxe dhcp");

Is there a particular reason you're overwriting the boot_targets rather than prepending them?

If I plug in an SD card with U-Boot on it, but my OS is on a SATA attached disk (which is how I currently use the ZynqMP), this would set the boot_targets to SD rather than "SD first, default list later".

If we instead do something like

  boot_targets = "pxe dhcp " + getenv(boot_targets);

we would maintain a workable fallback path. Yes, we might check a target device twice, but since we know that it fails I don't think it's too much of a problem.

Alex

#2 lore raw

PATCH 1/1 ARM64: zynqmp: Add support for standard distro boot commands

Quoted 52 lines · Alexander Graf
Quoted 36 lines · Michal Simek

Nand and QSPI are not defined now but this will be extended. Based on selected bootmode boot_targets are rewritten. Patch also contains detection if variables are saved. If yes don't rewrite boot_targets variable.

Also move variable setup to the end of file because SCSI needs to be defined before others macros are using it.

---

Patch depends on
"env: Setup GD_FLG_ENV_DEFAULT flag when default environment are used"

---
 board/xilinx/zynqmp/zynqmp.c    | 20 +++++++++-----
 include/configs/xilinx_zynqmp.h | 59 ++++++++++++++++++++++++++++++-----------
 2 files changed, 57 insertions(+), 22 deletions(-)
board/xilinx/zynqmp/zynqmp.c +5 -0
index 4623cd49e9c7..46c332215b6b 100644
@@ -215,6 +215,11 @@ int board_late_init(void)
 	u32 reg = 0;
 	u8 bootmode;
 
+	if (!(gd->flags & GD_FLG_ENV_DEFAULT)) {
+		debug("Saved variables - Skipping\n");
+		return 0;
+	}
+
 	reg = readl(&crlapb_base->boot_mode);
 	bootmode = reg & BOOT_MODES_MASK;
 

board/xilinx/zynqmp/zynqmp.c int board_late_init(void) · line 230

Quoted 5 lines
board/xilinx/zynqmp/zynqmp.c +1 -1
@@ -222,31 +227,32 @@ int board_late_init(void)
 	switch (bootmode) {
 	case JTAG_MODE:
 		puts("JTAG_MODE\n");
-		setenv("modeboot", "jtagboot");
+		setenv("boot_targets", "pxe dhcp");

Is there a particular reason you're overwriting the boot_targets rather than prepending them?

If I plug in an SD card with U-Boot on it, but my OS is on a SATA attached disk (which is how I currently use the ZynqMP), this would set the boot_targets to SD rather than "SD first, default list later".

Quoted 7 lines

If we instead do something like

  boot_targets = "pxe dhcp " + getenv(boot_targets);

we would maintain a workable fallback path. Yes, we might check a target device twice, but since we know that it fails I don't think it's too much of a problem.

No problem to do it but maybe in mmc0 case we should also remove mmc0 from boot_targets which is already there.

Thanks,
Michal

#3 lore raw

PATCH 1/1 ARM64: zynqmp: Add support for standard distro boot commands

Quoted 55 lines · Michal Simek
Quoted 54 lines · Alexander Graf
Quoted 36 lines · Michal Simek

Nand and QSPI are not defined now but this will be extended. Based on selected bootmode boot_targets are rewritten. Patch also contains detection if variables are saved. If yes don't rewrite boot_targets variable.

Also move variable setup to the end of file because SCSI needs to be defined before others macros are using it.

---

Patch depends on
"env: Setup GD_FLG_ENV_DEFAULT flag when default environment are used"

---
 board/xilinx/zynqmp/zynqmp.c    | 20 +++++++++-----
 include/configs/xilinx_zynqmp.h | 59 ++++++++++++++++++++++++++++++-----------
 2 files changed, 57 insertions(+), 22 deletions(-)
board/xilinx/zynqmp/zynqmp.c +5 -0
index 4623cd49e9c7..46c332215b6b 100644
@@ -215,6 +215,11 @@ int board_late_init(void)
 	u32 reg = 0;
 	u8 bootmode;
 
+	if (!(gd->flags & GD_FLG_ENV_DEFAULT)) {
+		debug("Saved variables - Skipping\n");
+		return 0;
+	}
+
 	reg = readl(&crlapb_base->boot_mode);
 	bootmode = reg & BOOT_MODES_MASK;
 

board/xilinx/zynqmp/zynqmp.c int board_late_init(void) · line 230

Quoted 5 lines
board/xilinx/zynqmp/zynqmp.c +1 -1
@@ -222,31 +227,32 @@ int board_late_init(void)
 	switch (bootmode) {
 	case JTAG_MODE:
 		puts("JTAG_MODE\n");
-		setenv("modeboot", "jtagboot");
+		setenv("boot_targets", "pxe dhcp");

Is there a particular reason you're overwriting the boot_targets rather than prepending them?

If I plug in an SD card with U-Boot on it, but my OS is on a SATA attached disk (which is how I currently use the ZynqMP), this would set the boot_targets to SD rather than "SD first, default list later".

If we instead do something like

Quoted 8 lines
Quoted 5 lines
  boot_targets = "pxe dhcp " + getenv(boot_targets);

we would maintain a workable fallback path. Yes, we might check a target device twice, but since we know that it fails I don't think it's too much of a problem.

No problem to do it but maybe in mmc0 case we should also remove mmc0 from boot_targets which is already there.

If you want to write the code for that, sure :).

Alex

#4 lore raw

PATCH 1/1 ARM64: zynqmp: Add support for standard distro boot commands

Quoted 60 lines · Alexander Graf
Quoted 57 lines · Michal Simek
Quoted 56 lines · Alexander Graf
Quoted 36 lines · Michal Simek

Nand and QSPI are not defined now but this will be extended. Based on selected bootmode boot_targets are rewritten. Patch also contains detection if variables are saved. If yes don't rewrite boot_targets variable.

Also move variable setup to the end of file because SCSI needs to be defined before others macros are using it.

---

Patch depends on
"env: Setup GD_FLG_ENV_DEFAULT flag when default environment are used"

---
 board/xilinx/zynqmp/zynqmp.c    | 20 +++++++++-----
 include/configs/xilinx_zynqmp.h | 59 ++++++++++++++++++++++++++++++-----------
 2 files changed, 57 insertions(+), 22 deletions(-)
board/xilinx/zynqmp/zynqmp.c +5 -0
index 4623cd49e9c7..46c332215b6b 100644
@@ -215,6 +215,11 @@ int board_late_init(void)
 	u32 reg = 0;
 	u8 bootmode;
 
+	if (!(gd->flags & GD_FLG_ENV_DEFAULT)) {
+		debug("Saved variables - Skipping\n");
+		return 0;
+	}
+
 	reg = readl(&crlapb_base->boot_mode);
 	bootmode = reg & BOOT_MODES_MASK;
 

board/xilinx/zynqmp/zynqmp.c int board_late_init(void) · line 230

Quoted 5 lines
board/xilinx/zynqmp/zynqmp.c +1 -1
@@ -222,31 +227,32 @@ int board_late_init(void)
 	switch (bootmode) {
 	case JTAG_MODE:
 		puts("JTAG_MODE\n");
-		setenv("modeboot", "jtagboot");
+		setenv("boot_targets", "pxe dhcp");

Is there a particular reason you're overwriting the boot_targets rather than prepending them?

If I plug in an SD card with U-Boot on it, but my OS is on a SATA attached disk (which is how I currently use the ZynqMP), this would set the boot_targets to SD rather than "SD first, default list later".

If we instead do something like

  boot_targets = "pxe dhcp " + getenv(boot_targets);
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

we would maintain a workable fallback path. Yes, we might check a target device twice, but since we know that it fails I don't think it's too much of a problem.

No problem to do it but maybe in mmc0 case we should also remove mmc0 from boot_targets which is already there.

If you want to write the code for that, sure :).

Let's just use simple version first and then we can tune this. There is checking if boot fails that's why it is not big deal just showing down boot process.

Thanks,
Michal