aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/kernel/setup.c
diff options
context:
space:
mode:
authorJie Zhang <jie.zhang@analog.com>2009-06-16 05:48:33 -0400
committerMike Frysinger <vapier@gentoo.org>2009-06-22 21:15:59 -0400
commit41ba653f24a39a0e6a4afe9b2763a95a57e042c2 (patch)
tree43eb086046d4eef764878e04512ddd215ca8845b /arch/blackfin/kernel/setup.c
parent7c039a90f02c3fdcab8d3ca170c05ad37014189e (diff)
Blackfin: decouple unrelated cache settings to get exact behavior
The current cache options don't really represent the hardware features. They end up setting different aspects of the hardware so that the end result is to turn on/off the cache. Unfortunately, when we hit cache problems with the hardware, it's difficult to test different settings to root cause the problem. The current settings also don't cleanly allow for different caching behaviors with different regions of memory. So split the configure options such that they properly reflect the settings that are applied to the hardware. Signed-off-by: Jie Zhang <jie.zhang@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin/kernel/setup.c')
-rw-r--r--arch/blackfin/kernel/setup.c96
1 files changed, 78 insertions, 18 deletions
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index b2782eae31e1..8d7892820130 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -117,15 +117,49 @@ void __cpuinit bfin_setup_caches(unsigned int cpu)
117 */ 117 */
118#ifdef CONFIG_BFIN_ICACHE 118#ifdef CONFIG_BFIN_ICACHE
119 printk(KERN_INFO "Instruction Cache Enabled for CPU%u\n", cpu); 119 printk(KERN_INFO "Instruction Cache Enabled for CPU%u\n", cpu);
120 printk(KERN_INFO " External memory:"
121# ifdef CONFIG_BFIN_EXTMEM_ICACHEABLE
122 " cacheable"
123# else
124 " uncacheable"
125# endif
126 " in instruction cache\n");
127 if (L2_LENGTH)
128 printk(KERN_INFO " L2 SRAM :"
129# ifdef CONFIG_BFIN_L2_ICACHEABLE
130 " cacheable"
131# else
132 " uncacheable"
133# endif
134 " in instruction cache\n");
135
136#else
137 printk(KERN_INFO "Instruction Cache Disabled for CPU%u\n", cpu);
120#endif 138#endif
139
121#ifdef CONFIG_BFIN_DCACHE 140#ifdef CONFIG_BFIN_DCACHE
122 printk(KERN_INFO "Data Cache Enabled for CPU%u" 141 printk(KERN_INFO "Data Cache Enabled for CPU%u\n", cpu);
123# if defined CONFIG_BFIN_WB 142 printk(KERN_INFO " External memory:"
124 " (write-back)" 143# if defined CONFIG_BFIN_EXTMEM_WRITEBACK
125# elif defined CONFIG_BFIN_WT 144 " cacheable (write-back)"
126 " (write-through)" 145# elif defined CONFIG_BFIN_EXTMEM_WRITETHROUGH
146 " cacheable (write-through)"
147# else
148 " uncacheable"
149# endif
150 " in data cache\n");
151 if (L2_LENGTH)
152 printk(KERN_INFO " L2 SRAM :"
153# if defined CONFIG_BFIN_L2_WRITEBACK
154 " cacheable (write-back)"
155# elif defined CONFIG_BFIN_L2_WRITETHROUGH
156 " cacheable (write-through)"
157# else
158 " uncacheable"
127# endif 159# endif
128 "\n", cpu); 160 " in data cache\n");
161#else
162 printk(KERN_INFO "Data Cache Disabled for CPU%u\n", cpu);
129#endif 163#endif
130} 164}
131 165
@@ -516,7 +550,7 @@ static __init void memory_setup(void)
516 && ((unsigned long *)mtd_phys)[1] == ROMSB_WORD1) 550 && ((unsigned long *)mtd_phys)[1] == ROMSB_WORD1)
517 mtd_size = 551 mtd_size =
518 PAGE_ALIGN(be32_to_cpu(((unsigned long *)mtd_phys)[2])); 552 PAGE_ALIGN(be32_to_cpu(((unsigned long *)mtd_phys)[2]));
519# if (defined(CONFIG_BFIN_ICACHE) && ANOMALY_05000263) 553# if (defined(CONFIG_BFIN_EXTMEM_ICACHEABLE) && ANOMALY_05000263)
520 /* Due to a Hardware Anomaly we need to limit the size of usable 554 /* Due to a Hardware Anomaly we need to limit the size of usable
521 * instruction memory to max 60MB, 56 if HUNT_FOR_ZERO is on 555 * instruction memory to max 60MB, 56 if HUNT_FOR_ZERO is on
522 * 05000263 - Hardware loop corrupted when taking an ICPLB exception 556 * 05000263 - Hardware loop corrupted when taking an ICPLB exception
@@ -544,7 +578,7 @@ static __init void memory_setup(void)
544 dma_memcpy((void *)uclinux_ram_map.phys, _end, uclinux_ram_map.size); 578 dma_memcpy((void *)uclinux_ram_map.phys, _end, uclinux_ram_map.size);
545#endif /* CONFIG_MTD_UCLINUX */ 579#endif /* CONFIG_MTD_UCLINUX */
546 580
547#if (defined(CONFIG_BFIN_ICACHE) && ANOMALY_05000263) 581#if (defined(CONFIG_BFIN_EXTMEM_ICACHEABLE) && ANOMALY_05000263)
548 /* Due to a Hardware Anomaly we need to limit the size of usable 582 /* Due to a Hardware Anomaly we need to limit the size of usable
549 * instruction memory to max 60MB, 56 if HUNT_FOR_ZERO is on 583 * instruction memory to max 60MB, 56 if HUNT_FOR_ZERO is on
550 * 05000263 - Hardware loop corrupted when taking an ICPLB exception 584 * 05000263 - Hardware loop corrupted when taking an ICPLB exception
@@ -1158,16 +1192,25 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1158 icache_size = 0; 1192 icache_size = 0;
1159 1193
1160 seq_printf(m, "cache size\t: %d KB(L1 icache) " 1194 seq_printf(m, "cache size\t: %d KB(L1 icache) "
1161 "%d KB(L1 dcache%s) %d KB(L2 cache)\n", 1195 "%d KB(L1 dcache) %d KB(L2 cache)\n",
1162 icache_size, dcache_size, 1196 icache_size, dcache_size, 0);
1163#if defined CONFIG_BFIN_WB
1164 "-wb"
1165#elif defined CONFIG_BFIN_WT
1166 "-wt"
1167#endif
1168 "", 0);
1169
1170 seq_printf(m, "%s\n", cache); 1197 seq_printf(m, "%s\n", cache);
1198 seq_printf(m, "external memory\t: "
1199#if defined(CONFIG_BFIN_EXTMEM_ICACHEABLE)
1200 "cacheable"
1201#else
1202 "uncacheable"
1203#endif
1204 " in instruction cache\n");
1205 seq_printf(m, "external memory\t: "
1206#if defined(CONFIG_BFIN_EXTMEM_WRITEBACK)
1207 "cacheable (write-back)"
1208#elif defined(CONFIG_BFIN_EXTMEM_WRITETHROUGH)
1209 "cacheable (write-through)"
1210#else
1211 "uncacheable"
1212#endif
1213 " in data cache\n");
1171 1214
1172 if (icache_size) 1215 if (icache_size)
1173 seq_printf(m, "icache setup\t: %d Sub-banks/%d Ways, %d Lines/Way\n", 1216 seq_printf(m, "icache setup\t: %d Sub-banks/%d Ways, %d Lines/Way\n",
@@ -1240,8 +1283,25 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1240 if (cpu_num != num_possible_cpus() - 1) 1283 if (cpu_num != num_possible_cpus() - 1)
1241 return 0; 1284 return 0;
1242 1285
1243 if (L2_LENGTH) 1286 if (L2_LENGTH) {
1244 seq_printf(m, "L2 SRAM\t\t: %dKB\n", L2_LENGTH/0x400); 1287 seq_printf(m, "L2 SRAM\t\t: %dKB\n", L2_LENGTH/0x400);
1288 seq_printf(m, "L2 SRAM\t\t: "
1289#if defined(CONFIG_BFIN_L2_ICACHEABLE)
1290 "cacheable"
1291#else
1292 "uncacheable"
1293#endif
1294 " in instruction cache\n");
1295 seq_printf(m, "L2 SRAM\t\t: "
1296#if defined(CONFIG_BFIN_L2_WRITEBACK)
1297 "cacheable (write-back)"
1298#elif defined(CONFIG_BFIN_L2_WRITETHROUGH)
1299 "cacheable (write-through)"
1300#else
1301 "uncacheable"
1302#endif
1303 " in data cache\n");
1304 }
1245 seq_printf(m, "board name\t: %s\n", bfin_board_name); 1305 seq_printf(m, "board name\t: %s\n", bfin_board_name);
1246 seq_printf(m, "board memory\t: %ld kB (0x%p -> 0x%p)\n", 1306 seq_printf(m, "board memory\t: %ld kB (0x%p -> 0x%p)\n",
1247 physical_mem_end >> 10, (void *)0, (void *)physical_mem_end); 1307 physical_mem_end >> 10, (void *)0, (void *)physical_mem_end);