Message ID | 20181101001149.13453-6-masneyb@onstation.org (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
Series | ARM: qcom: msm8974-hammerhead: add USB OTG support | expand |
On Thu, Nov 1, 2018 at 1:12 AM Brian Masney <masneyb@onstation.org> wrote: > When attempting to setup up a gpio hog, device probing would repeatedly > fail with -EPROBE_DEFERED errors. It was caused by a circular dependency > between the gpio and pinctrl frameworks. If the gpio-ranges property is > present in device tree, then the gpio framework will handle the gpio pin > registration and eliminate the circular dependency. > > See Christian Lamparter's commit a86caa9ba5d7 ("pinctrl: msm: fix > gpio-hog related boot issues") for a detailed commit message that > explains the issue in much more detail. The code comment in this commit > came from Christian's commit. > > Signed-off-by: Brian Masney <masneyb@onstation.org> No word from Bjorn but I trust my own intuition and applied it. Björn: shout if it's wrong. Question: should this also be done for pinctrl-ssbi-gpio.c? Yours, Linus Walleij
On Fri, Nov 09, 2018 at 09:59:08AM +0100, Linus Walleij wrote: > On Thu, Nov 1, 2018 at 1:12 AM Brian Masney <masneyb@onstation.org> wrote: > > > When attempting to setup up a gpio hog, device probing would repeatedly > > fail with -EPROBE_DEFERED errors. It was caused by a circular dependency > > between the gpio and pinctrl frameworks. If the gpio-ranges property is > > present in device tree, then the gpio framework will handle the gpio pin > > registration and eliminate the circular dependency. > > > > See Christian Lamparter's commit a86caa9ba5d7 ("pinctrl: msm: fix > > gpio-hog related boot issues") for a detailed commit message that > > explains the issue in much more detail. The code comment in this commit > > came from Christian's commit. > > > > Signed-off-by: Brian Masney <masneyb@onstation.org> > > No word from Bjorn but I trust my own intuition and applied it. > > Björn: shout if it's wrong. > > Question: should this also be done for pinctrl-ssbi-gpio.c? Yes, I believe so. Brian
diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c index a29efbe08f48..4c1ff9a1d156 100644 --- a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c +++ b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c @@ -1028,10 +1028,23 @@ static int pmic_gpio_probe(struct platform_device *pdev) return ret; } - ret = gpiochip_add_pin_range(&state->chip, dev_name(dev), 0, 0, npins); - if (ret) { - dev_err(dev, "failed to add pin range\n"); - goto err_range; + /* + * For DeviceTree-supported systems, the gpio core checks the + * pinctrl's device node for the "gpio-ranges" property. + * If it is present, it takes care of adding the pin ranges + * for the driver. In this case the driver can skip ahead. + * + * In order to remain compatible with older, existing DeviceTree + * files which don't set the "gpio-ranges" property or systems that + * utilize ACPI the driver has to call gpiochip_add_pin_range(). + */ + if (!of_property_read_bool(dev->of_node, "gpio-ranges")) { + ret = gpiochip_add_pin_range(&state->chip, dev_name(dev), 0, 0, + npins); + if (ret) { + dev_err(dev, "failed to add pin range\n"); + goto err_range; + } } return 0;
When attempting to setup up a gpio hog, device probing would repeatedly fail with -EPROBE_DEFERED errors. It was caused by a circular dependency between the gpio and pinctrl frameworks. If the gpio-ranges property is present in device tree, then the gpio framework will handle the gpio pin registration and eliminate the circular dependency. See Christian Lamparter's commit a86caa9ba5d7 ("pinctrl: msm: fix gpio-hog related boot issues") for a detailed commit message that explains the issue in much more detail. The code comment in this commit came from Christian's commit. Signed-off-by: Brian Masney <masneyb@onstation.org> --- drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)