diff options
author | Akira Takeuchi <takeuchi.akr@jp.panasonic.com> | 2010-10-27 12:28:55 -0400 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2010-10-27 12:28:55 -0400 |
commit | 368dd5acd154b09c043cc4392a74da01599b37d5 (patch) | |
tree | dd94ae3d044f6e774dec2437613515bd6b46dacb /arch/mn10300/kernel/setup.c | |
parent | 04157a6e7df99fd5ed64955233d6e00ab6613614 (diff) |
MN10300: And Panasonic AM34 subarch and implement SMP
Implement the Panasonic MN10300 AM34 CPU subarch and implement SMP support for
MN10300. Also implement support for the MN2WS0060 processor and the ASB2364
evaluation board which are AM34 based.
Signed-off-by: Akira Takeuchi <takeuchi.akr@jp.panasonic.com>
Signed-off-by: Kiyoshi Owada <owada.kiyoshi@jp.panasonic.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'arch/mn10300/kernel/setup.c')
-rw-r--r-- | arch/mn10300/kernel/setup.c | 75 |
1 files changed, 41 insertions, 34 deletions
diff --git a/arch/mn10300/kernel/setup.c b/arch/mn10300/kernel/setup.c index d464affcba0e..12514570ed5d 100644 --- a/arch/mn10300/kernel/setup.c +++ b/arch/mn10300/kernel/setup.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/bootmem.h> | 23 | #include <linux/bootmem.h> |
24 | #include <linux/seq_file.h> | 24 | #include <linux/seq_file.h> |
25 | #include <linux/cpu.h> | ||
25 | #include <asm/processor.h> | 26 | #include <asm/processor.h> |
26 | #include <linux/console.h> | 27 | #include <linux/console.h> |
27 | #include <asm/uaccess.h> | 28 | #include <asm/uaccess.h> |
@@ -30,7 +31,6 @@ | |||
30 | #include <asm/io.h> | 31 | #include <asm/io.h> |
31 | #include <asm/smp.h> | 32 | #include <asm/smp.h> |
32 | #include <proc/proc.h> | 33 | #include <proc/proc.h> |
33 | #include <asm/busctl-regs.h> | ||
34 | #include <asm/fpu.h> | 34 | #include <asm/fpu.h> |
35 | #include <asm/sections.h> | 35 | #include <asm/sections.h> |
36 | 36 | ||
@@ -64,11 +64,13 @@ unsigned long memory_size; | |||
64 | struct thread_info *__current_ti = &init_thread_union.thread_info; | 64 | struct thread_info *__current_ti = &init_thread_union.thread_info; |
65 | struct task_struct *__current = &init_task; | 65 | struct task_struct *__current = &init_task; |
66 | 66 | ||
67 | #define mn10300_known_cpus 3 | 67 | #define mn10300_known_cpus 5 |
68 | static const char *const mn10300_cputypes[] = { | 68 | static const char *const mn10300_cputypes[] = { |
69 | "am33v1", | 69 | "am33-1", |
70 | "am33v2", | 70 | "am33-2", |
71 | "am34v1", | 71 | "am34-1", |
72 | "am33-3", | ||
73 | "am34-2", | ||
72 | "unknown" | 74 | "unknown" |
73 | }; | 75 | }; |
74 | 76 | ||
@@ -123,6 +125,7 @@ void __init setup_arch(char **cmdline_p) | |||
123 | 125 | ||
124 | cpu_init(); | 126 | cpu_init(); |
125 | unit_setup(); | 127 | unit_setup(); |
128 | smp_init_cpus(); | ||
126 | parse_mem_cmdline(cmdline_p); | 129 | parse_mem_cmdline(cmdline_p); |
127 | 130 | ||
128 | init_mm.start_code = (unsigned long)&_text; | 131 | init_mm.start_code = (unsigned long)&_text; |
@@ -179,7 +182,6 @@ void __init setup_arch(char **cmdline_p) | |||
179 | void __init cpu_init(void) | 182 | void __init cpu_init(void) |
180 | { | 183 | { |
181 | unsigned long cpurev = CPUREV, type; | 184 | unsigned long cpurev = CPUREV, type; |
182 | unsigned long base, size; | ||
183 | 185 | ||
184 | type = (CPUREV & CPUREV_TYPE) >> CPUREV_TYPE_S; | 186 | type = (CPUREV & CPUREV_TYPE) >> CPUREV_TYPE_S; |
185 | if (type > mn10300_known_cpus) | 187 | if (type > mn10300_known_cpus) |
@@ -189,47 +191,46 @@ void __init cpu_init(void) | |||
189 | mn10300_cputypes[type], | 191 | mn10300_cputypes[type], |
190 | (cpurev & CPUREV_REVISION) >> CPUREV_REVISION_S); | 192 | (cpurev & CPUREV_REVISION) >> CPUREV_REVISION_S); |
191 | 193 | ||
192 | /* determine the memory size and base from the memory controller regs */ | 194 | get_mem_info(&phys_memory_base, &memory_size); |
193 | memory_size = 0; | 195 | phys_memory_end = phys_memory_base + memory_size; |
194 | |||
195 | base = SDBASE(0); | ||
196 | if (base & SDBASE_CE) { | ||
197 | size = (base & SDBASE_CBAM) << SDBASE_CBAM_SHIFT; | ||
198 | size = ~size + 1; | ||
199 | base &= SDBASE_CBA; | ||
200 | 196 | ||
201 | printk(KERN_INFO "SDRAM[0]: %luMb @%08lx\n", size >> 20, base); | 197 | fpu_init_state(); |
202 | memory_size += size; | 198 | } |
203 | phys_memory_base = base; | ||
204 | } | ||
205 | 199 | ||
206 | base = SDBASE(1); | 200 | static struct cpu cpu_devices[NR_CPUS]; |
207 | if (base & SDBASE_CE) { | ||
208 | size = (base & SDBASE_CBAM) << SDBASE_CBAM_SHIFT; | ||
209 | size = ~size + 1; | ||
210 | base &= SDBASE_CBA; | ||
211 | 201 | ||
212 | printk(KERN_INFO "SDRAM[1]: %luMb @%08lx\n", size >> 20, base); | 202 | static int __init topology_init(void) |
213 | memory_size += size; | 203 | { |
214 | if (phys_memory_base == 0) | 204 | int i; |
215 | phys_memory_base = base; | ||
216 | } | ||
217 | 205 | ||
218 | phys_memory_end = phys_memory_base + memory_size; | 206 | for_each_present_cpu(i) |
207 | register_cpu(&cpu_devices[i], i); | ||
219 | 208 | ||
220 | #ifdef CONFIG_FPU | 209 | return 0; |
221 | fpu_init_state(); | ||
222 | #endif | ||
223 | } | 210 | } |
224 | 211 | ||
212 | subsys_initcall(topology_init); | ||
213 | |||
225 | /* | 214 | /* |
226 | * Get CPU information for use by the procfs. | 215 | * Get CPU information for use by the procfs. |
227 | */ | 216 | */ |
228 | static int show_cpuinfo(struct seq_file *m, void *v) | 217 | static int show_cpuinfo(struct seq_file *m, void *v) |
229 | { | 218 | { |
219 | #ifdef CONFIG_SMP | ||
220 | struct mn10300_cpuinfo *c = v; | ||
221 | unsigned long cpu_id = c - cpu_data; | ||
222 | unsigned long cpurev = c->type, type, icachesz, dcachesz; | ||
223 | #else /* CONFIG_SMP */ | ||
224 | unsigned long cpu_id = 0; | ||
230 | unsigned long cpurev = CPUREV, type, icachesz, dcachesz; | 225 | unsigned long cpurev = CPUREV, type, icachesz, dcachesz; |
226 | #endif /* CONFIG_SMP */ | ||
231 | 227 | ||
232 | type = (CPUREV & CPUREV_TYPE) >> CPUREV_TYPE_S; | 228 | #ifdef CONFIG_SMP |
229 | if (!cpu_online(cpu_id)) | ||
230 | return 0; | ||
231 | #endif | ||
232 | |||
233 | type = (cpurev & CPUREV_TYPE) >> CPUREV_TYPE_S; | ||
233 | if (type > mn10300_known_cpus) | 234 | if (type > mn10300_known_cpus) |
234 | type = mn10300_known_cpus; | 235 | type = mn10300_known_cpus; |
235 | 236 | ||
@@ -244,13 +245,14 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
244 | 1024; | 245 | 1024; |
245 | 246 | ||
246 | seq_printf(m, | 247 | seq_printf(m, |
247 | "processor : 0\n" | 248 | "processor : %ld\n" |
248 | "vendor_id : Matsushita\n" | 249 | "vendor_id : Matsushita\n" |
249 | "cpu core : %s\n" | 250 | "cpu core : %s\n" |
250 | "cpu rev : %lu\n" | 251 | "cpu rev : %lu\n" |
251 | "model name : " PROCESSOR_MODEL_NAME "\n" | 252 | "model name : " PROCESSOR_MODEL_NAME "\n" |
252 | "icache size: %lu\n" | 253 | "icache size: %lu\n" |
253 | "dcache size: %lu\n", | 254 | "dcache size: %lu\n", |
255 | cpu_id, | ||
254 | mn10300_cputypes[type], | 256 | mn10300_cputypes[type], |
255 | (cpurev & CPUREV_REVISION) >> CPUREV_REVISION_S, | 257 | (cpurev & CPUREV_REVISION) >> CPUREV_REVISION_S, |
256 | icachesz, | 258 | icachesz, |
@@ -262,8 +264,13 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
262 | "bogomips : %lu.%02lu\n\n", | 264 | "bogomips : %lu.%02lu\n\n", |
263 | MN10300_IOCLK / 1000000, | 265 | MN10300_IOCLK / 1000000, |
264 | (MN10300_IOCLK / 10000) % 100, | 266 | (MN10300_IOCLK / 10000) % 100, |
267 | #ifdef CONFIG_SMP | ||
268 | c->loops_per_jiffy / (500000 / HZ), | ||
269 | (c->loops_per_jiffy / (5000 / HZ)) % 100 | ||
270 | #else /* CONFIG_SMP */ | ||
265 | loops_per_jiffy / (500000 / HZ), | 271 | loops_per_jiffy / (500000 / HZ), |
266 | (loops_per_jiffy / (5000 / HZ)) % 100 | 272 | (loops_per_jiffy / (5000 / HZ)) % 100 |
273 | #endif /* CONFIG_SMP */ | ||
267 | ); | 274 | ); |
268 | 275 | ||
269 | return 0; | 276 | return 0; |