Commit ab4a9362 authored by Linus Walleij's avatar Linus Walleij

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: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 6ca7d2e3
...@@ -3,7 +3,9 @@ ST Ericsson Nomadik pinmux controller ...@@ -3,7 +3,9 @@ ST Ericsson Nomadik pinmux controller
Required properties: Required properties:
- compatible: "stericsson,db8500-pinctrl", "stericsson,db8540-pinctrl", - compatible: "stericsson,db8500-pinctrl", "stericsson,db8540-pinctrl",
"stericsson,stn8815-pinctrl" "stericsson,stn8815-pinctrl"
- reg: Should contain the register physical address and length of the PRCMU. - nomadik-gpio-chips: array of phandles to the corresponding GPIO chips
(these have the register ranges used by the pin controller).
- prcm: phandle to the PRCMU managing the back end of this pin controller
Please refer to pinctrl-bindings.txt in this directory for details of the Please refer to pinctrl-bindings.txt in this directory for details of the
common pinctrl bindings used by client devices, including the meaning of the common pinctrl bindings used by client devices, including the meaning of the
...@@ -74,7 +76,8 @@ Example board file extract: ...@@ -74,7 +76,8 @@ Example board file extract:
pinctrl@80157000 { pinctrl@80157000 {
compatible = "stericsson,db8500-pinctrl"; compatible = "stericsson,db8500-pinctrl";
reg = <0x80157000 0x2000>; nomadik-gpio-chips = <&gpio0>, <&gpio1>, <&gpio2>, <&gpio3>;
prcm = <&prcmu>;
pinctrl-names = "default"; pinctrl-names = "default";
......
...@@ -2019,6 +2019,31 @@ static int nmk_pinctrl_probe(struct platform_device *pdev) ...@@ -2019,6 +2019,31 @@ static int nmk_pinctrl_probe(struct platform_device *pdev)
if (version == PINCTRL_NMK_DB8540) if (version == PINCTRL_NMK_DB8540)
nmk_pinctrl_db8540_init(&npct->soc); 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); prcm_np = of_parse_phandle(np, "prcm", 0);
if (prcm_np) if (prcm_np)
npct->prcm_base = of_iomap(prcm_np, 0); npct->prcm_base = of_iomap(prcm_np, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment