pinctrl/nomadik: use simple or linear IRQ domain
authorLinus Walleij <linus.walleij@linaro.org>
Wed, 26 Sep 2012 17:03:51 +0000 (19:03 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 10 Oct 2012 06:57:26 +0000 (08:57 +0200)
This alters the Nomadik pinctrl driver to:

- Call irqdomain_add_linear() for the DT case so we get
  all independent from IRQ numbers in this case.
- Call irqdomain_add_simple() for the legacy case, which
  allocates the IRQ descriptors for the Nomadik pin controller
  dynamically.

Cc: Lee Jones <lee.jones@linaro.org>
Cc: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/pinctrl-nomadik.c

index 67a5ef637ea7f4f93649978e84d8eb4cf7e2b6bf..fec9c30133d43b2731a9fe8d765ba05106d5eda1 100644 (file)
@@ -1371,9 +1371,19 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev)
 
        platform_set_drvdata(dev, nmk_chip);
 
-       nmk_chip->domain = irq_domain_add_legacy(np, NMK_GPIO_PER_CHIP,
-                                               NOMADIK_GPIO_TO_IRQ(pdata->first_gpio),
-                                               0, &nmk_gpio_irq_simple_ops, nmk_chip);
+       if (np) {
+               /* The DT case will just grab a set of IRQ numbers */
+               nmk_chip->domain = irq_domain_add_linear(np, NMK_GPIO_PER_CHIP,
+                               &nmk_gpio_irq_simple_ops, nmk_chip);
+       } else {
+               /* Non-DT legacy mode, use hardwired IRQ numbers */
+               int irq_start;
+
+               irq_start = NOMADIK_GPIO_TO_IRQ(pdata->first_gpio);
+               nmk_chip->domain = irq_domain_add_simple(NULL,
+                               NMK_GPIO_PER_CHIP, irq_start,
+                               &nmk_gpio_irq_simple_ops, nmk_chip);
+       }
        if (!nmk_chip->domain) {
                dev_err(&dev->dev, "failed to create irqdomain\n");
                ret = -ENOSYS;