devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] dt-bindings: gpio: Add Tegra256 support
@ 2025-08-04  4:16 Prathamesh Shete
  2025-08-04  7:37 ` Krzysztof Kozlowski
  2025-08-05  6:46 ` Krzysztof Kozlowski
  0 siblings, 2 replies; 7+ messages in thread
From: Prathamesh Shete @ 2025-08-04  4:16 UTC (permalink / raw)
  To: linus.walleij, brgl, thierry.reding, jonathanh, robh, krzk+dt,
	conor+dt, devicetree, linux-gpio, linux-tegra, linux-kernel
  Cc: pshete

Extend the existing Tegra186 GPIO controller device tree bindings with
support for the GPIO controller found on Tegra256. The number of pins is
slightly different, but the programming model remains the same

Signed-off-by: Prathamesh Shete <pshete@nvidia.com>
---
 .../bindings/gpio/nvidia,tegra186-gpio.yaml   |  2 ++
 include/dt-bindings/gpio/tegra256-gpio.h      | 28 +++++++++++++++++++
 2 files changed, 30 insertions(+)
 create mode 100644 include/dt-bindings/gpio/tegra256-gpio.h

diff --git a/Documentation/devicetree/bindings/gpio/nvidia,tegra186-gpio.yaml b/Documentation/devicetree/bindings/gpio/nvidia,tegra186-gpio.yaml
index 065f5761a93f..2bd620a1099b 100644
--- a/Documentation/devicetree/bindings/gpio/nvidia,tegra186-gpio.yaml
+++ b/Documentation/devicetree/bindings/gpio/nvidia,tegra186-gpio.yaml
@@ -85,6 +85,7 @@ properties:
       - nvidia,tegra194-gpio-aon
       - nvidia,tegra234-gpio
       - nvidia,tegra234-gpio-aon
+      - nvidia,tegra256-gpio
 
   reg-names:
     items:
@@ -155,6 +156,7 @@ allOf:
               - nvidia,tegra186-gpio
               - nvidia,tegra194-gpio
               - nvidia,tegra234-gpio
+              - nvidia,tegra256-gpio
     then:
       properties:
         interrupts:
diff --git a/include/dt-bindings/gpio/tegra256-gpio.h b/include/dt-bindings/gpio/tegra256-gpio.h
new file mode 100644
index 000000000000..36485b4bf47d
--- /dev/null
+++ b/include/dt-bindings/gpio/tegra256-gpio.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved. */
+
+/*
+ ** This header provides constants for binding nvidia,tegra256-gpio*.
+ **
+ ** The first cell in Tegra's GPIO specifier is the GPIO ID. The macros below
+ ** provide names for this.
+ **
+ ** The second cell contains standard flag values specified in gpio.h.
+ **/
+
+#ifndef _DT_BINDINGS_GPIO_TEGRA256_GPIO_H
+#define _DT_BINDINGS_GPIO_TEGRA256_GPIO_H
+
+#include <dt-bindings/gpio/gpio.h>
+
+/* GPIOs implemented by main GPIO controller */
+#define TEGRA256_MAIN_GPIO_PORT_A 0
+#define TEGRA256_MAIN_GPIO_PORT_B 1
+#define TEGRA256_MAIN_GPIO_PORT_C 2
+#define TEGRA256_MAIN_GPIO_PORT_D 3
+
+#define TEGRA256_MAIN_GPIO(port, offset) \
+		((TEGRA256_MAIN_GPIO_PORT_##port * 8) + (offset))
+
+#endif
+
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] dt-bindings: gpio: Add Tegra256 support
  2025-08-04  4:16 Prathamesh Shete
@ 2025-08-04  7:37 ` Krzysztof Kozlowski
  2025-08-05  6:46 ` Krzysztof Kozlowski
  1 sibling, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2025-08-04  7:37 UTC (permalink / raw)
  To: Prathamesh Shete, linus.walleij, brgl, thierry.reding, jonathanh,
	robh, krzk+dt, conor+dt, devicetree, linux-gpio, linux-tegra,
	linux-kernel

On 04/08/2025 06:16, Prathamesh Shete wrote:
>      then:
>        properties:
>          interrupts:
> diff --git a/include/dt-bindings/gpio/tegra256-gpio.h b/include/dt-bindings/gpio/tegra256-gpio.h
> new file mode 100644
> index 000000000000..36485b4bf47d
> --- /dev/null
> +++ b/include/dt-bindings/gpio/tegra256-gpio.h
> @@ -0,0 +1,28 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/* Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved. */
> +
> +/*
> + ** This header provides constants for binding nvidia,tegra256-gpio*.

Use Linux style comments. See Coding style.


> + **
> + ** The first cell in Tegra's GPIO specifier is the GPIO ID. The macros below
> + ** provide names for this.
> + **
> + ** The second cell contains standard flag values specified in gpio.h.
> + **/
> +
> +#ifndef _DT_BINDINGS_GPIO_TEGRA256_GPIO_H
> +#define _DT_BINDINGS_GPIO_TEGRA256_GPIO_H
> +
> +#include <dt-bindings/gpio/gpio.h>
> +
> +/* GPIOs implemented by main GPIO controller */
> +#define TEGRA256_MAIN_GPIO_PORT_A 0
> +#define TEGRA256_MAIN_GPIO_PORT_B 1
> +#define TEGRA256_MAIN_GPIO_PORT_C 2
> +#define TEGRA256_MAIN_GPIO_PORT_D 3
> +
> +#define TEGRA256_MAIN_GPIO(port, offset) \
> +		((TEGRA256_MAIN_GPIO_PORT_##port * 8) + (offset))
I don't see this macro being used in the drivers. I guess you need it
for embedding hardware constant (so not really bindings)? You have
entire commit msg to explain that...

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] dt-bindings: gpio: Add Tegra256 support
  2025-08-04  4:16 Prathamesh Shete
  2025-08-04  7:37 ` Krzysztof Kozlowski
@ 2025-08-05  6:46 ` Krzysztof Kozlowski
  1 sibling, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2025-08-05  6:46 UTC (permalink / raw)
  To: Prathamesh Shete
  Cc: linus.walleij, brgl, thierry.reding, jonathanh, robh, krzk+dt,
	conor+dt, devicetree, linux-gpio, linux-tegra, linux-kernel

On Mon, Aug 04, 2025 at 09:46:56AM +0530, Prathamesh Shete wrote:
> diff --git a/include/dt-bindings/gpio/tegra256-gpio.h b/include/dt-bindings/gpio/tegra256-gpio.h
> new file mode 100644
> index 000000000000..36485b4bf47d
> --- /dev/null
> +++ b/include/dt-bindings/gpio/tegra256-gpio.h
> @@ -0,0 +1,28 @@
> +/* SPDX-License-Identifier: GPL-2.0 */

Please run scripts/checkpatch.pl on the patches and fix reported
warnings. After that, run also 'scripts/checkpatch.pl --strict' on the
patches and (probably) fix more warnings. Some warnings can be ignored,
especially from --strict run, but the code here looks like it needs a
fix. Feel free to get in touch if the warning is not clear.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] dt-bindings: gpio: Add Tegra256 support
@ 2025-08-23  5:54 Prathamesh Shete
  2025-08-23  5:54 ` [PATCH 2/2] gpio: tegra186: Add support for Tegra256 Prathamesh Shete
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Prathamesh Shete @ 2025-08-23  5:54 UTC (permalink / raw)
  To: linus.walleij, brgl, thierry.reding, jonathanh, robh, krzk+dt,
	conor+dt, devicetree, linux-gpio, linux-tegra, linux-kernel
  Cc: pshete

Extend the existing Tegra186 GPIO controller device tree bindings with
support for the GPIO controller found on Tegra256. The number of pins is
slightly different, but the programming model remains the same

Add a new header, include/dt-bindings/gpio/tegra256-gpio.h,
that defines port IDs as well as the TEGRA256_MAIN_GPIO() helper,
both of which are used in conjunction to create a unique specifier
for each pin. The OS can reconstruct the port ID and pin from
these values to determine the register region for the corresponding
GPIO. However, the OS does not use the macro definitions in this file.

The symbolic names help associate these GPIO specifiers with the names
used in the technical documentation available for the chip.

Signed-off-by: Prathamesh Shete <pshete@nvidia.com>
---
 .../bindings/gpio/nvidia,tegra186-gpio.yaml   |  2 ++
 include/dt-bindings/gpio/tegra256-gpio.h      | 28 +++++++++++++++++++
 2 files changed, 30 insertions(+)
 create mode 100644 include/dt-bindings/gpio/tegra256-gpio.h

diff --git a/Documentation/devicetree/bindings/gpio/nvidia,tegra186-gpio.yaml b/Documentation/devicetree/bindings/gpio/nvidia,tegra186-gpio.yaml
index 065f5761a93f..2bd620a1099b 100644
--- a/Documentation/devicetree/bindings/gpio/nvidia,tegra186-gpio.yaml
+++ b/Documentation/devicetree/bindings/gpio/nvidia,tegra186-gpio.yaml
@@ -85,6 +85,7 @@ properties:
       - nvidia,tegra194-gpio-aon
       - nvidia,tegra234-gpio
       - nvidia,tegra234-gpio-aon
+      - nvidia,tegra256-gpio
 
   reg-names:
     items:
@@ -155,6 +156,7 @@ allOf:
               - nvidia,tegra186-gpio
               - nvidia,tegra194-gpio
               - nvidia,tegra234-gpio
+              - nvidia,tegra256-gpio
     then:
       properties:
         interrupts:
diff --git a/include/dt-bindings/gpio/tegra256-gpio.h b/include/dt-bindings/gpio/tegra256-gpio.h
new file mode 100644
index 000000000000..a0353a302aeb
--- /dev/null
+++ b/include/dt-bindings/gpio/tegra256-gpio.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved. */
+
+/*
+ * This header provides constants for the nvidia,tegra256-gpio DT binding.
+ *
+ * The first cell in Tegra's GPIO specifier is the GPIO ID.
+ * The macros below provide names for this.
+ *
+ * The second cell contains standard flag values specified in gpio.h.
+ */
+
+#ifndef _DT_BINDINGS_GPIO_TEGRA256_GPIO_H
+#define _DT_BINDINGS_GPIO_TEGRA256_GPIO_H
+
+#include <dt-bindings/gpio/gpio.h>
+
+/* GPIOs implemented by main GPIO controller */
+#define TEGRA256_MAIN_GPIO_PORT_A 0
+#define TEGRA256_MAIN_GPIO_PORT_B 1
+#define TEGRA256_MAIN_GPIO_PORT_C 2
+#define TEGRA256_MAIN_GPIO_PORT_D 3
+
+#define TEGRA256_MAIN_GPIO(port, offset) \
+		((TEGRA256_MAIN_GPIO_PORT_##port * 8) + (offset))
+
+#endif
+
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] gpio: tegra186: Add support for Tegra256
  2025-08-23  5:54 [PATCH 1/2] dt-bindings: gpio: Add Tegra256 support Prathamesh Shete
@ 2025-08-23  5:54 ` Prathamesh Shete
  2025-08-23 13:52 ` [PATCH 1/2] dt-bindings: gpio: Add Tegra256 support Conor Dooley
  2025-09-01  8:20 ` Bartosz Golaszewski
  2 siblings, 0 replies; 7+ messages in thread
From: Prathamesh Shete @ 2025-08-23  5:54 UTC (permalink / raw)
  To: linus.walleij, brgl, thierry.reding, jonathanh, robh, krzk+dt,
	conor+dt, devicetree, linux-gpio, linux-tegra, linux-kernel
  Cc: pshete

Extend the existing Tegra186 GPIO controller driver with support for the
GPIO controller found on Tegra256. While the programming model remains
the same, the number of pins has slightly changed.

Signed-off-by: Prathamesh Shete <pshete@nvidia.com>
---
 drivers/gpio/gpio-tegra186.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/drivers/gpio/gpio-tegra186.c b/drivers/gpio/gpio-tegra186.c
index d27bfac6c9f5..c9f1441a7b30 100644
--- a/drivers/gpio/gpio-tegra186.c
+++ b/drivers/gpio/gpio-tegra186.c
@@ -20,6 +20,7 @@
 #include <dt-bindings/gpio/tegra194-gpio.h>
 #include <dt-bindings/gpio/tegra234-gpio.h>
 #include <dt-bindings/gpio/tegra241-gpio.h>
+#include <dt-bindings/gpio/tegra256-gpio.h>
 
 /* security registers */
 #define TEGRA186_GPIO_CTL_SCR 0x0c
@@ -1274,6 +1275,30 @@ static const struct tegra_gpio_soc tegra241_aon_soc = {
 	.has_vm_support = false,
 };
 
+#define TEGRA256_MAIN_GPIO_PORT(_name, _bank, _port, _pins)	\
+	[TEGRA256_MAIN_GPIO_PORT_##_name] = {			\
+		.name = #_name,					\
+		.bank = _bank,					\
+		.port = _port,					\
+		.pins = _pins,					\
+	}
+
+static const struct tegra_gpio_port tegra256_main_ports[] = {
+	TEGRA256_MAIN_GPIO_PORT(A, 0, 0, 8),
+	TEGRA256_MAIN_GPIO_PORT(B, 0, 1, 8),
+	TEGRA256_MAIN_GPIO_PORT(C, 0, 2, 8),
+	TEGRA256_MAIN_GPIO_PORT(D, 0, 3, 8),
+};
+
+static const struct tegra_gpio_soc tegra256_main_soc = {
+	.num_ports = ARRAY_SIZE(tegra256_main_ports),
+	.ports = tegra256_main_ports,
+	.name = "tegra256-gpio-main",
+	.instance = 1,
+	.num_irqs_per_bank = 8,
+	.has_vm_support = true,
+};
+
 static const struct of_device_id tegra186_gpio_of_match[] = {
 	{
 		.compatible = "nvidia,tegra186-gpio",
@@ -1293,6 +1318,9 @@ static const struct of_device_id tegra186_gpio_of_match[] = {
 	}, {
 		.compatible = "nvidia,tegra234-gpio-aon",
 		.data = &tegra234_aon_soc
+	}, {
+		.compatible = "nvidia,tegra256-gpio",
+		.data = &tegra256_main_soc
 	}, {
 		/* sentinel */
 	}
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] dt-bindings: gpio: Add Tegra256 support
  2025-08-23  5:54 [PATCH 1/2] dt-bindings: gpio: Add Tegra256 support Prathamesh Shete
  2025-08-23  5:54 ` [PATCH 2/2] gpio: tegra186: Add support for Tegra256 Prathamesh Shete
@ 2025-08-23 13:52 ` Conor Dooley
  2025-09-01  8:20 ` Bartosz Golaszewski
  2 siblings, 0 replies; 7+ messages in thread
From: Conor Dooley @ 2025-08-23 13:52 UTC (permalink / raw)
  To: Prathamesh Shete
  Cc: linus.walleij, brgl, thierry.reding, jonathanh, robh, krzk+dt,
	conor+dt, devicetree, linux-gpio, linux-tegra, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 54 bytes --]



Acked-by: Conor Dooley <conor.dooley@microchip.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] dt-bindings: gpio: Add Tegra256 support
  2025-08-23  5:54 [PATCH 1/2] dt-bindings: gpio: Add Tegra256 support Prathamesh Shete
  2025-08-23  5:54 ` [PATCH 2/2] gpio: tegra186: Add support for Tegra256 Prathamesh Shete
  2025-08-23 13:52 ` [PATCH 1/2] dt-bindings: gpio: Add Tegra256 support Conor Dooley
@ 2025-09-01  8:20 ` Bartosz Golaszewski
  2 siblings, 0 replies; 7+ messages in thread
From: Bartosz Golaszewski @ 2025-09-01  8:20 UTC (permalink / raw)
  To: linus.walleij, brgl, thierry.reding, jonathanh, robh, krzk+dt,
	conor+dt, devicetree, linux-gpio, linux-tegra, linux-kernel,
	Prathamesh Shete
  Cc: Bartosz Golaszewski

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


On Sat, 23 Aug 2025 11:24:19 +0530, Prathamesh Shete wrote:
> Extend the existing Tegra186 GPIO controller device tree bindings with
> support for the GPIO controller found on Tegra256. The number of pins is
> slightly different, but the programming model remains the same
> 
> Add a new header, include/dt-bindings/gpio/tegra256-gpio.h,
> that defines port IDs as well as the TEGRA256_MAIN_GPIO() helper,
> both of which are used in conjunction to create a unique specifier
> for each pin. The OS can reconstruct the port ID and pin from
> these values to determine the register region for the corresponding
> GPIO. However, the OS does not use the macro definitions in this file.
> 
> [...]

Applied, thanks!

[1/2] dt-bindings: gpio: Add Tegra256 support
      https://git.kernel.org/brgl/linux/c/eef6dcbc52fa83c392a2f4a52845f347b233a584
[2/2] gpio: tegra186: Add support for Tegra256
      https://git.kernel.org/brgl/linux/c/db12ee08726e55c8a1a70c2308f98d121d96edc6

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-09-01  8:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-23  5:54 [PATCH 1/2] dt-bindings: gpio: Add Tegra256 support Prathamesh Shete
2025-08-23  5:54 ` [PATCH 2/2] gpio: tegra186: Add support for Tegra256 Prathamesh Shete
2025-08-23 13:52 ` [PATCH 1/2] dt-bindings: gpio: Add Tegra256 support Conor Dooley
2025-09-01  8:20 ` Bartosz Golaszewski
  -- strict thread matches above, loose matches on Subject: below --
2025-08-04  4:16 Prathamesh Shete
2025-08-04  7:37 ` Krzysztof Kozlowski
2025-08-05  6:46 ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).