aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRabin Vincent <rabin.vincent@stericsson.com>2010-03-18 03:05:22 -0400
committerLinus Walleij <linus.walleij@linaro.org>2011-03-14 09:05:14 -0400
commite493e06fedd86b484d172f961234f105f295d4d4 (patch)
tree563bfe6ed3cdba6c38408fdb97474305e8695aa1 /arch
parent5d7b8467e18b14ed44c5781d77993bfdcd8c826b (diff)
plat-nomadik: support varying number of GPIOs per block
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com> [Added constant 32-pin assignment in platform data] Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-ux500/devices-common.c1
-rw-r--r--arch/arm/plat-nomadik/gpio.c5
-rw-r--r--arch/arm/plat-nomadik/include/plat/gpio.h1
3 files changed, 4 insertions, 3 deletions
diff --git a/arch/arm/mach-ux500/devices-common.c b/arch/arm/mach-ux500/devices-common.c
index fe69f5fac1bb..13a4ce046ae5 100644
--- a/arch/arm/mach-ux500/devices-common.c
+++ b/arch/arm/mach-ux500/devices-common.c
@@ -139,6 +139,7 @@ void dbx500_add_gpios(resource_size_t *base, int num, int irq,
139 for (i = 0; i < num; i++, first += 32, irq++) { 139 for (i = 0; i < num; i++, first += 32, irq++) {
140 pdata->first_gpio = first; 140 pdata->first_gpio = first;
141 pdata->first_irq = NOMADIK_GPIO_TO_IRQ(first); 141 pdata->first_irq = NOMADIK_GPIO_TO_IRQ(first);
142 pdata->num_gpio = 32;
142 143
143 dbx500_add_gpio(i, base[i], irq, pdata); 144 dbx500_add_gpio(i, base[i], irq, pdata);
144 } 145 }
diff --git a/arch/arm/plat-nomadik/gpio.c b/arch/arm/plat-nomadik/gpio.c
index 1e88ecb846d1..30bb92a746e1 100644
--- a/arch/arm/plat-nomadik/gpio.c
+++ b/arch/arm/plat-nomadik/gpio.c
@@ -35,7 +35,6 @@
35 * Symbols in this file are called "nmk_gpio" for "nomadik gpio" 35 * Symbols in this file are called "nmk_gpio" for "nomadik gpio"
36 */ 36 */
37 37
38#define NMK_GPIO_PER_CHIP 32
39struct nmk_gpio_chip { 38struct nmk_gpio_chip {
40 struct gpio_chip chip; 39 struct gpio_chip chip;
41 void __iomem *addr; 40 void __iomem *addr;
@@ -546,7 +545,7 @@ static int nmk_gpio_init_irq(struct nmk_gpio_chip *nmk_chip)
546 int i; 545 int i;
547 546
548 first_irq = NOMADIK_GPIO_TO_IRQ(nmk_chip->chip.base); 547 first_irq = NOMADIK_GPIO_TO_IRQ(nmk_chip->chip.base);
549 for (i = first_irq; i < first_irq + NMK_GPIO_PER_CHIP; i++) { 548 for (i = first_irq; i < first_irq + nmk_chip->chip.ngpio; i++) {
550 set_irq_chip(i, &nmk_gpio_irq_chip); 549 set_irq_chip(i, &nmk_gpio_irq_chip);
551 set_irq_handler(i, handle_edge_irq); 550 set_irq_handler(i, handle_edge_irq);
552 set_irq_flags(i, IRQF_VALID); 551 set_irq_flags(i, IRQF_VALID);
@@ -612,7 +611,6 @@ static struct gpio_chip nmk_gpio_template = {
612 .direction_output = nmk_gpio_make_output, 611 .direction_output = nmk_gpio_make_output,
613 .set = nmk_gpio_set_output, 612 .set = nmk_gpio_set_output,
614 .to_irq = nmk_gpio_to_irq, 613 .to_irq = nmk_gpio_to_irq,
615 .ngpio = NMK_GPIO_PER_CHIP,
616 .can_sleep = 0, 614 .can_sleep = 0,
617}; 615};
618 616
@@ -672,6 +670,7 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev)
672 670
673 chip = &nmk_chip->chip; 671 chip = &nmk_chip->chip;
674 chip->base = pdata->first_gpio; 672 chip->base = pdata->first_gpio;
673 chip->ngpio = pdata->num_gpio;
675 chip->label = pdata->name ?: dev_name(&dev->dev); 674 chip->label = pdata->name ?: dev_name(&dev->dev);
676 chip->dev = &dev->dev; 675 chip->dev = &dev->dev;
677 chip->owner = THIS_MODULE; 676 chip->owner = THIS_MODULE;
diff --git a/arch/arm/plat-nomadik/include/plat/gpio.h b/arch/arm/plat-nomadik/include/plat/gpio.h
index 67b113d639d8..d745f3ac0a61 100644
--- a/arch/arm/plat-nomadik/include/plat/gpio.h
+++ b/arch/arm/plat-nomadik/include/plat/gpio.h
@@ -82,6 +82,7 @@ struct nmk_gpio_platform_data {
82 char *name; 82 char *name;
83 int first_gpio; 83 int first_gpio;
84 int first_irq; 84 int first_irq;
85 int num_gpio;
85}; 86};
86 87
87#endif /* __ASM_PLAT_GPIO_H */ 88#endif /* __ASM_PLAT_GPIO_H */