public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] ARM: mach-k3: sysfw-loader: Copy sysfw.itb to OCRAM in OSPI/SPI bootmode
@ 2021-12-23 13:56 Vignesh Raghavendra
  2021-12-24 10:52 ` Pratyush Yadav
  2022-01-17 18:36 ` Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Vignesh Raghavendra @ 2021-12-23 13:56 UTC (permalink / raw)
  To: Tom Rini; +Cc: u-boot, Vignesh Raghavendra, Praneeth Bajjuri, Pratyush Yadav

In case of xSPI bootmode OSPI flash is in DDR mode and needs to be accessed
in multiple of 16bit accesses Hence we cannot parse sysfw.itb FIT image
directly on OSPI flash via MMIO window. So, copy the image to internal
on-chip RAM before parsing the image.

Moreover, board cfg data maybe modified by ROM/TIFS in case of HS platform
and thus cannot reside in OSPI/xSPI and needs to be copied over to
internal OCRAM.

This unblocks OSPI/xSPI boot on HS platforms

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Reviewed-by: Dave Gerlach <d-gerlach@ti.com>
Tested-by: Keerthy <j-keerthy@ti.com>
---
 arch/arm/mach-k3/sysfw-loader.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-k3/sysfw-loader.c b/arch/arm/mach-k3/sysfw-loader.c
index 9ce576186c..5e48c36ccd 100644
--- a/arch/arm/mach-k3/sysfw-loader.c
+++ b/arch/arm/mach-k3/sysfw-loader.c
@@ -22,6 +22,7 @@
 #include <dm/uclass-internal.h>
 #include <spi_flash.h>
 
+#include <asm/io.h>
 #include <asm/arch/sys_proto.h>
 #include "common.h"
 
@@ -335,6 +336,14 @@ static void *k3_sysfw_get_spi_addr(void)
 
 	return (void *)(addr + CONFIG_K3_SYSFW_IMAGE_SPI_OFFS);
 }
+
+static void k3_sysfw_spi_copy(u32 *dst, u32 *src, size_t len)
+{
+	size_t i;
+
+	for (i = 0; i < len / sizeof(*dst); i++)
+		*dst++ = *src++;
+}
 #endif
 
 void k3_sysfw_loader(bool rom_loaded_sysfw,
@@ -344,6 +353,9 @@ void k3_sysfw_loader(bool rom_loaded_sysfw,
 	struct spl_image_info spl_image = { 0 };
 	struct spl_boot_device bootdev = { 0 };
 	struct ti_sci_handle *ti_sci;
+#if CONFIG_IS_ENABLED(SPI_LOAD)
+	void *sysfw_spi_base;
+#endif
 	int ret = 0;
 
 	if (rom_loaded_sysfw) {
@@ -394,9 +406,11 @@ void k3_sysfw_loader(bool rom_loaded_sysfw,
 #endif
 #if CONFIG_IS_ENABLED(SPI_LOAD)
 	case BOOT_DEVICE_SPI:
-		sysfw_load_address = k3_sysfw_get_spi_addr();
-		if (!sysfw_load_address)
+		sysfw_spi_base = k3_sysfw_get_spi_addr();
+		if (!sysfw_spi_base)
 			ret = -ENODEV;
+		k3_sysfw_spi_copy(sysfw_load_address, sysfw_spi_base,
+				  CONFIG_K3_SYSFW_IMAGE_SIZE_MAX);
 		break;
 #endif
 #if CONFIG_IS_ENABLED(YMODEM_SUPPORT)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ARM: mach-k3: sysfw-loader: Copy sysfw.itb to OCRAM in OSPI/SPI bootmode
  2021-12-23 13:56 [PATCH] ARM: mach-k3: sysfw-loader: Copy sysfw.itb to OCRAM in OSPI/SPI bootmode Vignesh Raghavendra
@ 2021-12-24 10:52 ` Pratyush Yadav
  2022-01-17 18:36 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Pratyush Yadav @ 2021-12-24 10:52 UTC (permalink / raw)
  To: Vignesh Raghavendra; +Cc: Tom Rini, u-boot, Praneeth Bajjuri

On 23/12/21 07:26PM, Vignesh Raghavendra wrote:
> In case of xSPI bootmode OSPI flash is in DDR mode and needs to be accessed
> in multiple of 16bit accesses Hence we cannot parse sysfw.itb FIT image
> directly on OSPI flash via MMIO window. So, copy the image to internal
> on-chip RAM before parsing the image.
> 
> Moreover, board cfg data maybe modified by ROM/TIFS in case of HS platform
> and thus cannot reside in OSPI/xSPI and needs to be copied over to
> internal OCRAM.
> 
> This unblocks OSPI/xSPI boot on HS platforms
> 
> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
> Reviewed-by: Dave Gerlach <d-gerlach@ti.com>
> Tested-by: Keerthy <j-keerthy@ti.com>

Acked-by: Pratyush Yadav <p.yadav@ti.com>

-- 
Regards,
Pratyush Yadav
Texas Instruments Inc.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ARM: mach-k3: sysfw-loader: Copy sysfw.itb to OCRAM in OSPI/SPI bootmode
  2021-12-23 13:56 [PATCH] ARM: mach-k3: sysfw-loader: Copy sysfw.itb to OCRAM in OSPI/SPI bootmode Vignesh Raghavendra
  2021-12-24 10:52 ` Pratyush Yadav
@ 2022-01-17 18:36 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2022-01-17 18:36 UTC (permalink / raw)
  To: Vignesh Raghavendra; +Cc: u-boot, Praneeth Bajjuri, Pratyush Yadav

[-- Attachment #1: Type: text/plain, Size: 807 bytes --]

On Thu, Dec 23, 2021 at 07:26:03PM +0530, Vignesh Raghavendra wrote:

> In case of xSPI bootmode OSPI flash is in DDR mode and needs to be accessed
> in multiple of 16bit accesses Hence we cannot parse sysfw.itb FIT image
> directly on OSPI flash via MMIO window. So, copy the image to internal
> on-chip RAM before parsing the image.
> 
> Moreover, board cfg data maybe modified by ROM/TIFS in case of HS platform
> and thus cannot reside in OSPI/xSPI and needs to be copied over to
> internal OCRAM.
> 
> This unblocks OSPI/xSPI boot on HS platforms
> 
> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
> Reviewed-by: Dave Gerlach <d-gerlach@ti.com>
> Tested-by: Keerthy <j-keerthy@ti.com>
> Acked-by: Pratyush Yadav <p.yadav@ti.com>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-17 18:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-23 13:56 [PATCH] ARM: mach-k3: sysfw-loader: Copy sysfw.itb to OCRAM in OSPI/SPI bootmode Vignesh Raghavendra
2021-12-24 10:52 ` Pratyush Yadav
2022-01-17 18:36 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox