Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e11047b authored by Keerthy's avatar Keerthy Committed by Linus Walleij
Browse files

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: default avatarKeerthy <j-keerthy@ti.com>
Reviewed-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent b5cf3fd8
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -186,7 +186,7 @@ static int davinci_gpio_of_xlate(struct gpio_chip *gc,


static int davinci_gpio_probe(struct platform_device *pdev)
static int davinci_gpio_probe(struct platform_device *pdev)
{
{
	static int ctrl_num;
	static int ctrl_num, bank_base;
	int gpio, bank;
	int gpio, bank;
	unsigned ngpio, nbank;
	unsigned ngpio, nbank;
	struct davinci_gpio_controller *chips;
	struct davinci_gpio_controller *chips;
@@ -240,6 +240,7 @@ static int davinci_gpio_probe(struct platform_device *pdev)
	chips->chip.set = davinci_gpio_set;
	chips->chip.set = davinci_gpio_set;


	chips->chip.ngpio = ngpio;
	chips->chip.ngpio = ngpio;
	chips->chip.base = bank_base;


#ifdef CONFIG_OF_GPIO
#ifdef CONFIG_OF_GPIO
	chips->chip.of_gpio_n_cells = 2;
	chips->chip.of_gpio_n_cells = 2;
@@ -248,6 +249,7 @@ static int davinci_gpio_probe(struct platform_device *pdev)
	chips->chip.of_node = dev->of_node;
	chips->chip.of_node = dev->of_node;
#endif
#endif
	spin_lock_init(&chips->lock);
	spin_lock_init(&chips->lock);
	bank_base += ngpio;


	for (gpio = 0, bank = 0; gpio < ngpio; gpio += 32, bank++)
	for (gpio = 0, bank = 0; gpio < ngpio; gpio += 32, bank++)
		chips->regs[bank] = gpio_base + offset_array[bank];
		chips->regs[bank] = gpio_base + offset_array[bank];
+1 −0
Original line number Original line Diff line number Diff line
@@ -42,6 +42,7 @@ struct davinci_gpio_controller {
	void __iomem		*regs[MAX_REGS_BANKS];
	void __iomem		*regs[MAX_REGS_BANKS];
	int			gpio_unbanked;
	int			gpio_unbanked;
	unsigned int		base_irq;
	unsigned int		base_irq;
	unsigned int		base;
};
};


/*
/*