2 * Copyright 2011 Freescale Semiconductor, Inc.
3 * Copyright 2011 Linaro Ltd.
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
9 * http://www.opensource.org/licenses/gpl-license.html
10 * http://www.gnu.org/copyleft/gpl.html
13 #include <linux/errno.h>
14 #include <linux/jiffies.h>
16 #include <asm/proc-fns.h>
20 static inline void cpu_enter_lowpower(void)
25 "mcr p15, 0, %1, c7, c5, 0\n"
26 " mcr p15, 0, %1, c7, c10, 4\n"
30 " mrc p15, 0, %0, c1, c0, 1\n"
32 " mcr p15, 0, %0, c1, c0, 1\n"
33 " mrc p15, 0, %0, c1, c0, 0\n"
35 " mcr p15, 0, %0, c1, c0, 0\n"
37 : "r" (0), "Ir" (CR_C
), "Ir" (0x40)
42 * platform-specific code to shutdown a CPU
44 * Called with IRQs disabled
46 void imx_cpu_die(unsigned int cpu
)
50 * We use the cpu jumping argument register to sync with
51 * imx_cpu_kill() which is running on cpu0 and waiting for
52 * the register being cleared to kill the cpu.
54 imx_set_cpu_arg(cpu
, ~0);
60 int imx_cpu_kill(unsigned int cpu
)
62 unsigned long timeout
= jiffies
+ msecs_to_jiffies(50);
64 while (imx_get_cpu_arg(cpu
) == 0)
65 if (time_after(jiffies
, timeout
))
67 imx_enable_cpu(cpu
, false);
68 imx_set_cpu_arg(cpu
, 0);