Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * OMAP4 SMP cpu-hotplug support
0004  *
0005  * Copyright (C) 2010 Texas Instruments, Inc.
0006  * Author:
0007  *      Santosh Shilimkar <santosh.shilimkar@ti.com>
0008  *
0009  * Platform file needed for the OMAP4 SMP. This file is based on arm
0010  * realview smp platform.
0011  * Copyright (c) 2002 ARM Limited.
0012  */
0013 
0014 #include <linux/kernel.h>
0015 #include <linux/errno.h>
0016 #include <linux/smp.h>
0017 #include <linux/io.h>
0018 
0019 #include "omap-wakeupgen.h"
0020 #include "common.h"
0021 #include "powerdomain.h"
0022 
0023 /*
0024  * platform-specific code to shutdown a CPU
0025  * Called with IRQs disabled
0026  */
0027 void omap4_cpu_die(unsigned int cpu)
0028 {
0029     unsigned int boot_cpu = 0;
0030     void __iomem *base = omap_get_wakeupgen_base();
0031 
0032     /*
0033      * we're ready for shutdown now, so do it
0034      */
0035     if (omap_secure_apis_support()) {
0036         if (omap_modify_auxcoreboot0(0x0, 0x200) != 0x0)
0037             pr_err("Secure clear status failed\n");
0038     } else {
0039         writel_relaxed(0, base + OMAP_AUX_CORE_BOOT_0);
0040     }
0041 
0042 
0043     for (;;) {
0044         /*
0045          * Enter into low power state
0046          */
0047         omap4_hotplug_cpu(cpu, PWRDM_POWER_OFF);
0048 
0049         if (omap_secure_apis_support())
0050             boot_cpu = omap_read_auxcoreboot0() >> 9;
0051         else
0052             boot_cpu =
0053                 readl_relaxed(base + OMAP_AUX_CORE_BOOT_0) >> 5;
0054 
0055         if (boot_cpu == smp_processor_id()) {
0056             /*
0057              * OK, proper wakeup, we're done
0058              */
0059             break;
0060         }
0061         pr_debug("CPU%u: spurious wakeup call\n", cpu);
0062     }
0063 }
0064 
0065 /* Needed by kexec and platform_can_cpu_hotplug() */
0066 int omap4_cpu_kill(unsigned int cpu)
0067 {
0068     return 1;
0069 }