Re: [U-Boot] [RFC PATCH] SPL: FIT: Enable SPL_FIT_LOAD in RAM based boot mode

2016-05-17 Thread Nicolae Rosia
Hello Michal,

I have a minor comment.

On Thu, Apr 28, 2016 at 11:43 AM, 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 
> ---
>
[...]
> +   debug("%s: sector %lx, count %lx, buf %lx\n",
> + __func__, sector, count, (ulong)buf);
> +   memcpy(buf, (void *)(CONFIG_SPL_LOAD_FIT_ADRESS + sector), count);
s/CONFIG_SPL_LOAD_FIT_ADRESS/CONFIG_SPL_LOAD_FIT_ADDRESS

[...]
> -*/
> -   header = (struct image_header *)
> -   (CONFIG_SYS_TEXT_BASE - sizeof(struct image_header));
> +   header = (struct image_header *)CONFIG_SPL_LOAD_FIT_ADRESS;
s/CONFIG_SPL_LOAD_FIT_ADRESS/CONFIG_SPL_LOAD_FIT_ADDRESS

[...]

Regards,
Nicolae
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH] SPL: FIT: Enable SPL_FIT_LOAD in RAM based boot mode

2016-05-01 Thread Simon Glass
Hi Michal,

On 28 April 2016 at 02:43, 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 
> ---
>
> Not sure if solution with CONFIG_SPL_LOAD_FIT_ADDRESS is accepted.
> But it should be out of TEXT_BASE.
>
> ---
>  common/spl/spl.c | 44 +++-
>  1 file changed, 35 insertions(+), 9 deletions(-)
>

Reviewed-by: Simon Glass 

I suggest moving this all into a new spl_ram.c file.

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [RFC PATCH] SPL: FIT: Enable SPL_FIT_LOAD in RAM based boot mode

2016-04-28 Thread Michal Simek
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 
---

Not sure if solution with CONFIG_SPL_LOAD_FIT_ADDRESS is accepted.
But it should be out of TEXT_BASE.

---
 common/spl/spl.c | 44 +++-
 1 file changed, 35 insertions(+), 9 deletions(-)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index f1e792dd7c61..128ccaa55e3e 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -134,19 +134,45 @@ __weak void __noreturn jump_to_image_no_args(struct 
spl_image_info *spl_image)
 }
 
 #ifdef CONFIG_SPL_RAM_DEVICE
+#ifdef CONFIG_SPL_LOAD_FIT
+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_ADRESS + sector), count);
+   return count;
+}
+#endif
+
 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_ADRESS;
 
-   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(, 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;
 }
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot