All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lokesh Vutla <lokeshvutla@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] SPL: FIT: Enable SPL_FIT_LOAD in RAM based boot mode
Date: Wed, 18 May 2016 20:42:39 +0530	[thread overview]
Message-ID: <573C8667.10005@ti.com> (raw)
In-Reply-To: <8e3d705c04c22e79959554093678775cdd84b4e3.1463504422.git.michal.simek@xilinx.com>



On 5/17/2016 10:30 PM, Michal Simek wrote:
> Support loading FIT in SPL for RAM bootmode.
> CONFIG_SPL_LOAD_FIT_ADRESS points to address where FIT image is stored
> in memory.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v2:
> - Fix empty line
> - Fix addr name and remove SPL_LOAD_FIT macro
>
>   common/spl/spl.c | 45 ++++++++++++++++++++++++++++++++++++---------
>   1 file changed, 36 insertions(+), 9 deletions(-)
>
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index 0fc5b058be31..3faa751e4b43 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -136,20 +136,47 @@ __weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
>   	image_entry();
>   }
>
> +#ifndef CONFIG_SPL_LOAD_FIT_ADDRESS
> +# define CONFIG_SPL_LOAD_FIT_ADDRESS	0
> +#endif
> +

May be a good idea to default this to CONFIG_SYS_TEXT_BASE instead of 0?

Other than that patch looks good to me.
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>

Thanks and regards,
Lokesh

>   #ifdef CONFIG_SPL_RAM_DEVICE
> +static ulong spl_ram_load_read(struct spl_load_info *load, ulong sector,
> +			       ulong count, void *buf)
> +{
> +	debug("%s: sector %lx, count %lx, buf %lx\n",
> +	      __func__, sector, count, (ulong)buf);
> +	memcpy(buf, (void *)(CONFIG_SPL_LOAD_FIT_ADDRESS + sector), count);
> +	return count;
> +}
> +
>   static int spl_ram_load_image(void)
>   {
> -	const struct image_header *header;
> +	struct image_header *header;
>
> -	/*
> -	 * Get the header.  It will point to an address defined by handoff
> -	 * which will tell where the image located inside the flash. For
> -	 * now, it will temporary fixed to address pointed by U-Boot.
> -	 */
> -	header = (struct image_header *)
> -		(CONFIG_SYS_TEXT_BASE -	sizeof(struct image_header));
> +	header = (struct image_header *)CONFIG_SPL_LOAD_FIT_ADDRESS;
>
> -	spl_parse_image_header(header);
> +	if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
> +	    image_get_magic(header) == FDT_MAGIC) {
> +		struct spl_load_info load;
> +
> +		debug("Found FIT\n");
> +		load.bl_len = 1;
> +		load.read = spl_ram_load_read;
> +		spl_load_simple_fit(&load, 0, header);
> +	} else {
> +		debug("Legacy image\n");
> +		/*
> +		 * Get the header.  It will point to an address defined by
> +		 * handoff which will tell where the image located inside
> +		 * the flash. For now, it will temporary fixed to address
> +		 * pointed by U-Boot.
> +		 */
> +		header = (struct image_header *)
> +			(CONFIG_SYS_TEXT_BASE -	sizeof(struct image_header));
> +
> +		spl_parse_image_header(header);
> +	}
>
>   	return 0;
>   }
>

  reply	other threads:[~2016-05-18 15:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-17 17:00 [U-Boot] [PATCH v2] SPL: FIT: Enable SPL_FIT_LOAD in RAM based boot mode Michal Simek
2016-05-18 15:12 ` Lokesh Vutla [this message]
2016-05-18 15:22   ` Michal Simek
2016-05-18 16:50     ` Lokesh Vutla
2016-05-19 16:15 ` Andreas Dannenberg
2016-05-19 16:38   ` Michal Simek
2016-05-19 18:16     ` Andreas Dannenberg
2016-05-19 18:33       ` Michal Simek
2016-05-19 19:26         ` Andreas Dannenberg
2016-05-20  6:05           ` Michal Simek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=573C8667.10005@ti.com \
    --to=lokeshvutla@ti.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.