summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorAbel Vesa <abel.vesa@nxp.com>2018-11-07 18:13:08 +0200
committerAbel Vesa <abel.vesa@nxp.com>2018-11-09 11:45:15 +0200
commit2bd8277fd7eceed3aa4b07b6fe238b7beef62530 (patch)
tree09682a6944b732fca3a8d02c9023a5810ae9985e /common
parent32adc4aed8864fe274de13f14f4e29759062ee1d (diff)
MLK-20233 spl_spi: Add QSPI boot device support to the container parser
Before parsing the image header, try to check if there is a container and validate it first. If no (valid) container then as a fall-through parse the image as before. Signed-off-by: Abel Vesa <abel.vesa@nxp.com> Reviewed-by: Ye Li <ye.li@nxp.com>
Diffstat (limited to 'common')
-rw-r--r--common/spl/spl_spi.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c
index c26896ed65..5551397e95 100644
--- a/common/spl/spl_spi.c
+++ b/common/spl/spl_spi.c
@@ -58,6 +58,15 @@ unsigned long __weak spl_spi_get_uboot_raw_sector(struct spi_flash *flash)
}
#endif
+#ifdef CONFIG_PARSE_CONTAINER
+int __weak spi_load_image_parse_container(struct spl_image_info *spl_image,
+ struct spi_flash *flash,
+ unsigned long offset)
+{
+ return -EINVAL;
+}
+#endif
+
static ulong spl_spi_fit_read(struct spl_load_info *load, ulong sector,
ulong count, void *buf)
{
@@ -134,12 +143,18 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
payload_offs,
header);
} else {
+#ifdef CONFIG_PARSE_CONTAINER
+ err = spi_load_image_parse_container(spl_image,
+ flash,
+ payload_offs);
+#else
err = spl_parse_image_header(spl_image, header);
if (err)
return err;
err = spi_flash_read(flash, payload_offs,
spl_image->size,
(void *)spl_image->load_addr);
+#endif
}
}