aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-08-03 13:39:02 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-08-03 13:39:02 -0400
commit7e31aa11fc672bbe0dd0da59513c9efe3809ced7 (patch)
tree0aafe6a0045230950ce6b26579a053da12614a49 /arch/arm/mm
parent071f4924844c435a3ae0cdbab7d7df2f1da85713 (diff)
parent9cb7117fa4858468014f76bd996076985111e955 (diff)
Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm: [ARM] 5182/1: pxa: Fix pcm990 compilation [ARM] Fix explicit asm(-arm)?/arch-foo references [ARM] move include/asm-arm to arch/arm/include/asm [ARM] Remove explicit dependency for misc.o from compressed/Makefile [ARM] initrd: claim initrd memory exclusively [ARM] pxa: add support for L2 outer cache on XScale3 (attempt 2) [ARM] 5180/1: at91: Fix at91_nand -> atmel_nand rename fallout [ARM] add Sascha Hauer as Freescale i.MX Maintainer [ARM] i.MX: add missing clock functions exports [ARM] i.MX: remove set_imx_fb_info() export [ARM] mx1ads: make mmc platform data available for modules [ARM] mx2: add missing Kconfig dependency
Diffstat (limited to 'arch/arm/mm')
-rw-r--r--arch/arm/mm/Kconfig10
-rw-r--r--arch/arm/mm/cache-xsc3l2.c182
-rw-r--r--arch/arm/mm/init.c32
-rw-r--r--arch/arm/mm/ioremap.c2
-rw-r--r--arch/arm/mm/proc-arm720.S2
-rw-r--r--arch/arm/mm/proc-xsc3.S22
6 files changed, 213 insertions, 37 deletions
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 3a6c8ec34cd9..ed15f876c725 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -187,7 +187,7 @@ config CPU_ARM926T
187 ARCH_AT91SAM9260 || ARCH_AT91SAM9261 || \ 187 ARCH_AT91SAM9260 || ARCH_AT91SAM9261 || \
188 ARCH_AT91SAM9263 || ARCH_AT91SAM9RL || \ 188 ARCH_AT91SAM9263 || ARCH_AT91SAM9RL || \
189 ARCH_AT91SAM9G20 || ARCH_AT91CAP9 || \ 189 ARCH_AT91SAM9G20 || ARCH_AT91CAP9 || \
190 ARCH_NS9XXX || ARCH_DAVINCI 190 ARCH_NS9XXX || ARCH_DAVINCI || ARCH_MX2
191 default y if ARCH_VERSATILE_PB || MACH_VERSATILE_AB || \ 191 default y if ARCH_VERSATILE_PB || MACH_VERSATILE_AB || \
192 ARCH_OMAP730 || ARCH_OMAP16XX || \ 192 ARCH_OMAP730 || ARCH_OMAP16XX || \
193 ARCH_PNX4008 || ARCH_NETX || CPU_S3C2412 || \ 193 ARCH_PNX4008 || ARCH_NETX || CPU_S3C2412 || \
@@ -742,3 +742,11 @@ config CACHE_L2X0
742 select OUTER_CACHE 742 select OUTER_CACHE
743 help 743 help
744 This option enables the L2x0 PrimeCell. 744 This option enables the L2x0 PrimeCell.
745
746config CACHE_XSC3L2
747 bool "Enable the L2 cache on XScale3"
748 depends on CPU_XSC3
749 default y
750 select OUTER_CACHE
751 help
752 This option enables the L2 cache on XScale3.
diff --git a/arch/arm/mm/cache-xsc3l2.c b/arch/arm/mm/cache-xsc3l2.c
new file mode 100644
index 000000000000..158bd96763d3
--- /dev/null
+++ b/arch/arm/mm/cache-xsc3l2.c
@@ -0,0 +1,182 @@
1/*
2 * arch/arm/mm/cache-xsc3l2.c - XScale3 L2 cache controller support
3 *
4 * Copyright (C) 2007 ARM Limited
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19#include <linux/init.h>
20#include <linux/spinlock.h>
21
22#include <asm/system.h>
23#include <asm/cacheflush.h>
24#include <asm/io.h>
25
26#define CR_L2 (1 << 26)
27
28#define CACHE_LINE_SIZE 32
29#define CACHE_LINE_SHIFT 5
30#define CACHE_WAY_PER_SET 8
31
32#define CACHE_WAY_SIZE(l2ctype) (8192 << (((l2ctype) >> 8) & 0xf))
33#define CACHE_SET_SIZE(l2ctype) (CACHE_WAY_SIZE(l2ctype) >> CACHE_LINE_SHIFT)
34
35static inline int xsc3_l2_present(void)
36{
37 unsigned long l2ctype;
38
39 __asm__("mrc p15, 1, %0, c0, c0, 1" : "=r" (l2ctype));
40
41 return !!(l2ctype & 0xf8);
42}
43
44static inline void xsc3_l2_clean_mva(unsigned long addr)
45{
46 __asm__("mcr p15, 1, %0, c7, c11, 1" : : "r" (addr));
47}
48
49static inline void xsc3_l2_clean_pa(unsigned long addr)
50{
51 xsc3_l2_clean_mva(__phys_to_virt(addr));
52}
53
54static inline void xsc3_l2_inv_mva(unsigned long addr)
55{
56 __asm__("mcr p15, 1, %0, c7, c7, 1" : : "r" (addr));
57}
58
59static inline void xsc3_l2_inv_pa(unsigned long addr)
60{
61 xsc3_l2_inv_mva(__phys_to_virt(addr));
62}
63
64static inline void xsc3_l2_inv_all(void)
65{
66 unsigned long l2ctype, set_way;
67 int set, way;
68
69 __asm__("mrc p15, 1, %0, c0, c0, 1" : "=r" (l2ctype));
70
71 for (set = 0; set < CACHE_SET_SIZE(l2ctype); set++) {
72 for (way = 0; way < CACHE_WAY_PER_SET; way++) {
73 set_way = (way << 29) | (set << 5);
74 __asm__("mcr p15, 1, %0, c7, c11, 2" : : "r"(set_way));
75 }
76 }
77
78 dsb();
79}
80
81static void xsc3_l2_inv_range(unsigned long start, unsigned long end)
82{
83 if (start == 0 && end == -1ul) {
84 xsc3_l2_inv_all();
85 return;
86 }
87
88 /*
89 * Clean and invalidate partial first cache line.
90 */
91 if (start & (CACHE_LINE_SIZE - 1)) {
92 xsc3_l2_clean_pa(start & ~(CACHE_LINE_SIZE - 1));
93 xsc3_l2_inv_pa(start & ~(CACHE_LINE_SIZE - 1));
94 start = (start | (CACHE_LINE_SIZE - 1)) + 1;
95 }
96
97 /*
98 * Clean and invalidate partial last cache line.
99 */
100 if (end & (CACHE_LINE_SIZE - 1)) {
101 xsc3_l2_clean_pa(end & ~(CACHE_LINE_SIZE - 1));
102 xsc3_l2_inv_pa(end & ~(CACHE_LINE_SIZE - 1));
103 end &= ~(CACHE_LINE_SIZE - 1);
104 }
105
106 /*
107 * Invalidate all full cache lines between 'start' and 'end'.
108 */
109 while (start != end) {
110 xsc3_l2_inv_pa(start);
111 start += CACHE_LINE_SIZE;
112 }
113
114 dsb();
115}
116
117static void xsc3_l2_clean_range(unsigned long start, unsigned long end)
118{
119 start &= ~(CACHE_LINE_SIZE - 1);
120 while (start < end) {
121 xsc3_l2_clean_pa(start);
122 start += CACHE_LINE_SIZE;
123 }
124
125 dsb();
126}
127
128/*
129 * optimize L2 flush all operation by set/way format
130 */
131static inline void xsc3_l2_flush_all(void)
132{
133 unsigned long l2ctype, set_way;
134 int set, way;
135
136 __asm__("mrc p15, 1, %0, c0, c0, 1" : "=r" (l2ctype));
137
138 for (set = 0; set < CACHE_SET_SIZE(l2ctype); set++) {
139 for (way = 0; way < CACHE_WAY_PER_SET; way++) {
140 set_way = (way << 29) | (set << 5);
141 __asm__("mcr p15, 1, %0, c7, c15, 2" : : "r"(set_way));
142 }
143 }
144
145 dsb();
146}
147
148static void xsc3_l2_flush_range(unsigned long start, unsigned long end)
149{
150 if (start == 0 && end == -1ul) {
151 xsc3_l2_flush_all();
152 return;
153 }
154
155 start &= ~(CACHE_LINE_SIZE - 1);
156 while (start < end) {
157 xsc3_l2_clean_pa(start);
158 xsc3_l2_inv_pa(start);
159 start += CACHE_LINE_SIZE;
160 }
161
162 dsb();
163}
164
165static int __init xsc3_l2_init(void)
166{
167 if (!cpu_is_xsc3() || !xsc3_l2_present())
168 return 0;
169
170 if (!(get_cr() & CR_L2)) {
171 pr_info("XScale3 L2 cache enabled.\n");
172 adjust_cr(CR_L2, CR_L2);
173 xsc3_l2_inv_all();
174 }
175
176 outer_cache.inv_range = xsc3_l2_inv_range;
177 outer_cache.clean_range = xsc3_l2_clean_range;
178 outer_cache.flush_range = xsc3_l2_flush_range;
179
180 return 0;
181}
182core_initcall(xsc3_l2_init);
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index e6352946dde0..30a69d67d673 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -156,9 +156,9 @@ static int __init check_initrd(struct meminfo *mi)
156 } 156 }
157 157
158 if (initrd_node == -1) { 158 if (initrd_node == -1) {
159 printk(KERN_ERR "initrd (0x%08lx - 0x%08lx) extends beyond " 159 printk(KERN_ERR "INITRD: 0x%08lx+0x%08lx extends beyond "
160 "physical memory - disabling initrd\n", 160 "physical memory - disabling initrd\n",
161 phys_initrd_start, end); 161 phys_initrd_start, phys_initrd_size);
162 phys_initrd_start = phys_initrd_size = 0; 162 phys_initrd_start = phys_initrd_size = 0;
163 } 163 }
164#endif 164#endif
@@ -239,25 +239,33 @@ bootmem_init_node(int node, int initrd_node, struct meminfo *mi)
239 reserve_bootmem_node(pgdat, boot_pfn << PAGE_SHIFT, 239 reserve_bootmem_node(pgdat, boot_pfn << PAGE_SHIFT,
240 boot_pages << PAGE_SHIFT, BOOTMEM_DEFAULT); 240 boot_pages << PAGE_SHIFT, BOOTMEM_DEFAULT);
241 241
242 /*
243 * Reserve any special node zero regions.
244 */
245 if (node == 0)
246 reserve_node_zero(pgdat);
247
242#ifdef CONFIG_BLK_DEV_INITRD 248#ifdef CONFIG_BLK_DEV_INITRD
243 /* 249 /*
244 * If the initrd is in this node, reserve its memory. 250 * If the initrd is in this node, reserve its memory.
245 */ 251 */
246 if (node == initrd_node) { 252 if (node == initrd_node) {
247 reserve_bootmem_node(pgdat, phys_initrd_start, 253 int res = reserve_bootmem_node(pgdat, phys_initrd_start,
248 phys_initrd_size, BOOTMEM_DEFAULT); 254 phys_initrd_size, BOOTMEM_EXCLUSIVE);
249 initrd_start = __phys_to_virt(phys_initrd_start); 255
250 initrd_end = initrd_start + phys_initrd_size; 256 if (res == 0) {
257 initrd_start = __phys_to_virt(phys_initrd_start);
258 initrd_end = initrd_start + phys_initrd_size;
259 } else {
260 printk(KERN_ERR
261 "INITRD: 0x%08lx+0x%08lx overlaps in-use "
262 "memory region - disabling initrd\n",
263 phys_initrd_start, phys_initrd_size);
264 }
251 } 265 }
252#endif 266#endif
253 267
254 /* 268 /*
255 * Finally, reserve any node zero regions.
256 */
257 if (node == 0)
258 reserve_node_zero(pgdat);
259
260 /*
261 * initialise the zones within this node. 269 * initialise the zones within this node.
262 */ 270 */
263 memset(zone_size, 0, sizeof(zone_size)); 271 memset(zone_size, 0, sizeof(zone_size));
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index 303a7ff6bfd2..b81dbf9ffb77 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -259,7 +259,7 @@ remap_area_supersections(unsigned long virt, unsigned long pfn,
259 * caller shouldn't need to know that small detail. 259 * caller shouldn't need to know that small detail.
260 * 260 *
261 * 'flags' are the extra L_PTE_ flags that you want to specify for this 261 * 'flags' are the extra L_PTE_ flags that you want to specify for this
262 * mapping. See include/asm-arm/proc-armv/pgtable.h for more information. 262 * mapping. See <asm/pgtable.h> for more information.
263 */ 263 */
264void __iomem * 264void __iomem *
265__arm_ioremap_pfn(unsigned long pfn, unsigned long offset, size_t size, 265__arm_ioremap_pfn(unsigned long pfn, unsigned long offset, size_t size,
diff --git a/arch/arm/mm/proc-arm720.S b/arch/arm/mm/proc-arm720.S
index d64f8e6f75ab..eda733d30455 100644
--- a/arch/arm/mm/proc-arm720.S
+++ b/arch/arm/mm/proc-arm720.S
@@ -231,7 +231,7 @@ cpu_arm720_name:
231 .align 231 .align
232 232
233/* 233/*
234 * See linux/include/asm-arm/procinfo.h for a definition of this structure. 234 * See <asm/procinfo.h> for a definition of this structure.
235 */ 235 */
236 236
237 .section ".proc.info.init", #alloc, #execinstr 237 .section ".proc.info.init", #alloc, #execinstr
diff --git a/arch/arm/mm/proc-xsc3.S b/arch/arm/mm/proc-xsc3.S
index 3533741a76f6..6ff53c24510f 100644
--- a/arch/arm/mm/proc-xsc3.S
+++ b/arch/arm/mm/proc-xsc3.S
@@ -52,11 +52,6 @@
52#define CACHESIZE 32768 52#define CACHESIZE 32768
53 53
54/* 54/*
55 * Run with L2 enabled.
56 */
57#define L2_CACHE_ENABLE 1
58
59/*
60 * This macro is used to wait for a CP15 write and is needed when we 55 * This macro is used to wait for a CP15 write and is needed when we
61 * have to ensure that the last operation to the coprocessor was 56 * have to ensure that the last operation to the coprocessor was
62 * completed before continuing with operation. 57 * completed before continuing with operation.
@@ -265,12 +260,9 @@ ENTRY(xsc3_dma_inv_range)
265 tst r0, #CACHELINESIZE - 1 260 tst r0, #CACHELINESIZE - 1
266 bic r0, r0, #CACHELINESIZE - 1 261 bic r0, r0, #CACHELINESIZE - 1
267 mcrne p15, 0, r0, c7, c10, 1 @ clean L1 D line 262 mcrne p15, 0, r0, c7, c10, 1 @ clean L1 D line
268 mcrne p15, 1, r0, c7, c11, 1 @ clean L2 line
269 tst r1, #CACHELINESIZE - 1 263 tst r1, #CACHELINESIZE - 1
270 mcrne p15, 0, r1, c7, c10, 1 @ clean L1 D line 264 mcrne p15, 0, r1, c7, c10, 1 @ clean L1 D line
271 mcrne p15, 1, r1, c7, c11, 1 @ clean L2 line
2721: mcr p15, 0, r0, c7, c6, 1 @ invalidate L1 D line 2651: mcr p15, 0, r0, c7, c6, 1 @ invalidate L1 D line
273 mcr p15, 1, r0, c7, c7, 1 @ invalidate L2 line
274 add r0, r0, #CACHELINESIZE 266 add r0, r0, #CACHELINESIZE
275 cmp r0, r1 267 cmp r0, r1
276 blo 1b 268 blo 1b
@@ -288,7 +280,6 @@ ENTRY(xsc3_dma_inv_range)
288ENTRY(xsc3_dma_clean_range) 280ENTRY(xsc3_dma_clean_range)
289 bic r0, r0, #CACHELINESIZE - 1 281 bic r0, r0, #CACHELINESIZE - 1
2901: mcr p15, 0, r0, c7, c10, 1 @ clean L1 D line 2821: mcr p15, 0, r0, c7, c10, 1 @ clean L1 D line
291 mcr p15, 1, r0, c7, c11, 1 @ clean L2 line
292 add r0, r0, #CACHELINESIZE 283 add r0, r0, #CACHELINESIZE
293 cmp r0, r1 284 cmp r0, r1
294 blo 1b 285 blo 1b
@@ -306,8 +297,6 @@ ENTRY(xsc3_dma_clean_range)
306ENTRY(xsc3_dma_flush_range) 297ENTRY(xsc3_dma_flush_range)
307 bic r0, r0, #CACHELINESIZE - 1 298 bic r0, r0, #CACHELINESIZE - 1
3081: mcr p15, 0, r0, c7, c14, 1 @ clean/invalidate L1 D line 2991: mcr p15, 0, r0, c7, c14, 1 @ clean/invalidate L1 D line
309 mcr p15, 1, r0, c7, c11, 1 @ clean L2 line
310 mcr p15, 1, r0, c7, c7, 1 @ invalidate L2 line
311 add r0, r0, #CACHELINESIZE 300 add r0, r0, #CACHELINESIZE
312 cmp r0, r1 301 cmp r0, r1
313 blo 1b 302 blo 1b
@@ -347,9 +336,7 @@ ENTRY(cpu_xsc3_switch_mm)
347 mcr p15, 0, ip, c7, c5, 0 @ invalidate L1 I cache and BTB 336 mcr p15, 0, ip, c7, c5, 0 @ invalidate L1 I cache and BTB
348 mcr p15, 0, ip, c7, c10, 4 @ data write barrier 337 mcr p15, 0, ip, c7, c10, 4 @ data write barrier
349 mcr p15, 0, ip, c7, c5, 4 @ prefetch flush 338 mcr p15, 0, ip, c7, c5, 4 @ prefetch flush
350#ifdef L2_CACHE_ENABLE
351 orr r0, r0, #0x18 @ cache the page table in L2 339 orr r0, r0, #0x18 @ cache the page table in L2
352#endif
353 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer 340 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
354 mcr p15, 0, ip, c8, c7, 0 @ invalidate I and D TLBs 341 mcr p15, 0, ip, c8, c7, 0 @ invalidate I and D TLBs
355 cpwait_ret lr, ip 342 cpwait_ret lr, ip
@@ -378,12 +365,10 @@ ENTRY(cpu_xsc3_set_pte_ext)
378 orreq r2, r2, #PTE_EXT_AP_UNO_SRW @ yes -> user n/a, system r/w 365 orreq r2, r2, #PTE_EXT_AP_UNO_SRW @ yes -> user n/a, system r/w
379 @ combined with user -> user r/w 366 @ combined with user -> user r/w
380 367
381#if L2_CACHE_ENABLE
382 @ If it's cacheable, it needs to be in L2 also. 368 @ If it's cacheable, it needs to be in L2 also.
383 eor ip, r1, #L_PTE_CACHEABLE 369 eor ip, r1, #L_PTE_CACHEABLE
384 tst ip, #L_PTE_CACHEABLE 370 tst ip, #L_PTE_CACHEABLE
385 orreq r2, r2, #PTE_EXT_TEX(0x5) 371 orreq r2, r2, #PTE_EXT_TEX(0x5)
386#endif
387 372
388 tst r3, #L_PTE_PRESENT | L_PTE_YOUNG @ present and young? 373 tst r3, #L_PTE_PRESENT | L_PTE_YOUNG @ present and young?
389 movne r2, #0 @ no -> fault 374 movne r2, #0 @ no -> fault
@@ -408,9 +393,7 @@ __xsc3_setup:
408 mcr p15, 0, ip, c7, c10, 4 @ data write barrier 393 mcr p15, 0, ip, c7, c10, 4 @ data write barrier
409 mcr p15, 0, ip, c7, c5, 4 @ prefetch flush 394 mcr p15, 0, ip, c7, c5, 4 @ prefetch flush
410 mcr p15, 0, ip, c8, c7, 0 @ invalidate I and D TLBs 395 mcr p15, 0, ip, c8, c7, 0 @ invalidate I and D TLBs
411#if L2_CACHE_ENABLE
412 orr r4, r4, #0x18 @ cache the page table in L2 396 orr r4, r4, #0x18 @ cache the page table in L2
413#endif
414 mcr p15, 0, r4, c2, c0, 0 @ load page table pointer 397 mcr p15, 0, r4, c2, c0, 0 @ load page table pointer
415 398
416 mov r0, #0 @ don't allow CP access 399 mov r0, #0 @ don't allow CP access
@@ -418,9 +401,7 @@ __xsc3_setup:
418 401
419 mrc p15, 0, r0, c1, c0, 1 @ get auxiliary control reg 402 mrc p15, 0, r0, c1, c0, 1 @ get auxiliary control reg
420 and r0, r0, #2 @ preserve bit P bit setting 403 and r0, r0, #2 @ preserve bit P bit setting
421#if L2_CACHE_ENABLE
422 orr r0, r0, #(1 << 10) @ enable L2 for LLR cache 404 orr r0, r0, #(1 << 10) @ enable L2 for LLR cache
423#endif
424 mcr p15, 0, r0, c1, c0, 1 @ set auxiliary control reg 405 mcr p15, 0, r0, c1, c0, 1 @ set auxiliary control reg
425 406
426 adr r5, xsc3_crval 407 adr r5, xsc3_crval
@@ -429,9 +410,6 @@ __xsc3_setup:
429 bic r0, r0, r5 @ ..V. ..R. .... ..A. 410 bic r0, r0, r5 @ ..V. ..R. .... ..A.
430 orr r0, r0, r6 @ ..VI Z..S .... .C.M (mmu) 411 orr r0, r0, r6 @ ..VI Z..S .... .C.M (mmu)
431 @ ...I Z..S .... .... (uc) 412 @ ...I Z..S .... .... (uc)
432#if L2_CACHE_ENABLE
433 orr r0, r0, #0x04000000 @ L2 enable
434#endif
435 mov pc, lr 413 mov pc, lr
436 414
437 .size __xsc3_setup, . - __xsc3_setup 415 .size __xsc3_setup, . - __xsc3_setup