]> err.no Git - linux-2.6/commitdiff
[PATCH] ARM: 2781/2: PXA27x Standby mode take 2
authorTodd Poynor <tpoynor@mvista.com>
Fri, 1 Jul 2005 10:27:05 +0000 (11:27 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Fri, 1 Jul 2005 10:27:05 +0000 (11:27 +0100)
Patch from Todd Poynor

Add support for PXA27x Standby mode, a low-power mode that retains CPU
and some peripheral state (the existing "sleep" mode is a power-power
mode that retains less state). Activated via:
echo -n standby > /sys/power/state
From: David Burrage and Todd Poynor

Signed-off-by: Todd Poynor <tpoynor@mvista.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-pxa/Makefile
arch/arm/mach-pxa/pxa27x.c
arch/arm/mach-pxa/standby.S [new file with mode: 0644]
include/asm-arm/arch-pxa/pxa-regs.h

index c4e6d252358533c9a9cb4df28b0aa38ee76c8943..efc2f657184edaf0245863b8782510985f28eb00 100644 (file)
@@ -24,3 +24,7 @@ obj-$(CONFIG_LEDS) += $(led-y)
 
 # Misc features
 obj-$(CONFIG_PM) += pm.o sleep.o
+
+ifeq ($(CONFIG_PXA27x),y)
+obj-$(CONFIG_PM) += standby.o
+endif
index 893964fb9659bbabed5ed818377f430315915ef2..9a791b07118df2a71163db05cb476d5a44b614b7 100644 (file)
@@ -126,6 +126,7 @@ int pxa_cpu_pm_prepare(suspend_state_t state)
 {
        switch (state) {
        case PM_SUSPEND_MEM:
+       case PM_SUSPEND_STANDBY:
                return 0;
        default:
                return -EINVAL;
@@ -138,7 +139,10 @@ void pxa_cpu_pm_enter(suspend_state_t state)
        extern void pxa_cpu_suspend(unsigned int);
        extern void pxa_cpu_resume(void);
 
-       CKEN = CKEN22_MEMC | CKEN9_OSTIMER;
+       if (state == PM_SUSPEND_STANDBY)
+               CKEN = CKEN22_MEMC | CKEN9_OSTIMER | CKEN16_LCD |CKEN0_PWM0;
+       else
+               CKEN = CKEN22_MEMC | CKEN9_OSTIMER;
 
        /* ensure voltage-change sequencer not initiated, which hangs */
        PCFR &= ~PCFR_FVC;
@@ -147,6 +151,9 @@ void pxa_cpu_pm_enter(suspend_state_t state)
        PEDR = 0xDF12FE1B;
 
        switch (state) {
+       case PM_SUSPEND_STANDBY:
+               pxa_cpu_standby();
+               break;
        case PM_SUSPEND_MEM:
                /* set resume return address */
                PSPR = virt_to_phys(pxa_cpu_resume);
diff --git a/arch/arm/mach-pxa/standby.S b/arch/arm/mach-pxa/standby.S
new file mode 100644 (file)
index 0000000..8a3f27b
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * PXA27x standby mode
+ *
+ * Author: David Burrage
+ *
+ * 2005 (c) MontaVista Software, Inc. This file is licensed under
+ * the terms of the GNU General Public License version 2. This program
+ * is licensed "as is" without any warranty of any kind, whether express
+ * or implied.
+ */
+
+#include <linux/config.h>
+#include <linux/linkage.h>
+#include <asm/assembler.h>
+#include <asm/hardware.h>
+
+#include <asm/arch/pxa-regs.h>
+
+               .text
+
+ENTRY(pxa_cpu_standby)
+       ldr     r0, =PSSR
+       mov     r1, #(PSSR_PH | PSSR_STS)
+       mov     r2, #2
+       mov     r3, #UNCACHED_PHYS_0    @ Read mem context in.
+       ldr     ip, [r3]
+       b       1f
+
+       .align  5
+1:     mcr     p14, 0, r2, c7, c0, 0   @ put the system into Standby
+       str     r1, [r0]                @ make sure PSSR_PH/STS are clear
+       mov     pc, lr
index b5e54a9e9fa76992f06da1e944ead0bd951d95a0..803dc92c90389ad3965597640ebab0dbf3e3f2fd 100644 (file)
 #define PSSR_OTGPH     (1 << 6)        /* OTG Peripheral control Hold */
 #define PSSR_RDH       (1 << 5)        /* Read Disable Hold */
 #define PSSR_PH                (1 << 4)        /* Peripheral Control Hold */
+#define PSSR_STS       (1 << 3)        /* Standby Mode Status */
 #define PSSR_VFS       (1 << 2)        /* VDD Fault Status */
 #define PSSR_BFS       (1 << 1)        /* Battery Fault Status */
 #define PSSR_SSS       (1 << 0)        /* Software Sleep Status */