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
421421 pxa_register_device(&pxa27x_device_i2c_power, info);
422422 }
423423
424+static struct pxa_gpio_platform_data pxa27x_gpio_info __initdata = {
425+ .gpio_set_wake = gpio_set_wake,
426+};
427+
424428 static struct platform_device *devices[] __initdata = {
425− &pxa_device_gpio,
426429 &pxa27x_device_udc,
427430 &pxa_device_pmu,
428431 &pxa_device_i2s,
@@ -458,6 +461,7 @@ static int __init pxa27x_init(void) · 29 unmodified lines
458461 register_syscore_ops(&pxa2xx_mfp_syscore_ops);
459462 register_syscore_ops(&pxa2xx_clock_syscore_ops);
460463
464+ pxa_register_device(&pxa_device_gpio, &pxa27x_gpio_info);
461465 ret = platform_add_devices(devices, ARRAY_SIZE(devices));
462466 }
463467
drivers/gpio/gpio-pxa.c+19−2
@@ -64,6 +64,7 @@ struct pxa_gpio_chip { · 63 unmodified lines
6464 unsigned long irq_mask;
6565 unsigned long irq_edge_rise;
6666 unsigned long irq_edge_fall;
67+ int (*set_wake)(unsigned int gpio, unsigned int on);
6768
6869 #ifdef CONFIG_PM
6970 unsigned long saved_gplr;
@@ -269,7 +270,8 @@ static void pxa_gpio_set(struct gpio_chip *chip, unsigned offset, int value) · 199 unmodified lines
269270 (value ? GPSR_OFFSET : GPCR_OFFSET));
270271 }
271272
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))
273275 {
274276 int i, gpio, nbanks = gpio_to_bank(gpio_end) + 1;
275277 struct pxa_gpio_chip *chips;
@@ -285,6 +287,7 @@ static int __devinit pxa_init_gpio_chip(int gpio_end) · 9 unmodified lines
285287
286288 sprintf(chips[i].label, "gpio-%d", i);
287289 chips[i].regbase = gpio_reg_base + BANK_OFF(i);
290+ chips[i].set_wake = set_wake;
288291
289292 c->base = gpio;
290293 c->label = chips[i].label;
@@ -412,6 +415,17 @@ static void pxa_mask_muxed_gpio(struct irq_data *d) · 121 unmodified lines
412415 writel_relaxed(gfer, c->regbase + GFER_OFFSET);
413416 }
414417
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+
415429 static void pxa_unmask_muxed_gpio(struct irq_data *d)
416430 {
417431 int gpio = pxa_irq_to_gpio(d->irq);
@@ -427,6 +441,7 @@ static struct irq_chip pxa_muxed_gpio_chip = { · 9 unmodified lines
427441 .irq_mask = pxa_mask_muxed_gpio,
428442 .irq_unmask = pxa_unmask_muxed_gpio,
429443 .irq_set_type = pxa_gpio_irq_type,
444+ .irq_set_wake = pxa_gpio_set_wake,
430445 };
431446
432447 static int pxa_gpio_nums(void)
@@ -471,6 +486,7 @@ static int __devinit pxa_gpio_probe(struct platform_device *pdev) · 38 unmodified lines
471486 struct pxa_gpio_chip *c;
472487 struct resource *res;
473488 struct clk *clk;
489+ struct pxa_gpio_platform_data *info;
474490 int gpio, irq, ret;
475491 int irq0 = 0, irq1 = 0, irq_mux, gpio_offset = 0;
476492
@@ -516,7 +532,8 @@ static int __devinit pxa_gpio_probe(struct platform_device *pdev) · 39 unmodified lines
516532 }
517533
518534 /* 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);
520537
521538 /* clear all GPIO edge detects */
522539 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
1313
1414 extern int pxa_irq_to_gpio(int irq);
1515
16+struct pxa_gpio_platform_data {
17+ int (*gpio_set_wake)(unsigned int gpio, unsigned int on);
18+};
19+
1620 #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