aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/mm/sc-mips.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-29 14:13:10 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-29 14:13:10 -0400
commitb77d643ced576bdd1e918aebda869de74696cde9 (patch)
treebb5d708f4bbb48461923a28e63a8cf8bdd477dd7 /arch/mips/mm/sc-mips.c
parentb4020c1b198c0f0c0b0ff0cfdd824a26b93edd6f (diff)
parent64575f918f3279d8487cf670dbefa956ce16a526 (diff)
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/upstream-linus
* 'upstream' of git://git.linux-mips.org/pub/scm/upstream-linus: (46 commits) ftrace/MIPS: Enable C Version of recordmcount ftrace/MIPS: Add module support for C version of recordmcount ftrace/MIPS: Add MIPS64 support for C version of recordmcount MIPS: Make TASK_SIZE reflect proper size for both 32 and 64 bit processes. MIPS: Allow UserLocal on MIPS_R1 processors MIPS: Honor L2 bypass bit MIPS: Add BMIPS CP0 register definitions MIPS: Add BMIPS processor types to Kconfig MIPS: Decouple BMIPS CPU support from bcm47xx/bcm63xx SoC code MIPS: Add support for hardware performance events (mipsxx) MIPS: Perf-events: Add callchain support MIPS: add support for hardware performance events (skeleton) MIPS: add support for software performance events MIPS: define local_xchg from xchg_local to atomic_long_xchg MIPS: AR7: Add support for Titan (TNETV10xx) SoC variant MIPS: AR7: Initialize GPIO earlier MIPS: Add platform device and Kconfig for Octeon USB EHCI / OHCI USB: Add EHCI and OHCH glue for OCTEON II SOCs. MIPS: Octeon: Add register definitions for EHCI / OHCI USB glue logic. MIPS: Octeon: Apply CN63XXP1 errata workarounds. ...
Diffstat (limited to 'arch/mips/mm/sc-mips.c')
-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;