diff options
author | Magnus Damm <damm@opensource.se> | 2010-12-14 02:56:55 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-12-14 04:15:44 -0500 |
commit | 1c51ed4fb9f11fa1e0873aa2d5b28f42a85ac299 (patch) | |
tree | 258c5de6db68146a86fc27ae1dc2b8fed2dc40e3 /arch/arm/mach-shmobile/platsmp.c | |
parent | 09dd7ded60019d6a4fd2ae20a08c4ad2bc3ed3e9 (diff) |
ARM: mach-shmobile: SMP base support
Add SMP base support for R-Mobile / SH-Mobile processors.
This patch contains all base code to support CONFIG_SMP
regardless of ARCH_SHMOBILE processor type. Both local timer
and CPU hotplug are supported, but no processor specific
code is included.
At this point only the default behavior is in place, so
a single core will always be used even though CONFIG_SMP
is enabled on multicore systems.
The SMP Kconfig entry for arch/arm/Kconfig is excluded from
this patch to simplify merging.
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/arm/mach-shmobile/platsmp.c')
-rw-r--r-- | arch/arm/mach-shmobile/platsmp.c | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/platsmp.c b/arch/arm/mach-shmobile/platsmp.c new file mode 100644 index 000000000000..b41f5d0650e4 --- /dev/null +++ b/arch/arm/mach-shmobile/platsmp.c | |||
@@ -0,0 +1,73 @@ | |||
1 | /* | ||
2 | * SMP support for R-Mobile / SH-Mobile | ||
3 | * | ||
4 | * Copyright (C) 2010 Magnus Damm | ||
5 | * | ||
6 | * Based on vexpress, Copyright (C) 2002 ARM Ltd, All Rights Reserved | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/errno.h> | ||
14 | #include <linux/delay.h> | ||
15 | #include <linux/device.h> | ||
16 | #include <linux/smp.h> | ||
17 | #include <linux/io.h> | ||
18 | #include <asm/localtimer.h> | ||
19 | |||
20 | static unsigned int __init shmobile_smp_get_core_count(void) | ||
21 | { | ||
22 | return 1; | ||
23 | } | ||
24 | |||
25 | static void __init shmobile_smp_prepare_cpus(void) | ||
26 | { | ||
27 | /* do nothing for now */ | ||
28 | } | ||
29 | |||
30 | |||
31 | void __cpuinit platform_secondary_init(unsigned int cpu) | ||
32 | { | ||
33 | trace_hardirqs_off(); | ||
34 | } | ||
35 | |||
36 | int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) | ||
37 | { | ||
38 | return -ENOSYS; | ||
39 | } | ||
40 | |||
41 | void __init smp_init_cpus(void) | ||
42 | { | ||
43 | unsigned int ncores = shmobile_smp_get_core_count(); | ||
44 | unsigned int i; | ||
45 | |||
46 | for (i = 0; i < ncores; i++) | ||
47 | set_cpu_possible(i, true); | ||
48 | } | ||
49 | |||
50 | void __init smp_prepare_cpus(unsigned int max_cpus) | ||
51 | { | ||
52 | unsigned int ncores = shmobile_smp_get_core_count(); | ||
53 | unsigned int cpu = smp_processor_id(); | ||
54 | int i; | ||
55 | |||
56 | smp_store_cpu_info(cpu); | ||
57 | |||
58 | if (max_cpus > ncores) | ||
59 | max_cpus = ncores; | ||
60 | |||
61 | for (i = 0; i < max_cpus; i++) | ||
62 | set_cpu_present(i, true); | ||
63 | |||
64 | if (max_cpus > 1) { | ||
65 | shmobile_smp_prepare_cpus(); | ||
66 | |||
67 | /* | ||
68 | * Enable the local timer or broadcast device for the | ||
69 | * boot CPU, but only if we have more than one CPU. | ||
70 | */ | ||
71 | percpu_timer_setup(); | ||
72 | } | ||
73 | } | ||