spl: Update spl_load_simple_fit() to take an spl_image param
authorSimon Glass <sjg@chromium.org>
Sun, 25 Sep 2016 00:20:16 +0000 (18:20 -0600)
committerTom Rini <trini@konsulko.com>
Thu, 6 Oct 2016 19:08:54 +0000 (15:08 -0400)
Upda the SPL FIT code to use the spl_image parameter.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
common/spl/spl.c
common/spl/spl_fat.c
common/spl/spl_fit.c
common/spl/spl_mmc.c
common/spl/spl_nand.c
common/spl/spl_spi.c
common/spl/spl_ymodem.c
include/spl.h

index fae3dbc7190374b7c954c47623c2fc69d903eb0d..3dafa508f7d3ae434c6be22d2d70c1b3c0b68d9d 100644 (file)
@@ -204,7 +204,7 @@ static int spl_ram_load_image(struct spl_image_info *spl_image,
                debug("Found FIT\n");
                load.bl_len = 1;
                load.read = spl_ram_load_read;
-               spl_load_simple_fit(&load, 0, header);
+               spl_load_simple_fit(spl_image, &load, 0, header);
        } else {
                debug("Legacy image\n");
                /*
index e2bb00029c24757662550662d423688c897e3c17..a14acceebb3d3a84b95885c0473a353fc8239b47 100644 (file)
@@ -82,7 +82,7 @@ int spl_load_image_fat(struct spl_image_info *spl_image,
                load.filename = (void *)filename;
                load.priv = NULL;
 
-               return spl_load_simple_fit(&load, 0, header);
+               return spl_load_simple_fit(spl_image, &load, 0, header);
        } else {
                err = spl_parse_image_header(spl_image, header);
                if (err)
index be86072c24e8138dc66be8be456d70ffe931ea4e..aae556f97dfd87197e55eefa04ec414db5b0d542 100644 (file)
@@ -123,7 +123,8 @@ static int get_aligned_image_size(struct spl_load_info *info, int data_size,
        return (data_size + info->bl_len - 1) / info->bl_len;
 }
 
-int spl_load_simple_fit(struct spl_load_info *info, ulong sector, void *fit)
+int spl_load_simple_fit(struct spl_image_info *spl_image,
+                       struct spl_load_info *info, ulong sector, void *fit)
 {
        int sectors;
        ulong size, load;
@@ -184,9 +185,9 @@ int spl_load_simple_fit(struct spl_load_info *info, ulong sector, void *fit)
        data_size = fdt_getprop_u32(fit, node, "data-size");
        load = fdt_getprop_u32(fit, node, "load");
        debug("data_offset=%x, data_size=%x\n", data_offset, data_size);
-       spl_image.load_addr = load;
-       spl_image.entry_point = load;
-       spl_image.os = IH_OS_U_BOOT;
+       spl_image->load_addr = load;
+       spl_image->entry_point = load;
+       spl_image->os = IH_OS_U_BOOT;
 
        /*
         * Work out where to place the image. We read it so that the first
index 16a6b49e7a5cf8d148b3e0fd13442cac016e8a2b..c674e61cbdebf4fb8fd98a078efce7617cb157d1 100644 (file)
@@ -80,7 +80,7 @@ static int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
                load.filename = NULL;
                load.bl_len = mmc->read_bl_len;
                load.read = h_spl_load_read;
-               ret = spl_load_simple_fit(&load, sector, header);
+               ret = spl_load_simple_fit(spl_image, &load, sector, header);
        } else {
                ret = mmc_load_legacy(spl_image, mmc, sector, header);
        }
index 5cf712e29aff64f98b1b3d3bc7a635f38c653f20..d1abda6e4ce1f555defbf3463bcda9b767b13d00 100644 (file)
@@ -59,7 +59,7 @@ static int spl_nand_load_element(struct spl_image_info *spl_image,
                load.filename = NULL;
                load.bl_len = 1;
                load.read = spl_nand_fit_read;
-               return spl_load_simple_fit(&load, offset, header);
+               return spl_load_simple_fit(spl_image, &load, offset, header);
        } else {
                err = spl_parse_image_header(spl_image, header);
                if (err)
index 4bf3d659675fd65396e4343579fc2991c379f35c..a3caafbd46d612b9f06783265c410ecdc5dd461c 100644 (file)
@@ -108,7 +108,7 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
                        load.filename = NULL;
                        load.bl_len = 1;
                        load.read = spl_spi_fit_read;
-                       err = spl_load_simple_fit(&load,
+                       err = spl_load_simple_fit(spl_image, &load,
                                                  CONFIG_SYS_SPI_U_BOOT_OFFS,
                                                  header);
                } else {
index 8fbf8958a13409934b8bd05899f4bcdf7179972b..13e8e51da99d5031b01e2b3bdc3474b7e44e587a 100644 (file)
@@ -103,7 +103,7 @@ static int spl_ymodem_load_image(struct spl_image_info *spl_image,
                info.buf = buf;
                info.image_read = BUF_SIZE;
                load.read = ymodem_read_fit;
-               ret =  spl_load_simple_fit(&load, 0, (void *)buf);
+               ret = spl_load_simple_fit(spl_image, &load, 0, (void *)buf);
                size = info.image_read;
 
                while ((res = xyzModem_stream_read(buf, BUF_SIZE, &err)) > 0)
index 1f4f4e523765941a187cc794692c28604257eb47..0b97cda7fceedc5ce68d838d85746ddcc1461b93 100644 (file)
@@ -49,6 +49,7 @@ struct spl_load_info {
 
 /**
  * spl_load_simple_fit() - Loads a fit image from a device.
+ * @spl_image: Image description to set up
  * @info:      Structure containing the information required to load data.
  * @sector:    Sector number where FIT image is located in the device
  * @fdt:       Pointer to the copied FIT header.
@@ -57,7 +58,8 @@ struct spl_load_info {
  * specified load address and copies the dtb to end of u-boot image.
  * Returns 0 on success.
  */
-int spl_load_simple_fit(struct spl_load_info *info, ulong sector, void *fdt);
+int spl_load_simple_fit(struct spl_image_info *spl_image,
+                       struct spl_load_info *info, ulong sector, void *fdt);
 
 #define SPL_COPY_PAYLOAD_ONLY  1