blob: ace979d74bfcc99fd16d1199a0305d0c88e3cf41 [file] [log] [blame]
Santosh Shilimkar7d35b8d2010-08-02 13:18:19 +03001/*
2 * OMAP4 SMP cpu-hotplug support
3 *
4 * Copyright (C) 2010 Texas Instruments, Inc.
5 * Author:
6 * Santosh Shilimkar <santosh.shilimkar@ti.com>
7 *
8 * Platform file needed for the OMAP4 SMP. This file is based on arm
9 * realview smp platform.
10 * Copyright (c) 2002 ARM Limited.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 */
16
17#include <linux/kernel.h>
18#include <linux/errno.h>
19#include <linux/smp.h>
Santosh Shilimkar7d35b8d2010-08-02 13:18:19 +030020
21#include <asm/cacheflush.h>
22#include <mach/omap4-common.h>
23
Santosh Shilimkar7d35b8d2010-08-02 13:18:19 +030024int platform_cpu_kill(unsigned int cpu)
25{
Russell King3c030be2010-11-30 11:07:35 +000026 return 1;
Santosh Shilimkar7d35b8d2010-08-02 13:18:19 +030027}
28
29/*
30 * platform-specific code to shutdown a CPU
31 * Called with IRQs disabled
32 */
33void platform_cpu_die(unsigned int cpu)
34{
35 unsigned int this_cpu = hard_smp_processor_id();
36
37 if (cpu != this_cpu) {
38 pr_crit("platform_cpu_die running on %u, should be %u\n",
39 this_cpu, cpu);
40 BUG();
41 }
Russell King3c030be2010-11-30 11:07:35 +000042
Santosh Shilimkar7d35b8d2010-08-02 13:18:19 +030043 flush_cache_all();
44 dsb();
45
46 /*
47 * we're ready for shutdown now, so do it
48 */
49 if (omap_modify_auxcoreboot0(0x0, 0x200) != 0x0)
50 printk(KERN_CRIT "Secure clear status failed\n");
51
52 for (;;) {
53 /*
54 * Execute WFI
55 */
56 do_wfi();
57
58 if (omap_read_auxcoreboot0() == cpu) {
59 /*
60 * OK, proper wakeup, we're done
61 */
62 break;
63 }
64 pr_debug("CPU%u: spurious wakeup call\n", cpu);
65 }
66}
67
68int platform_cpu_disable(unsigned int cpu)
69{
70 /*
71 * we don't allow CPU 0 to be shutdown (it is still too special
72 * e.g. clock tick interrupts)
73 */
74 return cpu == 0 ? -EPERM : 0;
75}