2 * Copyright (C) 2012-2013 Xilinx
4 * based on linux/arch/arm/mach-realview/hotplug.c
6 * Copyright (C) 2002 ARM Ltd.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
13 #include <linux/kernel.h>
14 #include <linux/errno.h>
15 #include <linux/smp.h>
17 #include <asm/cacheflush.h>
21 static inline void zynq_cpu_enter_lowpower(void)
27 " mcr p15, 0, %1, c7, c5, 0\n"
32 " mrc p15, 0, %0, c1, c0, 1\n"
33 " bic %0, %0, #0x40\n"
34 " mcr p15, 0, %0, c1, c0, 1\n"
35 " mrc p15, 0, %0, c1, c0, 0\n"
37 " mcr p15, 0, %0, c1, c0, 0\n"
39 : "r" (0), "Ir" (CR_C)
43 static inline void zynq_cpu_leave_lowpower(void)
48 " mrc p15, 0, %0, c1, c0, 0\n"
50 " mcr p15, 0, %0, c1, c0, 0\n"
51 " mrc p15, 0, %0, c1, c0, 1\n"
52 " orr %0, %0, #0x40\n"
53 " mcr p15, 0, %0, c1, c0, 1\n"
59 static inline void zynq_platform_do_lowpower(unsigned int cpu, int *spurious)
62 * there is no power-control hardware on this platform, so all
63 * we can do is put the core into WFI; this is safe as the calling
64 * code will have already disabled interrupts
71 * Getting here, means that we have come out of WFI without
72 * having been woken up - this shouldn't happen
74 * Just note it happening - when we're woken, we can report
82 * platform-specific code to shutdown a CPU
84 * Called with IRQs disabled
86 void zynq_platform_cpu_die(unsigned int cpu)
91 * we're ready for shutdown now, so do it
93 zynq_cpu_enter_lowpower();
94 zynq_platform_do_lowpower(cpu, &spurious);
97 * bring this CPU back into the world of cache
98 * coherency, and then restore interrupts
100 zynq_cpu_leave_lowpower();
103 pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);