[U-Boot] [PATCH 2/4] cache_v7: Check for dcache enablement in dcache flush functions

R, Sricharan r.sricharan at ti.com
Fri Jun 15 07:48:11 CEST 2012


Hi Tom,

On Fri, Jun 15, 2012 at 12:31 AM, Tom Rini <trini at ti.com> wrote:
> If we are built with D-CACHE enabled but have run 'dcache off' and then
> attempt to flush unaligned regions we spam the console with problems
> that aren't true (as the cache was off).
>
  Today we do cache maintenance operations after the dcache is turned off.
  One example is before jumping to kernel, we try to invalidate the caches,
  in cache turned off state. So with this patch those maintenance calls will
  do nothing, which is not correct.

   If it is a problem with unaligned regions, then that is the only
thing to be fixed
  right ?. Just trying to understand why this change is required ?

Thanks,
 Sricharan


> Signed-off-by: Tom Rini <trini at ti.com>
> ---
>  arch/arm/cpu/armv7/cache_v7.c |   11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/arch/arm/cpu/armv7/cache_v7.c b/arch/arm/cpu/armv7/cache_v7.c
> index 1b4e808..1c0f5b0 100644
> --- a/arch/arm/cpu/armv7/cache_v7.c
> +++ b/arch/arm/cpu/armv7/cache_v7.c
> @@ -250,6 +250,9 @@ static void v7_inval_tlb(void)
>
>  void invalidate_dcache_all(void)
>  {
> +       if (!dcache_status())
> +               return;
> +
>        v7_maint_dcache_all(ARMV7_DCACHE_INVAL_ALL);
>
>        v7_outer_cache_inval_all();
> @@ -261,6 +264,9 @@ void invalidate_dcache_all(void)
>  */
>  void flush_dcache_all(void)
>  {
> +       if (!dcache_status())
> +               return;
> +
>        v7_maint_dcache_all(ARMV7_DCACHE_CLEAN_INVAL_ALL);
>
>        v7_outer_cache_flush_all();
> @@ -272,6 +278,8 @@ void flush_dcache_all(void)
>  */
>  void invalidate_dcache_range(unsigned long start, unsigned long stop)
>  {
> +       if (!dcache_status())
> +               return;
>
>        v7_dcache_maint_range(start, stop, ARMV7_DCACHE_INVAL_RANGE);
>
> @@ -285,6 +293,9 @@ void invalidate_dcache_range(unsigned long start, unsigned long stop)
>  */
>  void flush_dcache_range(unsigned long start, unsigned long stop)
>  {
> +       if (!dcache_status())
> +               return;
> +
>        v7_dcache_maint_range(start, stop, ARMV7_DCACHE_CLEAN_INVAL_RANGE);
>
>        v7_outer_cache_flush_range(start, stop);
> --


More information about the U-Boot mailing list