From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lukasz Majewski Date: Thu, 28 Dec 2017 15:27:50 +0100 Subject: [U-Boot] [PATCH 8/9] spl: ram: Add support for fetching image position from control DT In-Reply-To: <20171228120621.4039-9-marex@denx.de> References: <20171228120621.4039-1-marex@denx.de> <20171228120621.4039-9-marex@denx.de> Message-ID: <20171228152750.01efd1d2@jawa> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Marek, > Add support for fetching the image position in RAM from control DT > rather than hard-coding it. While doing so, return the return value > of spl_parse_header_image() to make it possible to test application > of DTOs on U-Boot's control DT. > > Signed-off-by: Marek Vasut > Cc: Pantelis Antoniou > Cc: Simon Glass > --- > common/spl/spl_ram.c | 21 ++++++++++++++++----- > 1 file changed, 16 insertions(+), 5 deletions(-) > > diff --git a/common/spl/spl_ram.c b/common/spl/spl_ram.c > index fa8c768773..c88d09ba04 100644 > --- a/common/spl/spl_ram.c > +++ b/common/spl/spl_ram.c > @@ -14,12 +14,14 @@ > #include > #include > #include > -#include > +#include > > #ifndef CONFIG_SPL_LOAD_FIT_ADDRESS > # define CONFIG_SPL_LOAD_FIT_ADDRESS 0 > #endif > > +DECLARE_GLOBAL_DATA_PTR; > + > static ulong spl_ram_load_read(struct spl_load_info *load, ulong > sector, ulong count, void *buf) > { > @@ -33,7 +35,12 @@ static int spl_ram_load_image(struct > spl_image_info *spl_image, struct spl_boot_device *bootdev) > { > struct image_header *header; > + unsigned image_offs; > > +#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) > + image_offs = fdtdec_get_config_int(gd->fdt_blob, > + > "u-boot,spl-image-offset", 0); +#endif > header = (struct image_header *)CONFIG_SPL_LOAD_FIT_ADDRESS; > > #if defined(CONFIG_SPL_DFU_SUPPORT) > @@ -48,7 +55,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(spl_image, &load, 0, header); > + return spl_load_simple_fit(spl_image, &load, 0, > header); } else { > ulong u_boot_pos = binman_sym(ulong, u_boot_any, > pos); > @@ -64,12 +71,16 @@ static int spl_ram_load_image(struct > spl_image_info *spl_image, > * No binman support or no information. For > now, fix it > * to the address pointed to by U-Boot. > */ > - u_boot_pos = CONFIG_SYS_TEXT_BASE - > - sizeof(struct image_header); > + if (image_offs) > + u_boot_pos = image_offs; > + else > + u_boot_pos = CONFIG_SYS_TEXT_BASE - > + sizeof(struct > image_u_boot_pos); } > header = (struct image_header > *)map_sysmem(u_boot_pos, 0); > - spl_parse_image_header(spl_image, header); > + > + return spl_parse_image_header(spl_image, header); > } > > return 0; Reviewed-by: Lukasz Majewski Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 488 bytes Desc: OpenPGP digital signature URL: