2 * Copyright (C) 2002 ARM Ltd.
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.
9 * This hotplug implementation is _specific_ to the situation found on
10 * ARM development platforms where there is _no_ possibility of actually
11 * taking a CPU offline, resetting it, or otherwise. Real platforms must
14 #include <linux/kernel.h>
15 #include <linux/errno.h>
16 #include <linux/smp.h>
18 #include <asm/smp_plat.h>
21 #include <plat/platsmp.h>
23 static inline void versatile_immitation_enter_lowpower(unsigned int actrl_mask
)
28 "mcr p15, 0, %1, c7, c5, 0\n"
29 " mcr p15, 0, %1, c7, c10, 4\n"
33 " mrc p15, 0, %0, c1, c0, 1\n"
35 " mcr p15, 0, %0, c1, c0, 1\n"
36 " mrc p15, 0, %0, c1, c0, 0\n"
38 " mcr p15, 0, %0, c1, c0, 0\n"
40 : "r" (0), "Ir" (CR_C
), "Ir" (actrl_mask
)
44 static inline void versatile_immitation_leave_lowpower(unsigned int actrl_mask
)
49 "mrc p15, 0, %0, c1, c0, 0\n"
51 " mcr p15, 0, %0, c1, c0, 0\n"
52 " mrc p15, 0, %0, c1, c0, 1\n"
54 " mcr p15, 0, %0, c1, c0, 1\n"
56 : "Ir" (CR_C
), "Ir" (actrl_mask
)
60 static inline void versatile_immitation_do_lowpower(unsigned int cpu
, int *spurious
)
63 * there is no power-control hardware on this platform, so all
64 * we can do is put the core into WFI; this is safe as the calling
65 * code will have already disabled interrupts.
67 * This code should not be used outside Versatile platforms.
72 if (versatile_cpu_release
== cpu_logical_map(cpu
)) {
74 * OK, proper wakeup, we're done
80 * Getting here, means that we have come out of WFI without
81 * having been woken up - this shouldn't happen
83 * Just note it happening - when we're woken, we can report
91 * platform-specific code to shutdown a CPU.
92 * This code supports immitation-style CPU hotplug for Versatile/Realview/
93 * Versatile Express platforms that are unable to do real CPU hotplug.
95 void versatile_immitation_cpu_die(unsigned int cpu
, unsigned int actrl_mask
)
99 versatile_immitation_enter_lowpower(actrl_mask
);
100 versatile_immitation_do_lowpower(cpu
, &spurious
);
101 versatile_immitation_leave_lowpower(actrl_mask
);
104 pr_warn("CPU%u: %u spurious wakeup calls\n", cpu
, spurious
);