diff options
Diffstat (limited to 'arch/mips/mm/c-r4k.c')
| -rw-r--r-- | arch/mips/mm/c-r4k.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c index 643c8bcffff3..27096751ddce 100644 --- a/arch/mips/mm/c-r4k.c +++ b/arch/mips/mm/c-r4k.c | |||
| @@ -446,6 +446,7 @@ static inline void local_r4k_flush_cache_page(void *args) | |||
| 446 | struct page *page = pfn_to_page(fcp_args->pfn); | 446 | struct page *page = pfn_to_page(fcp_args->pfn); |
| 447 | int exec = vma->vm_flags & VM_EXEC; | 447 | int exec = vma->vm_flags & VM_EXEC; |
| 448 | struct mm_struct *mm = vma->vm_mm; | 448 | struct mm_struct *mm = vma->vm_mm; |
| 449 | int map_coherent = 0; | ||
| 449 | pgd_t *pgdp; | 450 | pgd_t *pgdp; |
| 450 | pud_t *pudp; | 451 | pud_t *pudp; |
| 451 | pmd_t *pmdp; | 452 | pmd_t *pmdp; |
| @@ -479,7 +480,9 @@ static inline void local_r4k_flush_cache_page(void *args) | |||
| 479 | * Use kmap_coherent or kmap_atomic to do flushes for | 480 | * Use kmap_coherent or kmap_atomic to do flushes for |
| 480 | * another ASID than the current one. | 481 | * another ASID than the current one. |
| 481 | */ | 482 | */ |
| 482 | if (cpu_has_dc_aliases) | 483 | map_coherent = (cpu_has_dc_aliases && |
| 484 | page_mapped(page) && !Page_dcache_dirty(page)); | ||
| 485 | if (map_coherent) | ||
| 483 | vaddr = kmap_coherent(page, addr); | 486 | vaddr = kmap_coherent(page, addr); |
| 484 | else | 487 | else |
| 485 | vaddr = kmap_atomic(page, KM_USER0); | 488 | vaddr = kmap_atomic(page, KM_USER0); |
| @@ -502,7 +505,7 @@ static inline void local_r4k_flush_cache_page(void *args) | |||
| 502 | } | 505 | } |
| 503 | 506 | ||
| 504 | if (vaddr) { | 507 | if (vaddr) { |
| 505 | if (cpu_has_dc_aliases) | 508 | if (map_coherent) |
| 506 | kunmap_coherent(); | 509 | kunmap_coherent(); |
| 507 | else | 510 | else |
| 508 | kunmap_atomic(vaddr, KM_USER0); | 511 | kunmap_atomic(vaddr, KM_USER0); |
| @@ -1226,6 +1229,28 @@ void au1x00_fixup_config_od(void) | |||
| 1226 | } | 1229 | } |
| 1227 | } | 1230 | } |
| 1228 | 1231 | ||
| 1232 | /* CP0 hazard avoidance. */ | ||
| 1233 | #define NXP_BARRIER() \ | ||
| 1234 | __asm__ __volatile__( \ | ||
| 1235 | ".set noreorder\n\t" \ | ||
| 1236 | "nop; nop; nop; nop; nop; nop;\n\t" \ | ||
| 1237 | ".set reorder\n\t") | ||
| 1238 | |||
| 1239 | static void nxp_pr4450_fixup_config(void) | ||
| 1240 | { | ||
| 1241 | unsigned long config0; | ||
| 1242 | |||
| 1243 | config0 = read_c0_config(); | ||
| 1244 | |||
| 1245 | /* clear all three cache coherency fields */ | ||
| 1246 | config0 &= ~(0x7 | (7 << 25) | (7 << 28)); | ||
| 1247 | config0 |= (((_page_cachable_default >> _CACHE_SHIFT) << 0) | | ||
| 1248 | ((_page_cachable_default >> _CACHE_SHIFT) << 25) | | ||
| 1249 | ((_page_cachable_default >> _CACHE_SHIFT) << 28)); | ||
| 1250 | write_c0_config(config0); | ||
| 1251 | NXP_BARRIER(); | ||
| 1252 | } | ||
| 1253 | |||
| 1229 | static int __cpuinitdata cca = -1; | 1254 | static int __cpuinitdata cca = -1; |
| 1230 | 1255 | ||
| 1231 | static int __init cca_setup(char *str) | 1256 | static int __init cca_setup(char *str) |
| @@ -1271,6 +1296,10 @@ static void __cpuinit coherency_setup(void) | |||
| 1271 | case CPU_AU1500: /* rev. AB */ | 1296 | case CPU_AU1500: /* rev. AB */ |
| 1272 | au1x00_fixup_config_od(); | 1297 | au1x00_fixup_config_od(); |
| 1273 | break; | 1298 | break; |
| 1299 | |||
| 1300 | case PRID_IMP_PR4450: | ||
| 1301 | nxp_pr4450_fixup_config(); | ||
| 1302 | break; | ||
| 1274 | } | 1303 | } |
| 1275 | } | 1304 | } |
| 1276 | 1305 | ||
