2024-01-17 09:46:09

by Hector Palacios

[permalink] [raw]
Subject: [PATCH v4 0/3] gpio: support i.MX93 truly available GPIO pins

All four GPIO ports of i.MX93 SoC show 32 pins available, but
not every port has 32 pins.
Add support on the GPIO driver to 'ngpios' property and set
the truly available pins on the SoC device tree.

v4
* Remove 'description' from 'npgio' field in bindings as it
is a generic one.

v3
* Move DT bindings to a patch of its own
* Improve reasoning for adding support in driver

v2
* Add 'ngpios' property to DT binding for proper validation

Hector Palacios (3):
gpio: vf610: add support to DT 'ngpios' property
dt-bindings: gpio: vf610: add optional 'ngpios'
arm64: dts: imx93: specify available 'ngpios' per GPIO port

Documentation/devicetree/bindings/gpio/gpio-vf610.yaml | 5 +++++
arch/arm64/boot/dts/freescale/imx93.dtsi | 4 ++++
drivers/gpio/gpio-vf610.c | 7 ++++++-
3 files changed, 15 insertions(+), 1 deletion(-)




2024-01-17 09:46:20

by Hector Palacios

[permalink] [raw]
Subject: [PATCH v4 1/3] gpio: vf610: add support to DT 'ngpios' property

Some SoCs, such as i.MX93, don't have all 32 pins available
per port. Allow optional generic 'ngpios' property to be
specified from the device tree and default to
VF610_GPIO_PER_PORT (32) if the property does not exist.

Signed-off-by: Hector Palacios <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
---
drivers/gpio/gpio-vf610.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c
index 07e5e6323e86..4abdf75e9a0a 100644
--- a/drivers/gpio/gpio-vf610.c
+++ b/drivers/gpio/gpio-vf610.c
@@ -276,6 +276,7 @@ static int vf610_gpio_probe(struct platform_device *pdev)
struct vf610_gpio_port *port;
struct gpio_chip *gc;
struct gpio_irq_chip *girq;
+ u32 ngpios;
int i;
int ret;
bool dual_base;
@@ -353,7 +354,11 @@ static int vf610_gpio_probe(struct platform_device *pdev)
gc = &port->gc;
gc->parent = dev;
gc->label = dev_name(dev);
- gc->ngpio = VF610_GPIO_PER_PORT;
+ ret = device_property_read_u32(dev, "ngpios", &ngpios);
+ if (ret || ngpios > VF610_GPIO_PER_PORT)
+ gc->ngpio = VF610_GPIO_PER_PORT;
+ else
+ gc->ngpio = (u16)ngpios;
gc->base = -1;

gc->request = gpiochip_generic_request;

2024-01-17 09:46:43

by Hector Palacios

[permalink] [raw]
Subject: [PATCH v4 2/3] dt-bindings: gpio: vf610: add optional 'ngpios'

Some SoCs, such as i.MX93, don't have all 32 pins available
per port. Allow optional generic 'ngpios' property to be
specified from the device tree and default to 32 if the
property does not exist.

Signed-off-by: Hector Palacios <[email protected]>
---
Documentation/devicetree/bindings/gpio/gpio-vf610.yaml | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/gpio/gpio-vf610.yaml b/Documentation/devicetree/bindings/gpio/gpio-vf610.yaml
index a27f92950257..1702aff5e0e9 100644
--- a/Documentation/devicetree/bindings/gpio/gpio-vf610.yaml
+++ b/Documentation/devicetree/bindings/gpio/gpio-vf610.yaml
@@ -65,6 +65,11 @@ properties:
minItems: 1
maxItems: 4

+ ngpios:
+ minimum: 1
+ maximum: 32
+ default: 32
+
patternProperties:
"^.+-hog(-[0-9]+)?$":
type: object

2024-01-17 09:46:55

by Hector Palacios

[permalink] [raw]
Subject: [PATCH v4 3/3] arm64: dts: imx93: specify available 'ngpios' per GPIO port

According to NXP HRM for i.MX93, the following GPIO pins are available:
- GPIO1: 16 pins (0..15)
- GPIO2: 30 pins (0..29)
- GPIO3: 32 pins (0..31)
- GPIO4: 30 pins (0..29)

Signed-off-by: Hector Palacios <[email protected]>
---
arch/arm64/boot/dts/freescale/imx93.dtsi | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/arch/arm64/boot/dts/freescale/imx93.dtsi b/arch/arm64/boot/dts/freescale/imx93.dtsi
index 34c0540276d1..7eb2cab7c749 100644
--- a/arch/arm64/boot/dts/freescale/imx93.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx93.dtsi
@@ -970,6 +970,7 @@ gpio2: gpio@43810000 {
<&clk IMX93_CLK_GPIO2_GATE>;
clock-names = "gpio", "port";
gpio-ranges = <&iomuxc 0 4 30>;
+ ngpios = <30>;
};

gpio3: gpio@43820000 {
@@ -986,6 +987,7 @@ gpio3: gpio@43820000 {
clock-names = "gpio", "port";
gpio-ranges = <&iomuxc 0 84 8>, <&iomuxc 8 66 18>,
<&iomuxc 26 34 2>, <&iomuxc 28 0 4>;
+ ngpios = <32>;
};

gpio4: gpio@43830000 {
@@ -1001,6 +1003,7 @@ gpio4: gpio@43830000 {
<&clk IMX93_CLK_GPIO4_GATE>;
clock-names = "gpio", "port";
gpio-ranges = <&iomuxc 0 38 28>, <&iomuxc 28 36 2>;
+ ngpios = <30>;
};

gpio1: gpio@47400000 {
@@ -1016,6 +1019,7 @@ gpio1: gpio@47400000 {
<&clk IMX93_CLK_GPIO1_GATE>;
clock-names = "gpio", "port";
gpio-ranges = <&iomuxc 0 92 16>;
+ ngpios = <16>;
};

ocotp: efuse@47510000 {

2024-01-17 10:10:11

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v4 2/3] dt-bindings: gpio: vf610: add optional 'ngpios'

On 17/01/2024 10:44, Hector Palacios wrote:
> Some SoCs, such as i.MX93, don't have all 32 pins available
> per port. Allow optional generic 'ngpios' property to be
> specified from the device tree and default to 32 if the
> property does not exist.
>
> Signed-off-by: Hector Palacios <[email protected]>

Reviewed-by: Krzysztof Kozlowski <[email protected]>

Please give maintainers chance to review your patches... one patchset
per day. During merge window maybe rarer.


---

This is an automated instruction, just in case, because many review tags
are being ignored. If you know the process, you can skip it (please do
not feel offended by me posting it here - no bad intentions intended).
If you do not know the process, here is a short explanation:

Please add Acked-by/Reviewed-by/Tested-by tags when posting new
versions, under or above your Signed-off-by tag. Tag is "received", when
provided in a message replied to you on the mailing list. Tools like b4
can help here. However, there's no need to repost patches *only* to add
the tags. The upstream maintainer will do that for tags received on the
version they apply.

https://elixir.bootlin.com/linux/v6.5-rc3/source/Documentation/process/submitting-patches.rst#L577

Best regards,
Krzysztof


2024-01-17 12:36:01

by Bartosz Golaszewski

[permalink] [raw]
Subject: Re: [PATCH v4 0/3] gpio: support i.MX93 truly available GPIO pins

On Wed, Jan 17, 2024 at 10:45 AM Hector Palacios
<[email protected]> wrote:
>
> All four GPIO ports of i.MX93 SoC show 32 pins available, but
> not every port has 32 pins.
> Add support on the GPIO driver to 'ngpios' property and set
> the truly available pins on the SoC device tree.
>
> v4
> * Remove 'description' from 'npgio' field in bindings as it
> is a generic one.
>
> v3
> * Move DT bindings to a patch of its own
> * Improve reasoning for adding support in driver
>
> v2
> * Add 'ngpios' property to DT binding for proper validation
>
> Hector Palacios (3):
> gpio: vf610: add support to DT 'ngpios' property
> dt-bindings: gpio: vf610: add optional 'ngpios'
> arm64: dts: imx93: specify available 'ngpios' per GPIO port
>
> Documentation/devicetree/bindings/gpio/gpio-vf610.yaml | 5 +++++
> arch/arm64/boot/dts/freescale/imx93.dtsi | 4 ++++
> drivers/gpio/gpio-vf610.c | 7 ++++++-
> 3 files changed, 15 insertions(+), 1 deletion(-)
>
>

Please don't spam the list with new versions less than an hour apart.
Leave the maintainers at least a couple days to respond. Especially
during the merge window.

Bartosz

2024-01-17 20:55:21

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v4 1/3] gpio: vf610: add support to DT 'ngpios' property

On Wed, Jan 17, 2024 at 11:46 AM Hector Palacios
<[email protected]> wrote:
>
> Some SoCs, such as i.MX93, don't have all 32 pins available
> per port. Allow optional generic 'ngpios' property to be
> specified from the device tree and default to
> VF610_GPIO_PER_PORT (32) if the property does not exist.

Same comment/Q as per v3.

--
With Best Regards,
Andy Shevchenko