[U-Boot] [PATCH 2/2] ehci-hcd.c, musb_core, usb.h: Add USB_DMA_MINALIGN define for cache alignment
Marek Vasut
marex at denx.de
Tue Jul 10 03:55:29 CEST 2012
Dear Ilya Yanok,
> 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.
Good point, ALIGN_END_ADDR should align it to max(32, length) ?
> Regards, Ilya.
Best regards,
Marek Vasut
More information about the U-Boot
mailing list