diff options
author | Robert Jarzmik <robert.jarzmik@free.fr> | 2008-11-13 17:30:00 -0500 |
---|---|---|
committer | Eric Miao <eric.miao@marvell.com> | 2008-12-02 01:42:36 -0500 |
commit | 9968711468570c5dc5f96c415e73cb3282e857fc (patch) | |
tree | 14db1ec9950e4df9420655ebc79f7d2dba88273a | |
parent | afb5b5c9adb66c73b83dc39319efbacb6fb26a7d (diff) |
[ARM] pxa: add muxed gpio wakeup sources on pxa2xx architectures
PXA SoC have several GPIOs muxed on only one wakeup source.
Add support for these wakeup sources which were missing
in mfp core support.
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Eric Miao <eric.miao@marvell.com>
-rw-r--r-- | arch/arm/mach-pxa/mfp-pxa2xx.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/arch/arm/mach-pxa/mfp-pxa2xx.c b/arch/arm/mach-pxa/mfp-pxa2xx.c index 2061c00c8ead..28d10679e225 100644 --- a/arch/arm/mach-pxa/mfp-pxa2xx.c +++ b/arch/arm/mach-pxa/mfp-pxa2xx.c | |||
@@ -39,6 +39,7 @@ struct gpio_desc { | |||
39 | unsigned can_wakeup : 1; | 39 | unsigned can_wakeup : 1; |
40 | unsigned keypad_gpio : 1; | 40 | unsigned keypad_gpio : 1; |
41 | unsigned int mask; /* bit mask in PWER or PKWR */ | 41 | unsigned int mask; /* bit mask in PWER or PKWR */ |
42 | unsigned int mux_mask; /* bit mask of muxed gpio bits, 0 if no mux */ | ||
42 | unsigned long config; | 43 | unsigned long config; |
43 | }; | 44 | }; |
44 | 45 | ||
@@ -169,7 +170,7 @@ void pxa2xx_mfp_set_lpm(int mfp, unsigned long lpm) | |||
169 | int gpio_set_wake(unsigned int gpio, unsigned int on) | 170 | int gpio_set_wake(unsigned int gpio, unsigned int on) |
170 | { | 171 | { |
171 | struct gpio_desc *d; | 172 | struct gpio_desc *d; |
172 | unsigned long c; | 173 | unsigned long c, mux_taken; |
173 | 174 | ||
174 | if (gpio > mfp_to_gpio(MFP_PIN_GPIO127)) | 175 | if (gpio > mfp_to_gpio(MFP_PIN_GPIO127)) |
175 | return -EINVAL; | 176 | return -EINVAL; |
@@ -183,9 +184,13 @@ int gpio_set_wake(unsigned int gpio, unsigned int on) | |||
183 | if (d->keypad_gpio) | 184 | if (d->keypad_gpio) |
184 | return -EINVAL; | 185 | return -EINVAL; |
185 | 186 | ||
187 | mux_taken = (PWER & d->mux_mask) & (~d->mask); | ||
188 | if (on && mux_taken) | ||
189 | return -EBUSY; | ||
190 | |||
186 | if (d->can_wakeup && (c & MFP_LPM_CAN_WAKEUP)) { | 191 | if (d->can_wakeup && (c & MFP_LPM_CAN_WAKEUP)) { |
187 | if (on) { | 192 | if (on) { |
188 | PWER |= d->mask; | 193 | PWER = (PWER & ~d->mux_mask) | d->mask; |
189 | 194 | ||
190 | if (c & MFP_LPM_EDGE_RISE) | 195 | if (c & MFP_LPM_EDGE_RISE) |
191 | PRER |= d->mask; | 196 | PRER |= d->mask; |
@@ -251,6 +256,22 @@ int keypad_set_wake(unsigned int on) | |||
251 | return 0; | 256 | return 0; |
252 | } | 257 | } |
253 | 258 | ||
259 | #define PWER_WEMUX2_GPIO38 (1 << 16) | ||
260 | #define PWER_WEMUX2_GPIO53 (2 << 16) | ||
261 | #define PWER_WEMUX2_GPIO40 (3 << 16) | ||
262 | #define PWER_WEMUX2_GPIO36 (4 << 16) | ||
263 | #define PWER_WEMUX2_MASK (7 << 16) | ||
264 | #define PWER_WEMUX3_GPIO31 (1 << 19) | ||
265 | #define PWER_WEMUX3_GPIO113 (2 << 19) | ||
266 | #define PWER_WEMUX3_MASK (3 << 19) | ||
267 | |||
268 | #define INIT_GPIO_DESC_MUXED(mux, gpio) \ | ||
269 | do { \ | ||
270 | gpio_desc[(gpio)].can_wakeup = 1; \ | ||
271 | gpio_desc[(gpio)].mask = PWER_ ## mux ## _GPIO ##gpio; \ | ||
272 | gpio_desc[(gpio)].mux_mask = PWER_ ## mux ## _MASK; \ | ||
273 | } while (0) | ||
274 | |||
254 | static void __init pxa27x_mfp_init(void) | 275 | static void __init pxa27x_mfp_init(void) |
255 | { | 276 | { |
256 | int i, gpio; | 277 | int i, gpio; |
@@ -286,6 +307,12 @@ static void __init pxa27x_mfp_init(void) | |||
286 | gpio_desc[35].can_wakeup = 1; | 307 | gpio_desc[35].can_wakeup = 1; |
287 | gpio_desc[35].mask = PWER_WE35; | 308 | gpio_desc[35].mask = PWER_WE35; |
288 | 309 | ||
310 | INIT_GPIO_DESC_MUXED(WEMUX3, 31); | ||
311 | INIT_GPIO_DESC_MUXED(WEMUX3, 113); | ||
312 | INIT_GPIO_DESC_MUXED(WEMUX2, 38); | ||
313 | INIT_GPIO_DESC_MUXED(WEMUX2, 53); | ||
314 | INIT_GPIO_DESC_MUXED(WEMUX2, 40); | ||
315 | INIT_GPIO_DESC_MUXED(WEMUX2, 36); | ||
289 | gpio_nr = 121; | 316 | gpio_nr = 121; |
290 | } | 317 | } |
291 | #else | 318 | #else |