Commit e493e06f authored by Rabin Vincent's avatar Rabin Vincent Committed by Linus Walleij

plat-nomadik: support varying number of GPIOs per block

Signed-off-by: default avatarRabin Vincent <rabin.vincent@stericsson.com>
[Added constant 32-pin assignment in platform data]
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 5d7b8467
...@@ -139,6 +139,7 @@ void dbx500_add_gpios(resource_size_t *base, int num, int irq, ...@@ -139,6 +139,7 @@ void dbx500_add_gpios(resource_size_t *base, int num, int irq,
for (i = 0; i < num; i++, first += 32, irq++) { for (i = 0; i < num; i++, first += 32, irq++) {
pdata->first_gpio = first; pdata->first_gpio = first;
pdata->first_irq = NOMADIK_GPIO_TO_IRQ(first); pdata->first_irq = NOMADIK_GPIO_TO_IRQ(first);
pdata->num_gpio = 32;
dbx500_add_gpio(i, base[i], irq, pdata); dbx500_add_gpio(i, base[i], irq, pdata);
} }
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
* Symbols in this file are called "nmk_gpio" for "nomadik gpio" * Symbols in this file are called "nmk_gpio" for "nomadik gpio"
*/ */
#define NMK_GPIO_PER_CHIP 32
struct nmk_gpio_chip { struct nmk_gpio_chip {
struct gpio_chip chip; struct gpio_chip chip;
void __iomem *addr; void __iomem *addr;
...@@ -546,7 +545,7 @@ static int nmk_gpio_init_irq(struct nmk_gpio_chip *nmk_chip) ...@@ -546,7 +545,7 @@ static int nmk_gpio_init_irq(struct nmk_gpio_chip *nmk_chip)
int i; int i;
first_irq = NOMADIK_GPIO_TO_IRQ(nmk_chip->chip.base); first_irq = NOMADIK_GPIO_TO_IRQ(nmk_chip->chip.base);
for (i = first_irq; i < first_irq + NMK_GPIO_PER_CHIP; i++) { for (i = first_irq; i < first_irq + nmk_chip->chip.ngpio; i++) {
set_irq_chip(i, &nmk_gpio_irq_chip); set_irq_chip(i, &nmk_gpio_irq_chip);
set_irq_handler(i, handle_edge_irq); set_irq_handler(i, handle_edge_irq);
set_irq_flags(i, IRQF_VALID); set_irq_flags(i, IRQF_VALID);
...@@ -612,7 +611,6 @@ static struct gpio_chip nmk_gpio_template = { ...@@ -612,7 +611,6 @@ static struct gpio_chip nmk_gpio_template = {
.direction_output = nmk_gpio_make_output, .direction_output = nmk_gpio_make_output,
.set = nmk_gpio_set_output, .set = nmk_gpio_set_output,
.to_irq = nmk_gpio_to_irq, .to_irq = nmk_gpio_to_irq,
.ngpio = NMK_GPIO_PER_CHIP,
.can_sleep = 0, .can_sleep = 0,
}; };
...@@ -672,6 +670,7 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev) ...@@ -672,6 +670,7 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev)
chip = &nmk_chip->chip; chip = &nmk_chip->chip;
chip->base = pdata->first_gpio; chip->base = pdata->first_gpio;
chip->ngpio = pdata->num_gpio;
chip->label = pdata->name ?: dev_name(&dev->dev); chip->label = pdata->name ?: dev_name(&dev->dev);
chip->dev = &dev->dev; chip->dev = &dev->dev;
chip->owner = THIS_MODULE; chip->owner = THIS_MODULE;
......
...@@ -82,6 +82,7 @@ struct nmk_gpio_platform_data { ...@@ -82,6 +82,7 @@ struct nmk_gpio_platform_data {
char *name; char *name;
int first_gpio; int first_gpio;
int first_irq; int first_irq;
int num_gpio;
}; };
#endif /* __ASM_PLAT_GPIO_H */ #endif /* __ASM_PLAT_GPIO_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment