[U-Boot] [PATCH 2/2] ehci-hcd.c, musb_core, usb.h: Add USB_DMA_MINALIGN define for cache alignment
Ilya Yanok
ilya.yanok at cogentembedded.com
Mon Jul 9 20:37:14 CEST 2012
Hi Marek,
On Sun, Jul 8, 2012 at 7:08 AM, Marek Vasut <marex at denx.de> wrote:
> - /* Invalidate the memory area occupied by buffer */
> - invalidate_dcache_range(((uint32_t)buffer & ~31),
> - ((uint32_t)buffer & ~31) + roundup(length, 32));
> + /*
> + * Invalidate the memory area occupied by buffer
> + * Don't try to fix the buffer alignment, if it isn't properly
> + * aligned it's upper layer's fault so let
> invalidate_dcache_range()
> + * vow about it. But we have to fix the length as it's actual
> + * transfer length and can be unaligned. This is potentially
> + * dangerous operation, it's responsibility of the calling
> + * code to make sure enough space is reserved.
> + */
> + invalidate_dcache_range((uint32_t)buffer,
> + ALIGN_END_ADDR(u8, buffer, length));
>
We shouldn't use ALIGN_END_ADDR here. This can lead to strange results on
systems with ARCH_DMA_MINALIGN < 32.
Regards, Ilya.
More information about the U-Boot
mailing list