From: Lokesh Vutla <lokeshvutla@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] spl: Make sure destination address is dma aligned when loading fit
Date: Thu, 5 May 2016 11:22:42 +0530 [thread overview]
Message-ID: <572ADFAA.2040908@ti.com> (raw)
In-Reply-To: <1459944180-31139-2-git-send-email-lokeshvutla@ti.com>
On Wednesday 06 April 2016 05:32 PM, Lokesh Vutla wrote:
> Peripherals like spi etc. uses DMA for transfers. So, when loading the fit
> image the destination address should be dma aligned.
After the v5 of my FS support for FIT[1], this patch is no more
necessary. Patch 2 is alone sufficient.
[1] http://patchwork.ozlabs.org/patch/618403/
Thanks and regards,
Lokesh
>
> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
> ---
> - Assuming u-boot.bin load addr will always be dma aligned.
>
> common/spl/spl_fit.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
> index 4c9fe7b..20396b9 100644
> --- a/common/spl/spl_fit.c
> +++ b/common/spl/spl_fit.c
> @@ -91,7 +91,7 @@ int spl_load_simple_fit(struct spl_load_info *info, ulong sector, void *fit)
> void *load_ptr;
> int fdt_offset, fdt_len;
> int data_offset, data_size;
> - int base_offset;
> + int base_offset, align_len;
> int src_sector;
> void *dst;
>
> @@ -117,7 +117,9 @@ int spl_load_simple_fit(struct spl_load_info *info, ulong sector, void *fit)
> * In fact the FIT has its own load address, but we assume it cannot
> * be before CONFIG_SYS_TEXT_BASE.
> */
> - fit = (void *)(CONFIG_SYS_TEXT_BASE - size - info->bl_len);
> + align_len = ARCH_DMA_MINALIGN - 1;
> + fit = (void *)((CONFIG_SYS_TEXT_BASE - size - info->bl_len -
> + align_len) & ~align_len);
> sectors = (size + info->bl_len - 1) / info->bl_len;
> count = info->read(info, sector, sectors, fit);
> debug("fit read sector %lx, sectors=%d, dst=%p, count=%lu\n",
> @@ -173,8 +175,9 @@ int spl_load_simple_fit(struct spl_load_info *info, ulong sector, void *fit)
> /*
> * Read the device tree and place it after the image. There may be
> * some extra data before it since we can only read entire blocks.
> + * And also align the destination address to ARCH_DMA_MINALIGN.
> */
> - dst = load_ptr + data_size;
> + dst = (void *)((load + data_size + align_len) & ~align_len);
> fdt_offset += base_offset;
> count = info->read(info, sector + fdt_offset / info->bl_len, sectors,
> dst);
> @@ -188,7 +191,7 @@ int spl_load_simple_fit(struct spl_load_info *info, ulong sector, void *fit)
> * After this we will have the U-Boot image and its device tree ready
> * for us to start.
> */
> - memcpy(dst, dst + fdt_offset % info->bl_len, fdt_len);
> + memcpy(load_ptr + data_size, dst + fdt_offset % info->bl_len, fdt_len);
>
> return 0;
> }
>
next prev parent reply other threads:[~2016-05-05 5:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-06 12:02 [U-Boot] [PATCH 0/2] spl: Support loading a FIT from SPI Lokesh Vutla
2016-04-06 12:02 ` [U-Boot] [PATCH 1/2] spl: Make sure destination address is dma aligned when loading fit Lokesh Vutla
2016-04-08 19:45 ` Tom Rini
2016-05-05 5:52 ` Lokesh Vutla [this message]
2016-05-05 10:54 ` Tom Rini
2016-05-06 10:15 ` Lokesh Vutla
2016-04-06 12:03 ` [U-Boot] [PATCH 2/2] spl: Support loading a FIT from SPI Lokesh Vutla
2016-04-08 19:45 ` Tom Rini
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=572ADFAA.2040908@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.