ARM: cpu topology: Add debugfs interface for cpu_power
[cmplus.git] / arch / arm / mach-omap2 / omap-hotplug.c
blobf69cd5cf0f5d76201aaad0831730a69890a11c76
1 /*
2 * OMAP4 SMP cpu-hotplug support
4 * Copyright (C) 2010 Texas Instruments, Inc.
5 * Author:
6 * Santosh Shilimkar <santosh.shilimkar@ti.com>
8 * Platform file needed for the OMAP4 SMP. This file is based on arm
9 * realview smp platform.
10 * Copyright (c) 2002 ARM Limited.
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.
17 #include <linux/kernel.h>
18 #include <linux/errno.h>
19 #include <linux/smp.h>
21 #include <asm/cacheflush.h>
22 #include <asm/hardware/gic.h>
24 #include <mach/omap4-common.h>
25 #include <mach/omap-wakeupgen.h>
27 #include "powerdomain.h"
28 #include "clockdomain.h"
30 int platform_cpu_kill(unsigned int cpu)
32 return 1;
36 * platform-specific code to shutdown a CPU
37 * Called with IRQs disabled
39 void platform_cpu_die(unsigned int cpu)
41 unsigned int this_cpu;
42 static struct clockdomain *cpu1_clkdm;
44 if (!cpu1_clkdm)
45 cpu1_clkdm = clkdm_lookup("mpu1_clkdm");
47 flush_cache_all();
48 dsb();
51 * we're ready for shutdown now, so do it
53 if (omap_modify_auxcoreboot0(0x0, 0x200) != 0x0)
54 pr_err("Secure clear status failed\n");
56 for (;;) {
58 * Enter into low power state
59 * clear all interrupt wakeup sources
61 omap_wakeupgen_irqmask_all(cpu, 1);
62 gic_cpu_disable();
63 omap4_enter_lowpower(cpu, PWRDM_POWER_OFF);
64 this_cpu = hard_smp_processor_id();
65 if (omap_read_auxcoreboot0() == this_cpu) {
67 * OK, proper wakeup, we're done
69 omap_wakeupgen_irqmask_all(this_cpu, 0);
70 gic_cpu_enable();
72 /* Restore clockdomain to hardware supervised */
73 clkdm_allow_idle(cpu1_clkdm);
74 break;
76 pr_debug("CPU%u: spurious wakeup call\n", cpu);
80 int platform_cpu_disable(unsigned int cpu)
83 * we don't allow CPU 0 to be shutdown (it is still too special
84 * e.g. clock tick interrupts)
86 return cpu == 0 ? -EPERM : 0;