diff options
Diffstat (limited to 'arch/arm/mach-omap2/omap-smp.c')
-rw-r--r-- | arch/arm/mach-omap2/omap-smp.c | 71 |
1 files changed, 19 insertions, 52 deletions
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c index 9e9f70e18e3c..ecfe93c4b585 100644 --- a/arch/arm/mach-omap2/omap-smp.c +++ b/arch/arm/mach-omap2/omap-smp.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include <linux/io.h> | 21 | #include <linux/io.h> |
22 | 22 | ||
23 | #include <asm/cacheflush.h> | 23 | #include <asm/cacheflush.h> |
24 | #include <asm/localtimer.h> | 24 | #include <asm/hardware/gic.h> |
25 | #include <asm/smp_scu.h> | 25 | #include <asm/smp_scu.h> |
26 | #include <mach/hardware.h> | 26 | #include <mach/hardware.h> |
27 | #include <mach/omap4-common.h> | 27 | #include <mach/omap4-common.h> |
@@ -29,28 +29,16 @@ | |||
29 | /* SCU base address */ | 29 | /* SCU base address */ |
30 | static void __iomem *scu_base; | 30 | static void __iomem *scu_base; |
31 | 31 | ||
32 | /* | ||
33 | * Use SCU config register to count number of cores | ||
34 | */ | ||
35 | static inline unsigned int get_core_count(void) | ||
36 | { | ||
37 | if (scu_base) | ||
38 | return scu_get_core_count(scu_base); | ||
39 | return 1; | ||
40 | } | ||
41 | |||
42 | static DEFINE_SPINLOCK(boot_lock); | 32 | static DEFINE_SPINLOCK(boot_lock); |
43 | 33 | ||
44 | void __cpuinit platform_secondary_init(unsigned int cpu) | 34 | void __cpuinit platform_secondary_init(unsigned int cpu) |
45 | { | 35 | { |
46 | trace_hardirqs_off(); | ||
47 | |||
48 | /* | 36 | /* |
49 | * If any interrupts are already enabled for the primary | 37 | * If any interrupts are already enabled for the primary |
50 | * core (e.g. timer irq), then they will not have been enabled | 38 | * core (e.g. timer irq), then they will not have been enabled |
51 | * for us: do so | 39 | * for us: do so |
52 | */ | 40 | */ |
53 | gic_cpu_init(0, gic_cpu_base_addr); | 41 | gic_secondary_init(0); |
54 | 42 | ||
55 | /* | 43 | /* |
56 | * Synchronise with the boot thread. | 44 | * Synchronise with the boot thread. |
@@ -76,7 +64,7 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) | |||
76 | omap_modify_auxcoreboot0(0x200, 0xfffffdff); | 64 | omap_modify_auxcoreboot0(0x200, 0xfffffdff); |
77 | flush_cache_all(); | 65 | flush_cache_all(); |
78 | smp_wmb(); | 66 | smp_wmb(); |
79 | smp_cross_call(cpumask_of(cpu)); | 67 | gic_raise_softirq(cpumask_of(cpu), 1); |
80 | 68 | ||
81 | /* | 69 | /* |
82 | * Now the secondary core is starting up let it run its | 70 | * Now the secondary core is starting up let it run its |
@@ -118,25 +106,9 @@ void __init smp_init_cpus(void) | |||
118 | scu_base = ioremap(OMAP44XX_SCU_BASE, SZ_256); | 106 | scu_base = ioremap(OMAP44XX_SCU_BASE, SZ_256); |
119 | BUG_ON(!scu_base); | 107 | BUG_ON(!scu_base); |
120 | 108 | ||
121 | ncores = get_core_count(); | 109 | ncores = scu_get_core_count(scu_base); |
122 | |||
123 | for (i = 0; i < ncores; i++) | ||
124 | set_cpu_possible(i, true); | ||
125 | } | ||
126 | |||
127 | void __init smp_prepare_cpus(unsigned int max_cpus) | ||
128 | { | ||
129 | unsigned int ncores = get_core_count(); | ||
130 | unsigned int cpu = smp_processor_id(); | ||
131 | int i; | ||
132 | 110 | ||
133 | /* sanity check */ | 111 | /* sanity check */ |
134 | if (ncores == 0) { | ||
135 | printk(KERN_ERR | ||
136 | "OMAP4: strange core count of 0? Default to 1\n"); | ||
137 | ncores = 1; | ||
138 | } | ||
139 | |||
140 | if (ncores > NR_CPUS) { | 112 | if (ncores > NR_CPUS) { |
141 | printk(KERN_WARNING | 113 | printk(KERN_WARNING |
142 | "OMAP4: no. of cores (%d) greater than configured " | 114 | "OMAP4: no. of cores (%d) greater than configured " |
@@ -144,13 +116,16 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
144 | ncores, NR_CPUS); | 116 | ncores, NR_CPUS); |
145 | ncores = NR_CPUS; | 117 | ncores = NR_CPUS; |
146 | } | 118 | } |
147 | smp_store_cpu_info(cpu); | ||
148 | 119 | ||
149 | /* | 120 | for (i = 0; i < ncores; i++) |
150 | * are we trying to boot more cores than exist? | 121 | set_cpu_possible(i, true); |
151 | */ | 122 | |
152 | if (max_cpus > ncores) | 123 | set_smp_cross_call(gic_raise_softirq); |
153 | max_cpus = ncores; | 124 | } |
125 | |||
126 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) | ||
127 | { | ||
128 | int i; | ||
154 | 129 | ||
155 | /* | 130 | /* |
156 | * Initialise the present map, which describes the set of CPUs | 131 | * Initialise the present map, which describes the set of CPUs |
@@ -159,18 +134,10 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
159 | for (i = 0; i < max_cpus; i++) | 134 | for (i = 0; i < max_cpus; i++) |
160 | set_cpu_present(i, true); | 135 | set_cpu_present(i, true); |
161 | 136 | ||
162 | if (max_cpus > 1) { | 137 | /* |
163 | /* | 138 | * Initialise the SCU and wake up the secondary core using |
164 | * Enable the local timer or broadcast device for the | 139 | * wakeup_secondary(). |
165 | * boot CPU, but only if we have more than one CPU. | 140 | */ |
166 | */ | 141 | scu_enable(scu_base); |
167 | percpu_timer_setup(); | 142 | wakeup_secondary(); |
168 | |||
169 | /* | ||
170 | * Initialise the SCU and wake up the secondary core using | ||
171 | * wakeup_secondary(). | ||
172 | */ | ||
173 | scu_enable(scu_base); | ||
174 | wakeup_secondary(); | ||
175 | } | ||
176 | } | 143 | } |