Commit 0c3dfa17 authored by Ludovic Desroches's avatar Ludovic Desroches Committed by Linus Walleij

pinctrl: at91: don't use the same irqchip with multiple gpiochips

Sharing the same irqchip with multiple gpiochips is not a good
practice. For instance, when installing hooks, we change the state
of the irqchip. The initial state of the irqchip for the second
gpiochip to register is then disrupted.
Signed-off-by: default avatarLudovic Desroches <ludovic.desroches@microchip.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent b97760ae
...@@ -1574,16 +1574,6 @@ void at91_pinctrl_gpio_resume(void) ...@@ -1574,16 +1574,6 @@ void at91_pinctrl_gpio_resume(void)
#define gpio_irq_set_wake NULL #define gpio_irq_set_wake NULL
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
static struct irq_chip gpio_irqchip = {
.name = "GPIO",
.irq_ack = gpio_irq_ack,
.irq_disable = gpio_irq_mask,
.irq_mask = gpio_irq_mask,
.irq_unmask = gpio_irq_unmask,
/* .irq_set_type is set dynamically */
.irq_set_wake = gpio_irq_set_wake,
};
static void gpio_irq_handler(struct irq_desc *desc) static void gpio_irq_handler(struct irq_desc *desc)
{ {
struct irq_chip *chip = irq_desc_get_chip(desc); struct irq_chip *chip = irq_desc_get_chip(desc);
...@@ -1624,12 +1614,22 @@ static int at91_gpio_of_irq_setup(struct platform_device *pdev, ...@@ -1624,12 +1614,22 @@ static int at91_gpio_of_irq_setup(struct platform_device *pdev,
struct gpio_chip *gpiochip_prev = NULL; struct gpio_chip *gpiochip_prev = NULL;
struct at91_gpio_chip *prev = NULL; struct at91_gpio_chip *prev = NULL;
struct irq_data *d = irq_get_irq_data(at91_gpio->pioc_virq); struct irq_data *d = irq_get_irq_data(at91_gpio->pioc_virq);
struct irq_chip *gpio_irqchip;
int ret, i; int ret, i;
gpio_irqchip = devm_kzalloc(&pdev->dev, sizeof(*gpio_irqchip), GFP_KERNEL);
if (!gpio_irqchip)
return -ENOMEM;
at91_gpio->pioc_hwirq = irqd_to_hwirq(d); at91_gpio->pioc_hwirq = irqd_to_hwirq(d);
/* Setup proper .irq_set_type function */ gpio_irqchip->name = "GPIO";
gpio_irqchip.irq_set_type = at91_gpio->ops->irq_type; gpio_irqchip->irq_ack = gpio_irq_ack;
gpio_irqchip->irq_disable = gpio_irq_mask;
gpio_irqchip->irq_mask = gpio_irq_mask;
gpio_irqchip->irq_unmask = gpio_irq_unmask;
gpio_irqchip->irq_set_wake = gpio_irq_set_wake,
gpio_irqchip->irq_set_type = at91_gpio->ops->irq_type;
/* Disable irqs of this PIO controller */ /* Disable irqs of this PIO controller */
writel_relaxed(~0, at91_gpio->regbase + PIO_IDR); writel_relaxed(~0, at91_gpio->regbase + PIO_IDR);
...@@ -1640,7 +1640,7 @@ static int at91_gpio_of_irq_setup(struct platform_device *pdev, ...@@ -1640,7 +1640,7 @@ static int at91_gpio_of_irq_setup(struct platform_device *pdev,
* interrupt. * interrupt.
*/ */
ret = gpiochip_irqchip_add(&at91_gpio->chip, ret = gpiochip_irqchip_add(&at91_gpio->chip,
&gpio_irqchip, gpio_irqchip,
0, 0,
handle_edge_irq, handle_edge_irq,
IRQ_TYPE_NONE); IRQ_TYPE_NONE);
...@@ -1658,7 +1658,7 @@ static int at91_gpio_of_irq_setup(struct platform_device *pdev, ...@@ -1658,7 +1658,7 @@ static int at91_gpio_of_irq_setup(struct platform_device *pdev,
if (!gpiochip_prev) { if (!gpiochip_prev) {
/* Then register the chain on the parent IRQ */ /* Then register the chain on the parent IRQ */
gpiochip_set_chained_irqchip(&at91_gpio->chip, gpiochip_set_chained_irqchip(&at91_gpio->chip,
&gpio_irqchip, gpio_irqchip,
at91_gpio->pioc_virq, at91_gpio->pioc_virq,
gpio_irq_handler); gpio_irq_handler);
return 0; return 0;
......
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