diff options
author | Rabin Vincent <rabin.vincent@stericsson.com> | 2010-09-02 06:28:48 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-09-02 10:52:19 -0400 |
commit | 6720db7cc592b2148e0d88a7d76dc0532f3d266c (patch) | |
tree | 68b2ba061880c163358bc4d5144dac99c127596a /arch/arm/plat-nomadik/include | |
parent | 7e3f7e59ccc6ed8b243de9941ffd09d2ad7a5b9c (diff) |
ARM: 6354/1: nomadik-gpio: allow control of sleep mode direction and pull up
DB8500v2 allows control of direction and pull up/down configuration in
sleep mode, instead of switching the pin to input with pull up/down
enabled.
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>
Diffstat (limited to 'arch/arm/plat-nomadik/include')
-rw-r--r-- | arch/arm/plat-nomadik/include/plat/pincfg.h | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/arch/arm/plat-nomadik/include/plat/pincfg.h b/arch/arm/plat-nomadik/include/plat/pincfg.h index 432a201b3b41..8c5ae3f2acf8 100644 --- a/arch/arm/plat-nomadik/include/plat/pincfg.h +++ b/arch/arm/plat-nomadik/include/plat/pincfg.h | |||
@@ -19,12 +19,16 @@ | |||
19 | * bit 9..10 - Alternate Function Selection | 19 | * bit 9..10 - Alternate Function Selection |
20 | * bit 11..12 - Pull up/down state | 20 | * bit 11..12 - Pull up/down state |
21 | * bit 13 - Sleep mode behaviour | 21 | * bit 13 - Sleep mode behaviour |
22 | * bit 14 - (sleep mode) Direction | ||
23 | * bit 15 - (sleep mode) Value (if output) | ||
22 | * | 24 | * |
23 | * to facilitate the definition, the following macros are provided | 25 | * to facilitate the definition, the following macros are provided |
24 | * | 26 | * |
25 | * PIN_CFG_DEFAULT - default config (0): | 27 | * PIN_CFG_DEFAULT - default config (0): |
26 | * pull up/down = disabled | 28 | * pull up/down = disabled |
27 | * sleep mode = input/wakeup | 29 | * sleep mode = input/wakeup |
30 | * (sleep mode) direction = input | ||
31 | * (sleep mode) value = low | ||
28 | * | 32 | * |
29 | * PIN_CFG - default config with alternate function | 33 | * PIN_CFG - default config with alternate function |
30 | * PIN_CFG_PULL - default config with alternate function and pull up/down | 34 | * PIN_CFG_PULL - default config with alternate function and pull up/down |
@@ -53,12 +57,37 @@ typedef unsigned long pin_cfg_t; | |||
53 | #define PIN_SLPM_SHIFT 13 | 57 | #define PIN_SLPM_SHIFT 13 |
54 | #define PIN_SLPM_MASK (0x1 << PIN_SLPM_SHIFT) | 58 | #define PIN_SLPM_MASK (0x1 << PIN_SLPM_SHIFT) |
55 | #define PIN_SLPM(x) (((x) & PIN_SLPM_MASK) >> PIN_SLPM_SHIFT) | 59 | #define PIN_SLPM(x) (((x) & PIN_SLPM_MASK) >> PIN_SLPM_SHIFT) |
56 | #define PIN_SLPM_INPUT (NMK_GPIO_SLPM_INPUT << PIN_SLPM_SHIFT) | 60 | #define PIN_SLPM_MAKE_INPUT (NMK_GPIO_SLPM_INPUT << PIN_SLPM_SHIFT) |
57 | #define PIN_SLPM_NOCHANGE (NMK_GPIO_SLPM_NOCHANGE << PIN_SLPM_SHIFT) | 61 | #define PIN_SLPM_NOCHANGE (NMK_GPIO_SLPM_NOCHANGE << PIN_SLPM_SHIFT) |
58 | /* These two replace the above in DB8500v2+ */ | 62 | /* These two replace the above in DB8500v2+ */ |
59 | #define PIN_SLPM_WAKEUP_ENABLE (NMK_GPIO_SLPM_WAKEUP_ENABLE << PIN_SLPM_SHIFT) | 63 | #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) | 64 | #define PIN_SLPM_WAKEUP_DISABLE (NMK_GPIO_SLPM_WAKEUP_DISABLE << PIN_SLPM_SHIFT) |
61 | 65 | ||
66 | #define PIN_DIR_SHIFT 14 | ||
67 | #define PIN_DIR_MASK (0x1 << PIN_DIR_SHIFT) | ||
68 | #define PIN_DIR(x) (((x) & PIN_DIR_MASK) >> PIN_DIR_SHIFT) | ||
69 | #define PIN_DIR_INPUT (0 << PIN_DIR_SHIFT) | ||
70 | #define PIN_DIR_OUTPUT (1 << PIN_DIR_SHIFT) | ||
71 | |||
72 | #define PIN_VAL_SHIFT 15 | ||
73 | #define PIN_VAL_MASK (0x1 << PIN_VAL_SHIFT) | ||
74 | #define PIN_VAL(x) (((x) & PIN_VAL_MASK) >> PIN_VAL_SHIFT) | ||
75 | #define PIN_VAL_LOW (0 << PIN_VAL_SHIFT) | ||
76 | #define PIN_VAL_HIGH (1 << PIN_VAL_SHIFT) | ||
77 | |||
78 | /* Shortcuts. Use these instead of separate DIR and VAL. */ | ||
79 | #define PIN_INPUT PIN_DIR_INPUT | ||
80 | #define PIN_OUTPUT_LOW (PIN_DIR_OUTPUT | PIN_VAL_LOW) | ||
81 | #define PIN_OUTPUT_HIGH (PIN_DIR_OUTPUT | PIN_VAL_HIGH) | ||
82 | |||
83 | /* | ||
84 | * These are the same as the ones above, but should make more sense to the | ||
85 | * reader when seen along with a setting a pin to AF mode. | ||
86 | */ | ||
87 | #define PIN_SLPM_INPUT PIN_INPUT | ||
88 | #define PIN_SLPM_OUTPUT_LOW PIN_OUTPUT_LOW | ||
89 | #define PIN_SLPM_OUTPUT_HIGH PIN_OUTPUT_HIGH | ||
90 | |||
62 | #define PIN_CFG_DEFAULT (PIN_PULL_NONE | PIN_SLPM_INPUT) | 91 | #define PIN_CFG_DEFAULT (PIN_PULL_NONE | PIN_SLPM_INPUT) |
63 | 92 | ||
64 | #define PIN_CFG(num, alt) \ | 93 | #define PIN_CFG(num, alt) \ |