Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+30 -2
+5 -2
Documentation/devicetree/bindings/pinctrl/ste,nomadik.txt
··· 3 3 Required properties: 4 4 - compatible: "stericsson,db8500-pinctrl", "stericsson,db8540-pinctrl", 5 5 "stericsson,stn8815-pinctrl" 6 - - reg: Should contain the register physical address and length of the PRCMU. 6 + - nomadik-gpio-chips: array of phandles to the corresponding GPIO chips 7 + (these have the register ranges used by the pin controller). 8 + - prcm: phandle to the PRCMU managing the back end of this pin controller 7 9 8 10 Please refer to pinctrl-bindings.txt in this directory for details of the 9 11 common pinctrl bindings used by client devices, including the meaning of the ··· 76 74 77 75 pinctrl@80157000 { 78 76 compatible = "stericsson,db8500-pinctrl"; 79 - reg = <0x80157000 0x2000>; 77 + nomadik-gpio-chips = <&gpio0>, <&gpio1>, <&gpio2>, <&gpio3>; 78 + prcm = <&prcmu>; 80 79 81 80 pinctrl-names = "default"; 82 81
+25
drivers/pinctrl/nomadik/pinctrl-nomadik.c
··· 2019 2019 if (version == PINCTRL_NMK_DB8540) 2020 2020 nmk_pinctrl_db8540_init(&npct->soc); 2021 2021 2022 + /* 2023 + * Since we depend on the GPIO chips to provide clock and register base 2024 + * for the pin control operations, make sure that we have these 2025 + * populated before we continue. Follow the phandles to instantiate 2026 + * them. The GPIO portion of the actual hardware may be probed before 2027 + * or after this point: it shouldn't matter as the APIs are orthogonal. 2028 + */ 2029 + for (i = 0; i < NMK_MAX_BANKS; i++) { 2030 + struct device_node *gpio_np; 2031 + struct nmk_gpio_chip *nmk_chip; 2032 + 2033 + gpio_np = of_parse_phandle(np, "nomadik-gpio-chips", i); 2034 + if (gpio_np) { 2035 + dev_info(&pdev->dev, 2036 + "populate NMK GPIO %d \"%s\"\n", 2037 + i, gpio_np->name); 2038 + nmk_chip = nmk_gpio_populate_chip(gpio_np, pdev); 2039 + if (IS_ERR(nmk_chip)) 2040 + dev_err(&pdev->dev, 2041 + "could not populate nmk chip struct " 2042 + "- continue anyway\n"); 2043 + of_node_put(gpio_np); 2044 + } 2045 + } 2046 + 2022 2047 prcm_np = of_parse_phandle(np, "prcm", 0); 2023 2048 if (prcm_np) 2024 2049 npct->prcm_base = of_iomap(prcm_np, 0);