arm64: versal-net: spi: Update boot sequence dynamically

Currently xspi0 is used for all spi boot modes, it means it will use "sf
probe 0 0 0" for all spi's irrespective of which node it is wired.

Get boot sequence from dev_seq() and update boot command for xspi
dynamically.

As a result bootcmd for spi is updated as below when two instances of spi
are present in DT node.
bootcmd_xspi0=devnum_xspi=0; run xspi_boot
bootcmd_xspi1=devnum_xspi=1; run xspi_boot

xspi_boot=sf probe $devnum_xspi:0 0 0 && sf read $scriptaddr
$script_offset_f $script_size_f && echo XSPI: Trying to boot script at
${scriptaddr} && source ${scriptaddr}; echo XSPI: SCRIPT FAILED:
continuing...;

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20230614093058.30438-1-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
diff --git a/board/xilinx/versal-net/board.c b/board/xilinx/versal-net/board.c
index a68b608..f0d2224 100644
--- a/board/xilinx/versal-net/board.c
+++ b/board/xilinx/versal-net/board.c
@@ -227,15 +227,33 @@
 		break;
 	case QSPI_MODE_24BIT:
 		puts("QSPI_MODE_24\n");
-		mode = "xspi0";
+		if (uclass_get_device_by_name(UCLASS_SPI,
+					      "spi@f1030000", &dev)) {
+			puts("Boot from QSPI but without QSPI enabled!\n");
+			return -1;
+		}
+		mode = "xspi";
+		bootseq = dev_seq(dev);
 		break;
 	case QSPI_MODE_32BIT:
 		puts("QSPI_MODE_32\n");
-		mode = "xspi0";
+		if (uclass_get_device_by_name(UCLASS_SPI,
+					      "spi@f1030000", &dev)) {
+			puts("Boot from QSPI but without QSPI enabled!\n");
+			return -1;
+		}
+		mode = "xspi";
+		bootseq = dev_seq(dev);
 		break;
 	case OSPI_MODE:
 		puts("OSPI_MODE\n");
-		mode = "xspi0";
+		if (uclass_get_device_by_name(UCLASS_SPI,
+					      "spi@f1010000", &dev)) {
+			puts("Boot from OSPI but without OSPI enabled!\n");
+			return -1;
+		}
+		mode = "xspi";
+		bootseq = dev_seq(dev);
 		break;
 	case EMMC_MODE:
 		puts("EMMC_MODE\n");