Commit b95ace54a23e2f8ebb032744cebb17c9f43bf651
Committed by
Haojian Zhuang
1 parent
66f75a5d02
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
ARM: pxa: fix gpio wakeup setting
In 3.3, gpio wakeup setting was broken. The call enable_irq_wake() didn't set up the PXA gpio registers (PWER, ...) anymore. Fix it at least for pxa27x. The driver doesn't seem to be used in pxa25x (weird ...), and the fix doesn't extend to pxa3xx and pxa95x (which don't have a gpio_set_wake() available). Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Showing 3 changed files with 28 additions and 3 deletions Side-by-side Diff
arch/arm/mach-pxa/pxa27x.c
... | ... | @@ -421,8 +421,11 @@ |
421 | 421 | pxa_register_device(&pxa27x_device_i2c_power, info); |
422 | 422 | } |
423 | 423 | |
424 | +static struct pxa_gpio_platform_data pxa27x_gpio_info __initdata = { | |
425 | + .gpio_set_wake = gpio_set_wake, | |
426 | +}; | |
427 | + | |
424 | 428 | static struct platform_device *devices[] __initdata = { |
425 | - &pxa_device_gpio, | |
426 | 429 | &pxa27x_device_udc, |
427 | 430 | &pxa_device_pmu, |
428 | 431 | &pxa_device_i2s, |
... | ... | @@ -458,6 +461,7 @@ |
458 | 461 | register_syscore_ops(&pxa2xx_mfp_syscore_ops); |
459 | 462 | register_syscore_ops(&pxa2xx_clock_syscore_ops); |
460 | 463 | |
464 | + pxa_register_device(&pxa_device_gpio, &pxa27x_gpio_info); | |
461 | 465 | ret = platform_add_devices(devices, ARRAY_SIZE(devices)); |
462 | 466 | } |
463 | 467 |
drivers/gpio/gpio-pxa.c
... | ... | @@ -64,6 +64,7 @@ |
64 | 64 | unsigned long irq_mask; |
65 | 65 | unsigned long irq_edge_rise; |
66 | 66 | unsigned long irq_edge_fall; |
67 | + int (*set_wake)(unsigned int gpio, unsigned int on); | |
67 | 68 | |
68 | 69 | #ifdef CONFIG_PM |
69 | 70 | unsigned long saved_gplr; |
... | ... | @@ -269,7 +270,8 @@ |
269 | 270 | (value ? GPSR_OFFSET : GPCR_OFFSET)); |
270 | 271 | } |
271 | 272 | |
272 | -static int __devinit pxa_init_gpio_chip(int gpio_end) | |
273 | +static int __devinit pxa_init_gpio_chip(int gpio_end, | |
274 | + int (*set_wake)(unsigned int, unsigned int)) | |
273 | 275 | { |
274 | 276 | int i, gpio, nbanks = gpio_to_bank(gpio_end) + 1; |
275 | 277 | struct pxa_gpio_chip *chips; |
... | ... | @@ -285,6 +287,7 @@ |
285 | 287 | |
286 | 288 | sprintf(chips[i].label, "gpio-%d", i); |
287 | 289 | chips[i].regbase = gpio_reg_base + BANK_OFF(i); |
290 | + chips[i].set_wake = set_wake; | |
288 | 291 | |
289 | 292 | c->base = gpio; |
290 | 293 | c->label = chips[i].label; |
... | ... | @@ -412,6 +415,17 @@ |
412 | 415 | writel_relaxed(gfer, c->regbase + GFER_OFFSET); |
413 | 416 | } |
414 | 417 | |
418 | +static int pxa_gpio_set_wake(struct irq_data *d, unsigned int on) | |
419 | +{ | |
420 | + int gpio = pxa_irq_to_gpio(d->irq); | |
421 | + struct pxa_gpio_chip *c = gpio_to_pxachip(gpio); | |
422 | + | |
423 | + if (c->set_wake) | |
424 | + return c->set_wake(gpio, on); | |
425 | + else | |
426 | + return 0; | |
427 | +} | |
428 | + | |
415 | 429 | static void pxa_unmask_muxed_gpio(struct irq_data *d) |
416 | 430 | { |
417 | 431 | int gpio = pxa_irq_to_gpio(d->irq); |
... | ... | @@ -427,6 +441,7 @@ |
427 | 441 | .irq_mask = pxa_mask_muxed_gpio, |
428 | 442 | .irq_unmask = pxa_unmask_muxed_gpio, |
429 | 443 | .irq_set_type = pxa_gpio_irq_type, |
444 | + .irq_set_wake = pxa_gpio_set_wake, | |
430 | 445 | }; |
431 | 446 | |
432 | 447 | static int pxa_gpio_nums(void) |
... | ... | @@ -471,6 +486,7 @@ |
471 | 486 | struct pxa_gpio_chip *c; |
472 | 487 | struct resource *res; |
473 | 488 | struct clk *clk; |
489 | + struct pxa_gpio_platform_data *info; | |
474 | 490 | int gpio, irq, ret; |
475 | 491 | int irq0 = 0, irq1 = 0, irq_mux, gpio_offset = 0; |
476 | 492 | |
... | ... | @@ -516,7 +532,8 @@ |
516 | 532 | } |
517 | 533 | |
518 | 534 | /* Initialize GPIO chips */ |
519 | - pxa_init_gpio_chip(pxa_last_gpio); | |
535 | + info = dev_get_platdata(&pdev->dev); | |
536 | + pxa_init_gpio_chip(pxa_last_gpio, info ? info->gpio_set_wake : NULL); | |
520 | 537 | |
521 | 538 | /* clear all GPIO edge detects */ |
522 | 539 | for_each_gpio_chip(gpio, c) { |