aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/mm
diff options
context:
space:
mode:
authorKevin Cernekee <cernekee@gmail.com>2010-10-20 23:05:42 -0400
committerRalf Baechle <ralf@linux-mips.org>2010-10-29 14:08:52 -0400
commitea31a6b203710c03d1fc025377a19572e620588a (patch)
treeb9a39c79e7080b9790936618a704439d057cb78a /arch/mips/mm
parentaf231172634b5c0923fa7484a043fadcc07e899e (diff)
MIPS: Honor L2 bypass bit
On many of the newer MIPS32 cores, CP0 CONFIG2 bit 12 (L2B) indicates that the L2 cache is disabled and therefore Linux should not attempt to use it. [Ralf: Moved the code added by Kevin's original patch into a separate function that can easily be replaced for platforms that need more a different probe.] Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Cc: linux-mips@linux-mips.org> Cc: <linux-kernel@vger.kernel.org> Patchwork: https://patchwork.linux-mips.org/patch/1723/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/mm')
-rw-r--r--arch/mips/mm/sc-mips.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/arch/mips/mm/sc-mips.c b/arch/mips/mm/sc-mips.c
index 5ab5fa8c1d82..505fecad4684 100644
--- a/arch/mips/mm/sc-mips.c
+++ b/arch/mips/mm/sc-mips.c
@@ -57,6 +57,34 @@ static struct bcache_ops mips_sc_ops = {
57 .bc_inv = mips_sc_inv 57 .bc_inv = mips_sc_inv
58}; 58};
59 59
60/*
61 * Check if the L2 cache controller is activated on a particular platform.
62 * MTI's L2 controller and the L2 cache controller of Broadcom's BMIPS
63 * cores both use c0_config2's bit 12 as "L2 Bypass" bit, that is the
64 * cache being disabled. However there is no guarantee for this to be
65 * true on all platforms. In an act of stupidity the spec defined bits
66 * 12..15 as implementation defined so below function will eventually have
67 * to be replaced by a platform specific probe.
68 */
69static inline int mips_sc_is_activated(struct cpuinfo_mips *c)
70{
71 /* Check the bypass bit (L2B) */
72 switch (c->cputype) {
73 case CPU_34K:
74 case CPU_74K:
75 case CPU_1004K:
76 case CPU_BMIPS5000:
77 if (config2 & (1 << 12))
78 return 0;
79 }
80
81 tmp = (config2 >> 4) & 0x0f;
82 if (0 < tmp && tmp <= 7)
83 c->scache.linesz = 2 << tmp;
84 else
85 return 0;
86}
87
60static inline int __init mips_sc_probe(void) 88static inline int __init mips_sc_probe(void)
61{ 89{
62 struct cpuinfo_mips *c = &current_cpu_data; 90 struct cpuinfo_mips *c = &current_cpu_data;
@@ -79,10 +107,8 @@ static inline int __init mips_sc_probe(void)
79 return 0; 107 return 0;
80 108
81 config2 = read_c0_config2(); 109 config2 = read_c0_config2();
82 tmp = (config2 >> 4) & 0x0f; 110
83 if (0 < tmp && tmp <= 7) 111 if (!mips_sc_is_activated(c))
84 c->scache.linesz = 2 << tmp;
85 else
86 return 0; 112 return 0;
87 113
88 tmp = (config2 >> 8) & 0x0f; 114 tmp = (config2 >> 8) & 0x0f;