* [PATCH 0/2] gpio: pl061: hook request if gpio-ranges avaiable @ 2014-12-02 4:32 Yunlei He 2014-12-02 4:32 ` [PATCH 1/2] " Yunlei He 2014-12-02 4:33 ` [PATCH 2/2] gpio: pl061: document gpio-ranges property for bindings file Yunlei He 0 siblings, 2 replies; 6+ messages in thread From: Yunlei He @ 2014-12-02 4:32 UTC (permalink / raw) To: haojian.zhuang, linus.walleij, linux-gpio Cc: bintian.wang, peifeiyue, liguozhu, Yunlei He Hi, This series includes two patches for sloving pinctrl_request_gpio() returns EPROBE_DEFER problem. We find this problem when we use gpio device without "gpio-ranges" property in gpio device node. - First patch provides solutions to this problem - Second patch documents gpio-ranges property for bindings file. Yunlei He (2): gpio: pl061: hook request if gpio-ranges avaiable gpio: pl061: document gpio-ranges property for bindings file .../devicetree/bindings/gpio/pl061-gpio.txt | 2 +- drivers/gpio/gpio-pl061.c | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) -- 1.9.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] gpio: pl061: hook request if gpio-ranges avaiable 2014-12-02 4:32 [PATCH 0/2] gpio: pl061: hook request if gpio-ranges avaiable Yunlei He @ 2014-12-02 4:32 ` Yunlei He 2014-12-03 13:45 ` Linus Walleij 2014-12-02 4:33 ` [PATCH 2/2] gpio: pl061: document gpio-ranges property for bindings file Yunlei He 1 sibling, 1 reply; 6+ messages in thread From: Yunlei He @ 2014-12-02 4:32 UTC (permalink / raw) To: haojian.zhuang, linus.walleij, linux-gpio Cc: bintian.wang, peifeiyue, liguozhu, Yunlei He, Xinwei Kong Gpio-ranges property is useful to represent which GPIOs correspond to which pins on which pin controllers. But there may be some gpios without pinctrl operation. So check whether gpio-ranges property exists in device node first. Signed-off-by: Yunlei He <heyunlei@huawei.com> Signed-off-by: Xinwei Kong <kong.kongxinwei@hisilicon.com> Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org> --- drivers/gpio/gpio-pl061.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c index 84b49cf..15d1885 100644 --- a/drivers/gpio/gpio-pl061.c +++ b/drivers/gpio/gpio-pl061.c @@ -52,28 +52,34 @@ struct pl061_gpio { void __iomem *base; struct gpio_chip gc; + bool uses_pinctrl; #ifdef CONFIG_PM struct pl061_context_save_regs csave_regs; #endif }; -static int pl061_gpio_request(struct gpio_chip *chip, unsigned offset) +static int pl061_gpio_request(struct gpio_chip *gc, unsigned offset) { /* * Map back to global GPIO space and request muxing, the direction * parameter does not matter for this controller. */ - int gpio = chip->base + offset; + struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc); + int gpio = gc->base + offset; - return pinctrl_request_gpio(gpio); + if (chip->uses_pinctrl) + return pinctrl_request_gpio(gpio); + return 0; } -static void pl061_gpio_free(struct gpio_chip *chip, unsigned offset) +static void pl061_gpio_free(struct gpio_chip *gc, unsigned offset) { - int gpio = chip->base + offset; + struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc); + int gpio = gc->base + offset; - pinctrl_free_gpio(gpio); + if (chip->uses_pinctrl) + pinctrl_free_gpio(gpio); } static int pl061_direction_input(struct gpio_chip *gc, unsigned offset) @@ -263,6 +269,8 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) return PTR_ERR(chip->base); spin_lock_init(&chip->lock); + if (of_property_read_bool(dev->of_node, "gpio-ranges")) + chip->uses_pinctrl = true; chip->gc.request = pl061_gpio_request; chip->gc.free = pl061_gpio_free; -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] gpio: pl061: hook request if gpio-ranges avaiable 2014-12-02 4:32 ` [PATCH 1/2] " Yunlei He @ 2014-12-03 13:45 ` Linus Walleij 2014-12-04 13:33 ` He YunLei 0 siblings, 1 reply; 6+ messages in thread From: Linus Walleij @ 2014-12-03 13:45 UTC (permalink / raw) To: Yunlei He Cc: Haojian Zhuang, linux-gpio@vger.kernel.org, Wangbintian, peifeiyue, liguozhu, Xinwei Kong On Tue, Dec 2, 2014 at 5:32 AM, Yunlei He <heyunlei@huawei.com> wrote: > Gpio-ranges property is useful to represent which GPIOs correspond > to which pins on which pin controllers. But there may be some gpios > without pinctrl operation. So check whether gpio-ranges property > exists in device node first. > > Signed-off-by: Yunlei He <heyunlei@huawei.com> > Signed-off-by: Xinwei Kong <kong.kongxinwei@hisilicon.com> > Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org> Yep simple and elegant. Patch applied. However I wonder if it would be possible to move this to the gpiolib.c or gpiolib-of.c core so not all drivers with this problem has to implement it. Yours, Linus Walleij ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] gpio: pl061: hook request if gpio-ranges avaiable 2014-12-03 13:45 ` Linus Walleij @ 2014-12-04 13:33 ` He YunLei 0 siblings, 0 replies; 6+ messages in thread From: He YunLei @ 2014-12-04 13:33 UTC (permalink / raw) To: Linus Walleij, Haojian Zhuang Cc: linux-gpio@vger.kernel.org, Wangbintian, peifeiyue, liguozhu, Xinwei Kong On 2014/12/3 21:45, Linus Walleij wrote: > On Tue, Dec 2, 2014 at 5:32 AM, Yunlei He <heyunlei@huawei.com> wrote: > >> Gpio-ranges property is useful to represent which GPIOs correspond >> to which pins on which pin controllers. But there may be some gpios >> without pinctrl operation. So check whether gpio-ranges property >> exists in device node first. >> >> Signed-off-by: Yunlei He <heyunlei@huawei.com> >> Signed-off-by: Xinwei Kong <kong.kongxinwei@hisilicon.com> >> Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org> > > Yep simple and elegant. > > Patch applied. > > However I wonder if it would be possible to move this to the > gpiolib.c or gpiolib-of.c core so not all drivers with this problem > has to implement it. > > Yours, > Linus Walleij > > Thanks for your suggest, I can move this judgement to the gpiolib.c in function gpio_request() along with a symbol uses_pinctrl in struct gpio_chip. But the symbol uses_pinctrl still need to assign a value in device initial time. So I think that drivers do this separately is better. Yours, Yunlei ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] gpio: pl061: document gpio-ranges property for bindings file 2014-12-02 4:32 [PATCH 0/2] gpio: pl061: hook request if gpio-ranges avaiable Yunlei He 2014-12-02 4:32 ` [PATCH 1/2] " Yunlei He @ 2014-12-02 4:33 ` Yunlei He 2014-12-03 13:48 ` Linus Walleij 1 sibling, 1 reply; 6+ messages in thread From: Yunlei He @ 2014-12-02 4:33 UTC (permalink / raw) To: haojian.zhuang, linus.walleij, linux-gpio Cc: bintian.wang, peifeiyue, liguozhu, Yunlei He, Xinwei Kong Document gpio-ranges property in pl061-gpio.txt Signed-off-by: Yunlei He <heyunlei@huawei.com> Signed-off-by: Xinwei Kong <kong.kongxinwei@hisilicon.com> Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org> --- Documentation/devicetree/bindings/gpio/pl061-gpio.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/gpio/pl061-gpio.txt b/Documentation/devicetree/bindings/gpio/pl061-gpio.txt index a2c416b..89058d3 100644 --- a/Documentation/devicetree/bindings/gpio/pl061-gpio.txt +++ b/Documentation/devicetree/bindings/gpio/pl061-gpio.txt @@ -7,4 +7,4 @@ Required properties: - bit 0 specifies polarity (0 for normal, 1 for inverted) - gpio-controller : Marks the device node as a GPIO controller. - interrupts : Interrupt mapping for GPIO IRQ. - +- gpio-ranges : Interaction with the PINCTRL subsystem. -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] gpio: pl061: document gpio-ranges property for bindings file 2014-12-02 4:33 ` [PATCH 2/2] gpio: pl061: document gpio-ranges property for bindings file Yunlei He @ 2014-12-03 13:48 ` Linus Walleij 0 siblings, 0 replies; 6+ messages in thread From: Linus Walleij @ 2014-12-03 13:48 UTC (permalink / raw) To: Yunlei He Cc: Haojian Zhuang, linux-gpio@vger.kernel.org, Wangbintian, peifeiyue, liguozhu, Xinwei Kong On Tue, Dec 2, 2014 at 5:33 AM, Yunlei He <heyunlei@huawei.com> wrote: > Document gpio-ranges property in pl061-gpio.txt > > Signed-off-by: Yunlei He <heyunlei@huawei.com> > Signed-off-by: Xinwei Kong <kong.kongxinwei@hisilicon.com> > Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org> Patch applied. Yours, Linus Walleij ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-12-04 13:34 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-12-02 4:32 [PATCH 0/2] gpio: pl061: hook request if gpio-ranges avaiable Yunlei He 2014-12-02 4:32 ` [PATCH 1/2] " Yunlei He 2014-12-03 13:45 ` Linus Walleij 2014-12-04 13:33 ` He YunLei 2014-12-02 4:33 ` [PATCH 2/2] gpio: pl061: document gpio-ranges property for bindings file Yunlei He 2014-12-03 13:48 ` Linus Walleij
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.