Commit ef039827 authored by Linus Walleij's avatar Linus Walleij

pinctrl: coh901: Pass irqchip when adding gpiochip

We need to convert all old gpio irqchips to pass the irqchip
setup along when adding the gpio_chip. For more info see
drivers/gpio/TODO.

For chained irqchips this is a pretty straight-forward
conversion.

Cc: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20190913113530.5536-1-linus.walleij@linaro.org
parent 54ecb8f7
...@@ -616,6 +616,7 @@ static int __init u300_gpio_probe(struct platform_device *pdev) ...@@ -616,6 +616,7 @@ static int __init u300_gpio_probe(struct platform_device *pdev)
{ {
struct u300_gpio *gpio; struct u300_gpio *gpio;
struct resource *memres; struct resource *memres;
struct gpio_irq_chip *girq;
int err = 0; int err = 0;
int portno; int portno;
u32 val; u32 val;
...@@ -672,26 +673,17 @@ static int __init u300_gpio_probe(struct platform_device *pdev) ...@@ -672,26 +673,17 @@ static int __init u300_gpio_probe(struct platform_device *pdev)
gpio->base + U300_GPIO_CR); gpio->base + U300_GPIO_CR);
u300_gpio_init_coh901571(gpio); u300_gpio_init_coh901571(gpio);
#ifdef CONFIG_OF_GPIO girq = &gpio->chip.irq;
gpio->chip.of_node = pdev->dev.of_node; girq->chip = &u300_gpio_irqchip;
#endif girq->parent_handler = u300_gpio_irq_handler;
err = gpiochip_add_data(&gpio->chip, gpio); girq->num_parents = U300_GPIO_NUM_PORTS;
if (err) { girq->parents = devm_kcalloc(gpio->dev, U300_GPIO_NUM_PORTS,
dev_err(gpio->dev, "unable to add gpiochip: %d\n", err); sizeof(*girq->parents),
goto err_no_chip; GFP_KERNEL);
} if (!girq->parents) {
err = -ENOMEM;
err = gpiochip_irqchip_add(&gpio->chip, goto err_dis_clk;
&u300_gpio_irqchip,
0,
handle_simple_irq,
IRQ_TYPE_EDGE_FALLING);
if (err) {
dev_err(gpio->dev, "no GPIO irqchip\n");
goto err_no_irqchip;
} }
/* Add each port with its IRQ separately */
for (portno = 0 ; portno < U300_GPIO_NUM_PORTS; portno++) { for (portno = 0 ; portno < U300_GPIO_NUM_PORTS; portno++) {
struct u300_gpio_port *port = &gpio->ports[portno]; struct u300_gpio_port *port = &gpio->ports[portno];
...@@ -700,16 +692,21 @@ static int __init u300_gpio_probe(struct platform_device *pdev) ...@@ -700,16 +692,21 @@ static int __init u300_gpio_probe(struct platform_device *pdev)
port->gpio = gpio; port->gpio = gpio;
port->irq = platform_get_irq(pdev, portno); port->irq = platform_get_irq(pdev, portno);
girq->parents[portno] = port->irq;
gpiochip_set_chained_irqchip(&gpio->chip,
&u300_gpio_irqchip,
port->irq,
u300_gpio_irq_handler);
/* Turns off irq force (test register) for this port */ /* Turns off irq force (test register) for this port */
writel(0x0, gpio->base + portno * gpio->stride + ifr); writel(0x0, gpio->base + portno * gpio->stride + ifr);
} }
dev_dbg(gpio->dev, "initialized %d GPIO ports\n", portno); girq->default_type = IRQ_TYPE_EDGE_FALLING;
girq->handler = handle_simple_irq;
#ifdef CONFIG_OF_GPIO
gpio->chip.of_node = pdev->dev.of_node;
#endif
err = gpiochip_add_data(&gpio->chip, gpio);
if (err) {
dev_err(gpio->dev, "unable to add gpiochip: %d\n", err);
goto err_dis_clk;
}
/* /*
* Add pinctrl pin ranges, the pin controller must be registered * Add pinctrl pin ranges, the pin controller must be registered
...@@ -729,9 +726,8 @@ static int __init u300_gpio_probe(struct platform_device *pdev) ...@@ -729,9 +726,8 @@ static int __init u300_gpio_probe(struct platform_device *pdev)
return 0; return 0;
err_no_range: err_no_range:
err_no_irqchip:
gpiochip_remove(&gpio->chip); gpiochip_remove(&gpio->chip);
err_no_chip: err_dis_clk:
clk_disable_unprepare(gpio->clk); clk_disable_unprepare(gpio->clk);
dev_err(&pdev->dev, "module ERROR:%d\n", err); dev_err(&pdev->dev, "module ERROR:%d\n", err);
return err; return err;
......
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