diff options
author | Lennert Buytenhek <buytenh@wantstofly.org> | 2008-06-22 16:45:04 -0400 |
---|---|---|
committer | Lennert Buytenhek <buytenh@marvell.com> | 2008-06-22 16:45:04 -0400 |
commit | 99c6dc117d27d6259214812bd0b113aaf467f600 (patch) | |
tree | 0baadd0827fc39f9d2b052305f9447e4b50c5162 /arch/arm/mm/proc-feroceon.S | |
parent | 836a8051d54525e0782f156dcfa3c13d30f22840 (diff) |
[ARM] Feroceon: L2 cache support
This patch adds support for the unified Feroceon L2 cache controller
as found in e.g. the Marvell Kirkwood and Marvell Discovery Duo
families of ARM SoCs.
Note that:
- Page table walks are outer uncacheable on Kirkwood and Discovery
Duo, since the ARMv5 spec provides no way to indicate outer
cacheability of page table walks (specifying it in TTBR[4:3] is
an ARMv6+ feature).
This requires adding L2 cache clean instructions to
proc-feroceon.S (dcache_clean_area(), set_pte()) as well as to
tlbflush.h ({flush,clean}_pmd_entry()). The latter case is handled
by defining a new TLB type (TLB_FEROCEON) which is almost identical
to the v4wbi one but provides a TLB_L2CLEAN_FR flag.
- The Feroceon L2 cache controller supports L2 range (i.e. 'clean L2
range by MVA' and 'invalidate L2 range by MVA') operations, and this
patch uses those range operations for all Linux outer cache
operations, as they are faster than the regular per-line operations.
L2 range operations are not interruptible on this hardware, which
avoids potential livelock issues, but can be bad for interrupt
latency, so there is a compile-time tunable (MAX_RANGE_SIZE) which
allows you to select the maximum range size to operate on at once.
(Valid range is between one cache line and one 4KiB page, and must
be a multiple of the line size.)
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Diffstat (limited to 'arch/arm/mm/proc-feroceon.S')
-rw-r--r-- | arch/arm/mm/proc-feroceon.S | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/arm/mm/proc-feroceon.S b/arch/arm/mm/proc-feroceon.S index c279652a98fd..cecf96ee07d5 100644 --- a/arch/arm/mm/proc-feroceon.S +++ b/arch/arm/mm/proc-feroceon.S | |||
@@ -79,6 +79,13 @@ ENTRY(cpu_feroceon_proc_fin) | |||
79 | mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE | 79 | mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE |
80 | msr cpsr_c, ip | 80 | msr cpsr_c, ip |
81 | bl feroceon_flush_kern_cache_all | 81 | bl feroceon_flush_kern_cache_all |
82 | |||
83 | #if defined(CONFIG_CACHE_FEROCEON_L2) && !defined(CONFIG_L2_CACHE_WRITETHROUGH) | ||
84 | mov r0, #0 | ||
85 | mcr p15, 1, r0, c15, c9, 0 @ clean L2 | ||
86 | mcr p15, 0, r0, c7, c10, 4 @ drain WB | ||
87 | #endif | ||
88 | |||
82 | mrc p15, 0, r0, c1, c0, 0 @ ctrl register | 89 | mrc p15, 0, r0, c1, c0, 0 @ ctrl register |
83 | bic r0, r0, #0x1000 @ ...i............ | 90 | bic r0, r0, #0x1000 @ ...i............ |
84 | bic r0, r0, #0x000e @ ............wca. | 91 | bic r0, r0, #0x000e @ ............wca. |
@@ -382,10 +389,20 @@ ENTRY(feroceon_range_cache_fns) | |||
382 | 389 | ||
383 | .align 5 | 390 | .align 5 |
384 | ENTRY(cpu_feroceon_dcache_clean_area) | 391 | ENTRY(cpu_feroceon_dcache_clean_area) |
392 | #if defined(CONFIG_CACHE_FEROCEON_L2) && !defined(CONFIG_L2_CACHE_WRITETHROUGH) | ||
393 | mov r2, r0 | ||
394 | mov r3, r1 | ||
395 | #endif | ||
385 | 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry | 396 | 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry |
386 | add r0, r0, #CACHE_DLINESIZE | 397 | add r0, r0, #CACHE_DLINESIZE |
387 | subs r1, r1, #CACHE_DLINESIZE | 398 | subs r1, r1, #CACHE_DLINESIZE |
388 | bhi 1b | 399 | bhi 1b |
400 | #if defined(CONFIG_CACHE_FEROCEON_L2) && !defined(CONFIG_L2_CACHE_WRITETHROUGH) | ||
401 | 1: mcr p15, 1, r2, c15, c9, 1 @ clean L2 entry | ||
402 | add r2, r2, #CACHE_DLINESIZE | ||
403 | subs r3, r3, #CACHE_DLINESIZE | ||
404 | bhi 1b | ||
405 | #endif | ||
389 | mcr p15, 0, r0, c7, c10, 4 @ drain WB | 406 | mcr p15, 0, r0, c7, c10, 4 @ drain WB |
390 | mov pc, lr | 407 | mov pc, lr |
391 | 408 | ||
@@ -449,6 +466,9 @@ ENTRY(cpu_feroceon_set_pte_ext) | |||
449 | str r2, [r0] @ hardware version | 466 | str r2, [r0] @ hardware version |
450 | mov r0, r0 | 467 | mov r0, r0 |
451 | mcr p15, 0, r0, c7, c10, 1 @ clean D entry | 468 | mcr p15, 0, r0, c7, c10, 1 @ clean D entry |
469 | #if defined(CONFIG_CACHE_FEROCEON_L2) && !defined(CONFIG_L2_CACHE_WRITETHROUGH) | ||
470 | mcr p15, 1, r0, c15, c9, 1 @ clean L2 entry | ||
471 | #endif | ||
452 | mcr p15, 0, r0, c7, c10, 4 @ drain WB | 472 | mcr p15, 0, r0, c7, c10, 4 @ drain WB |
453 | #endif | 473 | #endif |
454 | mov pc, lr | 474 | mov pc, lr |