From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Tue, 9 Aug 2011 21:55:24 +0200 Subject: [U-Boot] [PATCH] ARM926ejs: Add routines to invalidate D-Cache In-Reply-To: <4E409415.1030005@atmel.com> References: <1312773617-10859-1-git-send-email-hong.xu@atmel.com> <201108081934.50668.marek.vasut@gmail.com> <4E409415.1030005@atmel.com> Message-ID: <201108092155.24250.marek.vasut@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Tuesday, August 09, 2011 03:57:41 AM Hong Xu wrote: > Hi Marek Vasut, > > On 08/09/2011 01:34 AM, Marek Vasut wrote: > > On Monday, August 08, 2011 10:01:19 AM Albert ARIBAUD wrote: > >> Hi Hong Xu, > >> > >> Le 08/08/2011 05:20, Hong Xu a ?crit : > >>> After DMA operation, we need to maintain D-Cache coherency. > >>> So that the DCache must be invalidated (hence CPU will fetch > >>> data written by DMA controller from RAM). > >>> > >>> Tested on AT91SAM9261EK with Peripheral DMA controller. > >>> > >>> Signed-off-by: Hong Xu > >>> Tested-by: Elen Song > >>> CC: Albert Aribaud > >>> CC: Aneesh V > >>> CC: Reinhard Meyer > >>> CC: Heiko Schocher > >>> --- > >>> > >>> V2: > >>> Per Albert's suggestion, add invalidate_dcache_range > >>> > >>> V3: > >>> invalidate_dcache_range emits warning when detecting unaligned > >>> buffer > >>> > >>> invalidate_dcache_range won't clean any adjacent cache line when > >>> detecting unaligned buffer and only round up/down the buffer > >>> address > >>> > >>> + mva = start; > >>> + if ((mva& (cache_line_len - 1)) != 0) { > >>> + printf("WARNING: %s - unaligned buffer detected, starting " > >> > >> I'd rather have a message about "cache", not "buffer", e.g. > >> > >> printf("WARNING: %s - start address %x is not aligned\n" > >> > >> __FUNCTION__, start); > > > > __func__ is prefered in linux kernel :-) > > __func__ is C99 standard. __FUNCTION__ appears more in U-Boot. ;-) This doesn't mean it's correct ;-) "majority proof" isn't a proof really. > GCC manual says some older GCC only recognize __FUNCTION__ . > If we rely on GCC, it looks __FUNCTION__ will reduce troubles. Do we support such ancient versions of GCC anyway ? Just to be clear, I'm fine with either way, just my 2.7183 cents ;-) > > BR, > Eric > > >>> + mva&= ~(cache_line_len - 1); > >>> + } > >>> + if ((stop& (cache_line_len - 1)) != 0) { > >>> + printf("WARNING: %s - unaligned buffer detected, ending " > >>> + "address: 0x%08x\n", __FUNCTION__, stop); > >> > >> Ditto. > > > > Ditto. > > [...]