[ARM] Optionally flush entire dcache from v6_dma_flush_range
authorArve Hjønnevåg <arve@android.com>
Wed, 10 Jun 2009 03:17:45 +0000 (20:17 -0700)
committerArve Hjønnevåg <arve@android.com>
Thu, 4 Feb 2010 05:26:57 +0000 (21:26 -0800)
If CACHE_FLUSH_RANGE_LIMIT is defined, then the entire dcache will
be flushed if the requested range is larger than this limit.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
arch/arm/mm/cache-v6.S

index 295e25dd6381f69da0eaf59c8e9da1854434ddd8..037cb2dc8cef63e8563ae0f40183560885f35cf4 100644 (file)
@@ -248,6 +248,11 @@ ENTRY(v6_dma_clean_range)
  *     - end     - virtual end address of region
  */
 ENTRY(v6_dma_flush_range)
+#ifdef CONFIG_CACHE_FLUSH_RANGE_LIMIT
+       sub     r2, r1, r0
+       cmp     r2, #CONFIG_CACHE_FLUSH_RANGE_LIMIT
+       bhi     v6_dma_flush_dcache_all
+#endif
        bic     r0, r0, #D_CACHE_LINE_SIZE - 1
 1:
 #ifdef HARVARD_CACHE
@@ -262,6 +267,18 @@ ENTRY(v6_dma_flush_range)
        mcr     p15, 0, r0, c7, c10, 4          @ drain write buffer
        mov     pc, lr
 
+#ifdef CONFIG_CACHE_FLUSH_RANGE_LIMIT
+v6_dma_flush_dcache_all:
+       mov     r0, #0
+#ifdef HARVARD_CACHE
+       mcr     p15, 0, r0, c7, c14, 0          @ D cache clean+invalidate
+#else
+       mcr     p15, 0, r0, c7, c15, 0          @ Cache clean+invalidate
+#endif
+       mcr     p15, 0, r0, c7, c10, 4          @ drain write buffer
+       mov     pc, lr
+#endif
+
        __INITDATA
 
        .type   v6_cache_fns, #object