diff options
Diffstat (limited to 'arch/arm/mach-integrator')
-rw-r--r-- | arch/arm/mach-integrator/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-integrator/core.c | 20 | ||||
-rw-r--r-- | arch/arm/mach-integrator/headsmp.S | 37 | ||||
-rw-r--r-- | arch/arm/mach-integrator/leds.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-integrator/platsmp.c | 192 |
5 files changed, 252 insertions, 2 deletions
diff --git a/arch/arm/mach-integrator/Makefile b/arch/arm/mach-integrator/Makefile index 158daaf9e3b0..ebb255bdce8a 100644 --- a/arch/arm/mach-integrator/Makefile +++ b/arch/arm/mach-integrator/Makefile | |||
@@ -12,3 +12,4 @@ obj-$(CONFIG_LEDS) += leds.o | |||
12 | obj-$(CONFIG_PCI) += pci_v3.o pci.o | 12 | obj-$(CONFIG_PCI) += pci_v3.o pci.o |
13 | obj-$(CONFIG_CPU_FREQ_INTEGRATOR) += cpu.o | 13 | obj-$(CONFIG_CPU_FREQ_INTEGRATOR) += cpu.o |
14 | obj-$(CONFIG_INTEGRATOR_IMPD1) += impd1.o | 14 | obj-$(CONFIG_INTEGRATOR_IMPD1) += impd1.o |
15 | obj-$(CONFIG_SMP) += platsmp.o headsmp.o | ||
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c index bd17b5154311..d302f0405fd2 100644 --- a/arch/arm/mach-integrator/core.c +++ b/arch/arm/mach-integrator/core.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/spinlock.h> | 14 | #include <linux/spinlock.h> |
15 | #include <linux/interrupt.h> | 15 | #include <linux/interrupt.h> |
16 | #include <linux/sched.h> | 16 | #include <linux/sched.h> |
17 | #include <linux/smp.h> | ||
17 | 18 | ||
18 | #include <asm/hardware.h> | 19 | #include <asm/hardware.h> |
19 | #include <asm/irq.h> | 20 | #include <asm/irq.h> |
@@ -221,7 +222,24 @@ integrator_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
221 | */ | 222 | */ |
222 | timer1->TimerClear = 1; | 223 | timer1->TimerClear = 1; |
223 | 224 | ||
224 | timer_tick(regs); | 225 | /* |
226 | * the clock tick routines are only processed on the | ||
227 | * primary CPU | ||
228 | */ | ||
229 | if (hard_smp_processor_id() == 0) { | ||
230 | nmi_tick(); | ||
231 | timer_tick(regs); | ||
232 | #ifdef CONFIG_SMP | ||
233 | smp_send_timer(); | ||
234 | #endif | ||
235 | } | ||
236 | |||
237 | #ifdef CONFIG_SMP | ||
238 | /* | ||
239 | * this is the ARM equivalent of the APIC timer interrupt | ||
240 | */ | ||
241 | update_process_times(user_mode(regs)); | ||
242 | #endif /* CONFIG_SMP */ | ||
225 | 243 | ||
226 | write_sequnlock(&xtime_lock); | 244 | write_sequnlock(&xtime_lock); |
227 | 245 | ||
diff --git a/arch/arm/mach-integrator/headsmp.S b/arch/arm/mach-integrator/headsmp.S new file mode 100644 index 000000000000..ceaa88e30d70 --- /dev/null +++ b/arch/arm/mach-integrator/headsmp.S | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-integrator/headsmp.S | ||
3 | * | ||
4 | * Copyright (c) 2003 ARM Limited | ||
5 | * All Rights Reserved | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | #include <linux/linkage.h> | ||
12 | #include <linux/init.h> | ||
13 | |||
14 | __INIT | ||
15 | |||
16 | /* | ||
17 | * Integrator specific entry point for secondary CPUs. This provides | ||
18 | * a "holding pen" into which all secondary cores are held until we're | ||
19 | * ready for them to initialise. | ||
20 | */ | ||
21 | ENTRY(integrator_secondary_startup) | ||
22 | adr r4, 1f | ||
23 | ldmia r4, {r5, r6} | ||
24 | sub r4, r4, r5 | ||
25 | ldr r6, [r6, r4] | ||
26 | pen: ldr r7, [r6] | ||
27 | cmp r7, r0 | ||
28 | bne pen | ||
29 | |||
30 | /* | ||
31 | * we've been released from the holding pen: secondary_stack | ||
32 | * should now contain the SVC stack for this core | ||
33 | */ | ||
34 | b secondary_startup | ||
35 | |||
36 | 1: .long . | ||
37 | .long phys_pen_release | ||
diff --git a/arch/arm/mach-integrator/leds.c b/arch/arm/mach-integrator/leds.c index d2c0ab21150c..f1436e683b49 100644 --- a/arch/arm/mach-integrator/leds.c +++ b/arch/arm/mach-integrator/leds.c | |||
@@ -22,6 +22,8 @@ | |||
22 | */ | 22 | */ |
23 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/smp.h> | ||
26 | #include <linux/spinlock.h> | ||
25 | 27 | ||
26 | #include <asm/hardware.h> | 28 | #include <asm/hardware.h> |
27 | #include <asm/io.h> | 29 | #include <asm/io.h> |
@@ -85,4 +87,4 @@ static int __init leds_init(void) | |||
85 | return 0; | 87 | return 0; |
86 | } | 88 | } |
87 | 89 | ||
88 | __initcall(leds_init); | 90 | core_initcall(leds_init); |
diff --git a/arch/arm/mach-integrator/platsmp.c b/arch/arm/mach-integrator/platsmp.c new file mode 100644 index 000000000000..ead15dfcb53d --- /dev/null +++ b/arch/arm/mach-integrator/platsmp.c | |||
@@ -0,0 +1,192 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-cintegrator/platsmp.c | ||
3 | * | ||
4 | * Copyright (C) 2002 ARM Ltd. | ||
5 | * All Rights Reserved | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | #include <linux/init.h> | ||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/sched.h> | ||
14 | #include <linux/errno.h> | ||
15 | #include <linux/mm.h> | ||
16 | |||
17 | #include <asm/atomic.h> | ||
18 | #include <asm/delay.h> | ||
19 | #include <asm/mmu_context.h> | ||
20 | #include <asm/procinfo.h> | ||
21 | #include <asm/ptrace.h> | ||
22 | #include <asm/smp.h> | ||
23 | |||
24 | extern void integrator_secondary_startup(void); | ||
25 | |||
26 | /* | ||
27 | * control for which core is the next to come out of the secondary | ||
28 | * boot "holding pen" | ||
29 | */ | ||
30 | volatile int __initdata pen_release = -1; | ||
31 | unsigned long __initdata phys_pen_release = 0; | ||
32 | |||
33 | static DEFINE_SPINLOCK(boot_lock); | ||
34 | |||
35 | void __init platform_secondary_init(unsigned int cpu) | ||
36 | { | ||
37 | /* | ||
38 | * the primary core may have used a "cross call" soft interrupt | ||
39 | * to get this processor out of WFI in the BootMonitor - make | ||
40 | * sure that we are no longer being sent this soft interrupt | ||
41 | */ | ||
42 | smp_cross_call_done(cpumask_of_cpu(cpu)); | ||
43 | |||
44 | /* | ||
45 | * if any interrupts are already enabled for the primary | ||
46 | * core (e.g. timer irq), then they will not have been enabled | ||
47 | * for us: do so | ||
48 | */ | ||
49 | secondary_scan_irqs(); | ||
50 | |||
51 | /* | ||
52 | * let the primary processor know we're out of the | ||
53 | * pen, then head off into the C entry point | ||
54 | */ | ||
55 | pen_release = -1; | ||
56 | |||
57 | /* | ||
58 | * Synchronise with the boot thread. | ||
59 | */ | ||
60 | spin_lock(&boot_lock); | ||
61 | spin_unlock(&boot_lock); | ||
62 | } | ||
63 | |||
64 | int __init boot_secondary(unsigned int cpu, struct task_struct *idle) | ||
65 | { | ||
66 | unsigned long timeout; | ||
67 | |||
68 | /* | ||
69 | * set synchronisation state between this boot processor | ||
70 | * and the secondary one | ||
71 | */ | ||
72 | spin_lock(&boot_lock); | ||
73 | |||
74 | /* | ||
75 | * The secondary processor is waiting to be released from | ||
76 | * the holding pen - release it, then wait for it to flag | ||
77 | * that it has been released by resetting pen_release. | ||
78 | * | ||
79 | * Note that "pen_release" is the hardware CPU ID, whereas | ||
80 | * "cpu" is Linux's internal ID. | ||
81 | */ | ||
82 | pen_release = cpu; | ||
83 | |||
84 | /* | ||
85 | * XXX | ||
86 | * | ||
87 | * This is a later addition to the booting protocol: the | ||
88 | * bootMonitor now puts secondary cores into WFI, so | ||
89 | * poke_milo() no longer gets the cores moving; we need | ||
90 | * to send a soft interrupt to wake the secondary core. | ||
91 | * Use smp_cross_call() for this, since there's little | ||
92 | * point duplicating the code here | ||
93 | */ | ||
94 | smp_cross_call(cpumask_of_cpu(cpu)); | ||
95 | |||
96 | timeout = jiffies + (1 * HZ); | ||
97 | while (time_before(jiffies, timeout)) { | ||
98 | if (pen_release == -1) | ||
99 | break; | ||
100 | |||
101 | udelay(10); | ||
102 | } | ||
103 | |||
104 | /* | ||
105 | * now the secondary core is starting up let it run its | ||
106 | * calibrations, then wait for it to finish | ||
107 | */ | ||
108 | spin_unlock(&boot_lock); | ||
109 | |||
110 | return pen_release != -1 ? -ENOSYS : 0; | ||
111 | } | ||
112 | |||
113 | static void __init poke_milo(void) | ||
114 | { | ||
115 | extern void secondary_startup(void); | ||
116 | |||
117 | /* nobody is to be released from the pen yet */ | ||
118 | pen_release = -1; | ||
119 | |||
120 | phys_pen_release = virt_to_phys(&pen_release); | ||
121 | |||
122 | /* | ||
123 | * write the address of secondary startup into the system-wide | ||
124 | * flags register, then clear the bottom two bits, which is what | ||
125 | * BootMonitor is waiting for | ||
126 | */ | ||
127 | #if 1 | ||
128 | #define CINTEGRATOR_HDR_FLAGSS_OFFSET 0x30 | ||
129 | __raw_writel(virt_to_phys(integrator_secondary_startup), | ||
130 | (IO_ADDRESS(INTEGRATOR_HDR_BASE) + | ||
131 | CINTEGRATOR_HDR_FLAGSS_OFFSET)); | ||
132 | #define CINTEGRATOR_HDR_FLAGSC_OFFSET 0x34 | ||
133 | __raw_writel(3, | ||
134 | (IO_ADDRESS(INTEGRATOR_HDR_BASE) + | ||
135 | CINTEGRATOR_HDR_FLAGSC_OFFSET)); | ||
136 | #endif | ||
137 | |||
138 | mb(); | ||
139 | } | ||
140 | |||
141 | void __init smp_prepare_cpus(unsigned int max_cpus) | ||
142 | { | ||
143 | unsigned int ncores = get_core_count(); | ||
144 | unsigned int cpu = smp_processor_id(); | ||
145 | int i; | ||
146 | |||
147 | /* sanity check */ | ||
148 | if (ncores == 0) { | ||
149 | printk(KERN_ERR | ||
150 | "Integrator/CP: strange CM count of 0? Default to 1\n"); | ||
151 | |||
152 | ncores = 1; | ||
153 | } | ||
154 | |||
155 | if (ncores > NR_CPUS) { | ||
156 | printk(KERN_WARNING | ||
157 | "Integrator/CP: no. of cores (%d) greater than configured " | ||
158 | "maximum of %d - clipping\n", | ||
159 | ncores, NR_CPUS); | ||
160 | ncores = NR_CPUS; | ||
161 | } | ||
162 | |||
163 | /* | ||
164 | * start with some more config for the Boot CPU, now that | ||
165 | * the world is a bit more alive (which was not the case | ||
166 | * when smp_prepare_boot_cpu() was called) | ||
167 | */ | ||
168 | smp_store_cpu_info(cpu); | ||
169 | |||
170 | /* | ||
171 | * are we trying to boot more cores than exist? | ||
172 | */ | ||
173 | if (max_cpus > ncores) | ||
174 | max_cpus = ncores; | ||
175 | |||
176 | /* | ||
177 | * Initialise the present mask - this tells us which CPUs should | ||
178 | * be present. | ||
179 | */ | ||
180 | for (i = 0; i < max_cpus; i++) { | ||
181 | cpu_set(i, cpu_present_mask); | ||
182 | } | ||
183 | |||
184 | /* | ||
185 | * Do we need any more CPUs? If so, then let them know where | ||
186 | * to start. Note that, on modern versions of MILO, the "poke" | ||
187 | * doesn't actually do anything until each individual core is | ||
188 | * sent a soft interrupt to get it out of WFI | ||
189 | */ | ||
190 | if (max_cpus > 1) | ||
191 | poke_milo(); | ||
192 | } | ||