summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Simek <[email protected]>2026-06-23 14:53:40 +0200
committerMichal Simek <[email protected]>2026-07-08 08:55:51 +0200
commitd9938274747cafa24af47d404e78001396f7fdf0 (patch)
treed49cb3d8cff4476032828263e43a17ea06884b1b
parentfb3801be128c9d0bf34a1797141a972b0759cb25 (diff)
arm64: versal-net: Simplify spi_get_bootseq() bootmode switch
The QSPI and OSPI cases only differ in the SPI device name. Pick the name in the switch and perform a single uclass_get_device_by_name() lookup afterwards, instead of repeating the lookup and dev_seq() in every case. No functional change. Signed-off-by: Michal Simek <[email protected]> Link: https://patch.msgid.link/191f0f583e2d02c184ea2a2a2fe0ef473ca9fe61.1782219202.git.michal.simek@amd.com
-rw-r--r--board/xilinx/versal-net/board.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/board/xilinx/versal-net/board.c b/board/xilinx/versal-net/board.c
index 5ad8c8d6426..50dd49927be 100644
--- a/board/xilinx/versal-net/board.c
+++ b/board/xilinx/versal-net/board.c
@@ -71,41 +71,34 @@ int board_early_init_r(void)
static int spi_get_bootseq(u8 bootmode)
{
struct udevice *dev;
- int bootseq = -1;
+ const char *name;
+ int bootseq;
switch (bootmode) {
case QSPI_MODE_24BIT:
puts("QSPI_MODE_24\n");
- if (uclass_get_device_by_name(UCLASS_SPI,
- "spi@f1030000", &dev)) {
- debug("QSPI driver for QSPI device is not present\n");
- break;
- }
- bootseq = dev_seq(dev);
+ name = "spi@f1030000";
break;
case QSPI_MODE_32BIT:
puts("QSPI_MODE_32\n");
- if (uclass_get_device_by_name(UCLASS_SPI,
- "spi@f1030000", &dev)) {
- debug("QSPI driver for QSPI device is not present\n");
- break;
- }
- bootseq = dev_seq(dev);
+ name = "spi@f1030000";
break;
case OSPI_MODE:
puts("OSPI_MODE\n");
- if (uclass_get_device_by_name(UCLASS_SPI,
- "spi@f1010000", &dev)) {
- debug("OSPI driver for OSPI device is not present\n");
- break;
- }
- bootseq = dev_seq(dev);
+ name = "spi@f1010000";
break;
default:
- break;
+ return -1;
}
+ if (uclass_get_device_by_name(UCLASS_SPI, name, &dev)) {
+ debug("SPI driver for %s is not present\n", name);
+ return -1;
+ }
+
+ bootseq = dev_seq(dev);
debug("bootseq %d\n", bootseq);
+
return bootseq;
}