diff mbox series

common: spl: spl_mmc: Add full FIT image support for kernel/OS loading during Falcon boot mode while booting via MMC

Message ID CAPE2wM16du6OGuYkKFMkeW79+ZgxDYYOnR48M1w3Kr_dVTCRvQ@mail.gmail.com
State Deferred
Delegated to: Tom Rini
Headers show
Series common: spl: spl_mmc: Add full FIT image support for kernel/OS loading during Falcon boot mode while booting via MMC | expand

Commit Message

Nathan Barrett-Morrison Feb. 8, 2022, 6:20 p.m. UTC
Hi Tom,

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

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

Patch attached and also added inline below:

Sincerely,
Nathan

From a3d066656df60856950c9cbb28914d02d57c9364 Mon Sep 17 00:00:00 2001
From: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
Date: Tue, 8 Feb 2022 13:16:24 -0500
Subject: [PATCH] common: spl: spl_mmc: Add full FIT image support for
 kernel/OS loading during Falcon boot mode while booting via MMC

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

  struct spl_load_info load;
diff mbox series

Patch

From a3d066656df60856950c9cbb28914d02d57c9364 Mon Sep 17 00:00:00 2001
From: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
Date: Tue, 8 Feb 2022 13:16:24 -0500
Subject: [PATCH] common: spl: spl_mmc: Add full FIT image support for
 kernel/OS loading during Falcon boot mode while booting via MMC

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

diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index e1a7d25bd0..7fb2505c33 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -94,7 +94,19 @@  int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
 		goto end;
 	}
 
-	if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
+	if (IS_ENABLED(CONFIG_SPL_LOAD_FIT_FULL) &&
+	    image_get_magic(header) == FDT_MAGIC) {
+		u32 image_size_sectors;
+
+		debug("Found FIT\n");
+
+		image_size_sectors = (roundup(fdt_totalsize(header), 4) + mmc->read_bl_len - 1) /
+				     mmc->read_bl_len;
+		count = blk_dread(bd, sector, image_size_sectors, CONFIG_SYS_LOAD_ADDR);
+		debug("hdr read sector %lx, count=%lu\n", sector, count);
+
+		ret = spl_parse_image_header(spl_image, CONFIG_SYS_LOAD_ADDR);
+	} else if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
 	    image_get_magic(header) == FDT_MAGIC) {
 		struct spl_load_info load;
 
-- 
2.30.2