omap-hotplug.c 1.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
/*
 * OMAP4 SMP cpu-hotplug support
 *
 * Copyright (C) 2010 Texas Instruments, Inc.
 * Author:
 *      Santosh Shilimkar <santosh.shilimkar@ti.com>
 *
 * Platform file needed for the OMAP4 SMP. This file is based on arm
 * realview smp platform.
 * Copyright (c) 2002 ARM Limited.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/smp.h>
20
#include <linux/io.h>
21

22
#include "omap-wakeupgen.h"
23
#include "common.h"
24 25
#include "powerdomain.h"

26 27 28 29
/*
 * platform-specific code to shutdown a CPU
 * Called with IRQs disabled
 */
30
void omap4_cpu_die(unsigned int cpu)
31
{
32 33
	unsigned int boot_cpu = 0;
	void __iomem *base = omap_get_wakeupgen_base();
34

35 36 37
	/*
	 * we're ready for shutdown now, so do it
	 */
38 39 40 41
	if (omap_secure_apis_support()) {
		if (omap_modify_auxcoreboot0(0x0, 0x200) != 0x0)
			pr_err("Secure clear status failed\n");
	} else {
42
		writel_relaxed(0, base + OMAP_AUX_CORE_BOOT_0);
43 44
	}

45 46 47

	for (;;) {
		/*
48
		 * Enter into low power state
49
		 */
50
		omap4_hotplug_cpu(cpu, PWRDM_POWER_OFF);
51 52

		if (omap_secure_apis_support())
53
			boot_cpu = omap_read_auxcoreboot0() >> 9;
54 55
		else
			boot_cpu =
56
				readl_relaxed(base + OMAP_AUX_CORE_BOOT_0) >> 5;
57 58

		if (boot_cpu == smp_processor_id()) {
59 60 61 62 63 64 65 66
			/*
			 * OK, proper wakeup, we're done
			 */
			break;
		}
		pr_debug("CPU%u: spurious wakeup call\n", cpu);
	}
}
67 68 69 70 71 72

/* Needed by kexec and platform_can_cpu_hotplug() */
int omap4_cpu_kill(unsigned int cpu)
{
	return 1;
}