History

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).

Robert Jarzmik committed 14 years ago

Commit b95ace51 parent 66f75a53 files · +28 −3Browse files

Unified · Split

3 files
  1. arch/arm/mach-pxa/pxa27x.c +5 −1
  2. drivers/gpio/gpio-pxa.c +19 −2
  3. include/linux/gpio-pxa.h +4 −0
arch/arm/mach-pxa/pxa27x.c+5−1
@@ -421,8 +421,11 @@ void __init pxa27x_set_i2c_power_info(struct i2c_pxa_platform_data *info) · 420 unmodified lines
421 pxa_register_device(&pxa27x_device_i2c_power, info);421 pxa_register_device(&pxa27x_device_i2c_power, info);
422}422}
423 423
424static struct pxa_gpio_platform_data pxa27x_gpio_info __initdata = {
425 .gpio_set_wake = gpio_set_wake,
426};
427
424static struct platform_device *devices[] __initdata = {428static struct platform_device *devices[] __initdata = {
425 &pxa_device_gpio,
426 &pxa27x_device_udc,429 &pxa27x_device_udc,
427 &pxa_device_pmu,430 &pxa_device_pmu,
428 &pxa_device_i2s,431 &pxa_device_i2s,
@@ -458,6 +461,7 @@ static int __init pxa27x_init(void) · 29 unmodified lines
458 register_syscore_ops(&pxa2xx_mfp_syscore_ops);461 register_syscore_ops(&pxa2xx_mfp_syscore_ops);
459 register_syscore_ops(&pxa2xx_clock_syscore_ops);462 register_syscore_ops(&pxa2xx_clock_syscore_ops);
460 463
464 pxa_register_device(&pxa_device_gpio, &pxa27x_gpio_info);
461 ret = platform_add_devices(devices, ARRAY_SIZE(devices));465 ret = platform_add_devices(devices, ARRAY_SIZE(devices));
462 }466 }
463 467
drivers/gpio/gpio-pxa.c+19−2
@@ -64,6 +64,7 @@ struct pxa_gpio_chip { · 63 unmodified lines
64 unsigned long irq_mask;64 unsigned long irq_mask;
65 unsigned long irq_edge_rise;65 unsigned long irq_edge_rise;
66 unsigned long irq_edge_fall;66 unsigned long irq_edge_fall;
67 int (*set_wake)(unsigned int gpio, unsigned int on);
67 68
68#ifdef CONFIG_PM69#ifdef CONFIG_PM
69 unsigned long saved_gplr;70 unsigned long saved_gplr;
@@ -269,7 +270,8 @@ static void pxa_gpio_set(struct gpio_chip *chip, unsigned offset, int value) · 199 unmodified lines
269 (value ? GPSR_OFFSET : GPCR_OFFSET));270 (value ? GPSR_OFFSET : GPCR_OFFSET));
270}271}
271 272
272static int __devinit pxa_init_gpio_chip(int gpio_end)273static int __devinit pxa_init_gpio_chip(int gpio_end,
274 int (*set_wake)(unsigned int, unsigned int))
273{275{
274 int i, gpio, nbanks = gpio_to_bank(gpio_end) + 1;276 int i, gpio, nbanks = gpio_to_bank(gpio_end) + 1;
275 struct pxa_gpio_chip *chips;277 struct pxa_gpio_chip *chips;
@@ -285,6 +287,7 @@ static int __devinit pxa_init_gpio_chip(int gpio_end) · 9 unmodified lines
285 287
286 sprintf(chips[i].label, "gpio-%d", i);288 sprintf(chips[i].label, "gpio-%d", i);
287 chips[i].regbase = gpio_reg_base + BANK_OFF(i);289 chips[i].regbase = gpio_reg_base + BANK_OFF(i);
290 chips[i].set_wake = set_wake;
288 291
289 c->base = gpio;292 c->base = gpio;
290 c->label = chips[i].label;293 c->label = chips[i].label;
@@ -412,6 +415,17 @@ static void pxa_mask_muxed_gpio(struct irq_data *d) · 121 unmodified lines
412 writel_relaxed(gfer, c->regbase + GFER_OFFSET);415 writel_relaxed(gfer, c->regbase + GFER_OFFSET);
413}416}
414 417
418static 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
415static void pxa_unmask_muxed_gpio(struct irq_data *d)429static void pxa_unmask_muxed_gpio(struct irq_data *d)
416{430{
417 int gpio = pxa_irq_to_gpio(d->irq);431 int gpio = pxa_irq_to_gpio(d->irq);
@@ -427,6 +441,7 @@ static struct irq_chip pxa_muxed_gpio_chip = { · 9 unmodified lines
427 .irq_mask = pxa_mask_muxed_gpio,441 .irq_mask = pxa_mask_muxed_gpio,
428 .irq_unmask = pxa_unmask_muxed_gpio,442 .irq_unmask = pxa_unmask_muxed_gpio,
429 .irq_set_type = pxa_gpio_irq_type,443 .irq_set_type = pxa_gpio_irq_type,
444 .irq_set_wake = pxa_gpio_set_wake,
430};445};
431 446
432static int pxa_gpio_nums(void)447static int pxa_gpio_nums(void)
@@ -471,6 +486,7 @@ static int __devinit pxa_gpio_probe(struct platform_device *pdev) · 38 unmodified lines
471 struct pxa_gpio_chip *c;486 struct pxa_gpio_chip *c;
472 struct resource *res;487 struct resource *res;
473 struct clk *clk;488 struct clk *clk;
489 struct pxa_gpio_platform_data *info;
474 int gpio, irq, ret;490 int gpio, irq, ret;
475 int irq0 = 0, irq1 = 0, irq_mux, gpio_offset = 0;491 int irq0 = 0, irq1 = 0, irq_mux, gpio_offset = 0;
476 492
@@ -516,7 +532,8 @@ static int __devinit pxa_gpio_probe(struct platform_device *pdev) · 39 unmodified lines
516 }532 }
517 533
518 /* Initialize GPIO chips */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 /* clear all GPIO edge detects */538 /* clear all GPIO edge detects */
522 for_each_gpio_chip(gpio, c) {539 for_each_gpio_chip(gpio, c) {
include/linux/gpio-pxa.h+4−0
@@ -13,4 +13,8 @@ extern int pxa_last_gpio; · 12 unmodified lines
13 13
14extern int pxa_irq_to_gpio(int irq);14extern int pxa_irq_to_gpio(int irq);
15 15
16struct pxa_gpio_platform_data {
17 int (*gpio_set_wake)(unsigned int gpio, unsigned int on);
18};
19
16#endif /* __GPIO_PXA_H */20#endif /* __GPIO_PXA_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t