]> git.sur5r.net Git - u-boot/commitdiff
spl: spi: Support full fitImage handling
authorMarek Vasut <marex@denx.de>
Thu, 31 May 2018 15:59:29 +0000 (17:59 +0200)
committerTom Rini <trini@konsulko.com>
Tue, 10 Jul 2018 20:55:56 +0000 (16:55 -0400)
Handle the case where the full fitImage support is enabled. In this
case, the whole fitImage must be loaded up front as some parts of the
fitImage code require memory-mapped access to the entire fitImage.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
common/spl/spl_spi.c

index df460467298843b1f107c091620124e09c37e7ed..ba60a3a3c5053d07b026d3aeb96914faa6dbf111 100644 (file)
@@ -110,8 +110,17 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
                        return err;
                }
 
-               if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
-                       image_get_magic(header) == FDT_MAGIC) {
+               if (IS_ENABLED(CONFIG_SPL_LOAD_FIT_FULL) &&
+                   image_get_magic(header) == FDT_MAGIC) {
+                       err = spi_flash_read(flash, payload_offs,
+                                            roundup(fdt_totalsize(header), 4),
+                                            (void *)CONFIG_SYS_LOAD_ADDR);
+                       if (err)
+                               return err;
+                       err = spl_parse_image_header(spl_image,
+                                       (struct image_header *)CONFIG_SYS_LOAD_ADDR);
+               } else if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
+                          image_get_magic(header) == FDT_MAGIC) {
                        struct spl_load_info load;
 
                        debug("Found FIT\n");