1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright 2011 Freescale Semiconductor, Inc.
4 * Copyright 2011 Linaro Ltd.
7 #include <linux/errno.h>
8 #include <linux/jiffies.h>
10 #include <asm/proc-fns.h>
14 static inline void cpu_enter_lowpower(void)
19 "mcr p15, 0, %1, c7, c5, 0\n"
20 " mcr p15, 0, %1, c7, c10, 4\n"
24 " mrc p15, 0, %0, c1, c0, 1\n"
26 " mcr p15, 0, %0, c1, c0, 1\n"
27 " mrc p15, 0, %0, c1, c0, 0\n"
29 " mcr p15, 0, %0, c1, c0, 0\n"
31 : "r" (0), "Ir" (CR_C), "Ir" (0x40)
36 * platform-specific code to shutdown a CPU
38 * Called with IRQs disabled
40 void imx_cpu_die(unsigned int cpu)
44 * We use the cpu jumping argument register to sync with
45 * imx_cpu_kill() which is running on cpu0 and waiting for
46 * the register being cleared to kill the cpu.
48 imx_set_cpu_arg(cpu, ~0);
54 int imx_cpu_kill(unsigned int cpu)
56 unsigned long timeout = jiffies + msecs_to_jiffies(50);
58 while (imx_get_cpu_arg(cpu) == 0)
59 if (time_after(jiffies, timeout))
61 imx_enable_cpu(cpu, false);
62 imx_set_cpu_arg(cpu, 0);