diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2015-06-18 00:10:21 +0300 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2015-07-23 10:11:14 +0300 |
commit | ab4a936247561cd998913bab5f15e3d3eaed1f9e (patch) | |
tree | 82e449c8bd183f32c592f3b511ec3a597d95979f /drivers/pinctrl | |
parent | 6ca7d2e352545132923bfdfcd17a4ceee80f5ce9 (diff) | |
download | linux-ab4a936247561cd998913bab5f15e3d3eaed1f9e.tar.xz |
pinctrl: nomadik: assure GPIO chips are populated
If the pin controller probes before the GPIO driver it needs to
populate the GPIO driver state containers ahead of the actual
driver probe as the addresses are used by both halves of the
driver.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r-- | drivers/pinctrl/nomadik/pinctrl-nomadik.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/pinctrl/nomadik/pinctrl-nomadik.c b/drivers/pinctrl/nomadik/pinctrl-nomadik.c index 7b1160def285..143d1c06078c 100644 --- a/drivers/pinctrl/nomadik/pinctrl-nomadik.c +++ b/drivers/pinctrl/nomadik/pinctrl-nomadik.c @@ -2019,6 +2019,31 @@ static int nmk_pinctrl_probe(struct platform_device *pdev) if (version == PINCTRL_NMK_DB8540) nmk_pinctrl_db8540_init(&npct->soc); + /* + * Since we depend on the GPIO chips to provide clock and register base + * for the pin control operations, make sure that we have these + * populated before we continue. Follow the phandles to instantiate + * them. The GPIO portion of the actual hardware may be probed before + * or after this point: it shouldn't matter as the APIs are orthogonal. + */ + for (i = 0; i < NMK_MAX_BANKS; i++) { + struct device_node *gpio_np; + struct nmk_gpio_chip *nmk_chip; + + gpio_np = of_parse_phandle(np, "nomadik-gpio-chips", i); + if (gpio_np) { + dev_info(&pdev->dev, + "populate NMK GPIO %d \"%s\"\n", + i, gpio_np->name); + nmk_chip = nmk_gpio_populate_chip(gpio_np, pdev); + if (IS_ERR(nmk_chip)) + dev_err(&pdev->dev, + "could not populate nmk chip struct " + "- continue anyway\n"); + of_node_put(gpio_np); + } + } + prcm_np = of_parse_phandle(np, "prcm", 0); if (prcm_np) npct->prcm_base = of_iomap(prcm_np, 0); |