* [PATCH] arm64: versal-net: spi: Update boot sequence dynamically
@ 2023-06-14 9:30 Ashok Reddy Soma
2023-06-23 12:55 ` Michal Simek
0 siblings, 1 reply; 2+ messages in thread
From: Ashok Reddy Soma @ 2023-06-14 9:30 UTC (permalink / raw)
To: u-boot; +Cc: michal.simek, git, Ashok Reddy Soma
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>
---
board/xilinx/versal-net/board.c | 24 +++++++++++++++++++++---
include/configs/xilinx_versal_net.h | 19 ++++++++++++-------
2 files changed, 33 insertions(+), 10 deletions(-)
diff --git a/board/xilinx/versal-net/board.c b/board/xilinx/versal-net/board.c
index 6595d6f3e8..00b01d9641 100644
--- a/board/xilinx/versal-net/board.c
+++ b/board/xilinx/versal-net/board.c
@@ -214,15 +214,33 @@ int board_late_init(void)
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");
diff --git a/include/configs/xilinx_versal_net.h b/include/configs/xilinx_versal_net.h
index 424ead038e..613cce46f9 100644
--- a/include/configs/xilinx_versal_net.h
+++ b/include/configs/xilinx_versal_net.h
@@ -76,20 +76,24 @@
# define BOOT_TARGET_DEVICES_DHCP(func)
#endif
-#if defined(CONFIG_ZYNQMP_GQSPI) || defined(CONFIG_CADENCE_OSPI_VERSAL_NET)
-# define BOOT_TARGET_DEVICES_XSPI(func) func(XSPI, xspi, 0)
+#if defined(CONFIG_ZYNQMP_GQSPI) || defined(CONFIG_CADENCE_OSPI_VERSAL)
+# define BOOT_TARGET_DEVICES_XSPI(func) func(XSPI, xspi, 0) func(XSPI, xspi, 1)
+# define BOOTENV_DEV_SHARED_XSPI \
+ "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...;\0"
#else
# define BOOT_TARGET_DEVICES_XSPI(func)
+# define BOOTENV_DEV_SHARED_XSPI
#endif
#define BOOTENV_DEV_XSPI(devtypeu, devtypel, instance) \
- "bootcmd_xspi0=sf probe 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...;\0"
+ "bootcmd_" #devtypel #instance "=" \
+ "devnum_xspi=" #instance "; run " #devtypel "_boot\0" \
#define BOOTENV_DEV_NAME_XSPI(devtypeu, devtypel, instance) \
- "xspi0 "
+ ""
#define BOOT_TARGET_DEVICES_JTAG(func) func(JTAG, jtag, na)
@@ -127,6 +131,7 @@
#define CFG_EXTRA_ENV_SETTINGS \
ENV_MEM_LAYOUT_SETTINGS \
BOOTENV \
+ BOOTENV_DEV_SHARED_XSPI \
DFU_ALT_INFO
#endif
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] arm64: versal-net: spi: Update boot sequence dynamically
2023-06-14 9:30 [PATCH] arm64: versal-net: spi: Update boot sequence dynamically Ashok Reddy Soma
@ 2023-06-23 12:55 ` Michal Simek
0 siblings, 0 replies; 2+ messages in thread
From: Michal Simek @ 2023-06-23 12:55 UTC (permalink / raw)
To: Ashok Reddy Soma, u-boot; +Cc: git
On 6/14/23 11:30, Ashok Reddy Soma wrote:
> 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>
> ---
>
> board/xilinx/versal-net/board.c | 24 +++++++++++++++++++++---
> include/configs/xilinx_versal_net.h | 19 ++++++++++++-------
> 2 files changed, 33 insertions(+), 10 deletions(-)
>
> diff --git a/board/xilinx/versal-net/board.c b/board/xilinx/versal-net/board.c
> index 6595d6f3e8..00b01d9641 100644
> --- a/board/xilinx/versal-net/board.c
> +++ b/board/xilinx/versal-net/board.c
> @@ -214,15 +214,33 @@ int board_late_init(void)
> 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");
> diff --git a/include/configs/xilinx_versal_net.h b/include/configs/xilinx_versal_net.h
> index 424ead038e..613cce46f9 100644
> --- a/include/configs/xilinx_versal_net.h
> +++ b/include/configs/xilinx_versal_net.h
> @@ -76,20 +76,24 @@
> # define BOOT_TARGET_DEVICES_DHCP(func)
> #endif
>
> -#if defined(CONFIG_ZYNQMP_GQSPI) || defined(CONFIG_CADENCE_OSPI_VERSAL_NET)
> -# define BOOT_TARGET_DEVICES_XSPI(func) func(XSPI, xspi, 0)
> +#if defined(CONFIG_ZYNQMP_GQSPI) || defined(CONFIG_CADENCE_OSPI_VERSAL)
> +# define BOOT_TARGET_DEVICES_XSPI(func) func(XSPI, xspi, 0) func(XSPI, xspi, 1)
> +# define BOOTENV_DEV_SHARED_XSPI \
> + "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...;\0"
> #else
> # define BOOT_TARGET_DEVICES_XSPI(func)
> +# define BOOTENV_DEV_SHARED_XSPI
> #endif
>
> #define BOOTENV_DEV_XSPI(devtypeu, devtypel, instance) \
> - "bootcmd_xspi0=sf probe 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...;\0"
> + "bootcmd_" #devtypel #instance "=" \
> + "devnum_xspi=" #instance "; run " #devtypel "_boot\0" \
>
> #define BOOTENV_DEV_NAME_XSPI(devtypeu, devtypel, instance) \
> - "xspi0 "
> + ""
>
> #define BOOT_TARGET_DEVICES_JTAG(func) func(JTAG, jtag, na)
>
> @@ -127,6 +131,7 @@
> #define CFG_EXTRA_ENV_SETTINGS \
> ENV_MEM_LAYOUT_SETTINGS \
> BOOTENV \
> + BOOTENV_DEV_SHARED_XSPI \
> DFU_ALT_INFO
> #endif
>
Applied.
M
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-23 12:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-14 9:30 [PATCH] arm64: versal-net: spi: Update boot sequence dynamically Ashok Reddy Soma
2023-06-23 12:55 ` Michal Simek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox