aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Simek <monstr@monstr.eu>2009-10-08 07:06:42 -0400
committerMichal Simek <monstr@monstr.eu>2009-12-14 02:44:57 -0500
commit44e4e196a9b3a703ebe273ffe3fb6cda326fe5d3 (patch)
tree1e9217c3af95f1843dbe499cd7022fd531ef4c38
parent6cec713b1629228527fb8f813003522817f55da1 (diff)
microblaze: Fix cache_line_lenght
We used cache_line as cache_line_lenght. For this reason we did cache flushing 4 times longer than was necessary. Signed-off-by: Michal Simek <monstr@monstr.eu>
-rw-r--r--arch/microblaze/include/asm/cpuinfo.h4
-rw-r--r--arch/microblaze/kernel/cpu/cache.c16
-rw-r--r--arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c4
-rw-r--r--arch/microblaze/kernel/cpu/cpuinfo-static.c16
4 files changed, 20 insertions, 20 deletions
diff --git a/arch/microblaze/include/asm/cpuinfo.h b/arch/microblaze/include/asm/cpuinfo.h
index 52f28f6dc4eb..aadf7a899d49 100644
--- a/arch/microblaze/include/asm/cpuinfo.h
+++ b/arch/microblaze/include/asm/cpuinfo.h
@@ -43,7 +43,7 @@ struct cpuinfo {
43 u32 use_icache; 43 u32 use_icache;
44 u32 icache_tagbits; 44 u32 icache_tagbits;
45 u32 icache_write; 45 u32 icache_write;
46 u32 icache_line; 46 u32 icache_line_length;
47 u32 icache_size; 47 u32 icache_size;
48 unsigned long icache_base; 48 unsigned long icache_base;
49 unsigned long icache_high; 49 unsigned long icache_high;
@@ -51,7 +51,7 @@ struct cpuinfo {
51 u32 use_dcache; 51 u32 use_dcache;
52 u32 dcache_tagbits; 52 u32 dcache_tagbits;
53 u32 dcache_write; 53 u32 dcache_write;
54 u32 dcache_line; 54 u32 dcache_line_length;
55 u32 dcache_size; 55 u32 dcache_size;
56 unsigned long dcache_base; 56 unsigned long dcache_base;
57 unsigned long dcache_high; 57 unsigned long dcache_high;
diff --git a/arch/microblaze/kernel/cpu/cache.c b/arch/microblaze/kernel/cpu/cache.c
index af866a450125..538f1df6761d 100644
--- a/arch/microblaze/kernel/cpu/cache.c
+++ b/arch/microblaze/kernel/cpu/cache.c
@@ -140,7 +140,7 @@ void __invalidate_icache_all(void)
140 /* Just loop through cache size and invalidate, no need to add 140 /* Just loop through cache size and invalidate, no need to add
141 CACHE_BASE address */ 141 CACHE_BASE address */
142 for (i = 0; i < cpuinfo.icache_size; 142 for (i = 0; i < cpuinfo.icache_size;
143 i += cpuinfo.icache_line) 143 i += cpuinfo.icache_line_length)
144 __invalidate_icache(i); 144 __invalidate_icache(i);
145 145
146 __enable_icache(); 146 __enable_icache();
@@ -160,15 +160,15 @@ void __invalidate_icache_range(unsigned long start, unsigned long end)
160 * just cover cache footprint 160 * just cover cache footprint
161 */ 161 */
162 end = min(start + cpuinfo.icache_size, end); 162 end = min(start + cpuinfo.icache_size, end);
163 align = ~(cpuinfo.icache_line - 1); 163 align = ~(cpuinfo.icache_line_length - 1);
164 start &= align; /* Make sure we are aligned */ 164 start &= align; /* Make sure we are aligned */
165 /* Push end up to the next cache line */ 165 /* Push end up to the next cache line */
166 end = ((end & align) + cpuinfo.icache_line); 166 end = ((end & align) + cpuinfo.icache_line_length);
167 167
168 local_irq_save(flags); 168 local_irq_save(flags);
169 __disable_icache(); 169 __disable_icache();
170 170
171 for (i = start; i < end; i += cpuinfo.icache_line) 171 for (i = start; i < end; i += cpuinfo.icache_line_length)
172 __invalidate_icache(i); 172 __invalidate_icache(i);
173 173
174 __enable_icache(); 174 __enable_icache();
@@ -207,7 +207,7 @@ void __invalidate_dcache_all(void)
207 * no need to add CACHE_BASE address 207 * no need to add CACHE_BASE address
208 */ 208 */
209 for (i = 0; i < cpuinfo.dcache_size; 209 for (i = 0; i < cpuinfo.dcache_size;
210 i += cpuinfo.dcache_line) 210 i += cpuinfo.dcache_line_length)
211 __invalidate_dcache(i); 211 __invalidate_dcache(i);
212 212
213 __enable_dcache(); 213 __enable_dcache();
@@ -227,14 +227,14 @@ void __invalidate_dcache_range(unsigned long start, unsigned long end)
227 * just cover cache footprint 227 * just cover cache footprint
228 */ 228 */
229 end = min(start + cpuinfo.dcache_size, end); 229 end = min(start + cpuinfo.dcache_size, end);
230 align = ~(cpuinfo.dcache_line - 1); 230 align = ~(cpuinfo.dcache_line_length - 1);
231 start &= align; /* Make sure we are aligned */ 231 start &= align; /* Make sure we are aligned */
232 /* Push end up to the next cache line */ 232 /* Push end up to the next cache line */
233 end = ((end & align) + cpuinfo.dcache_line); 233 end = ((end & align) + cpuinfo.dcache_line_length);
234 local_irq_save(flags); 234 local_irq_save(flags);
235 __disable_dcache(); 235 __disable_dcache();
236 236
237 for (i = start; i < end; i += cpuinfo.dcache_line) 237 for (i = start; i < end; i += cpuinfo.dcache_line_length)
238 __invalidate_dcache(i); 238 __invalidate_dcache(i);
239 239
240 __enable_dcache(); 240 __enable_dcache();
diff --git a/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c b/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c
index c259786e7faa..c5acf2b56eed 100644
--- a/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c
+++ b/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c
@@ -70,7 +70,7 @@ void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu)
70 CI(use_icache, USE_ICACHE); 70 CI(use_icache, USE_ICACHE);
71 CI(icache_tagbits, ICACHE_ADDR_TAG_BITS); 71 CI(icache_tagbits, ICACHE_ADDR_TAG_BITS);
72 CI(icache_write, ICACHE_ALLOW_WR); 72 CI(icache_write, ICACHE_ALLOW_WR);
73 CI(icache_line, ICACHE_LINE_LEN); 73 ci->icache_line_length = PVR_ICACHE_LINE_LEN(pvr) << 2;
74 CI(icache_size, ICACHE_BYTE_SIZE); 74 CI(icache_size, ICACHE_BYTE_SIZE);
75 CI(icache_base, ICACHE_BASEADDR); 75 CI(icache_base, ICACHE_BASEADDR);
76 CI(icache_high, ICACHE_HIGHADDR); 76 CI(icache_high, ICACHE_HIGHADDR);
@@ -78,7 +78,7 @@ void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu)
78 CI(use_dcache, USE_DCACHE); 78 CI(use_dcache, USE_DCACHE);
79 CI(dcache_tagbits, DCACHE_ADDR_TAG_BITS); 79 CI(dcache_tagbits, DCACHE_ADDR_TAG_BITS);
80 CI(dcache_write, DCACHE_ALLOW_WR); 80 CI(dcache_write, DCACHE_ALLOW_WR);
81 CI(dcache_line, DCACHE_LINE_LEN); 81 ci->dcache_line_length = PVR_DCACHE_LINE_LEN(pvr) << 2;
82 CI(dcache_size, DCACHE_BYTE_SIZE); 82 CI(dcache_size, DCACHE_BYTE_SIZE);
83 CI(dcache_base, DCACHE_BASEADDR); 83 CI(dcache_base, DCACHE_BASEADDR);
84 CI(dcache_high, DCACHE_HIGHADDR); 84 CI(dcache_high, DCACHE_HIGHADDR);
diff --git a/arch/microblaze/kernel/cpu/cpuinfo-static.c b/arch/microblaze/kernel/cpu/cpuinfo-static.c
index adb448f93d5f..6558429eb973 100644
--- a/arch/microblaze/kernel/cpu/cpuinfo-static.c
+++ b/arch/microblaze/kernel/cpu/cpuinfo-static.c
@@ -72,12 +72,12 @@ void __init set_cpuinfo_static(struct cpuinfo *ci, struct device_node *cpu)
72 ci->use_icache = fcpu(cpu, "xlnx,use-icache"); 72 ci->use_icache = fcpu(cpu, "xlnx,use-icache");
73 ci->icache_tagbits = fcpu(cpu, "xlnx,addr-tag-bits"); 73 ci->icache_tagbits = fcpu(cpu, "xlnx,addr-tag-bits");
74 ci->icache_write = fcpu(cpu, "xlnx,allow-icache-wr"); 74 ci->icache_write = fcpu(cpu, "xlnx,allow-icache-wr");
75 ci->icache_line = fcpu(cpu, "xlnx,icache-line-len") << 2; 75 ci->icache_line_length = fcpu(cpu, "xlnx,icache-line-len") << 2;
76 if (!ci->icache_line) { 76 if (!ci->icache_line_length) {
77 if (fcpu(cpu, "xlnx,icache-use-fsl")) 77 if (fcpu(cpu, "xlnx,icache-use-fsl"))
78 ci->icache_line = 4 << 2; 78 ci->icache_line_length = 4 << 2;
79 else 79 else
80 ci->icache_line = 1 << 2; 80 ci->icache_line_length = 1 << 2;
81 } 81 }
82 ci->icache_size = fcpu(cpu, "i-cache-size"); 82 ci->icache_size = fcpu(cpu, "i-cache-size");
83 ci->icache_base = fcpu(cpu, "i-cache-baseaddr"); 83 ci->icache_base = fcpu(cpu, "i-cache-baseaddr");
@@ -86,12 +86,12 @@ void __init set_cpuinfo_static(struct cpuinfo *ci, struct device_node *cpu)
86 ci->use_dcache = fcpu(cpu, "xlnx,use-dcache"); 86 ci->use_dcache = fcpu(cpu, "xlnx,use-dcache");
87 ci->dcache_tagbits = fcpu(cpu, "xlnx,dcache-addr-tag"); 87 ci->dcache_tagbits = fcpu(cpu, "xlnx,dcache-addr-tag");
88 ci->dcache_write = fcpu(cpu, "xlnx,allow-dcache-wr"); 88 ci->dcache_write = fcpu(cpu, "xlnx,allow-dcache-wr");
89 ci->dcache_line = fcpu(cpu, "xlnx,dcache-line-len") << 2; 89 ci->dcache_line_length = fcpu(cpu, "xlnx,dcache-line-len") << 2;
90 if (!ci->dcache_line) { 90 if (!ci->dcache_line_length) {
91 if (fcpu(cpu, "xlnx,dcache-use-fsl")) 91 if (fcpu(cpu, "xlnx,dcache-use-fsl"))
92 ci->dcache_line = 4 << 2; 92 ci->dcache_line_length = 4 << 2;
93 else 93 else
94 ci->dcache_line = 1 << 2; 94 ci->dcache_line_length = 1 << 2;
95 } 95 }
96 ci->dcache_size = fcpu(cpu, "d-cache-size"); 96 ci->dcache_size = fcpu(cpu, "d-cache-size");
97 ci->dcache_base = fcpu(cpu, "d-cache-baseaddr"); 97 ci->dcache_base = fcpu(cpu, "d-cache-baseaddr");