Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Keerthy and committed by
Linus Walleij
8e11047b b5cf3fd8

+4 -1
+3 -1
drivers/gpio/gpio-davinci.c
··· 186 186 187 187 static int davinci_gpio_probe(struct platform_device *pdev) 188 188 { 189 - static int ctrl_num; 189 + static int ctrl_num, bank_base; 190 190 int gpio, bank; 191 191 unsigned ngpio, nbank; 192 192 struct davinci_gpio_controller *chips; ··· 240 240 chips->chip.set = davinci_gpio_set; 241 241 242 242 chips->chip.ngpio = ngpio; 243 + chips->chip.base = bank_base; 243 244 244 245 #ifdef CONFIG_OF_GPIO 245 246 chips->chip.of_gpio_n_cells = 2; ··· 249 248 chips->chip.of_node = dev->of_node; 250 249 #endif 251 250 spin_lock_init(&chips->lock); 251 + bank_base += ngpio; 252 252 253 253 for (gpio = 0, bank = 0; gpio < ngpio; gpio += 32, bank++) 254 254 chips->regs[bank] = gpio_base + offset_array[bank];
+1
include/linux/platform_data/gpio-davinci.h
··· 42 42 void __iomem *regs[MAX_REGS_BANKS]; 43 43 int gpio_unbanked; 44 44 unsigned int base_irq; 45 + unsigned int base; 45 46 }; 46 47 47 48 /*