public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Albert ARIBAUD <albert.u.boot@aribaud.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] ARM926ejs: Add routines to invalidate D-Cache
Date: Thu, 04 Aug 2011 09:11:50 +0200	[thread overview]
Message-ID: <4E3A4636.3040608@aribaud.net> (raw)
In-Reply-To: <1312429550-14394-1-git-send-email-hong.xu@atmel.com>

Le 04/08/2011 05:45, Hong Xu a ?crit :
> After DMA transfer, we need to maintain D-Cache coherency.
> We need to clean cache (write back the dirty lines) and then
> make the cache invalidate as well(hence CPU will fetch data
> written by DMA controller from RAM).
>
> Tested on AT91SAM9261EK with Peripheral DMA controller.
>
> Signed-off-by: Hong Xu<hong.xu@atmel.com>
> Tested-by: Elen Song<elen.song@atmel.com>
> CC: Heiko Schocher<hs@denx.de>
> CC: Albert Aribaud<albert.aribaud@free.fr>
> ---
>   arch/arm/lib/cache.c |   10 ++++++++++
>   1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/lib/cache.c b/arch/arm/lib/cache.c
> index 92b61a2..216bde0 100644
> --- a/arch/arm/lib/cache.c
> +++ b/arch/arm/lib/cache.c
> @@ -53,3 +53,13 @@ void	__flush_dcache_all(void)
>   }
>   void	flush_dcache_all(void)
>   	__attribute__((weak, alias("__flush_dcache_all")));
> +
> +void __invalidate_dcache_all(void)
> +{
> +#ifdef CONFIG_ARM926EJS
> +	asm("mcr p15, 0, %0, c7, c6, 0" : : "r" (0));
> +#endif
> +	return;
> +}
> +void  invalidate_dcache_all(void)
> +	__attribute__((weak, alias("__invalidate_dcache_all")));

NAK in this form.

I don't want invalide function introduced only in full invalidation 
form, because driver code will start using this, and it is the wrong 
thing to do as each caller can only tell what it wants invalidated, not 
what other code wants invalidated; a client doing a full invalidate 
might (and certainly will, to some extent) trash other data than its own.

So please provide also an invalidate_cache() function similar to the 
flush_cache() function, with start and size arguments, that callers 
should use.

full flush and invalidate should only be used by callers that *really* 
need it (bootm comes to mind).

Amicalement,
-- 
Albert.

  reply	other threads:[~2011-08-04  7:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-04  3:45 [U-Boot] [PATCH] ARM926ejs: Add routines to invalidate D-Cache Hong Xu
2011-08-04  7:11 ` Albert ARIBAUD [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-08-08  3:20 Hong Xu
2011-08-08  8:01 ` Albert ARIBAUD
2011-08-08  8:58   ` Hong Xu
2011-08-08 17:34   ` Marek Vasut
2011-08-08 17:56     ` Albert ARIBAUD
2011-08-09  1:57     ` Hong Xu
2011-08-09 19:55       ` Marek Vasut
2011-08-10  1:45         ` Hong Xu
2011-08-10  2:46           ` Marek Vasut
2011-08-09 11:05     ` Aneesh V

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E3A4636.3040608@aribaud.net \
    --to=albert.u.boot@aribaud.net \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox