From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Christian Lamparter <chunkeey@gmail.com>,
Linus Walleij <linus.walleij@linaro.org>
Cc: linux-gpio@vger.kernel.org, linux-arm-msm@vger.kernel.org,
David Brown <david.brown@linaro.org>,
Sven Eckelmann <sven.eckelmann@openmesh.com>,
Andy Gross <andy.gross@linaro.org>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2] pinctrl: msm: fix gpio-hog related boot issues
Date: Mon, 2 Apr 2018 08:04:47 -0700 [thread overview]
Message-ID: <20180402150447.GH510@tuxbook-pro> (raw)
In-Reply-To: <20180402121005.10080-1-chunkeey@gmail.com>
On Mon 02 Apr 05:10 PDT 2018, Christian Lamparter wrote:
[..]
> diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi
> index 0a6f7952bbb1..18511e782cbd 100644
> --- a/arch/arm64/boot/dts/qcom/msm8996.dtsi
> +++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi
> @@ -530,6 +530,7 @@
> reg = <0x01010000 0x300000>;
> interrupts = <GIC_SPI 208 IRQ_TYPE_LEVEL_HIGH>;
> gpio-controller;
> + gpio-ranges = <&msmgpio 0 0 150>;
> #gpio-cells = <2>;
> interrupt-controller;
> #interrupt-cells = <2>;
> diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c
> index 495432f3341b..258fa357d946 100644
> --- a/drivers/pinctrl/qcom/pinctrl-msm.c
> +++ b/drivers/pinctrl/qcom/pinctrl-msm.c
> @@ -831,11 +831,22 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl)
> return ret;
> }
>
> - ret = gpiochip_add_pin_range(&pctrl->chip, dev_name(pctrl->dev), 0, 0, chip->ngpio);
> - if (ret) {
> - dev_err(pctrl->dev, "Failed to add pin range\n");
> - gpiochip_remove(&pctrl->chip);
> - return ret;
> + if (!is_of_node(pctrl->dev->fwnode)) {
Afaict this still means that if I boot this kernel with yesterday's dtb
(without gpio-ranges) I will not get any gpios. This isn't okay.
@Linus, I count 24 callers of gpiochip_add_pin_range(). Is this
suggestion reasonable?
Can we make gpiochip_add_pin_range() check if there's already a
gpio-range and return ok in some way?
> + /*
> + * gpiochip_add_pin_range() is meant for platforms that
> + * don't support DT. All DT platforms should just add
> + * the gpio-ranges property to the pinctrl device node.
> + *
> + * See Documentation/devicetree/bindings/gpio/gpio.txt .
> + */
> + ret = gpiochip_add_pin_range(&pctrl->chip,
> + dev_name(pctrl->dev), 0, 0, chip->ngpio);
> +
> + if (ret) {
> + dev_err(pctrl->dev, "Failed to add pin range\n");
> + gpiochip_remove(&pctrl->chip);
> + return ret;
> + }
Regards,
Bjorn
WARNING: multiple messages have this Message-ID (diff)
From: bjorn.andersson@linaro.org (Bjorn Andersson)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] pinctrl: msm: fix gpio-hog related boot issues
Date: Mon, 2 Apr 2018 08:04:47 -0700 [thread overview]
Message-ID: <20180402150447.GH510@tuxbook-pro> (raw)
In-Reply-To: <20180402121005.10080-1-chunkeey@gmail.com>
On Mon 02 Apr 05:10 PDT 2018, Christian Lamparter wrote:
[..]
> diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi
> index 0a6f7952bbb1..18511e782cbd 100644
> --- a/arch/arm64/boot/dts/qcom/msm8996.dtsi
> +++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi
> @@ -530,6 +530,7 @@
> reg = <0x01010000 0x300000>;
> interrupts = <GIC_SPI 208 IRQ_TYPE_LEVEL_HIGH>;
> gpio-controller;
> + gpio-ranges = <&msmgpio 0 0 150>;
> #gpio-cells = <2>;
> interrupt-controller;
> #interrupt-cells = <2>;
> diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c
> index 495432f3341b..258fa357d946 100644
> --- a/drivers/pinctrl/qcom/pinctrl-msm.c
> +++ b/drivers/pinctrl/qcom/pinctrl-msm.c
> @@ -831,11 +831,22 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl)
> return ret;
> }
>
> - ret = gpiochip_add_pin_range(&pctrl->chip, dev_name(pctrl->dev), 0, 0, chip->ngpio);
> - if (ret) {
> - dev_err(pctrl->dev, "Failed to add pin range\n");
> - gpiochip_remove(&pctrl->chip);
> - return ret;
> + if (!is_of_node(pctrl->dev->fwnode)) {
Afaict this still means that if I boot this kernel with yesterday's dtb
(without gpio-ranges) I will not get any gpios. This isn't okay.
@Linus, I count 24 callers of gpiochip_add_pin_range(). Is this
suggestion reasonable?
Can we make gpiochip_add_pin_range() check if there's already a
gpio-range and return ok in some way?
> + /*
> + * gpiochip_add_pin_range() is meant for platforms that
> + * don't support DT. All DT platforms should just add
> + * the gpio-ranges property to the pinctrl device node.
> + *
> + * See Documentation/devicetree/bindings/gpio/gpio.txt .
> + */
> + ret = gpiochip_add_pin_range(&pctrl->chip,
> + dev_name(pctrl->dev), 0, 0, chip->ngpio);
> +
> + if (ret) {
> + dev_err(pctrl->dev, "Failed to add pin range\n");
> + gpiochip_remove(&pctrl->chip);
> + return ret;
> + }
Regards,
Bjorn
next prev parent reply other threads:[~2018-04-02 15:04 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-02 12:10 [PATCH v2] pinctrl: msm: fix gpio-hog related boot issues Christian Lamparter
2018-04-02 12:10 ` Christian Lamparter
2018-04-02 15:04 ` Bjorn Andersson [this message]
2018-04-02 15:04 ` Bjorn Andersson
2018-04-05 16:35 ` Christian Lamparter
2018-04-05 16:35 ` Christian Lamparter
2018-04-26 9:12 ` Linus Walleij
2018-04-26 9:12 ` Linus Walleij
2018-04-26 21:47 ` Christian Lamparter
2018-04-26 21:47 ` Christian Lamparter
2018-05-02 12:14 ` Linus Walleij
2018-05-02 12:14 ` Linus Walleij
2018-05-03 17:43 ` Christian Lamparter
2018-05-03 17:43 ` Christian Lamparter
2018-05-04 9:04 ` Laxman Dewangan
2018-05-04 9:04 ` Laxman Dewangan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180402150447.GH510@tuxbook-pro \
--to=bjorn.andersson@linaro.org \
--cc=andy.gross@linaro.org \
--cc=chunkeey@gmail.com \
--cc=david.brown@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=sven.eckelmann@openmesh.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.