diff options
author | Eric Miao <eric.miao@marvell.com> | 2008-06-06 04:34:03 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-07-28 18:13:09 -0400 |
commit | 905a09d57afcc49511de18a95605c11ad9c88649 (patch) | |
tree | 3e027f413846fb0b392068183dcc840b5aea64ef /arch/arm/mm/proc-xsc3.S | |
parent | e76e3ac69e62d3f93e935526bc9afa371e7f38ba (diff) |
[ARM] pxa: add support for L2 outer cache on XScale3 (attempt 2)
(20072fd0c93349e19527dd2fa9588b4335960e62 lost most of its changes
somehow, came from a mbox archive applied with git-am. No idea
what happened. This puts back the missing bits. --rmk)
The initial patch from Lothar, and Lennert make it into a cleaner
one, modified and tested on PXA320 by Eric Miao.
This patch moves the L2 cache operations out of proc-xsc3.S into
dedicated outer cache support code.
CACHE_XSC3L2 can be deselected so no L2 cache specific code will be
linked in, and that L2 enable bit will not be set, this applies to
the following cases:
a. _only_ PXA300/PXA310 support included and no L2 cache wanted
b. PXA320 support included, but want L2 be disabled
So the enabling of L2 depends on two things:
- CACHE_XSC3L2 is selected
- and L2 cache is present
Where the latter is only a safeguard (previous testing shows it works
OK even when this bit is turned on).
IXP series of processors with XScale3 cannot disable L2 cache for the
moment since they depend on the L2 cache for its coherent memory, so
IXP may always select CACHE_XSC3L2.
Other L2 relevant bits are always turned on (i.e. the original code
enclosed by #if L2_CACHE_ENABLED .. #endif), as they showed no side
effects. Specifically, these bits are:
- OC bits in TTBASE register (table walk outer cache attributes)
- LLR Outer Cache Attributes (OC) in Auxiliary Control Register
Signed-off-by: Lothar WaÃ<9f>mann <LW@KARO-electronics.de>
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mm/proc-xsc3.S')
-rw-r--r-- | arch/arm/mm/proc-xsc3.S | 22 |
1 files changed, 0 insertions, 22 deletions
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 | ||
272 | 1: mcr p15, 0, r0, c7, c6, 1 @ invalidate L1 D line | 265 | 1: 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) | |||
288 | ENTRY(xsc3_dma_clean_range) | 280 | ENTRY(xsc3_dma_clean_range) |
289 | bic r0, r0, #CACHELINESIZE - 1 | 281 | bic r0, r0, #CACHELINESIZE - 1 |
290 | 1: mcr p15, 0, r0, c7, c10, 1 @ clean L1 D line | 282 | 1: 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) | |||
306 | ENTRY(xsc3_dma_flush_range) | 297 | ENTRY(xsc3_dma_flush_range) |
307 | bic r0, r0, #CACHELINESIZE - 1 | 298 | bic r0, r0, #CACHELINESIZE - 1 |
308 | 1: mcr p15, 0, r0, c7, c14, 1 @ clean/invalidate L1 D line | 299 | 1: 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 |