ar71xx: WNR2000v3: enable control of all LEDs and buttons
[oweals/openwrt.git] / target / linux / cns3xxx / patches-4.4 / 010-arm_introduce-dma-fiq-irq-broadcast.patch
1 --- a/arch/arm/include/asm/glue-cache.h
2 +++ b/arch/arm/include/asm/glue-cache.h
3 @@ -156,9 +156,15 @@ static inline void nop_dma_unmap_area(co
4  #define __cpuc_flush_user_range                __glue(_CACHE,_flush_user_cache_range)
5  #define __cpuc_coherent_kern_range     __glue(_CACHE,_coherent_kern_range)
6  #define __cpuc_coherent_user_range     __glue(_CACHE,_coherent_user_range)
7 -#define __cpuc_flush_dcache_area       __glue(_CACHE,_flush_kern_dcache_area)
8  
9 -#define dmac_flush_range               __glue(_CACHE,_dma_flush_range)
10 +#ifndef CONFIG_DMA_CACHE_FIQ_BROADCAST
11 +# define __cpuc_flush_dcache_area      __glue(_CACHE,_flush_kern_dcache_area)
12 +# define dmac_flush_range              __glue(_CACHE,_dma_flush_range)
13 +#else
14 +# define __cpuc_flush_dcache_area      __glue(fiq,_flush_kern_dcache_area)
15 +# define dmac_flush_range              __glue(fiq,_dma_flush_range)
16 +#endif
17 +
18  #endif
19  
20  #endif
21 --- a/arch/arm/mm/Kconfig
22 +++ b/arch/arm/mm/Kconfig
23 @@ -866,6 +866,17 @@ config DMA_CACHE_RWFO
24           in hardware, other workarounds are needed (e.g. cache
25           maintenance broadcasting in software via FIQ).
26  
27 +config DMA_CACHE_FIQ_BROADCAST
28 +       bool "Enable fiq broadcast DMA cache maintenance"
29 +       depends on CPU_V6K && SMP
30 +       select FIQ
31 +       help
32 +         The Snoop Control Unit on ARM11MPCore does not detect the
33 +         cache maintenance operations and the dma_{map,unmap}_area()
34 +         functions may leave stale cache entries on other CPUs. By
35 +         enabling this option, fiq broadcast in the ARMv6
36 +         DMA cache maintenance functions is performed.
37 +
38  config OUTER_CACHE
39         bool
40  
41 --- a/arch/arm/mm/flush.c
42 +++ b/arch/arm/mm/flush.c
43 @@ -319,6 +319,7 @@ void __sync_icache_dcache(pte_t pteval)
44  void flush_dcache_page(struct page *page)
45  {
46         struct address_space *mapping;
47 +       bool skip_broadcast = true;
48  
49         /*
50          * The zero page is never written to, so never has any dirty
51 @@ -329,7 +330,10 @@ void flush_dcache_page(struct page *page
52  
53         mapping = page_mapping(page);
54  
55 -       if (!cache_ops_need_broadcast() &&
56 +#ifndef CONFIG_DMA_CACHE_FIQ_BROADCAST
57 +       skip_broadcast = !cache_ops_need_broadcast();
58 +#endif
59 +       if (skip_broadcast &&
60             mapping && !page_mapped(page))
61                 clear_bit(PG_dcache_clean, &page->flags);
62         else {
63 --- a/arch/arm/mm/dma.h
64 +++ b/arch/arm/mm/dma.h
65 @@ -4,8 +4,13 @@
66  #include <asm/glue-cache.h>
67  
68  #ifndef MULTI_CACHE
69 -#define dmac_map_area                  __glue(_CACHE,_dma_map_area)
70 -#define dmac_unmap_area                __glue(_CACHE,_dma_unmap_area)
71 +#ifndef CONFIG_DMA_CACHE_FIQ_BROADCAST
72 +# define dmac_map_area                 __glue(_CACHE,_dma_map_area)
73 +# define dmac_unmap_area               __glue(_CACHE,_dma_unmap_area)
74 +#else
75 +# define dmac_map_area                 __glue(fiq,_dma_map_area)
76 +# define dmac_unmap_area                       __glue(fiq,_dma_unmap_area)
77 +#endif
78  
79  /*
80   * These are private to the dma-mapping API.  Do not use directly.