From: Jonas Karlman <jonas@kwiboo.se>
To: Matthijs Kooijman <matthijs@stdin.nl>
Cc: Heiko Stuebner <heiko@sntech.de>,
Linus Walleij <linusw@kernel.org>,
Bartosz Golaszewski <brgl@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
"linux-rockchip@lists.infradead.org"
<linux-rockchip@lists.infradead.org>
Subject: Re: [PATCH RESEND 1/2] arm64: dts: rockchip: rk3308: Add gpio-ranges properties
Date: Mon, 2 Mar 2026 22:56:53 +0100 [thread overview]
Message-ID: <e439f2f7-0b25-41a5-951a-d8d3bc9f2bf2@kwiboo.se> (raw)
In-Reply-To: <20260302202121.197288-3-matthijs@stdin.nl>
Hi Matthijs,
On 3/2/2026 9:17 PM, Matthijs Kooijman wrote:
> This makes the mapping between gpio and pinctrl explicit.
>
> This does not immediately change functionality, because the
> gpio-rockchip.c driver has a workaround that defines ranges when they
> are not present in DT, but that relies on global gpio numbering (so
> AFAICS only works when the rockchip gpio banks are initialized first and
> in-order).
This is strictly not correct, the driver use the gpioX alias id as
defined in the device tree and does not depend on the initialization
order.
This file explicitly define the aliases matching the hardware:
aliases {
gpio0 = &gpio0;
gpio1 = &gpio1;
gpio2 = &gpio2;
gpio3 = &gpio3;
gpio4 = &gpio4;
[...]
};
>
> Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
> ---
> arch/arm64/boot/dts/rockchip/rk3308.dtsi | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/rockchip/rk3308.dtsi b/arch/arm64/boot/dts/rockchip/rk3308.dtsi
> index 31c25de2d689c..681d2429d541d 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3308.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk3308.dtsi
> @@ -889,6 +889,7 @@ gpio0: gpio@ff220000 {
> interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>;
> clocks = <&cru PCLK_GPIO0>;
> gpio-controller;
> + gpio-ranges = <&pinctrl 0 0 32>;
This matches the driver, but not the hardware according to datasheet, it
only lists gpio0 A0-C5 used, and not all 32 pins supported by the gpio0
controller.
> #gpio-cells = <2>;
> interrupt-controller;
> #interrupt-cells = <2>;
> @@ -900,6 +901,7 @@ gpio1: gpio@ff230000 {
> interrupts = <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
> clocks = <&cru PCLK_GPIO1>;
> gpio-controller;
> + gpio-ranges = <&pinctrl 0 32 32>;
Same here, the datasheet only lists gpio1 A0-D1 used, and not all 32
pins supported by the gpio1 controller.
> #gpio-cells = <2>;
> interrupt-controller;
> #interrupt-cells = <2>;
> @@ -911,6 +913,7 @@ gpio2: gpio@ff240000 {
> interrupts = <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>;
> clocks = <&cru PCLK_GPIO2>;
> gpio-controller;
> + gpio-ranges = <&pinctrl 0 64 32>;
Same here, the datasheet only lists gpio1 A0-C0 used, and not all 32
pins supported by the gpio2 controller.
> #gpio-cells = <2>;
> interrupt-controller;
> #interrupt-cells = <2>;
> @@ -922,6 +925,7 @@ gpio3: gpio@ff250000 {
> interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
> clocks = <&cru PCLK_GPIO3>;
> gpio-controller;
> + gpio-ranges = <&pinctrl 0 96 32>;
Same here, the datasheet only lists gpio1 A0-B5 used, and not all 32
pins supported by the gpio3 controller.
> #gpio-cells = <2>;
> interrupt-controller;
> #interrupt-cells = <2>;
> @@ -933,6 +937,7 @@ gpio4: gpio@ff260000 {
> interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
> clocks = <&cru PCLK_GPIO4>;
> gpio-controller;
> + gpio-ranges = <&pinctrl 0 128 32>;
Same here, the datasheet only lists gpio1 A0-C1 and D0-D7 used, and not
all 32 pins supported by the gpio4 controller.
Regards,
Jonas
> #gpio-cells = <2>;
> interrupt-controller;
> #interrupt-cells = <2>;
next prev parent reply other threads:[~2026-03-03 5:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-02 20:17 [PATCH RESEND] rockchip: Make gpiod pin control work and add gpio-ranges Matthijs Kooijman
2026-03-02 20:17 ` [PATCH RESEND 1/2] arm64: dts: rockchip: rk3308: Add gpio-ranges properties Matthijs Kooijman
2026-03-02 21:56 ` Jonas Karlman [this message]
2026-03-10 8:53 ` Matthijs Kooijman
2026-03-10 8:59 ` Linus Walleij
2026-03-10 9:13 ` Matthijs Kooijman
2026-03-10 12:15 ` Jonas Karlman
2026-03-02 20:17 ` [PATCH RESEND 2/2] gpio: rockchip: Call pinctrl for gpio config Matthijs Kooijman
2026-03-03 7:36 ` Linus Walleij
2026-03-02 20:23 ` [PATCH RESEND] rockchip: Make gpiod pin control work and add gpio-ranges Matthijs Kooijman
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=e439f2f7-0b25-41a5-951a-d8d3bc9f2bf2@kwiboo.se \
--to=jonas@kwiboo.se \
--cc=brgl@kernel.org \
--cc=heiko@sntech.de \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=matthijs@stdin.nl \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®