Skip to content

Commit

Permalink
gpio-langwell: fix irq conflicts when DT is not used
Browse files Browse the repository at this point in the history
When DT is not used IOAPIC does not register irq domain. As result
IOAPIC won't care about gpio-langwell's virq and may cause conflict if
an irq number is equal to gpio-langwell's virq mapped beforehand.

This patch tells gpio_langwell to not ignore irq_base if != 0 and
preferably use it to avoid the conflict.

If DT is used, irq_base can safely be 0.

Signed-off-by: David Cohen <david.a.cohen@intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
David Cohen authored and Linus Walleij committed May 20, 2013
1 parent 0f119a8 commit 2519f9a
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions drivers/gpio/gpio-langwell.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ static int lnw_gpio_probe(struct pci_dev *pdev,
resource_size_t start, len;
struct lnw_gpio *lnw;
u32 gpio_base;
u32 irq_base;
int retval;
int ngpio = id->driver_data;

Expand All @@ -345,6 +346,7 @@ static int lnw_gpio_probe(struct pci_dev *pdev,
retval = -EFAULT;
goto err_ioremap;
}
irq_base = *(u32 *)base;
gpio_base = *((u32 *)base + 1);
/* release the IO mapping, since we already get the info from bar1 */
iounmap(base);
Expand All @@ -365,13 +367,6 @@ static int lnw_gpio_probe(struct pci_dev *pdev,
goto err_ioremap;
}

lnw->domain = irq_domain_add_linear(pdev->dev.of_node, ngpio,
&lnw_gpio_irq_ops, lnw);
if (!lnw->domain) {
retval = -ENOMEM;
goto err_ioremap;
}

lnw->reg_base = base;
lnw->chip.label = dev_name(&pdev->dev);
lnw->chip.request = lnw_gpio_request;
Expand All @@ -384,6 +379,14 @@ static int lnw_gpio_probe(struct pci_dev *pdev,
lnw->chip.ngpio = ngpio;
lnw->chip.can_sleep = 0;
lnw->pdev = pdev;

lnw->domain = irq_domain_add_simple(pdev->dev.of_node, ngpio, irq_base,
&lnw_gpio_irq_ops, lnw);
if (!lnw->domain) {
retval = -ENOMEM;
goto err_ioremap;
}

pci_set_drvdata(pdev, lnw);
retval = gpiochip_add(&lnw->chip);
if (retval) {
Expand Down

0 comments on commit 2519f9a

Please sign in to comment.