[PATCH 4/5] ARM: scu: Move register defines to header file
Russell King - ARM Linux
linux at arm.linux.org.uk
Tue Jan 25 06:46:35 EST 2011
On Mon, Jan 24, 2011 at 02:21:18PM +0530, Santosh Shilimkar wrote:
> This patch moves SCU register defines from smp_scu.c to smp_scu.h
> so that its available for platforms to use
>
> The SCU CPU power status registers is used for power management
> on OMAP4.
Could we instead have an API inside smp_scu.c rather than having each
SoC implement its own SCU PM stuff?
Maybe this. Note that scu_power_mode() needs to be called from a non-
preemptible context, which is sane as we don't want to be rescheduled
onto a different CPU between scu_power_mode() and the wfi/wfe required
to enter the selected mode.
arch/arm/include/asm/smp_scu.h | 5 +++++
arch/arm/kernel/smp_scu.c | 11 +++++++++++
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/arch/arm/include/asm/smp_scu.h b/arch/arm/include/asm/smp_scu.h
index 2376835..ec11a92 100644
--- a/arch/arm/include/asm/smp_scu.h
+++ b/arch/arm/include/asm/smp_scu.h
@@ -1,7 +1,12 @@
#ifndef __ASMARM_ARCH_SCU_H
#define __ASMARM_ARCH_SCU_H
+#define SCU_PM_NORMAL 0
+#define SCU_PM_DORMANT 2
+#define SCU_PM_POWEROFF 3
+
unsigned int scu_get_core_count(void __iomem *);
void scu_enable(void __iomem *);
+int scu_power_mode(unsigned int);
#endif
diff --git a/arch/arm/kernel/smp_scu.c b/arch/arm/kernel/smp_scu.c
index 9ab4149..bbb9b1c 100644
--- a/arch/arm/kernel/smp_scu.c
+++ b/arch/arm/kernel/smp_scu.c
@@ -50,3 +50,14 @@ void __init scu_enable(void __iomem *scu_base)
*/
flush_cache_all();
}
+
+int scu_power_mode(unsigned int mode)
+{
+ int cpu = smp_processor_id();
+
+ if (mode > 3 || mode == 1 || cpu > 3)
+ return -EINVAL;
+
+ __raw_writel(mode << (8 * cpu), scu_base + SCU_CPU_STATUS);
+ return 0;
+}
More information about the linux-arm-kernel
mailing list