]> Pileus Git - ~andy/linux/blob - arch/arm/mach-msm/hotplug.c
ARM: SoC: convert MSM to SMP operations
[~andy/linux] / 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 #include "core.h"
17
18 extern volatile int pen_release;
19
20 static inline void cpu_enter_lowpower(void)
21 {
22         /* Just flush the cache. Changing the coherency is not yet
23          * available on msm. */
24         flush_cache_all();
25 }
26
27 static inline void cpu_leave_lowpower(void)
28 {
29 }
30
31 static inline void platform_do_lowpower(unsigned int cpu)
32 {
33         /* Just enter wfi for now. TODO: Properly shut off the cpu. */
34         for (;;) {
35                 /*
36                  * here's the WFI
37                  */
38                 asm("wfi"
39                     :
40                     :
41                     : "memory", "cc");
42
43                 if (pen_release == cpu_logical_map(cpu)) {
44                         /*
45                          * OK, proper wakeup, we're done
46                          */
47                         break;
48                 }
49
50                 /*
51                  * getting here, means that we have come out of WFI without
52                  * having been woken up - this shouldn't happen
53                  *
54                  * The trouble is, letting people know about this is not really
55                  * possible, since we are currently running incoherently, and
56                  * therefore cannot safely call printk() or anything else
57                  */
58                 pr_debug("CPU%u: spurious wakeup call\n", cpu);
59         }
60 }
61
62 /*
63  * platform-specific code to shutdown a CPU
64  *
65  * Called with IRQs disabled
66  */
67 void __ref msm_cpu_die(unsigned int cpu)
68 {
69         /*
70          * we're ready for shutdown now, so do it
71          */
72         cpu_enter_lowpower();
73         platform_do_lowpower(cpu);
74
75         /*
76          * bring this CPU back into the world of cache
77          * coherency, and then restore interrupts
78          */
79         cpu_leave_lowpower();
80 }