diff options
author | Rabin Vincent <rabin.vincent@stericsson.com> | 2010-09-02 06:28:05 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-09-02 10:52:19 -0400 |
commit | 7e3f7e59ccc6ed8b243de9941ffd09d2ad7a5b9c (patch) | |
tree | 32cfd4d50ae95dcc0fd4b285cb49a403f6bf46a9 | |
parent | e3726fcf263adf764a4f1b9428082837662a41c4 (diff) |
ARM: 6353/1: nomadik-gpio: add SLPM register handing for DB8500v2
The SLPM register enables/disables wakeup detection on DB8500v2.
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/plat-nomadik/gpio.c | 30 | ||||
-rw-r--r-- | arch/arm/plat-nomadik/include/plat/gpio.h | 2 | ||||
-rw-r--r-- | arch/arm/plat-nomadik/include/plat/pincfg.h | 5 |
3 files changed, 33 insertions, 4 deletions
diff --git a/arch/arm/plat-nomadik/gpio.c b/arch/arm/plat-nomadik/gpio.c index 977c8f9a07a2..014da39b6a88 100644 --- a/arch/arm/plat-nomadik/gpio.c +++ b/arch/arm/plat-nomadik/gpio.c | |||
@@ -118,8 +118,8 @@ static void __nmk_config_pin(struct nmk_gpio_chip *nmk_chip, unsigned offset, | |||
118 | [3] /* illegal */ = "??" | 118 | [3] /* illegal */ = "??" |
119 | }; | 119 | }; |
120 | static const char *slpmnames[] = { | 120 | static const char *slpmnames[] = { |
121 | [NMK_GPIO_SLPM_INPUT] = "input", | 121 | [NMK_GPIO_SLPM_INPUT] = "input/wakeup", |
122 | [NMK_GPIO_SLPM_NOCHANGE] = "no-change", | 122 | [NMK_GPIO_SLPM_NOCHANGE] = "no-change/no-wakeup", |
123 | }; | 123 | }; |
124 | 124 | ||
125 | int pin = PIN_NUM(cfg); | 125 | int pin = PIN_NUM(cfg); |
@@ -200,6 +200,10 @@ EXPORT_SYMBOL(nmk_config_pins); | |||
200 | * changed to an input (with pullup/down enabled) in sleep and deep sleep. If | 200 | * changed to an input (with pullup/down enabled) in sleep and deep sleep. If |
201 | * @mode is NMK_GPIO_SLPM_NOCHANGE, the pin remains in the state it was | 201 | * @mode is NMK_GPIO_SLPM_NOCHANGE, the pin remains in the state it was |
202 | * configured even when in sleep and deep sleep. | 202 | * configured even when in sleep and deep sleep. |
203 | * | ||
204 | * On DB8500v2 onwards, this setting loses the previous meaning and instead | ||
205 | * indicates if wakeup detection is enabled on the pin. Note that | ||
206 | * enable_irq_wake() will automatically enable wakeup detection. | ||
203 | */ | 207 | */ |
204 | int nmk_gpio_set_slpm(int gpio, enum nmk_gpio_slpm mode) | 208 | int nmk_gpio_set_slpm(int gpio, enum nmk_gpio_slpm mode) |
205 | { | 209 | { |
@@ -367,7 +371,27 @@ static void nmk_gpio_irq_unmask(unsigned int irq) | |||
367 | 371 | ||
368 | static int nmk_gpio_irq_set_wake(unsigned int irq, unsigned int on) | 372 | static int nmk_gpio_irq_set_wake(unsigned int irq, unsigned int on) |
369 | { | 373 | { |
370 | return nmk_gpio_irq_modify(irq, WAKE, on); | 374 | struct nmk_gpio_chip *nmk_chip; |
375 | unsigned long flags; | ||
376 | int gpio; | ||
377 | |||
378 | gpio = NOMADIK_IRQ_TO_GPIO(irq); | ||
379 | nmk_chip = get_irq_chip_data(irq); | ||
380 | if (!nmk_chip) | ||
381 | return -EINVAL; | ||
382 | |||
383 | spin_lock_irqsave(&nmk_chip->lock, flags); | ||
384 | #ifdef CONFIG_ARCH_U8500 | ||
385 | if (cpu_is_u8500v2()) { | ||
386 | __nmk_gpio_set_slpm(nmk_chip, gpio, | ||
387 | on ? NMK_GPIO_SLPM_WAKEUP_ENABLE | ||
388 | : NMK_GPIO_SLPM_WAKEUP_DISABLE); | ||
389 | } | ||
390 | #endif | ||
391 | __nmk_gpio_irq_modify(nmk_chip, gpio, WAKE, on); | ||
392 | spin_unlock_irqrestore(&nmk_chip->lock, flags); | ||
393 | |||
394 | return 0; | ||
371 | } | 395 | } |
372 | 396 | ||
373 | static int nmk_gpio_irq_set_type(unsigned int irq, unsigned int type) | 397 | static int nmk_gpio_irq_set_type(unsigned int irq, unsigned int type) |
diff --git a/arch/arm/plat-nomadik/include/plat/gpio.h b/arch/arm/plat-nomadik/include/plat/gpio.h index aba355101f49..67b113d639d8 100644 --- a/arch/arm/plat-nomadik/include/plat/gpio.h +++ b/arch/arm/plat-nomadik/include/plat/gpio.h | |||
@@ -65,7 +65,9 @@ enum nmk_gpio_pull { | |||
65 | /* Sleep mode */ | 65 | /* Sleep mode */ |
66 | enum nmk_gpio_slpm { | 66 | enum nmk_gpio_slpm { |
67 | NMK_GPIO_SLPM_INPUT, | 67 | NMK_GPIO_SLPM_INPUT, |
68 | NMK_GPIO_SLPM_WAKEUP_ENABLE = NMK_GPIO_SLPM_INPUT, | ||
68 | NMK_GPIO_SLPM_NOCHANGE, | 69 | NMK_GPIO_SLPM_NOCHANGE, |
70 | NMK_GPIO_SLPM_WAKEUP_DISABLE = NMK_GPIO_SLPM_NOCHANGE, | ||
69 | }; | 71 | }; |
70 | 72 | ||
71 | extern int nmk_gpio_set_slpm(int gpio, enum nmk_gpio_slpm mode); | 73 | extern int nmk_gpio_set_slpm(int gpio, enum nmk_gpio_slpm mode); |
diff --git a/arch/arm/plat-nomadik/include/plat/pincfg.h b/arch/arm/plat-nomadik/include/plat/pincfg.h index 7eed11c1038d..432a201b3b41 100644 --- a/arch/arm/plat-nomadik/include/plat/pincfg.h +++ b/arch/arm/plat-nomadik/include/plat/pincfg.h | |||
@@ -24,7 +24,7 @@ | |||
24 | * | 24 | * |
25 | * PIN_CFG_DEFAULT - default config (0): | 25 | * PIN_CFG_DEFAULT - default config (0): |
26 | * pull up/down = disabled | 26 | * pull up/down = disabled |
27 | * sleep mode = input | 27 | * sleep mode = input/wakeup |
28 | * | 28 | * |
29 | * PIN_CFG - default config with alternate function | 29 | * PIN_CFG - default config with alternate function |
30 | * PIN_CFG_PULL - default config with alternate function and pull up/down | 30 | * PIN_CFG_PULL - default config with alternate function and pull up/down |
@@ -55,6 +55,9 @@ typedef unsigned long pin_cfg_t; | |||
55 | #define PIN_SLPM(x) (((x) & PIN_SLPM_MASK) >> PIN_SLPM_SHIFT) | 55 | #define PIN_SLPM(x) (((x) & PIN_SLPM_MASK) >> PIN_SLPM_SHIFT) |
56 | #define PIN_SLPM_INPUT (NMK_GPIO_SLPM_INPUT << PIN_SLPM_SHIFT) | 56 | #define PIN_SLPM_INPUT (NMK_GPIO_SLPM_INPUT << PIN_SLPM_SHIFT) |
57 | #define PIN_SLPM_NOCHANGE (NMK_GPIO_SLPM_NOCHANGE << PIN_SLPM_SHIFT) | 57 | #define PIN_SLPM_NOCHANGE (NMK_GPIO_SLPM_NOCHANGE << PIN_SLPM_SHIFT) |
58 | /* These two replace the above in DB8500v2+ */ | ||
59 | #define PIN_SLPM_WAKEUP_ENABLE (NMK_GPIO_SLPM_WAKEUP_ENABLE << PIN_SLPM_SHIFT) | ||
60 | #define PIN_SLPM_WAKEUP_DISABLE (NMK_GPIO_SLPM_WAKEUP_DISABLE << PIN_SLPM_SHIFT) | ||
58 | 61 | ||
59 | #define PIN_CFG_DEFAULT (PIN_PULL_NONE | PIN_SLPM_INPUT) | 62 | #define PIN_CFG_DEFAULT (PIN_PULL_NONE | PIN_SLPM_INPUT) |
60 | 63 | ||