After commit da5dd31efd24 ("gpio: vf610: Switch to gpio-mmio"),
the vf610 GPIO driver no longer uses the static number 32 for
gc->ngpio. This allows users to configure the number of GPIOs
per port.
And some gpio controllers did have less pads. So add 'ngpios' here,
this can save some memory when request bitmap, and also show user
more accurate information when use gpio tools.
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
arch/arm/boot/dts/nxp/imx/imx7ulp.dtsi | 4 ++++
arch/arm/boot/dts/nxp/vf/vfxxx.dtsi | 5 +++++
2 files changed, 9 insertions(+)
diff --git a/arch/arm/boot/dts/nxp/imx/imx7ulp.dtsi b/arch/arm/boot/dts/nxp/imx/imx7ulp.dtsi
index 3c6ef7bfba60986b797bb01b843830d364c96d45..880b9a4f32b0846a773dbf9ad30715c84ac2fda6 100644
--- a/arch/arm/boot/dts/nxp/imx/imx7ulp.dtsi
+++ b/arch/arm/boot/dts/nxp/imx/imx7ulp.dtsi
@@ -399,6 +399,7 @@ gpio_ptc: gpio@40ae0000 {
<&pcc3 IMX7ULP_CLK_PCTLC>;
clock-names = "gpio", "port";
gpio-ranges = <&iomuxc1 0 0 20>;
+ ngpios = <20>;
};
gpio_ptd: gpio@40af0000 {
@@ -413,6 +414,7 @@ gpio_ptd: gpio@40af0000 {
<&pcc3 IMX7ULP_CLK_PCTLD>;
clock-names = "gpio", "port";
gpio-ranges = <&iomuxc1 0 32 12>;
+ ngpios = <12>;
};
gpio_pte: gpio@40b00000 {
@@ -427,6 +429,7 @@ gpio_pte: gpio@40b00000 {
<&pcc3 IMX7ULP_CLK_PCTLE>;
clock-names = "gpio", "port";
gpio-ranges = <&iomuxc1 0 64 16>;
+ ngpios = <16>;
};
gpio_ptf: gpio@40b10000 {
@@ -441,6 +444,7 @@ gpio_ptf: gpio@40b10000 {
<&pcc3 IMX7ULP_CLK_PCTLF>;
clock-names = "gpio", "port";
gpio-ranges = <&iomuxc1 0 96 20>;
+ ngpios = <20>;
};
};
diff --git a/arch/arm/boot/dts/nxp/vf/vfxxx.dtsi b/arch/arm/boot/dts/nxp/vf/vfxxx.dtsi
index 597f20be82f1ee044e14bfaf3bd05cff37a8ad39..a275821c35d41e97eb2139a081ef5765d07672aa 100644
--- a/arch/arm/boot/dts/nxp/vf/vfxxx.dtsi
+++ b/arch/arm/boot/dts/nxp/vf/vfxxx.dtsi
@@ -318,6 +318,7 @@ gpio0: gpio@40049000 {
interrupt-controller;
#interrupt-cells = <2>;
gpio-ranges = <&iomuxc 0 0 32>;
+ ngpios = <32>;
};
gpio1: gpio@4004a000 {
@@ -329,6 +330,7 @@ gpio1: gpio@4004a000 {
interrupt-controller;
#interrupt-cells = <2>;
gpio-ranges = <&iomuxc 0 32 32>;
+ ngpios = <32>;
};
gpio2: gpio@4004b000 {
@@ -340,6 +342,7 @@ gpio2: gpio@4004b000 {
interrupt-controller;
#interrupt-cells = <2>;
gpio-ranges = <&iomuxc 0 64 32>;
+ ngpios = <32>;
};
gpio3: gpio@4004c000 {
@@ -351,6 +354,7 @@ gpio3: gpio@4004c000 {
interrupt-controller;
#interrupt-cells = <2>;
gpio-ranges = <&iomuxc 0 96 32>;
+ ngpios = <32>;
};
gpio4: gpio@4004d000 {
@@ -362,6 +366,7 @@ gpio4: gpio@4004d000 {
interrupt-controller;
#interrupt-cells = <2>;
gpio-ranges = <&iomuxc 0 128 7>;
+ ngpios = <7>;
};
anatop: anatop@40050000 {
--
2.34.1
On Tue, May 20, 2025 at 11:46:13AM +0800, Haibo Chen wrote:
> After commit da5dd31efd24 ("gpio: vf610: Switch to gpio-mmio"),
> the vf610 GPIO driver no longer uses the static number 32 for
> gc->ngpio. This allows users to configure the number of GPIOs
> per port.
>
> And some gpio controllers did have less pads. So add 'ngpios' here,
> this can save some memory when request bitmap, and also show user
> more accurate information when use gpio tools.
>
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Applied, thanks!
Hi,
Am 20.05.25 um 05:46 schrieb Haibo Chen:
> After commit da5dd31efd24 ("gpio: vf610: Switch to gpio-mmio"),
> the vf610 GPIO driver no longer uses the static number 32 for
> gc->ngpio. This allows users to configure the number of GPIOs
> per port.
>
> And some gpio controllers did have less pads. So add 'ngpios' here,
> this can save some memory when request bitmap, and also show user
> more accurate information when use gpio tools.
sorry for asking this dumb question: why do we need the redundant ngpio
property in case there is already gpio-ranges defined? AFAIU the last
cell already contains the necessary information. Or do I missed something?
Best regards
>
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
> ---
> arch/arm/boot/dts/nxp/imx/imx7ulp.dtsi | 4 ++++
> arch/arm/boot/dts/nxp/vf/vfxxx.dtsi | 5 +++++
> 2 files changed, 9 insertions(+)
>
> diff --git a/arch/arm/boot/dts/nxp/imx/imx7ulp.dtsi b/arch/arm/boot/dts/nxp/imx/imx7ulp.dtsi
> index 3c6ef7bfba60986b797bb01b843830d364c96d45..880b9a4f32b0846a773dbf9ad30715c84ac2fda6 100644
> --- a/arch/arm/boot/dts/nxp/imx/imx7ulp.dtsi
> +++ b/arch/arm/boot/dts/nxp/imx/imx7ulp.dtsi
> @@ -399,6 +399,7 @@ gpio_ptc: gpio@40ae0000 {
> <&pcc3 IMX7ULP_CLK_PCTLC>;
> clock-names = "gpio", "port";
> gpio-ranges = <&iomuxc1 0 0 20>;
> + ngpios = <20>;
> };
>
> gpio_ptd: gpio@40af0000 {
> @@ -413,6 +414,7 @@ gpio_ptd: gpio@40af0000 {
> <&pcc3 IMX7ULP_CLK_PCTLD>;
> clock-names = "gpio", "port";
> gpio-ranges = <&iomuxc1 0 32 12>;
> + ngpios = <12>;
> };
>
> gpio_pte: gpio@40b00000 {
> @@ -427,6 +429,7 @@ gpio_pte: gpio@40b00000 {
> <&pcc3 IMX7ULP_CLK_PCTLE>;
> clock-names = "gpio", "port";
> gpio-ranges = <&iomuxc1 0 64 16>;
> + ngpios = <16>;
> };
>
> gpio_ptf: gpio@40b10000 {
> @@ -441,6 +444,7 @@ gpio_ptf: gpio@40b10000 {
> <&pcc3 IMX7ULP_CLK_PCTLF>;
> clock-names = "gpio", "port";
> gpio-ranges = <&iomuxc1 0 96 20>;
> + ngpios = <20>;
> };
> };
>
> diff --git a/arch/arm/boot/dts/nxp/vf/vfxxx.dtsi b/arch/arm/boot/dts/nxp/vf/vfxxx.dtsi
> index 597f20be82f1ee044e14bfaf3bd05cff37a8ad39..a275821c35d41e97eb2139a081ef5765d07672aa 100644
> --- a/arch/arm/boot/dts/nxp/vf/vfxxx.dtsi
> +++ b/arch/arm/boot/dts/nxp/vf/vfxxx.dtsi
> @@ -318,6 +318,7 @@ gpio0: gpio@40049000 {
> interrupt-controller;
> #interrupt-cells = <2>;
> gpio-ranges = <&iomuxc 0 0 32>;
> + ngpios = <32>;
> };
>
> gpio1: gpio@4004a000 {
> @@ -329,6 +330,7 @@ gpio1: gpio@4004a000 {
> interrupt-controller;
> #interrupt-cells = <2>;
> gpio-ranges = <&iomuxc 0 32 32>;
> + ngpios = <32>;
> };
>
> gpio2: gpio@4004b000 {
> @@ -340,6 +342,7 @@ gpio2: gpio@4004b000 {
> interrupt-controller;
> #interrupt-cells = <2>;
> gpio-ranges = <&iomuxc 0 64 32>;
> + ngpios = <32>;
> };
>
> gpio3: gpio@4004c000 {
> @@ -351,6 +354,7 @@ gpio3: gpio@4004c000 {
> interrupt-controller;
> #interrupt-cells = <2>;
> gpio-ranges = <&iomuxc 0 96 32>;
> + ngpios = <32>;
> };
>
> gpio4: gpio@4004d000 {
> @@ -362,6 +366,7 @@ gpio4: gpio@4004d000 {
> interrupt-controller;
> #interrupt-cells = <2>;
> gpio-ranges = <&iomuxc 0 128 7>;
> + ngpios = <7>;
> };
>
> anatop: anatop@40050000 {
>
On Tue, May 20, 2025 at 12:54 PM Stefan Wahren <wahrenst@gmx.net> wrote: > sorry for asking this dumb question: why do we need the redundant ngpio > property in case there is already gpio-ranges defined? AFAIU the last > cell already contains the necessary information. Or do I missed something? Not all GPIOs on a gpio controller have to be present in a range. The ranges can be multiple and have holes in them. The ranges are also optional. The fact that this DTS file, for this SoC and on this controller happens to have a range mapped right over all of the pins is merely a coinicidence and not a general rule of any kind, it just apophenia playing games on us. Yours, Linus Walleij
Am 21.05.25 um 00:14 schrieb Linus Walleij: > On Tue, May 20, 2025 at 12:54 PM Stefan Wahren <wahrenst@gmx.net> wrote: > >> sorry for asking this dumb question: why do we need the redundant ngpio >> property in case there is already gpio-ranges defined? AFAIU the last >> cell already contains the necessary information. Or do I missed something? > Not all GPIOs on a gpio controller have to be present in > a range. > > The ranges can be multiple and have holes in them. > > The ranges are also optional. > > The fact that this DTS file, for this SoC and on this controller > happens to have a range mapped right over all of the pins > is merely a coinicidence and not a general rule of any kind, > it just apophenia playing games on us. Thanks for clarification > > Yours, > Linus Walleij >
© 2016 - 2025 Red Hat, Inc.