summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorJean-Jacques Hiblot <jjhiblot@ti.com>2019-10-22 16:39:10 +0200
committerTom Rini <trini@konsulko.com>2020-01-07 11:12:47 -0500
commit6b8b98d54d8e74c8b4c6cfe431e88c90efcea72d (patch)
tree8af385460d373efdec7d87cbb98bfbcf05c95f73 /common
parente3cd06be93e7e669a93d5786d131f421f346a925 (diff)
spl: fit: don't load the firmware twice
When u-boot.img is a FIT image generated automatically by mkimage, the configuration node has the following structure: conf-1 { description = "k3-am654-base-board"; firmware = "firmware-1"; loadables = "firmware-1"; fdt = "fdt-1"; }; The firmware is referenced twice. Once by the 'firmware' property and once by the 'loadables' property. Currently this result in the firmware being loaded twice. This is not a big problem but has an impact on the boot time. Fixing it by not loading a loadable image if it is also the firmware image. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Andreas Dannenberg <dannenberg@ti.com>
Diffstat (limited to 'common')
-rw-r--r--common/spl/spl_fit.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index cbc00a4e7c..346f9edaa5 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -373,6 +373,7 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
int images, ret;
int base_offset, hsize, align_len = ARCH_DMA_MINALIGN - 1;
int index = 0;
+ int firmware_node;
/*
* For FIT with external data, figure out where the external images
@@ -502,6 +503,7 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
spl_fit_append_fdt(spl_image, info, sector, fit,
images, base_offset);
+ firmware_node = node;
/* Now check if there are more images for us to load */
for (; ; index++) {
uint8_t os_type = IH_OS_INVALID;
@@ -510,6 +512,14 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
if (node < 0)
break;
+ /*
+ * if the firmware is also a loadable, skip it because
+ * it already has been loaded. This is typically the case with
+ * u-boot.img generated by mkimage.
+ */
+ if (firmware_node == node)
+ continue;
+
ret = spl_load_fit_image(info, sector, fit, base_offset, node,
&image_info);
if (ret < 0)