diff options
author | Ronen Shitrit <rshitrit@marvell.com> | 2008-09-23 08:28:10 -0400 |
---|---|---|
committer | Nicolas Pitre <nico@cam.org> | 2008-09-25 16:29:21 -0400 |
commit | 4360bb41920ffacd4a935fa692768129ee5bef4e (patch) | |
tree | 8d5bbe15ad4c39d089ac42ab0330d8c515584f65 /arch/arm | |
parent | 3d014b01e54ce08d15a598f0bfb3ce597f14ca03 (diff) |
[ARM] Kirkwood: add support for L2 cache WB/WT selection
Feroceon L2 cache can work in eighther write through or write back mode
on Kirkwood. Add the option to configure this mode according to Kconfig.
Signed-off-by: Ronen Shitrit <rshitrit@marvell.com>
Signed-off-by: Nicolas Pitre <nico@marvell.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-kirkwood/common.c | 12 | ||||
-rw-r--r-- | arch/arm/mm/Kconfig | 8 | ||||
-rw-r--r-- | arch/arm/mm/proc-feroceon.S | 12 |
3 files changed, 25 insertions, 7 deletions
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c index c8516e352d1c..85cad05d8c5b 100644 --- a/arch/arm/mach-kirkwood/common.c +++ b/arch/arm/mach-kirkwood/common.c | |||
@@ -588,9 +588,15 @@ static char * __init kirkwood_id(void) | |||
588 | } | 588 | } |
589 | } | 589 | } |
590 | 590 | ||
591 | static int __init is_l2_writethrough(void) | 591 | static void __init kirkwood_l2_init(void) |
592 | { | 592 | { |
593 | return !!(readl(L2_CONFIG_REG) & L2_WRITETHROUGH); | 593 | #ifdef CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH |
594 | writel(readl(L2_CONFIG_REG) | L2_WRITETHROUGH, L2_CONFIG_REG); | ||
595 | feroceon_l2_init(1); | ||
596 | #else | ||
597 | writel(readl(L2_CONFIG_REG) & ~L2_WRITETHROUGH, L2_CONFIG_REG); | ||
598 | feroceon_l2_init(0); | ||
599 | #endif | ||
594 | } | 600 | } |
595 | 601 | ||
596 | void __init kirkwood_init(void) | 602 | void __init kirkwood_init(void) |
@@ -605,6 +611,6 @@ void __init kirkwood_init(void) | |||
605 | kirkwood_setup_cpu_mbus(); | 611 | kirkwood_setup_cpu_mbus(); |
606 | 612 | ||
607 | #ifdef CONFIG_CACHE_FEROCEON_L2 | 613 | #ifdef CONFIG_CACHE_FEROCEON_L2 |
608 | feroceon_l2_init(is_l2_writethrough()); | 614 | kirkwood_l2_init(); |
609 | #endif | 615 | #endif |
610 | } | 616 | } |
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig index ed15f876c725..330814d1ee25 100644 --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig | |||
@@ -735,6 +735,14 @@ config CACHE_FEROCEON_L2 | |||
735 | help | 735 | help |
736 | This option enables the Feroceon L2 cache controller. | 736 | This option enables the Feroceon L2 cache controller. |
737 | 737 | ||
738 | config CACHE_FEROCEON_L2_WRITETHROUGH | ||
739 | bool "Force Feroceon L2 cache write through" | ||
740 | depends on CACHE_FEROCEON_L2 | ||
741 | default n | ||
742 | help | ||
743 | Say Y here to use the Feroceon L2 cache in writethrough mode. | ||
744 | Unless you specifically require this, say N for writeback mode. | ||
745 | |||
738 | config CACHE_L2X0 | 746 | config CACHE_L2X0 |
739 | bool "Enable the L2x0 outer cache controller" | 747 | bool "Enable the L2x0 outer cache controller" |
740 | depends on REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || MACH_REALVIEW_PB1176 | 748 | depends on REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || MACH_REALVIEW_PB1176 |
diff --git a/arch/arm/mm/proc-feroceon.S b/arch/arm/mm/proc-feroceon.S index f2e5884c513a..207392f1ce8a 100644 --- a/arch/arm/mm/proc-feroceon.S +++ b/arch/arm/mm/proc-feroceon.S | |||
@@ -80,7 +80,8 @@ ENTRY(cpu_feroceon_proc_fin) | |||
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 | 82 | ||
83 | #if defined(CONFIG_CACHE_FEROCEON_L2) && !defined(CONFIG_L2_CACHE_WRITETHROUGH) | 83 | #if defined(CONFIG_CACHE_FEROCEON_L2) && \ |
84 | !defined(CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH) | ||
84 | mov r0, #0 | 85 | mov r0, #0 |
85 | mcr p15, 1, r0, c15, c9, 0 @ clean L2 | 86 | mcr p15, 1, r0, c15, c9, 0 @ clean L2 |
86 | mcr p15, 0, r0, c7, c10, 4 @ drain WB | 87 | mcr p15, 0, r0, c7, c10, 4 @ drain WB |
@@ -389,7 +390,8 @@ ENTRY(feroceon_range_cache_fns) | |||
389 | 390 | ||
390 | .align 5 | 391 | .align 5 |
391 | ENTRY(cpu_feroceon_dcache_clean_area) | 392 | ENTRY(cpu_feroceon_dcache_clean_area) |
392 | #if defined(CONFIG_CACHE_FEROCEON_L2) && !defined(CONFIG_L2_CACHE_WRITETHROUGH) | 393 | #if defined(CONFIG_CACHE_FEROCEON_L2) && \ |
394 | !defined(CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH) | ||
393 | mov r2, r0 | 395 | mov r2, r0 |
394 | mov r3, r1 | 396 | mov r3, r1 |
395 | #endif | 397 | #endif |
@@ -397,7 +399,8 @@ ENTRY(cpu_feroceon_dcache_clean_area) | |||
397 | add r0, r0, #CACHE_DLINESIZE | 399 | add r0, r0, #CACHE_DLINESIZE |
398 | subs r1, r1, #CACHE_DLINESIZE | 400 | subs r1, r1, #CACHE_DLINESIZE |
399 | bhi 1b | 401 | bhi 1b |
400 | #if defined(CONFIG_CACHE_FEROCEON_L2) && !defined(CONFIG_L2_CACHE_WRITETHROUGH) | 402 | #if defined(CONFIG_CACHE_FEROCEON_L2) && \ |
403 | !defined(CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH) | ||
401 | 1: mcr p15, 1, r2, c15, c9, 1 @ clean L2 entry | 404 | 1: mcr p15, 1, r2, c15, c9, 1 @ clean L2 entry |
402 | add r2, r2, #CACHE_DLINESIZE | 405 | add r2, r2, #CACHE_DLINESIZE |
403 | subs r3, r3, #CACHE_DLINESIZE | 406 | subs r3, r3, #CACHE_DLINESIZE |
@@ -466,7 +469,8 @@ ENTRY(cpu_feroceon_set_pte_ext) | |||
466 | str r2, [r0] @ hardware version | 469 | str r2, [r0] @ hardware version |
467 | mov r0, r0 | 470 | mov r0, r0 |
468 | mcr p15, 0, r0, c7, c10, 1 @ clean D entry | 471 | mcr p15, 0, r0, c7, c10, 1 @ clean D entry |
469 | #if defined(CONFIG_CACHE_FEROCEON_L2) && !defined(CONFIG_L2_CACHE_WRITETHROUGH) | 472 | #if defined(CONFIG_CACHE_FEROCEON_L2) && \ |
473 | !defined(CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH) | ||
470 | mcr p15, 1, r0, c15, c9, 1 @ clean L2 entry | 474 | mcr p15, 1, r0, c15, c9, 1 @ clean L2 entry |
471 | #endif | 475 | #endif |
472 | mcr p15, 0, r0, c7, c10, 4 @ drain WB | 476 | mcr p15, 0, r0, c7, c10, 4 @ drain WB |