generic: add USB_DWC2 missing symbols
[openwrt.git] / target / linux / brcm47xx / patches-3.14 / 160-kmap_coherent.patch
1 --- a/arch/mips/include/asm/cpu-features.h
2 +++ b/arch/mips/include/asm/cpu-features.h
3 @@ -133,6 +133,9 @@
4  #ifndef cpu_has_local_ebase
5  #define cpu_has_local_ebase    1
6  #endif
7 +#ifndef cpu_use_kmap_coherent
8 +#define cpu_use_kmap_coherent 1
9 +#endif
10  
11  /*
12   * I-Cache snoops remote store.         This only matters on SMP.  Some multiprocessors
13 --- a/arch/mips/include/asm/mach-bcm47xx/cpu-feature-overrides.h
14 +++ b/arch/mips/include/asm/mach-bcm47xx/cpu-feature-overrides.h
15 @@ -79,4 +79,6 @@
16  #define cpu_scache_line_size()         0
17  #define cpu_has_vz                     0
18  
19 +#define cpu_use_kmap_coherent          0
20 +
21  #endif /* __ASM_MACH_BCM47XX_CPU_FEATURE_OVERRIDES_H */
22 --- a/arch/mips/mm/c-r4k.c
23 +++ b/arch/mips/mm/c-r4k.c
24 @@ -523,7 +523,7 @@ static inline void local_r4k_flush_cache
25                  */
26                 map_coherent = (cpu_has_dc_aliases &&
27                                 page_mapped(page) && !Page_dcache_dirty(page));
28 -               if (map_coherent)
29 +               if (map_coherent && cpu_use_kmap_coherent)
30                         vaddr = kmap_coherent(page, addr);
31                 else
32                         vaddr = kmap_atomic(page);
33 @@ -546,7 +546,7 @@ static inline void local_r4k_flush_cache
34         }
35  
36         if (vaddr) {
37 -               if (map_coherent)
38 +               if (map_coherent && cpu_use_kmap_coherent)
39                         kunmap_coherent();
40                 else
41                         kunmap_atomic(vaddr);
42 --- a/arch/mips/mm/init.c
43 +++ b/arch/mips/mm/init.c
44 @@ -200,7 +200,7 @@ void copy_user_highpage(struct page *to,
45         void *vfrom, *vto;
46  
47         vto = kmap_atomic(to);
48 -       if (cpu_has_dc_aliases &&
49 +       if (cpu_has_dc_aliases && cpu_use_kmap_coherent &&
50             page_mapped(from) && !Page_dcache_dirty(from)) {
51                 vfrom = kmap_coherent(from, vaddr);
52                 copy_page(vto, vfrom);
53 @@ -222,7 +222,7 @@ void copy_to_user_page(struct vm_area_st
54         struct page *page, unsigned long vaddr, void *dst, const void *src,
55         unsigned long len)
56  {
57 -       if (cpu_has_dc_aliases &&
58 +       if (cpu_has_dc_aliases && cpu_use_kmap_coherent &&
59             page_mapped(page) && !Page_dcache_dirty(page)) {
60                 void *vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
61                 memcpy(vto, src, len);
62 @@ -240,7 +240,7 @@ void copy_from_user_page(struct vm_area_
63         struct page *page, unsigned long vaddr, void *dst, const void *src,
64         unsigned long len)
65  {
66 -       if (cpu_has_dc_aliases &&
67 +       if (cpu_has_dc_aliases && cpu_use_kmap_coherent &&
68             page_mapped(page) && !Page_dcache_dirty(page)) {
69                 void *vfrom = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
70                 memcpy(dst, vfrom, len);