aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2013-01-28 04:37:31 -0500
committerVineet Gupta <vgupta@synopsys.com>2013-02-15 12:46:19 -0500
commitd626f547dd0457ab36f6151673fcc78fc3c63eaa (patch)
treec9ccac3168a7201a97fc50c765dfb7a4bd234a83 /arch
parentdb8e35d5b28fe6608e73913c919e4a6568f7c09c (diff)
ARC: Don't fiddle with non-existent caches
!CONFIG_ARC_HAS_(I|D)CACHE makes Linux disable caches (assuming they exist in hardware) - mostly for debugging issues with new peripherals. However, independent of CONFIG_ARC_HAS_(I|D)CACHE, Linux also needs to handle, non-existant caches, using the information in Cache BCRs (Build Configuration Reg) Reported-by: Alexey Brodkin <abrodkin@synopsys.com> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arc/mm/cache_arc700.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/arch/arc/mm/cache_arc700.c b/arch/arc/mm/cache_arc700.c
index c299b30924ee..88d617d84234 100644
--- a/arch/arc/mm/cache_arc700.c
+++ b/arch/arc/mm/cache_arc700.c
@@ -144,23 +144,18 @@ void __init read_decode_cache_bcr(void)
144void __init arc_cache_init(void) 144void __init arc_cache_init(void)
145{ 145{
146 unsigned int temp; 146 unsigned int temp;
147#ifdef CONFIG_ARC_CACHE
148 unsigned int cpu = smp_processor_id(); 147 unsigned int cpu = smp_processor_id();
149#endif 148 struct cpuinfo_arc_cache *ic = &cpuinfo_arc700[cpu].icache;
150#ifdef CONFIG_ARC_HAS_ICACHE 149 struct cpuinfo_arc_cache *dc = &cpuinfo_arc700[cpu].dcache;
151 struct cpuinfo_arc_cache *ic;
152#endif
153#ifdef CONFIG_ARC_HAS_DCACHE
154 struct cpuinfo_arc_cache *dc;
155#endif
156 int way_pg_ratio = way_pg_ratio; 150 int way_pg_ratio = way_pg_ratio;
157 char str[256]; 151 char str[256];
158 152
159 printk(arc_cache_mumbojumbo(0, str, sizeof(str))); 153 printk(arc_cache_mumbojumbo(0, str, sizeof(str)));
160 154
161#ifdef CONFIG_ARC_HAS_ICACHE 155 if (!ic->ver)
162 ic = &cpuinfo_arc700[cpu].icache; 156 goto chk_dc;
163 157
158#ifdef CONFIG_ARC_HAS_ICACHE
164 /* 1. Confirm some of I-cache params which Linux assumes */ 159 /* 1. Confirm some of I-cache params which Linux assumes */
165 if ((ic->assoc != ARC_ICACHE_WAYS) || 160 if ((ic->assoc != ARC_ICACHE_WAYS) ||
166 (ic->line_len != ARC_ICACHE_LINE_LEN)) { 161 (ic->line_len != ARC_ICACHE_LINE_LEN)) {
@@ -213,9 +208,11 @@ void __init arc_cache_init(void)
213 208
214 write_aux_reg(ARC_REG_IC_CTRL, temp); 209 write_aux_reg(ARC_REG_IC_CTRL, temp);
215 210
216#ifdef CONFIG_ARC_HAS_DCACHE 211chk_dc:
217 dc = &cpuinfo_arc700[cpu].dcache; 212 if (!dc->ver)
213 return;
218 214
215#ifdef CONFIG_ARC_HAS_DCACHE
219 if ((dc->assoc != ARC_DCACHE_WAYS) || 216 if ((dc->assoc != ARC_DCACHE_WAYS) ||
220 (dc->line_len != ARC_DCACHE_LINE_LEN)) { 217 (dc->line_len != ARC_DCACHE_LINE_LEN)) {
221 panic("Cache H/W doesn't match kernel Config"); 218 panic("Cache H/W doesn't match kernel Config");