Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /*
0003  * Copyright 2011 Freescale Semiconductor, Inc.
0004  * Copyright 2011 Linaro Ltd.
0005  */
0006 
0007 #include <linux/errno.h>
0008 #include <linux/jiffies.h>
0009 #include <asm/cacheflush.h>
0010 #include <asm/cp15.h>
0011 #include <asm/proc-fns.h>
0012 
0013 #include "common.h"
0014 #include "hardware.h"
0015 
0016 /*
0017  * platform-specific code to shutdown a CPU
0018  *
0019  * Called with IRQs disabled
0020  */
0021 void imx_cpu_die(unsigned int cpu)
0022 {
0023     v7_exit_coherency_flush(louis);
0024     /*
0025      * We use the cpu jumping argument register to sync with
0026      * imx_cpu_kill() which is running on cpu0 and waiting for
0027      * the register being cleared to kill the cpu.
0028      */
0029     imx_set_cpu_arg(cpu, ~0);
0030 
0031     while (1)
0032         cpu_do_idle();
0033 }
0034 
0035 int imx_cpu_kill(unsigned int cpu)
0036 {
0037     unsigned long timeout = jiffies + msecs_to_jiffies(50);
0038 
0039     while (imx_get_cpu_arg(cpu) == 0)
0040         if (time_after(jiffies, timeout))
0041             return 0;
0042     imx_enable_cpu(cpu, false);
0043     imx_set_cpu_arg(cpu, 0);
0044     if (cpu_is_imx7d())
0045         imx_gpcv2_set_core1_pdn_pup_by_software(true);
0046     return 1;
0047 }