Commit d626f547 authored by Vineet Gupta's avatar Vineet Gupta

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: default avatarAlexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
parent db8e35d5
...@@ -144,23 +144,18 @@ void __init read_decode_cache_bcr(void) ...@@ -144,23 +144,18 @@ void __init read_decode_cache_bcr(void)
void __init arc_cache_init(void) void __init arc_cache_init(void)
{ {
unsigned int temp; unsigned int temp;
#ifdef CONFIG_ARC_CACHE
unsigned int cpu = smp_processor_id(); unsigned int cpu = smp_processor_id();
#endif struct cpuinfo_arc_cache *ic = &cpuinfo_arc700[cpu].icache;
#ifdef CONFIG_ARC_HAS_ICACHE struct cpuinfo_arc_cache *dc = &cpuinfo_arc700[cpu].dcache;
struct cpuinfo_arc_cache *ic;
#endif
#ifdef CONFIG_ARC_HAS_DCACHE
struct cpuinfo_arc_cache *dc;
#endif
int way_pg_ratio = way_pg_ratio; int way_pg_ratio = way_pg_ratio;
char str[256]; char str[256];
printk(arc_cache_mumbojumbo(0, str, sizeof(str))); printk(arc_cache_mumbojumbo(0, str, sizeof(str)));
#ifdef CONFIG_ARC_HAS_ICACHE if (!ic->ver)
ic = &cpuinfo_arc700[cpu].icache; goto chk_dc;
#ifdef CONFIG_ARC_HAS_ICACHE
/* 1. Confirm some of I-cache params which Linux assumes */ /* 1. Confirm some of I-cache params which Linux assumes */
if ((ic->assoc != ARC_ICACHE_WAYS) || if ((ic->assoc != ARC_ICACHE_WAYS) ||
(ic->line_len != ARC_ICACHE_LINE_LEN)) { (ic->line_len != ARC_ICACHE_LINE_LEN)) {
...@@ -213,9 +208,11 @@ void __init arc_cache_init(void) ...@@ -213,9 +208,11 @@ void __init arc_cache_init(void)
write_aux_reg(ARC_REG_IC_CTRL, temp); write_aux_reg(ARC_REG_IC_CTRL, temp);
#ifdef CONFIG_ARC_HAS_DCACHE chk_dc:
dc = &cpuinfo_arc700[cpu].dcache; if (!dc->ver)
return;
#ifdef CONFIG_ARC_HAS_DCACHE
if ((dc->assoc != ARC_DCACHE_WAYS) || if ((dc->assoc != ARC_DCACHE_WAYS) ||
(dc->line_len != ARC_DCACHE_LINE_LEN)) { (dc->line_len != ARC_DCACHE_LINE_LEN)) {
panic("Cache H/W doesn't match kernel Config"); panic("Cache H/W doesn't match kernel Config");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment