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 #include <linux/kernel.h>
10 #include <linux/errno.h>
11 #include <linux/smp.h>
14 #include <asm/smp_plat.h>
16 static inline void cpu_enter_lowpower(void)
21 " mcr p15, 0, %1, c7, c5, 0\n"
22 " mcr p15, 0, %1, c7, c10, 4\n"
26 " mrc p15, 0, %0, c1, c0, 1\n"
27 " bic %0, %0, #0x20\n"
28 " mcr p15, 0, %0, c1, c0, 1\n"
29 " mrc p15, 0, %0, c1, c0, 0\n"
31 " mcr p15, 0, %0, c1, c0, 0\n"
33 : "r" (0), "Ir" (CR_C
)
37 static inline void cpu_leave_lowpower(void)
41 asm volatile( "mrc p15, 0, %0, c1, c0, 0\n"
43 " mcr p15, 0, %0, c1, c0, 0\n"
44 " mrc p15, 0, %0, c1, c0, 1\n"
45 " orr %0, %0, #0x20\n"
46 " mcr p15, 0, %0, c1, c0, 1\n"
52 static inline void platform_do_lowpower(unsigned int cpu
, int *spurious
)
55 * there is no power-control hardware on this platform, so all
56 * we can do is put the core into WFI; this is safe as the calling
57 * code will have already disabled interrupts
63 asm(".word 0xe320f003\n"
68 if (pen_release
== cpu_logical_map(cpu
)) {
70 * OK, proper wakeup, we're done
76 * Getting here, means that we have come out of WFI without
77 * having been woken up - this shouldn't happen
79 * Just note it happening - when we're woken, we can report
87 * platform-specific code to shutdown a CPU
89 * Called with IRQs disabled
91 void ox820_cpu_die(unsigned int cpu
)
96 * we're ready for shutdown now, so do it
99 platform_do_lowpower(cpu
, &spurious
);
102 * bring this CPU back into the world of cache
103 * coherency, and then restore interrupts
105 cpu_leave_lowpower();
108 pr_warn("CPU%u: %u spurious wakeup calls\n", cpu
, spurious
);