aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91/gpio.c
diff options
context:
space:
mode:
authorNicolas Ferre <nicolas.ferre@atmel.com>2012-02-11 09:28:08 -0500
committerNicolas Ferre <nicolas.ferre@atmel.com>2012-03-01 07:29:01 -0500
commit4340cde57d54db2078d0f1ef070664e21d32711d (patch)
tree10330a90766a7fc6cde3037cc807c38e6e9f1a4c /arch/arm/mach-at91/gpio.c
parente44990790a2528dc825a258bf931c745710f652e (diff)
ARM: at91/gpio: change comments and one variable name
What was true only on at91sam9263 about the sharing of a single AIC IRQ line for several GPIO banks is now used by several Atmel SoCs. Change a variable name to allow better understanding while introducing IRQ domains in following patches. Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Diffstat (limited to 'arch/arm/mach-at91/gpio.c')
-rw-r--r--arch/arm/mach-at91/gpio.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c
index 74d6783eeabb..b762afc4ec17 100644
--- a/arch/arm/mach-at91/gpio.c
+++ b/arch/arm/mach-at91/gpio.c
@@ -29,8 +29,8 @@
29struct at91_gpio_chip { 29struct at91_gpio_chip {
30 struct gpio_chip chip; 30 struct gpio_chip chip;
31 struct at91_gpio_chip *next; /* Bank sharing same clock */ 31 struct at91_gpio_chip *next; /* Bank sharing same clock */
32 int id; /* ID of register bank */ 32 int pioc_hwirq; /* PIO bank interrupt identifier on AIC */
33 void __iomem *regbase; /* Base of register bank */ 33 void __iomem *regbase; /* PIO bank virtual address */
34 struct clk *clock; /* associated clock */ 34 struct clk *clock; /* associated clock */
35}; 35};
36 36
@@ -285,7 +285,7 @@ static int gpio_irq_set_wake(struct irq_data *d, unsigned state)
285 else 285 else
286 wakeups[bank] &= ~mask; 286 wakeups[bank] &= ~mask;
287 287
288 irq_set_irq_wake(gpio_chip[bank].id, state); 288 irq_set_irq_wake(gpio_chip[bank].pioc_hwirq, state);
289 289
290 return 0; 290 return 0;
291} 291}
@@ -499,7 +499,7 @@ void __init at91_gpio_irq_setup(void)
499 for (pioc = 0, this = gpio_chip, prev = NULL; 499 for (pioc = 0, this = gpio_chip, prev = NULL;
500 pioc++ < gpio_banks; 500 pioc++ < gpio_banks;
501 prev = this, this++) { 501 prev = this, this++) {
502 unsigned id = this->id; 502 unsigned pioc_hwirq = this->pioc_hwirq;
503 unsigned i; 503 unsigned i;
504 504
505 __raw_writel(~0, this->regbase + PIO_IDR); 505 __raw_writel(~0, this->regbase + PIO_IDR);
@@ -518,14 +518,14 @@ void __init at91_gpio_irq_setup(void)
518 } 518 }
519 519
520 /* The toplevel handler handles one bank of GPIOs, except 520 /* The toplevel handler handles one bank of GPIOs, except
521 * AT91SAM9263_ID_PIOCDE handles three... PIOC is first in 521 * on some SoC it can handles up to three...
522 * the list, so we only set up that handler. 522 * We only set up the handler for the first of the list.
523 */ 523 */
524 if (prev && prev->next == this) 524 if (prev && prev->next == this)
525 continue; 525 continue;
526 526
527 irq_set_chip_data(id, this); 527 irq_set_chip_data(pioc_hwirq, this);
528 irq_set_chained_handler(id, gpio_irq_handler); 528 irq_set_chained_handler(pioc_hwirq, gpio_irq_handler);
529 } 529 }
530 pr_info("AT91: %d gpio irqs in %d banks\n", irq - gpio_to_irq(0), gpio_banks); 530 pr_info("AT91: %d gpio irqs in %d banks\n", irq - gpio_to_irq(0), gpio_banks);
531} 531}
@@ -615,7 +615,7 @@ void __init at91_gpio_init(struct at91_gpio_bank *data, int nr_banks)
615 for (i = 0; i < nr_banks; i++) { 615 for (i = 0; i < nr_banks; i++) {
616 at91_gpio = &gpio_chip[i]; 616 at91_gpio = &gpio_chip[i];
617 617
618 at91_gpio->id = data[i].id; 618 at91_gpio->pioc_hwirq = data[i].pioc_hwirq;
619 at91_gpio->chip.base = i * 32; 619 at91_gpio->chip.base = i * 32;
620 620
621 at91_gpio->regbase = ioremap(data[i].regbase, 512); 621 at91_gpio->regbase = ioremap(data[i].regbase, 512);
@@ -633,8 +633,11 @@ void __init at91_gpio_init(struct at91_gpio_bank *data, int nr_banks)
633 /* enable PIO controller's clock */ 633 /* enable PIO controller's clock */
634 clk_enable(at91_gpio->clock); 634 clk_enable(at91_gpio->clock);
635 635
636 /* AT91SAM9263_ID_PIOCDE groups PIOC, PIOD, PIOE */ 636 /*
637 if (last && last->id == at91_gpio->id) 637 * GPIO controller are grouped on some SoC:
638 * PIOC, PIOD and PIOE can share the same IRQ line
639 */
640 if (last && last->pioc_hwirq == at91_gpio->pioc_hwirq)
638 last->next = at91_gpio; 641 last->next = at91_gpio;
639 last = at91_gpio; 642 last = at91_gpio;
640 643