
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 -
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",align_len) & ~align_len);
@@ -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;
}