aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/pinctrl-coh901.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2013-04-10 10:49:31 +0200
committerLinus Walleij <linus.walleij@linaro.org>2013-05-31 11:25:45 +0200
commit351c2163f918e2a4218e0206f854dbec7799fda8 (patch)
tree5074a0500816af030dd2d22f3c37338a9296d3cf /drivers/pinctrl/pinctrl-coh901.c
parentpinctrl: u300 device tree support (diff)
downloadlinux-dev-351c2163f918e2a4218e0206f854dbec7799fda8.tar.xz
linux-dev-351c2163f918e2a4218e0206f854dbec7799fda8.zip
pinctrl: coh901: add device tree support
This makes it possible to probe the COH901 pinctrl driver from the device tree, and assigned the device tree node in the gpio_chip so we can look up cross-references from the device tree. Start grabbing the per-port (bank) IRQs by index instead of by name so we don't have to look up the IRQs by name going forward. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinctrl-coh901.c')
-rw-r--r--drivers/pinctrl/pinctrl-coh901.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/pinctrl/pinctrl-coh901.c b/drivers/pinctrl/pinctrl-coh901.c
index edde3acc4186..d4f8afdad1ad 100644
--- a/drivers/pinctrl/pinctrl-coh901.c
+++ b/drivers/pinctrl/pinctrl-coh901.c
@@ -773,8 +773,7 @@ static int __init u300_gpio_probe(struct platform_device *pdev)
port->number = portno;
port->gpio = gpio;
- port->irq = platform_get_irq_byname(pdev,
- port->name);
+ port->irq = platform_get_irq(pdev, portno);
dev_dbg(gpio->dev, "register IRQ %d for port %s\n", port->irq,
port->name);
@@ -811,6 +810,9 @@ static int __init u300_gpio_probe(struct platform_device *pdev)
}
dev_dbg(gpio->dev, "initialized %d GPIO ports\n", portno);
+#ifdef CONFIG_OF_GPIO
+ gpio->chip.of_node = pdev->dev.of_node;
+#endif
err = gpiochip_add(&gpio->chip);
if (err) {
dev_err(gpio->dev, "unable to add gpiochip: %d\n", err);
@@ -864,9 +866,15 @@ static int __exit u300_gpio_remove(struct platform_device *pdev)
return 0;
}
+static const struct of_device_id u300_gpio_match[] = {
+ { .compatible = "stericsson,gpio-coh901" },
+ {},
+};
+
static struct platform_driver u300_gpio_driver = {
.driver = {
.name = "u300-gpio",
+ .of_match_table = u300_gpio_match,
},
.remove = __exit_p(u300_gpio_remove),
};