diff options
author | eric miao <eric.miao@marvell.com> | 2008-03-10 21:46:28 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-04-19 06:29:05 -0400 |
commit | c0a596d6a138ea281bed4ff3018c07c45dd245a2 (patch) | |
tree | ab3c25663433bf8c3f16026d969f9722d4ecff92 /arch/arm/mach-pxa/pxa27x.c | |
parent | 9b02b2df0099c083ea40ba8c7068e3dcbe381302 (diff) |
[ARM] pxa: allow dynamic enable/disable of GPIO wakeup for pxa{25x,27x}
Changes include:
1. rename MFP_LPM_WAKEUP_ENABLE into MFP_LPM_CAN_WAKEUP to indicate
the board capability of this pin to wakeup the system
2. add gpio_set_wake() and keypad_set_wake() to allow dynamically
enable/disable wakeup from GPIOs and keypad GPIO
* these functions are currently kept in mfp-pxa2xx.c due to their
dependency to the MFP configuration
3. pxa2xx_mfp_config() only gives early warning if MFP_LPM_CAN_WAKEUP
is set on incorrect pins
So that the GPIO's wakeup capability is now decided by the following:
a) processor's capability: (only those GPIOs which have dedicated
bits within PWER/PRER/PFER can wakeup the system), this is
initialized by pxa{25x,27x}_init_mfp()
b) board design decides:
- whether the pin is designed to wakeup the system (some of
the GPIOs are configured as other functions, which is not
intended to be a wakeup source), by OR'ing the pin config
with MFP_LPM_CAN_WAKEUP
- which edge the pin is designed to wakeup the system, this
may depends on external peripherals/connections, which is
totally board specific; this is indicated by MFP_LPM_EDGE_*
c) the corresponding device's (most likely the gpio_keys.c) wakeup
attribute:
Signed-off-by: eric miao <eric.miao@marvell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-pxa/pxa27x.c')
-rw-r--r-- | arch/arm/mach-pxa/pxa27x.c | 31 |
1 files changed, 5 insertions, 26 deletions
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c index 87ade40865f1..b230af22ae05 100644 --- a/arch/arm/mach-pxa/pxa27x.c +++ b/arch/arm/mach-pxa/pxa27x.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <asm/arch/irqs.h> | 23 | #include <asm/arch/irqs.h> |
24 | #include <asm/arch/pxa-regs.h> | 24 | #include <asm/arch/pxa-regs.h> |
25 | #include <asm/arch/pxa2xx-regs.h> | 25 | #include <asm/arch/pxa2xx-regs.h> |
26 | #include <asm/arch/mfp-pxa27x.h> | ||
26 | #include <asm/arch/ohci.h> | 27 | #include <asm/arch/ohci.h> |
27 | #include <asm/arch/pm.h> | 28 | #include <asm/arch/pm.h> |
28 | #include <asm/arch/dma.h> | 29 | #include <asm/arch/dma.h> |
@@ -286,37 +287,16 @@ static inline void pxa27x_init_pm(void) {} | |||
286 | /* PXA27x: Various gpios can issue wakeup events. This logic only | 287 | /* PXA27x: Various gpios can issue wakeup events. This logic only |
287 | * handles the simple cases, not the WEMUX2 and WEMUX3 options | 288 | * handles the simple cases, not the WEMUX2 and WEMUX3 options |
288 | */ | 289 | */ |
289 | #define PXA27x_GPIO_NOWAKE_MASK \ | ||
290 | ((1 << 8) | (1 << 7) | (1 << 6) | (1 << 5) | (1 << 2)) | ||
291 | #define WAKEMASK(gpio) \ | ||
292 | (((gpio) <= 15) \ | ||
293 | ? ((1 << (gpio)) & ~PXA27x_GPIO_NOWAKE_MASK) \ | ||
294 | : ((gpio == 35) ? (1 << 24) : 0)) | ||
295 | |||
296 | static int pxa27x_set_wake(unsigned int irq, unsigned int on) | 290 | static int pxa27x_set_wake(unsigned int irq, unsigned int on) |
297 | { | 291 | { |
298 | int gpio = IRQ_TO_GPIO(irq); | 292 | int gpio = IRQ_TO_GPIO(irq); |
299 | uint32_t mask; | 293 | uint32_t mask; |
300 | 294 | ||
301 | if ((gpio >= 0 && gpio <= 15) || (gpio == 35)) { | 295 | if (gpio >= 0 && gpio < 128) |
302 | if (WAKEMASK(gpio) == 0) | 296 | return gpio_set_wake(gpio, on); |
303 | return -EINVAL; | ||
304 | |||
305 | mask = WAKEMASK(gpio); | ||
306 | |||
307 | if (on) { | ||
308 | if (GRER(gpio) | GPIO_bit(gpio)) | ||
309 | PRER |= mask; | ||
310 | else | ||
311 | PRER &= ~mask; | ||
312 | 297 | ||
313 | if (GFER(gpio) | GPIO_bit(gpio)) | 298 | if (irq == IRQ_KEYPAD) |
314 | PFER |= mask; | 299 | return keypad_set_wake(on); |
315 | else | ||
316 | PFER &= ~mask; | ||
317 | } | ||
318 | goto set_pwer; | ||
319 | } | ||
320 | 300 | ||
321 | switch (irq) { | 301 | switch (irq) { |
322 | case IRQ_RTCAlrm: | 302 | case IRQ_RTCAlrm: |
@@ -329,7 +309,6 @@ static int pxa27x_set_wake(unsigned int irq, unsigned int on) | |||
329 | return -EINVAL; | 309 | return -EINVAL; |
330 | } | 310 | } |
331 | 311 | ||
332 | set_pwer: | ||
333 | if (on) | 312 | if (on) |
334 | PWER |= mask; | 313 | PWER |= mask; |
335 | else | 314 | else |