aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVenkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>2023-09-04 08:50:33 +0530
committerMichal Simek <michal.simek@amd.com>2023-09-21 13:20:11 +0200
commitc55eb1d542363951347f73c8f03ebcfc63833e11 (patch)
tree70eb1ff8ce8aca0f6b8ad34e18933c48fb66a379
parent0bbc962efda40d6b9b479c6be7fb4c7fb6129707 (diff)
downloadu-boot-c55eb1d542363951347f73c8f03ebcfc63833e11.zip
u-boot-c55eb1d542363951347f73c8f03ebcfc63833e11.tar.gz
u-boot-c55eb1d542363951347f73c8f03ebcfc63833e11.tar.bz2
xilinx: versal-net: Do not setup boot_targets if driver is not enabled
SOC can boot in the device which is not accessible from APU and running this is detected as error which ends up in stopping boot process. Boot mode detection and logic around is present to setup priority on boot devices that SOC boot device is likely also used for booting OS. Change logic to detect this case with showing message about it but don't fail in boot process and don't prioritize boot device in this case. Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com> Signed-off-by: Michal Simek <michal.simek@amd.com> Link: https://lore.kernel.org/r/20230904032035.11926-2-venkatesh.abbarapu@amd.com
-rw-r--r--board/xilinx/versal-net/board.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/board/xilinx/versal-net/board.c b/board/xilinx/versal-net/board.c
index f0d2224..7ad299f 100644
--- a/board/xilinx/versal-net/board.c
+++ b/board/xilinx/versal-net/board.c
@@ -201,7 +201,7 @@ int board_late_init(void)
int bootseq = -1;
int bootseq_len = 0;
int env_targets_len = 0;
- const char *mode;
+ const char *mode = NULL;
char *new_targets;
char *env_targets;
@@ -229,8 +229,8 @@ int board_late_init(void)
puts("QSPI_MODE_24\n");
if (uclass_get_device_by_name(UCLASS_SPI,
"spi@f1030000", &dev)) {
- puts("Boot from QSPI but without QSPI enabled!\n");
- return -1;
+ debug("QSPI driver for QSPI device is not present\n");
+ break;
}
mode = "xspi";
bootseq = dev_seq(dev);
@@ -239,8 +239,8 @@ int board_late_init(void)
puts("QSPI_MODE_32\n");
if (uclass_get_device_by_name(UCLASS_SPI,
"spi@f1030000", &dev)) {
- puts("Boot from QSPI but without QSPI enabled!\n");
- return -1;
+ debug("QSPI driver for QSPI device is not present\n");
+ break;
}
mode = "xspi";
bootseq = dev_seq(dev);
@@ -249,8 +249,8 @@ int board_late_init(void)
puts("OSPI_MODE\n");
if (uclass_get_device_by_name(UCLASS_SPI,
"spi@f1010000", &dev)) {
- puts("Boot from OSPI but without OSPI enabled!\n");
- return -1;
+ debug("OSPI driver for OSPI device is not present\n");
+ break;
}
mode = "xspi";
bootseq = dev_seq(dev);
@@ -264,8 +264,8 @@ int board_late_init(void)
puts("SD_MODE\n");
if (uclass_get_device_by_name(UCLASS_MMC,
"mmc@f1040000", &dev)) {
- puts("Boot from SD0 but without SD0 enabled!\n");
- return -1;
+ debug("SD0 driver for SD0 device is not present\n");
+ break;
}
debug("mmc0 device found at %p, seq %d\n", dev, dev_seq(dev));
@@ -279,8 +279,8 @@ int board_late_init(void)
puts("SD_MODE1\n");
if (uclass_get_device_by_name(UCLASS_MMC,
"mmc@f1050000", &dev)) {
- puts("Boot from SD1 but without SD1 enabled!\n");
- return -1;
+ debug("SD1 driver for SD1 device is not present\n");
+ break;
}
debug("mmc1 device found at %p, seq %d\n", dev, dev_seq(dev));
@@ -288,38 +288,38 @@ int board_late_init(void)
bootseq = dev_seq(dev);
break;
default:
- mode = "";
printf("Invalid Boot Mode:0x%x\n", bootmode);
break;
}
- if (bootseq >= 0) {
- bootseq_len = snprintf(NULL, 0, "%i", bootseq);
- debug("Bootseq len: %x\n", bootseq_len);
- }
-
- /*
- * One terminating char + one byte for space between mode
- * and default boot_targets
- */
- env_targets = env_get("boot_targets");
- if (env_targets)
- env_targets_len = strlen(env_targets);
-
- new_targets = calloc(1, strlen(mode) + env_targets_len + 2 +
- bootseq_len);
- if (!new_targets)
- return -ENOMEM;
-
- if (bootseq >= 0)
- sprintf(new_targets, "%s%x %s", mode, bootseq,
- env_targets ? env_targets : "");
- else
- sprintf(new_targets, "%s %s", mode,
- env_targets ? env_targets : "");
-
- env_set("boot_targets", new_targets);
+ if (mode) {
+ if (bootseq >= 0) {
+ bootseq_len = snprintf(NULL, 0, "%i", bootseq);
+ debug("Bootseq len: %x\n", bootseq_len);
+ }
+ /*
+ * One terminating char + one byte for space between mode
+ * and default boot_targets
+ */
+ env_targets = env_get("boot_targets");
+ if (env_targets)
+ env_targets_len = strlen(env_targets);
+
+ new_targets = calloc(1, strlen(mode) + env_targets_len + 2 +
+ bootseq_len);
+ if (!new_targets)
+ return -ENOMEM;
+
+ if (bootseq >= 0)
+ sprintf(new_targets, "%s%x %s", mode, bootseq,
+ env_targets ? env_targets : "");
+ else
+ sprintf(new_targets, "%s %s", mode,
+ env_targets ? env_targets : "");
+
+ env_set("boot_targets", new_targets);
+ }
return board_late_init_xilinx();
}