[PATCH] common: spl: spl_spi: Add in FIT image support for kernel/OS loading during Falcon boot mode while booting via SPI

Nathan Barrett-Morrison nathan.morrison at timesys.com
Tue Feb 8 19:12:57 CET 2022


Hi Tom,

This patch adds support for Falcon mode boot via SPI flash boot devices
with FIT images.

While attempting to use Falcon boot mode with FIT images on SPI flash boot
devices, I've found the following additional code to be required.

Patch attached and also added inline below:

Sincerely,
Nathan

>From b93c9122114ee701f13a62af63d74a0644fcef92 Mon Sep 17 00:00:00 2001
From: Nathan Barrett-Morrison <nathan.morrison at timesys.com>
Date: Tue, 8 Feb 2022 13:05:34 -0500
Subject: [PATCH] common: spl: spl_spi: Add in FIT image support for
kernel/OS
 loading during Falcon boot mode while booting via SPI

Signed-off-by: Nathan Barrett-Morrison <nathan.morrison at timesys.com>
Cc: Tom Rini <trini at konsulko.com>
---
 common/spl/spl_spi.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c
index 4e20a23dea..82b396fc62 100644
--- a/common/spl/spl_spi.c
+++ b/common/spl/spl_spi.c
@@ -29,6 +29,18 @@ static int spi_load_image_os(struct spl_image_info
*spl_image,
 {
  int err;

+#if CONFIG_IS_ENABLED(LOAD_FIT_FULL) || CONFIG_IS_ENABLED(LOAD_FIT)
+ spi_flash_read(flash, CONFIG_SYS_SPI_KERNEL_OFFS, sizeof(struct
fdt_header),
+       (void *)header);
+
+ if (image_get_magic(header) == FDT_MAGIC)
+ spi_flash_read(flash, CONFIG_SYS_SPI_KERNEL_OFFS,
+       roundup(fdt_totalsize(header), 4), CONFIG_SYS_LOAD_ADDR);
+
+ err = spl_parse_image_header(spl_image, CONFIG_SYS_LOAD_ADDR);
+ if (err)
+ return err;
+#else
  /* Read for a header, parse or error out. */
  spi_flash_read(flash, CONFIG_SYS_SPI_KERNEL_OFFS, sizeof(*header),
        (void *)header);
@@ -47,6 +59,7 @@ static int spi_load_image_os(struct spl_image_info
*spl_image,
  spi_flash_read(flash, CONFIG_SYS_SPI_ARGS_OFFS,
        CONFIG_SYS_SPI_ARGS_SIZE,
        (void *)CONFIG_SYS_SPL_ARGS_ADDR);
+#endif

  return 0;
 }
-- 
2.30.2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-common-spl-spl_spi-Add-in-FIT-image-support-for-kern.patch
Type: text/x-patch
Size: 1564 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20220208/a43d79e1/attachment.bin>


More information about the U-Boot mailing list