From: Andre Przywara <andre.przywara@arm.com>
To: Andrei Lalaev <andrey.lalaev@gmail.com>
Cc: wens@csie.org, jernej.skrabec@gmail.com, samuel@sholland.org,
krzysztof.kozlowski+dt@linaro.org, robh+dt@kernel.org,
devicetree@vger.kernel.org, linux-sunxi@lists.linux.dev
Subject: Re: [PATCH] arm: dts: sunxi: h3/h5: add gpio-ranges for pio and r_pio
Date: Sun, 22 May 2022 22:26:30 +0100 [thread overview]
Message-ID: <20220522222630.7faab948@slackpad.lan> (raw)
In-Reply-To: <20220522172018.238564-1-andrey.lalaev@gmail.com>
On Sun, 22 May 2022 20:20:19 +0300
Andrei Lalaev <andrey.lalaev@gmail.com> wrote:
> Without this property the next node can't be hogged:
> &r_pio {
> test_hog {
> gpio-hog;
> gpios = <0 6 GPIO_ACTIVE_HIGH>;
> output-high;
> };
> };
> And the appropriate error message:
> "requesting hog GPIO test_hog (chip 1f02c00.pinctrl, offset 6) failed, -517"
>
> This problem occurs because the "pinctrl-sunxi" calls
> "gpiochip_add_data" that parses "gpio-ranges"
> (using "of_gpiochip_add_pin_range") and registers hogs
> (using "of_gpiochip_scan_gpios").
> So when the gpiolib tries to register hogs it can't find any ranges and
> fails.
>
> Signed-off-by: Andrei Lalaev <andrey.lalaev@gmail.com>
> ---
> arch/arm/boot/dts/sunxi-h3-h5.dtsi | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/arch/arm/boot/dts/sunxi-h3-h5.dtsi b/arch/arm/boot/dts/sunxi-h3-h5.dtsi
> index d7e9f977f986..4193bf962b7d 100644
> --- a/arch/arm/boot/dts/sunxi-h3-h5.dtsi
> +++ b/arch/arm/boot/dts/sunxi-h3-h5.dtsi
> @@ -404,6 +404,9 @@ pio: pinctrl@1c20800 {
> #gpio-cells = <3>;
> interrupt-controller;
> #interrupt-cells = <3>;
> + gpio-ranges = <&pio 0 0 22>, <&pio 64 64 17>,
> + <&pio 96 96 18>, <&pio 128 128 16>,
> + <&pio 160 160 7>, <&pio 192 192 14>;
But this is somewhat redundant information, because the pinctrl driver
knows about those values, as they are derived from the big struct
sunxi_desc_pin definition.
So wouldn't it be smarter to put a call to
gpiochip_add_pingroup_range() somewhere into the sunxi pinctrl driver,
so that it would automatically work for all SoCs?
Cheers,
Andre
>
> csi_pins: csi-pins {
> pins = "PE0", "PE2", "PE3", "PE4", "PE5",
> @@ -937,6 +940,7 @@ r_pio: pinctrl@1f02c00 {
> #gpio-cells = <3>;
> interrupt-controller;
> #interrupt-cells = <3>;
> + gpio-ranges = <&r_pio 0 352 12>;
>
> r_ir_rx_pin: r-ir-rx-pin {
> pins = "PL11";
next prev parent reply other threads:[~2022-05-22 21:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-22 17:20 [PATCH] arm: dts: sunxi: h3/h5: add gpio-ranges for pio and r_pio Andrei Lalaev
2022-05-22 21:26 ` Andre Przywara [this message]
2022-05-23 5:55 ` Andrei Lalaev
2022-05-23 19:19 ` Andrei Lalaev
2022-07-05 4:28 ` Samuel Holland
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=20220522222630.7faab948@slackpad.lan \
--to=andre.przywara@arm.com \
--cc=andrey.lalaev@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=jernej.skrabec@gmail.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=robh+dt@kernel.org \
--cc=samuel@sholland.org \
--cc=wens@csie.org \
/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.