ARM: kirkwood: Trim excess #includes in board-dnskw.c
[deliverable/linux.git] / arch / arm / mach-msm / hotplug.c
1 /*
2 * Copyright (C) 2002 ARM Ltd.
3 * All Rights Reserved
4 *
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>
12
13 #include <asm/cacheflush.h>
14 #include <asm/smp_plat.h>
15
16 extern volatile int pen_release;
17
18 static inline void cpu_enter_lowpower(void)
19 {
20 /* Just flush the cache. Changing the coherency is not yet
21 * available on msm. */
22 flush_cache_all();
23 }
24
25 static inline void cpu_leave_lowpower(void)
26 {
27 }
28
29 static inline void platform_do_lowpower(unsigned int cpu)
30 {
31 /* Just enter wfi for now. TODO: Properly shut off the cpu. */
32 for (;;) {
33 /*
34 * here's the WFI
35 */
36 asm("wfi"
37 :
38 :
39 : "memory", "cc");
40
41 if (pen_release == cpu_logical_map(cpu)) {
42 /*
43 * OK, proper wakeup, we're done
44 */
45 break;
46 }
47
48 /*
49 * getting here, means that we have come out of WFI without
50 * having been woken up - this shouldn't happen
51 *
52 * The trouble is, letting people know about this is not really
53 * possible, since we are currently running incoherently, and
54 * therefore cannot safely call printk() or anything else
55 */
56 pr_debug("CPU%u: spurious wakeup call\n", cpu);
57 }
58 }
59
60 int platform_cpu_kill(unsigned int cpu)
61 {
62 return 1;
63 }
64
65 /*
66 * platform-specific code to shutdown a CPU
67 *
68 * Called with IRQs disabled
69 */
70 void platform_cpu_die(unsigned int cpu)
71 {
72 /*
73 * we're ready for shutdown now, so do it
74 */
75 cpu_enter_lowpower();
76 platform_do_lowpower(cpu);
77
78 /*
79 * bring this CPU back into the world of cache
80 * coherency, and then restore interrupts
81 */
82 cpu_leave_lowpower();
83 }
84
85 int platform_cpu_disable(unsigned int cpu)
86 {
87 /*
88 * we don't allow CPU 0 to be shutdown (it is still too special
89 * e.g. clock tick interrupts)
90 */
91 return cpu == 0 ? -EPERM : 0;
92 }
This page took 0.031305 seconds and 5 git commands to generate.