diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-12-05 05:35:33 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-12-05 05:35:33 -0500 |
commit | 0719dc341389882cc834ed18fc9b7fc6006b2b85 (patch) | |
tree | 794480ac62c07ea8cc4e69c2cb3d2b83bb7f36b7 /arch/arm/mm | |
parent | e28edb723e64200554194da17617ee6e82de6690 (diff) | |
parent | 677f4f64e4b2336682f0e15c69b206ade6f6b131 (diff) |
Merge branch 'devel-stable' into devel
Diffstat (limited to 'arch/arm/mm')
-rw-r--r-- | arch/arm/mm/Kconfig | 11 | ||||
-rw-r--r-- | arch/arm/mm/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mm/cache-tauros2.c | 263 | ||||
-rw-r--r-- | arch/arm/mm/mmu.c | 2 | ||||
-rw-r--r-- | arch/arm/mm/proc-v6.S | 33 | ||||
-rw-r--r-- | arch/arm/mm/proc-xsc3.S | 2 |
6 files changed, 308 insertions, 5 deletions
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig index 7b7d4c36c11c..dd4698c67cc3 100644 --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig | |||
@@ -388,7 +388,7 @@ config CPU_FEROCEON_OLD_ID | |||
388 | 388 | ||
389 | # ARMv6 | 389 | # ARMv6 |
390 | config CPU_V6 | 390 | config CPU_V6 |
391 | bool "Support ARM V6 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX | 391 | bool "Support ARM V6 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX || ARCH_DOVE |
392 | select CPU_32v6 | 392 | select CPU_32v6 |
393 | select CPU_ABRT_EV6 | 393 | select CPU_ABRT_EV6 |
394 | select CPU_PABRT_V6 | 394 | select CPU_PABRT_V6 |
@@ -764,6 +764,15 @@ config CACHE_L2X0 | |||
764 | help | 764 | help |
765 | This option enables the L2x0 PrimeCell. | 765 | This option enables the L2x0 PrimeCell. |
766 | 766 | ||
767 | config CACHE_TAUROS2 | ||
768 | bool "Enable the Tauros2 L2 cache controller" | ||
769 | depends on ARCH_DOVE | ||
770 | default y | ||
771 | select OUTER_CACHE | ||
772 | help | ||
773 | This option enables the Tauros2 L2 cache controller (as | ||
774 | found on PJ1/PJ4). | ||
775 | |||
767 | config CACHE_XSC3L2 | 776 | config CACHE_XSC3L2 |
768 | bool "Enable the L2 cache on XScale3" | 777 | bool "Enable the L2 cache on XScale3" |
769 | depends on CPU_XSC3 | 778 | depends on CPU_XSC3 |
diff --git a/arch/arm/mm/Makefile b/arch/arm/mm/Makefile index 42352e75742b..827e238e5d4a 100644 --- a/arch/arm/mm/Makefile +++ b/arch/arm/mm/Makefile | |||
@@ -87,4 +87,4 @@ obj-$(CONFIG_CPU_V7) += proc-v7.o | |||
87 | obj-$(CONFIG_CACHE_FEROCEON_L2) += cache-feroceon-l2.o | 87 | obj-$(CONFIG_CACHE_FEROCEON_L2) += cache-feroceon-l2.o |
88 | obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o | 88 | obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o |
89 | obj-$(CONFIG_CACHE_XSC3L2) += cache-xsc3l2.o | 89 | obj-$(CONFIG_CACHE_XSC3L2) += cache-xsc3l2.o |
90 | 90 | obj-$(CONFIG_CACHE_TAUROS2) += cache-tauros2.o | |
diff --git a/arch/arm/mm/cache-tauros2.c b/arch/arm/mm/cache-tauros2.c new file mode 100644 index 000000000000..50868651890f --- /dev/null +++ b/arch/arm/mm/cache-tauros2.c | |||
@@ -0,0 +1,263 @@ | |||
1 | /* | ||
2 | * arch/arm/mm/cache-tauros2.c - Tauros2 L2 cache controller support | ||
3 | * | ||
4 | * Copyright (C) 2008 Marvell Semiconductor | ||
5 | * | ||
6 | * This file is licensed under the terms of the GNU General Public | ||
7 | * License version 2. This program is licensed "as is" without any | ||
8 | * warranty of any kind, whether express or implied. | ||
9 | * | ||
10 | * References: | ||
11 | * - PJ1 CPU Core Datasheet, | ||
12 | * Document ID MV-S104837-01, Rev 0.7, January 24 2008. | ||
13 | * - PJ4 CPU Core Datasheet, | ||
14 | * Document ID MV-S105190-00, Rev 0.7, March 14 2008. | ||
15 | */ | ||
16 | |||
17 | #include <linux/init.h> | ||
18 | #include <asm/cacheflush.h> | ||
19 | #include <asm/hardware/cache-tauros2.h> | ||
20 | |||
21 | |||
22 | /* | ||
23 | * When Tauros2 is used on a CPU that supports the v7 hierarchical | ||
24 | * cache operations, the cache handling code in proc-v7.S takes care | ||
25 | * of everything, including handling DMA coherency. | ||
26 | * | ||
27 | * So, we only need to register outer cache operations here if we're | ||
28 | * being used on a pre-v7 CPU, and we only need to build support for | ||
29 | * outer cache operations into the kernel image if the kernel has been | ||
30 | * configured to support a pre-v7 CPU. | ||
31 | */ | ||
32 | #if __LINUX_ARM_ARCH__ < 7 | ||
33 | /* | ||
34 | * Low-level cache maintenance operations. | ||
35 | */ | ||
36 | static inline void tauros2_clean_pa(unsigned long addr) | ||
37 | { | ||
38 | __asm__("mcr p15, 1, %0, c7, c11, 3" : : "r" (addr)); | ||
39 | } | ||
40 | |||
41 | static inline void tauros2_clean_inv_pa(unsigned long addr) | ||
42 | { | ||
43 | __asm__("mcr p15, 1, %0, c7, c15, 3" : : "r" (addr)); | ||
44 | } | ||
45 | |||
46 | static inline void tauros2_inv_pa(unsigned long addr) | ||
47 | { | ||
48 | __asm__("mcr p15, 1, %0, c7, c7, 3" : : "r" (addr)); | ||
49 | } | ||
50 | |||
51 | |||
52 | /* | ||
53 | * Linux primitives. | ||
54 | * | ||
55 | * Note that the end addresses passed to Linux primitives are | ||
56 | * noninclusive. | ||
57 | */ | ||
58 | #define CACHE_LINE_SIZE 32 | ||
59 | |||
60 | static void tauros2_inv_range(unsigned long start, unsigned long end) | ||
61 | { | ||
62 | /* | ||
63 | * Clean and invalidate partial first cache line. | ||
64 | */ | ||
65 | if (start & (CACHE_LINE_SIZE - 1)) { | ||
66 | tauros2_clean_inv_pa(start & ~(CACHE_LINE_SIZE - 1)); | ||
67 | start = (start | (CACHE_LINE_SIZE - 1)) + 1; | ||
68 | } | ||
69 | |||
70 | /* | ||
71 | * Clean and invalidate partial last cache line. | ||
72 | */ | ||
73 | if (end & (CACHE_LINE_SIZE - 1)) { | ||
74 | tauros2_clean_inv_pa(end & ~(CACHE_LINE_SIZE - 1)); | ||
75 | end &= ~(CACHE_LINE_SIZE - 1); | ||
76 | } | ||
77 | |||
78 | /* | ||
79 | * Invalidate all full cache lines between 'start' and 'end'. | ||
80 | */ | ||
81 | while (start < end) { | ||
82 | tauros2_inv_pa(start); | ||
83 | start += CACHE_LINE_SIZE; | ||
84 | } | ||
85 | |||
86 | dsb(); | ||
87 | } | ||
88 | |||
89 | static void tauros2_clean_range(unsigned long start, unsigned long end) | ||
90 | { | ||
91 | start &= ~(CACHE_LINE_SIZE - 1); | ||
92 | while (start < end) { | ||
93 | tauros2_clean_pa(start); | ||
94 | start += CACHE_LINE_SIZE; | ||
95 | } | ||
96 | |||
97 | dsb(); | ||
98 | } | ||
99 | |||
100 | static void tauros2_flush_range(unsigned long start, unsigned long end) | ||
101 | { | ||
102 | start &= ~(CACHE_LINE_SIZE - 1); | ||
103 | while (start < end) { | ||
104 | tauros2_clean_inv_pa(start); | ||
105 | start += CACHE_LINE_SIZE; | ||
106 | } | ||
107 | |||
108 | dsb(); | ||
109 | } | ||
110 | #endif | ||
111 | |||
112 | static inline u32 __init read_extra_features(void) | ||
113 | { | ||
114 | u32 u; | ||
115 | |||
116 | __asm__("mrc p15, 1, %0, c15, c1, 0" : "=r" (u)); | ||
117 | |||
118 | return u; | ||
119 | } | ||
120 | |||
121 | static inline void __init write_extra_features(u32 u) | ||
122 | { | ||
123 | __asm__("mcr p15, 1, %0, c15, c1, 0" : : "r" (u)); | ||
124 | } | ||
125 | |||
126 | static void __init disable_l2_prefetch(void) | ||
127 | { | ||
128 | u32 u; | ||
129 | |||
130 | /* | ||
131 | * Read the CPU Extra Features register and verify that the | ||
132 | * Disable L2 Prefetch bit is set. | ||
133 | */ | ||
134 | u = read_extra_features(); | ||
135 | if (!(u & 0x01000000)) { | ||
136 | printk(KERN_INFO "Tauros2: Disabling L2 prefetch.\n"); | ||
137 | write_extra_features(u | 0x01000000); | ||
138 | } | ||
139 | } | ||
140 | |||
141 | static inline int __init cpuid_scheme(void) | ||
142 | { | ||
143 | extern int processor_id; | ||
144 | |||
145 | return !!((processor_id & 0x000f0000) == 0x000f0000); | ||
146 | } | ||
147 | |||
148 | static inline u32 __init read_mmfr3(void) | ||
149 | { | ||
150 | u32 mmfr3; | ||
151 | |||
152 | __asm__("mrc p15, 0, %0, c0, c1, 7\n" : "=r" (mmfr3)); | ||
153 | |||
154 | return mmfr3; | ||
155 | } | ||
156 | |||
157 | static inline u32 __init read_actlr(void) | ||
158 | { | ||
159 | u32 actlr; | ||
160 | |||
161 | __asm__("mrc p15, 0, %0, c1, c0, 1\n" : "=r" (actlr)); | ||
162 | |||
163 | return actlr; | ||
164 | } | ||
165 | |||
166 | static inline void __init write_actlr(u32 actlr) | ||
167 | { | ||
168 | __asm__("mcr p15, 0, %0, c1, c0, 1\n" : : "r" (actlr)); | ||
169 | } | ||
170 | |||
171 | void __init tauros2_init(void) | ||
172 | { | ||
173 | extern int processor_id; | ||
174 | char *mode; | ||
175 | |||
176 | disable_l2_prefetch(); | ||
177 | |||
178 | #ifdef CONFIG_CPU_32v5 | ||
179 | if ((processor_id & 0xff0f0000) == 0x56050000) { | ||
180 | u32 feat; | ||
181 | |||
182 | /* | ||
183 | * v5 CPUs with Tauros2 have the L2 cache enable bit | ||
184 | * located in the CPU Extra Features register. | ||
185 | */ | ||
186 | feat = read_extra_features(); | ||
187 | if (!(feat & 0x00400000)) { | ||
188 | printk(KERN_INFO "Tauros2: Enabling L2 cache.\n"); | ||
189 | write_extra_features(feat | 0x00400000); | ||
190 | } | ||
191 | |||
192 | mode = "ARMv5"; | ||
193 | outer_cache.inv_range = tauros2_inv_range; | ||
194 | outer_cache.clean_range = tauros2_clean_range; | ||
195 | outer_cache.flush_range = tauros2_flush_range; | ||
196 | } | ||
197 | #endif | ||
198 | |||
199 | #ifdef CONFIG_CPU_32v6 | ||
200 | /* | ||
201 | * Check whether this CPU lacks support for the v7 hierarchical | ||
202 | * cache ops. (PJ4 is in its v6 personality mode if the MMFR3 | ||
203 | * register indicates no support for the v7 hierarchical cache | ||
204 | * ops.) | ||
205 | */ | ||
206 | if (cpuid_scheme() && (read_mmfr3() & 0xf) == 0) { | ||
207 | /* | ||
208 | * When Tauros2 is used in an ARMv6 system, the L2 | ||
209 | * enable bit is in the ARMv6 ARM-mandated position | ||
210 | * (bit [26] of the System Control Register). | ||
211 | */ | ||
212 | if (!(get_cr() & 0x04000000)) { | ||
213 | printk(KERN_INFO "Tauros2: Enabling L2 cache.\n"); | ||
214 | adjust_cr(0x04000000, 0x04000000); | ||
215 | } | ||
216 | |||
217 | mode = "ARMv6"; | ||
218 | outer_cache.inv_range = tauros2_inv_range; | ||
219 | outer_cache.clean_range = tauros2_clean_range; | ||
220 | outer_cache.flush_range = tauros2_flush_range; | ||
221 | } | ||
222 | #endif | ||
223 | |||
224 | #ifdef CONFIG_CPU_32v7 | ||
225 | /* | ||
226 | * Check whether this CPU has support for the v7 hierarchical | ||
227 | * cache ops. (PJ4 is in its v7 personality mode if the MMFR3 | ||
228 | * register indicates support for the v7 hierarchical cache | ||
229 | * ops.) | ||
230 | * | ||
231 | * (Although strictly speaking there may exist CPUs that | ||
232 | * implement the v7 cache ops but are only ARMv6 CPUs (due to | ||
233 | * not complying with all of the other ARMv7 requirements), | ||
234 | * there are no real-life examples of Tauros2 being used on | ||
235 | * such CPUs as of yet.) | ||
236 | */ | ||
237 | if (cpuid_scheme() && (read_mmfr3() & 0xf) == 1) { | ||
238 | u32 actlr; | ||
239 | |||
240 | /* | ||
241 | * When Tauros2 is used in an ARMv7 system, the L2 | ||
242 | * enable bit is located in the Auxiliary System Control | ||
243 | * Register (which is the only register allowed by the | ||
244 | * ARMv7 spec to contain fine-grained cache control bits). | ||
245 | */ | ||
246 | actlr = read_actlr(); | ||
247 | if (!(actlr & 0x00000002)) { | ||
248 | printk(KERN_INFO "Tauros2: Enabling L2 cache.\n"); | ||
249 | write_actlr(actlr | 0x00000002); | ||
250 | } | ||
251 | |||
252 | mode = "ARMv7"; | ||
253 | } | ||
254 | #endif | ||
255 | |||
256 | if (mode == NULL) { | ||
257 | printk(KERN_CRIT "Tauros2: Unable to detect CPU mode.\n"); | ||
258 | return; | ||
259 | } | ||
260 | |||
261 | printk(KERN_INFO "Tauros2: L2 cache support initialised " | ||
262 | "in %s mode.\n", mode); | ||
263 | } | ||
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 2427cdcd9098..8c7fbd19a4b3 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c | |||
@@ -881,7 +881,7 @@ void __init reserve_node_zero(pg_data_t *pgdat) | |||
881 | BOOTMEM_EXCLUSIVE); | 881 | BOOTMEM_EXCLUSIVE); |
882 | } | 882 | } |
883 | 883 | ||
884 | if (machine_is_treo680()) { | 884 | if (machine_is_treo680() || machine_is_centro()) { |
885 | reserve_bootmem_node(pgdat, 0xa0000000, 0x1000, | 885 | reserve_bootmem_node(pgdat, 0xa0000000, 0x1000, |
886 | BOOTMEM_EXCLUSIVE); | 886 | BOOTMEM_EXCLUSIVE); |
887 | reserve_bootmem_node(pgdat, 0xa2000000, 0x1000, | 887 | reserve_bootmem_node(pgdat, 0xa2000000, 0x1000, |
diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S index 70f75d2e3ead..5485c821101c 100644 --- a/arch/arm/mm/proc-v6.S +++ b/arch/arm/mm/proc-v6.S | |||
@@ -130,9 +130,16 @@ ENTRY(cpu_v6_set_pte_ext) | |||
130 | 130 | ||
131 | 131 | ||
132 | 132 | ||
133 | 133 | .type cpu_v6_name, #object | |
134 | cpu_v6_name: | 134 | cpu_v6_name: |
135 | .asciz "ARMv6-compatible processor" | 135 | .asciz "ARMv6-compatible processor" |
136 | .size cpu_v6_name, . - cpu_v6_name | ||
137 | |||
138 | .type cpu_pj4_name, #object | ||
139 | cpu_pj4_name: | ||
140 | .asciz "Marvell PJ4 processor" | ||
141 | .size cpu_pj4_name, . - cpu_pj4_name | ||
142 | |||
136 | .align | 143 | .align |
137 | 144 | ||
138 | __INIT | 145 | __INIT |
@@ -241,3 +248,27 @@ __v6_proc_info: | |||
241 | .long v6_user_fns | 248 | .long v6_user_fns |
242 | .long v6_cache_fns | 249 | .long v6_cache_fns |
243 | .size __v6_proc_info, . - __v6_proc_info | 250 | .size __v6_proc_info, . - __v6_proc_info |
251 | |||
252 | .type __pj4_v6_proc_info, #object | ||
253 | __pj4_v6_proc_info: | ||
254 | .long 0x560f5810 | ||
255 | .long 0xff0ffff0 | ||
256 | .long PMD_TYPE_SECT | \ | ||
257 | PMD_SECT_BUFFERABLE | \ | ||
258 | PMD_SECT_CACHEABLE | \ | ||
259 | PMD_SECT_AP_WRITE | \ | ||
260 | PMD_SECT_AP_READ | ||
261 | .long PMD_TYPE_SECT | \ | ||
262 | PMD_SECT_XN | \ | ||
263 | PMD_SECT_AP_WRITE | \ | ||
264 | PMD_SECT_AP_READ | ||
265 | b __v6_setup | ||
266 | .long cpu_arch_name | ||
267 | .long cpu_elf_name | ||
268 | .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP | ||
269 | .long cpu_pj4_name | ||
270 | .long v6_processor_functions | ||
271 | .long v6wbi_tlb_fns | ||
272 | .long v6_user_fns | ||
273 | .long v6_cache_fns | ||
274 | .size __pj4_v6_proc_info, . - __pj4_v6_proc_info | ||
diff --git a/arch/arm/mm/proc-xsc3.S b/arch/arm/mm/proc-xsc3.S index 2028f3702881..fab134e29826 100644 --- a/arch/arm/mm/proc-xsc3.S +++ b/arch/arm/mm/proc-xsc3.S | |||
@@ -396,7 +396,7 @@ __xsc3_setup: | |||
396 | orr r4, r4, #0x18 @ cache the page table in L2 | 396 | orr r4, r4, #0x18 @ cache the page table in L2 |
397 | mcr p15, 0, r4, c2, c0, 0 @ load page table pointer | 397 | mcr p15, 0, r4, c2, c0, 0 @ load page table pointer |
398 | 398 | ||
399 | mov r0, #0 @ don't allow CP access | 399 | mov r0, #1 << 6 @ cp6 access for early sched_clock |
400 | mcr p15, 0, r0, c15, c1, 0 @ write CP access register | 400 | mcr p15, 0, r0, c15, c1, 0 @ write CP access register |
401 | 401 | ||
402 | mrc p15, 0, r0, c1, c0, 1 @ get auxiliary control reg | 402 | mrc p15, 0, r0, c1, c0, 1 @ get auxiliary control reg |