aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-langwell.c
diff options
context:
space:
mode:
authorDavid Cohen <david.a.cohen@intel.com>2013-05-06 19:11:03 -0400
committerLinus Walleij <linus.walleij@linaro.org>2013-05-20 14:10:22 -0400
commit2519f9abced15b4327f03d7b8666827517582c29 (patch)
treee960822ef78c74d1e6e4c55451f45e1c427e59a6 /drivers/gpio/gpio-langwell.c
parent0f119a840b128f18b20608f0d33895e85f381105 (diff)
gpio-langwell: fix irq conflicts when DT is not used
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>
Diffstat (limited to 'drivers/gpio/gpio-langwell.c')
-rw-r--r--drivers/gpio/gpio-langwell.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/gpio/gpio-langwell.c b/drivers/gpio/gpio-langwell.c
index 634c3d37f7b5..62ef10a641c4 100644
--- a/drivers/gpio/gpio-langwell.c
+++ b/drivers/gpio/gpio-langwell.c
@@ -324,6 +324,7 @@ static int lnw_gpio_probe(struct pci_dev *pdev,
324 resource_size_t start, len; 324 resource_size_t start, len;
325 struct lnw_gpio *lnw; 325 struct lnw_gpio *lnw;
326 u32 gpio_base; 326 u32 gpio_base;
327 u32 irq_base;
327 int retval; 328 int retval;
328 int ngpio = id->driver_data; 329 int ngpio = id->driver_data;
329 330
@@ -345,6 +346,7 @@ static int lnw_gpio_probe(struct pci_dev *pdev,
345 retval = -EFAULT; 346 retval = -EFAULT;
346 goto err_ioremap; 347 goto err_ioremap;
347 } 348 }
349 irq_base = *(u32 *)base;
348 gpio_base = *((u32 *)base + 1); 350 gpio_base = *((u32 *)base + 1);
349 /* release the IO mapping, since we already get the info from bar1 */ 351 /* release the IO mapping, since we already get the info from bar1 */
350 iounmap(base); 352 iounmap(base);
@@ -365,13 +367,6 @@ static int lnw_gpio_probe(struct pci_dev *pdev,
365 goto err_ioremap; 367 goto err_ioremap;
366 } 368 }
367 369
368 lnw->domain = irq_domain_add_linear(pdev->dev.of_node, ngpio,
369 &lnw_gpio_irq_ops, lnw);
370 if (!lnw->domain) {
371 retval = -ENOMEM;
372 goto err_ioremap;
373 }
374
375 lnw->reg_base = base; 370 lnw->reg_base = base;
376 lnw->chip.label = dev_name(&pdev->dev); 371 lnw->chip.label = dev_name(&pdev->dev);
377 lnw->chip.request = lnw_gpio_request; 372 lnw->chip.request = lnw_gpio_request;
@@ -384,6 +379,14 @@ static int lnw_gpio_probe(struct pci_dev *pdev,
384 lnw->chip.ngpio = ngpio; 379 lnw->chip.ngpio = ngpio;
385 lnw->chip.can_sleep = 0; 380 lnw->chip.can_sleep = 0;
386 lnw->pdev = pdev; 381 lnw->pdev = pdev;
382
383 lnw->domain = irq_domain_add_simple(pdev->dev.of_node, ngpio, irq_base,
384 &lnw_gpio_irq_ops, lnw);
385 if (!lnw->domain) {
386 retval = -ENOMEM;
387 goto err_ioremap;
388 }
389
387 pci_set_drvdata(pdev, lnw); 390 pci_set_drvdata(pdev, lnw);
388 retval = gpiochip_add(&lnw->chip); 391 retval = gpiochip_add(&lnw->chip);
389 if (retval) { 392 if (retval) {