diff options
Diffstat (limited to 'arch/mips/mm/sc-mips.c')
-rw-r--r-- | arch/mips/mm/sc-mips.c | 34 |
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 | */ | ||
69 | static 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 | |||
60 | static inline int __init mips_sc_probe(void) | 88 | static inline int __init mips_sc_probe(void) |
61 | { | 89 | { |
62 | struct cpuinfo_mips *c = ¤t_cpu_data; | 90 | struct cpuinfo_mips *c = ¤t_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; |