blob: 8343fcf4f399b7be242b215ee153bb873a292e5c [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001// SPDX-License-Identifier: GPL-2.0-only
Santosh Shilimkar7d35b8d2010-08-02 13:18:19 +03002/*
3 * OMAP4 SMP cpu-hotplug support
4 *
5 * Copyright (C) 2010 Texas Instruments, Inc.
6 * Author:
7 * Santosh Shilimkar <santosh.shilimkar@ti.com>
8 *
9 * Platform file needed for the OMAP4 SMP. This file is based on arm
10 * realview smp platform.
11 * Copyright (c) 2002 ARM Limited.
Santosh Shilimkar7d35b8d2010-08-02 13:18:19 +030012 */
13
14#include <linux/kernel.h>
15#include <linux/errno.h>
16#include <linux/smp.h>
Santosh Shilimkar247c4452012-05-09 20:38:35 +053017#include <linux/io.h>
Santosh Shilimkar7d35b8d2010-08-02 13:18:19 +030018
Tony Lindgren732231a2012-09-20 11:41:16 -070019#include "omap-wakeupgen.h"
Tony Lindgren4e653312011-11-10 22:45:17 +010020#include "common.h"
Santosh Shilimkarb5b4f282010-06-16 22:19:48 +053021#include "powerdomain.h"
22
Santosh Shilimkar7d35b8d2010-08-02 13:18:19 +030023/*
24 * platform-specific code to shutdown a CPU
25 * Called with IRQs disabled
26 */
Stephen Boydb96fc2f2015-10-19 13:05:33 -070027void omap4_cpu_die(unsigned int cpu)
Santosh Shilimkar7d35b8d2010-08-02 13:18:19 +030028{
Santosh Shilimkar247c4452012-05-09 20:38:35 +053029 unsigned int boot_cpu = 0;
30 void __iomem *base = omap_get_wakeupgen_base();
Santosh Shilimkarb5b4f282010-06-16 22:19:48 +053031
Santosh Shilimkar7d35b8d2010-08-02 13:18:19 +030032 /*
33 * we're ready for shutdown now, so do it
34 */
Santosh Shilimkar247c4452012-05-09 20:38:35 +053035 if (omap_secure_apis_support()) {
36 if (omap_modify_auxcoreboot0(0x0, 0x200) != 0x0)
37 pr_err("Secure clear status failed\n");
38 } else {
Victor Kamenskyedfaf052014-04-15 20:37:46 +030039 writel_relaxed(0, base + OMAP_AUX_CORE_BOOT_0);
Santosh Shilimkar247c4452012-05-09 20:38:35 +053040 }
41
Santosh Shilimkar7d35b8d2010-08-02 13:18:19 +030042
43 for (;;) {
44 /*
Santosh Shilimkarb5b4f282010-06-16 22:19:48 +053045 * Enter into low power state
Santosh Shilimkar7d35b8d2010-08-02 13:18:19 +030046 */
Santosh Shilimkarb5b4f282010-06-16 22:19:48 +053047 omap4_hotplug_cpu(cpu, PWRDM_POWER_OFF);
Santosh Shilimkar247c4452012-05-09 20:38:35 +053048
49 if (omap_secure_apis_support())
Tony Lindgren351b7c42017-03-22 11:01:48 -070050 boot_cpu = omap_read_auxcoreboot0() >> 9;
Santosh Shilimkar247c4452012-05-09 20:38:35 +053051 else
52 boot_cpu =
Victor Kamenskyedfaf052014-04-15 20:37:46 +030053 readl_relaxed(base + OMAP_AUX_CORE_BOOT_0) >> 5;
Santosh Shilimkar247c4452012-05-09 20:38:35 +053054
55 if (boot_cpu == smp_processor_id()) {
Santosh Shilimkar7d35b8d2010-08-02 13:18:19 +030056 /*
57 * OK, proper wakeup, we're done
58 */
59 break;
60 }
61 pr_debug("CPU%u: spurious wakeup call\n", cpu);
62 }
63}
Tony Lindgren36962032016-06-22 02:05:12 -070064
65/* Needed by kexec and platform_can_cpu_hotplug() */
66int omap4_cpu_kill(unsigned int cpu)
67{
68 return 1;
69}