From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Tue, 10 Jul 2012 03:55:29 +0200 Subject: [U-Boot] [PATCH 2/2] ehci-hcd.c, musb_core, usb.h: Add USB_DMA_MINALIGN define for cache alignment In-Reply-To: References: <1341716895-31089-1-git-send-email-marex@denx.de> <1341716895-31089-2-git-send-email-marex@denx.de> Message-ID: <201207100355.29187.marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Ilya Yanok, > Hi Marek, > > On Sun, Jul 8, 2012 at 7:08 AM, Marek Vasut 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