[PATCH] ARM: Fix XScale PMD setting

The ARM Architecture Reference Manual lists bit 4 of the PMD as "implementation
defined" and it must be set to zero on Intel XScale CPUs or the cache does
not behave properly. Found by Mike Rapoport while debugging a flash issue
on the PXA255:

http://marc.10east.com/?l=linux-arm-kernel&m=114845287600782&w=1

Signed-off-by: Deepak Saxena <dsaxena@plexity.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Deepak Saxena and committed by Linus Torvalds 5cedae9c 29f767a2

+8 -2
+2 -2
arch/arm/mm/mm-armv.c
··· 376 ecc_mask = 0; 377 } 378 379 - if (cpu_arch <= CPU_ARCH_ARMv5TEJ) { 380 for (i = 0; i < ARRAY_SIZE(mem_types); i++) { 381 if (mem_types[i].prot_l1) 382 mem_types[i].prot_l1 |= PMD_BIT4; ··· 631 pgd = init_mm.pgd; 632 633 base_pmdval = PMD_SECT_AP_WRITE | PMD_SECT_AP_READ | PMD_TYPE_SECT; 634 - if (cpu_architecture() <= CPU_ARCH_ARMv5TEJ) 635 base_pmdval |= PMD_BIT4; 636 637 for (i = 0; i < FIRST_USER_PGD_NR + USER_PTRS_PER_PGD; i++, pgd++) {
··· 376 ecc_mask = 0; 377 } 378 379 + if (cpu_arch <= CPU_ARCH_ARMv5TEJ && !cpu_is_xscale()) { 380 for (i = 0; i < ARRAY_SIZE(mem_types); i++) { 381 if (mem_types[i].prot_l1) 382 mem_types[i].prot_l1 |= PMD_BIT4; ··· 631 pgd = init_mm.pgd; 632 633 base_pmdval = PMD_SECT_AP_WRITE | PMD_SECT_AP_READ | PMD_TYPE_SECT; 634 + if (cpu_architecture() <= CPU_ARCH_ARMv5TEJ && !cpu_is_xscale()) 635 base_pmdval |= PMD_BIT4; 636 637 for (i = 0; i < FIRST_USER_PGD_NR + USER_PTRS_PER_PGD; i++, pgd++) {
+6
include/asm-arm/system.h
··· 127 } 128 #endif 129 130 #define set_cr(x) \ 131 __asm__ __volatile__( \ 132 "mcr p15, 0, %0, c1, c0, 0 @ set CR" \
··· 127 } 128 #endif 129 130 + #if !defined(CONFIG_CPU_XSCALE) && !defined(CONFIG_CPU_XSC3) 131 + #define cpu_is_xscale() 0 132 + #else 133 + #define cpu_is_xscale() 1 134 + #endif 135 + 136 #define set_cr(x) \ 137 __asm__ __volatile__( \ 138 "mcr p15, 0, %0, c1, c0, 0 @ set CR" \