Merge remote-tracking branch 's5p/for-next'
[linux-2.6/next.git] / arch / arm / mach-msm / hotplug.c
blob5a31f70dfb8e9504779e0b91f01804524aded95a
1 /*
2 * Copyright (C) 2002 ARM Ltd.
3 * All Rights Reserved
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9 #include <linux/kernel.h>
10 #include <linux/errno.h>
11 #include <linux/smp.h>
13 #include <asm/cacheflush.h>
15 extern volatile int pen_release;
17 static inline void cpu_enter_lowpower(void)
19 /* Just flush the cache. Changing the coherency is not yet
20 * available on msm. */
21 flush_cache_all();
24 static inline void cpu_leave_lowpower(void)
28 static inline void platform_do_lowpower(unsigned int cpu)
30 /* Just enter wfi for now. TODO: Properly shut off the cpu. */
31 for (;;) {
33 * here's the WFI
35 asm("wfi"
38 : "memory", "cc");
40 if (pen_release == cpu) {
42 * OK, proper wakeup, we're done
44 break;
48 * getting here, means that we have come out of WFI without
49 * having been woken up - this shouldn't happen
51 * The trouble is, letting people know about this is not really
52 * possible, since we are currently running incoherently, and
53 * therefore cannot safely call printk() or anything else
55 pr_debug("CPU%u: spurious wakeup call\n", cpu);
59 int platform_cpu_kill(unsigned int cpu)
61 return 1;
65 * platform-specific code to shutdown a CPU
67 * Called with IRQs disabled
69 void platform_cpu_die(unsigned int cpu)
72 * we're ready for shutdown now, so do it
74 cpu_enter_lowpower();
75 platform_do_lowpower(cpu);
78 * bring this CPU back into the world of cache
79 * coherency, and then restore interrupts
81 cpu_leave_lowpower();
84 int platform_cpu_disable(unsigned int cpu)
87 * we don't allow CPU 0 to be shutdown (it is still too special
88 * e.g. clock tick interrupts)
90 return cpu == 0 ? -EPERM : 0;