aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-davinci.c
diff options
context:
space:
mode:
authorKeerthy <j-keerthy@ti.com>2017-01-17 11:19:14 -0500
committerLinus Walleij <linus.walleij@linaro.org>2017-01-26 04:00:22 -0500
commit8e11047b8f3cc0dc6df956cf01915077a574168e (patch)
tree1ecb8c417b38c93279b687e78865f29eac7ae170 /drivers/gpio/gpio-davinci.c
parentb5cf3fd827d2e11355c126b44ea625650ebf4d39 (diff)
gpio: davinci: Add support for multiple GPIO controllers
Update GPIO driver to support Multiple GPIO controllers by updating the base of subsequent GPIO chips with total of previous chips gpio count so that gpio_add_chip gets unique numbers. Signed-off-by: Keerthy <j-keerthy@ti.com> Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-davinci.c')
-rw-r--r--drivers/gpio/gpio-davinci.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
index 446df4ece915..2f0b6fdbcddb 100644
--- a/drivers/gpio/gpio-davinci.c
+++ b/drivers/gpio/gpio-davinci.c
@@ -186,7 +186,7 @@ static int davinci_gpio_of_xlate(struct gpio_chip *gc,
186 186
187static int davinci_gpio_probe(struct platform_device *pdev) 187static int davinci_gpio_probe(struct platform_device *pdev)
188{ 188{
189 static int ctrl_num; 189 static int ctrl_num, bank_base;
190 int gpio, bank; 190 int gpio, bank;
191 unsigned ngpio, nbank; 191 unsigned ngpio, nbank;
192 struct davinci_gpio_controller *chips; 192 struct davinci_gpio_controller *chips;
@@ -240,6 +240,7 @@ static int davinci_gpio_probe(struct platform_device *pdev)
240 chips->chip.set = davinci_gpio_set; 240 chips->chip.set = davinci_gpio_set;
241 241
242 chips->chip.ngpio = ngpio; 242 chips->chip.ngpio = ngpio;
243 chips->chip.base = bank_base;
243 244
244#ifdef CONFIG_OF_GPIO 245#ifdef CONFIG_OF_GPIO
245 chips->chip.of_gpio_n_cells = 2; 246 chips->chip.of_gpio_n_cells = 2;
@@ -248,6 +249,7 @@ static int davinci_gpio_probe(struct platform_device *pdev)
248 chips->chip.of_node = dev->of_node; 249 chips->chip.of_node = dev->of_node;
249#endif 250#endif
250 spin_lock_init(&chips->lock); 251 spin_lock_init(&chips->lock);
252 bank_base += ngpio;
251 253
252 for (gpio = 0, bank = 0; gpio < ngpio; gpio += 32, bank++) 254 for (gpio = 0, bank = 0; gpio < ngpio; gpio += 32, bank++)
253 chips->regs[bank] = gpio_base + offset_array[bank]; 255 chips->regs[bank] = gpio_base + offset_array[bank];