Skip to contentSkip to conversation

pinctrl: tegra: Add Tegra234 pinmux driver

PATCH Superseded Thierry Reding 3 participants 6 messages Jun 2, 2023 – Jun 4, 2023

Subsystems (4)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover pinctrl: tegra: Add Tegra234 pinmux driver

From: Thierry Reding <[email protected]>

Hi,

this is an updated version of v3 of the series, which can be found here:

	http://patchwork.ozlabs.org/project/linux-tegra/list/?series=357257

This addresses some comments from Krzysztof on the DT bindings. However, one change that I didn't make is to remove the list of explicitly allowed pin group properties. This is so that the common bindings can define the format of all pin group properties, but the per-SoC bindings can then decide which ones are allowed for each IP version. I added a comment to the bindings to explain why this is done.

Changes in v4:
- use unevaluatedProperties for specific bindings and drop unnecessary or duplicated properties
- move "$ref" and "required" properties into more standard locations
- use "additionalProperties: true" for common bindings
- only allow valid per-SoC pin group properties

Note that the driver patch applies on top of the function table fix that I sent out earlier:

	http://patchwork.ozlabs.org/project/linux-tegra/list/?series=357206

Once accepted, patches 1 and 2 can go through the pinctrl tree and I can pick up patch 3 into the Tegra tree. Alternatively I can also pick up patch 1 into the Tegra tree to help with validation. We're not quite at a point yet where the Tegra DTs fully validate, so it doesn't matter much which way these get applied.

Thanks,
Thierry

Prathamesh Shete (3):
dt-bindings: pinctrl: Document Tegra234 pin controllers
pinctrl: tegra: Add Tegra234 pinmux driver
arm64: tegra: Add Tegra234 pin controllers

 .../pinctrl/nvidia,tegra234-pinmux-aon.yaml   |   59 +
 .../nvidia,tegra234-pinmux-common.yaml        |   66 +
 .../pinctrl/nvidia,tegra234-pinmux.yaml       |  139 ++
 arch/arm64/boot/dts/nvidia/tegra234.dtsi      |   12 +
 drivers/pinctrl/tegra/Kconfig                 |    4 +
 drivers/pinctrl/tegra/Makefile                |    1 +
 drivers/pinctrl/tegra/pinctrl-tegra234.c      | 1969 +++++++++++++++++
 drivers/soc/tegra/Kconfig                     |    1 +
 8 files changed, 2251 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra234-pinmux-aon.yaml
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra234-pinmux-common.yaml
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra234-pinmux.yaml
 create mode 100644 drivers/pinctrl/tegra/pinctrl-tegra234.c
Signature · 1 line
2.40.1
#1 lore raw

PATCH v4 1/3 dt-bindings: pinctrl: Document Tegra234 pin controllers

From: Prathamesh Shete <[email protected]>

Tegra234 contains two pin controllers. Document their compatible strings and describe the list of pins and functions that they provide.

---
Changes in v4:
- move "$ref" and "required" properties into more standard locations
- use "additionalProperties: true" for common bindings
- use unevaluatedProperties for specific bindings
- only allow valid per-SoC pin group properties
- drop unnecessary or duplicated properties

Changes in v3:
- split up into multiple files (suggested by Krzysztof)
- do not permit underscore in pinmux node names
- reword commit message

 .../pinctrl/nvidia,tegra234-pinmux-aon.yaml   |  59 ++++++++
 .../nvidia,tegra234-pinmux-common.yaml        |  66 +++++++++
 .../pinctrl/nvidia,tegra234-pinmux.yaml       | 139 ++++++++++++++++++
 3 files changed, 264 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra234-pinmux-aon.yaml
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra234-pinmux-common.yaml
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra234-pinmux.yaml
Documentation/devicetree/bindings/pinctrl/nvidia,tegra234-pinmux-aon.yaml new file +59 -0
new file mode 100644
index 000000000000..4ec969451eec
@@ -0,0 +1,59 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pinctrl/nvidia,tegra234-pinmux-aon.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NVIDIA Tegra234 AON Pinmux Controller
+
+maintainers:
+  - Thierry Reding <[email protected]>
+  - Jon Hunter <[email protected]>
+
+$ref: nvidia,tegra234-pinmux-common.yaml
+
+properties:
+  compatible:
+    const: nvidia,tegra234-pinmux-aon
+
+patternProperties:
+  "^pinmux(-[a-z0-9-]+)?$":
+    type: object
+
+    # pin groups
+    additionalProperties:
+      properties:
+        nvidia,pins:
+          items:
+            enum: [ can0_dout_paa0, can0_din_paa1, can1_dout_paa2,
+                    can1_din_paa3, can0_stb_paa4, can0_en_paa5,
+                    soc_gpio49_paa6, can0_err_paa7, can1_stb_pbb0,
+                    can1_en_pbb1, soc_gpio50_pbb2, can1_err_pbb3,
+                    spi2_sck_pcc0, spi2_miso_pcc1, spi2_mosi_pcc2,
+                    spi2_cs0_pcc3, touch_clk_pcc4, uart3_tx_pcc5,
+                    uart3_rx_pcc6, gen2_i2c_scl_pcc7, gen2_i2c_sda_pdd0,
+                    gen8_i2c_scl_pdd1, gen8_i2c_sda_pdd2,
+                    sce_error_pee0, vcomp_alert_pee1,
+                    ao_retention_n_pee2, batt_oc_pee3, power_on_pee4,
+                    soc_gpio26_pee5, soc_gpio27_pee6, bootv_ctl_n_pee7,
+                    hdmi_cec_pgg0,
+                    # drive groups
+                    drive_touch_clk_pcc4, drive_uart3_rx_pcc6,
+                    drive_uart3_tx_pcc5, drive_gen8_i2c_sda_pdd2,
+                    drive_gen8_i2c_scl_pdd1, drive_spi2_mosi_pcc2,
+                    drive_gen2_i2c_scl_pcc7, drive_spi2_cs0_pcc3,
+                    drive_gen2_i2c_sda_pdd0, drive_spi2_sck_pcc0,
+                    drive_spi2_miso_pcc1, drive_can1_dout_paa2,
+                    drive_can1_din_paa3, drive_can0_dout_paa0,
+                    drive_can0_din_paa1, drive_can0_stb_paa4,
+                    drive_can0_en_paa5, drive_soc_gpio49_paa6,
+                    drive_can0_err_paa7, drive_can1_stb_pbb0,
+                    drive_can1_en_pbb1, drive_soc_gpio50_pbb2,
+                    drive_can1_err_pbb3, drive_sce_error_pee0,
+                    drive_batt_oc_pee3, drive_bootv_ctl_n_pee7,
+                    drive_power_on_pee4, drive_soc_gpio26_pee5,
+                    drive_soc_gpio27_pee6, drive_ao_retention_n_pee2,
+                    drive_vcomp_alert_pee1, drive_hdmi_cec_pgg0 ]
+
+unevaluatedProperties: false
+...
Documentation/devicetree/bindings/pinctrl/nvidia,tegra234-pinmux-common.yaml new file +66 -0

66 lines not on this page · raw message

Documentation/devicetree/bindings/pinctrl/nvidia,tegra234-pinmux.yaml new file +139 -0

139 lines not on this page · raw message

Signature · 1 line
2.40.1
#5 lore raw

PATCH v4 3/3 arm64: tegra: Add Tegra234 pin controllers

In reply to Thierry Reding

From: Prathamesh Shete <[email protected]>

Add the device tree nodes for the MAIN and AON pin controllers found on the Tegra234 family of SoCs.

---
Changes in v3:
- use correct value for #address-cells and #size-cells
- correct gpio-ranges property name

 arch/arm64/boot/dts/nvidia/tegra234.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm64/boot/dts/nvidia/tegra234.dtsi +12 -0
index 133b2d32d19b..9dba05be03d2 100644
@@ -109,6 +109,7 @@ gpio: gpio@2200000 {
 			interrupt-controller;
 			#gpio-cells = <2>;
 			gpio-controller;
+			gpio-ranges = <&pinmux 0 0 164>;
 		};
 
 		ethernet@2310000 {
@@ -147,6 +148,11 @@ codec@242c000 {
 			status = "disabled";
 		};
 
+		pinmux: pinmux@2430000 {
+			compatible = "nvidia,tegra234-pinmux";
+			reg = <0x0 0x2430000 0x0 0x19100>;
+		};
+
 		gpcdma: dma-controller@2600000 {
 			compatible = "nvidia,tegra234-gpcdma",
 				     "nvidia,tegra186-gpcdma";
@@ -1805,6 +1811,12 @@ gpio_aon: gpio@c2f0000 {
 			interrupt-controller;
 			#gpio-cells = <2>;
 			gpio-controller;
+			gpio-ranges = <&pinmux_aon 0 0 32>;
+		};
+
+		pinmux_aon: pinmux@c300000 {
+			compatible = "nvidia,tegra234-pinmux-aon";
+			reg = <0x0 0xc300000 0x0 0x4000>;
 		};
 
 		pwm4: pwm@c340000 {
Signature · 1 line
2.40.1
#3 lore raw

PATCH v4 2/3 pinctrl: tegra: Add Tegra234 pinmux driver

In reply to Thierry Reding

From: Prathamesh Shete <[email protected]>

This change adds support for the two pin controllers found on Tegra234.

---
Changes in v3:
- rebase on top of pinmux function table fix:
http://patchwork.ozlabs.org/project/linux-tegra/list/?series=357206

 drivers/pinctrl/tegra/Kconfig            |    4 +
 drivers/pinctrl/tegra/Makefile           |    1 +
 drivers/pinctrl/tegra/pinctrl-tegra234.c | 1969 ++++++++++++++++++++++
 drivers/soc/tegra/Kconfig                |    1 +
 4 files changed, 1975 insertions(+)
 create mode 100644 drivers/pinctrl/tegra/pinctrl-tegra234.c
drivers/pinctrl/tegra/Kconfig +4 -0
index a67d0d9ae8cd..4e87d19323ba 100644
@@ -28,6 +28,10 @@ config PINCTRL_TEGRA194
 	bool
 	select PINCTRL_TEGRA
 
+config PINCTRL_TEGRA234
+	bool
+	select PINCTRL_TEGRA
+
 config PINCTRL_TEGRA_XUSB
 	def_bool y if ARCH_TEGRA
 	select GENERIC_PHY
drivers/pinctrl/tegra/Makefile +1 -0
index ead4e10097d0..a93973701d4c 100644
@@ -6,4 +6,5 @@ obj-$(CONFIG_PINCTRL_TEGRA114)		+= pinctrl-tegra114.o
 obj-$(CONFIG_PINCTRL_TEGRA124)		+= pinctrl-tegra124.o
 obj-$(CONFIG_PINCTRL_TEGRA210)		+= pinctrl-tegra210.o
 obj-$(CONFIG_PINCTRL_TEGRA194)		+= pinctrl-tegra194.o
+obj-$(CONFIG_PINCTRL_TEGRA234)		+= pinctrl-tegra234.o
 obj-$(CONFIG_PINCTRL_TEGRA_XUSB)	+= pinctrl-tegra-xusb.o
drivers/pinctrl/tegra/pinctrl-tegra234.c new file +1969 -0

1,969 lines not on this page · raw message

drivers/soc/tegra/Kconfig +1 -0
index e4c319f2c725..f075e2d88664 100644
@@ -125,6 +125,7 @@ config ARCH_TEGRA_234_SOC
 	bool "NVIDIA Tegra234 SoC"
 	depends on !CPU_BIG_ENDIAN
 	select MAILBOX
+	select PINCTRL_TEGRA234
 	select TEGRA_BPMP
 	select TEGRA_HSP_MBOX
 	select TEGRA_IVC
Signature · 1 line
2.40.1
#4 lore raw

Fri, Jun 02, 2023 at 04:14:44PM +0200, Thierry Reding kirjoitti:

Quoted 3 lines

From: Prathamesh Shete <[email protected]>

This change adds support for the two pin controllers found on Tegra234.

I'm not sure why my review got ignored. Did you receive it?

https://lore.kernel.org/linux-gpio/ZHlGTgdsqcGOmVN2@surfacebook/

It seems most of the comments are actual even for this version. (Yes, you can ignore the struct pingroup usage as it's out of
the scope of this change, obviously.)

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw

Re: [PATCH v4 1/3] dt-bindings: pinctrl: Document Tegra234 pin controllers

In reply to Thierry Reding
Quoted 82 lines · Thierry Reding

From: Prathamesh Shete <[email protected]>

Tegra234 contains two pin controllers. Document their compatible strings and describe the list of pins and functions that they provide.

---
Changes in v4:
- move "$ref" and "required" properties into more standard locations
- use "additionalProperties: true" for common bindings
- use unevaluatedProperties for specific bindings
- only allow valid per-SoC pin group properties
- drop unnecessary or duplicated properties

Changes in v3:
- split up into multiple files (suggested by Krzysztof)
- do not permit underscore in pinmux node names
- reword commit message

 .../pinctrl/nvidia,tegra234-pinmux-aon.yaml   |  59 ++++++++
 .../nvidia,tegra234-pinmux-common.yaml        |  66 +++++++++
 .../pinctrl/nvidia,tegra234-pinmux.yaml       | 139 ++++++++++++++++++
 3 files changed, 264 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra234-pinmux-aon.yaml
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra234-pinmux-common.yaml
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra234-pinmux.yaml
Documentation/devicetree/bindings/pinctrl/nvidia,tegra234-pinmux-aon.yaml new file +48 -0
new file mode 100644
index 000000000000..4ec969451eec
@@ -0,0 +1,59 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pinctrl/nvidia,tegra234-pinmux-aon.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NVIDIA Tegra234 AON Pinmux Controller
+
+maintainers:
+  - Thierry Reding <[email protected]>
+  - Jon Hunter <[email protected]>
+
+$ref: nvidia,tegra234-pinmux-common.yaml
+
+properties:
+  compatible:
+    const: nvidia,tegra234-pinmux-aon
+
+patternProperties:
+  "^pinmux(-[a-z0-9-]+)?$":
+    type: object
+
+    # pin groups
+    additionalProperties:
+      properties:
+        nvidia,pins:
+          items:
+            enum: [ can0_dout_paa0, can0_din_paa1, can1_dout_paa2,
+                    can1_din_paa3, can0_stb_paa4, can0_en_paa5,
+                    soc_gpio49_paa6, can0_err_paa7, can1_stb_pbb0,
+                    can1_en_pbb1, soc_gpio50_pbb2, can1_err_pbb3,
+                    spi2_sck_pcc0, spi2_miso_pcc1, spi2_mosi_pcc2,
+                    spi2_cs0_pcc3, touch_clk_pcc4, uart3_tx_pcc5,
+                    uart3_rx_pcc6, gen2_i2c_scl_pcc7, gen2_i2c_sda_pdd0,
+                    gen8_i2c_scl_pdd1, gen8_i2c_sda_pdd2,
+                    sce_error_pee0, vcomp_alert_pee1,
+                    ao_retention_n_pee2, batt_oc_pee3, power_on_pee4,
+                    soc_gpio26_pee5, soc_gpio27_pee6, bootv_ctl_n_pee7,
+                    hdmi_cec_pgg0,
+                    # drive groups
+                    drive_touch_clk_pcc4, drive_uart3_rx_pcc6,
+                    drive_uart3_tx_pcc5, drive_gen8_i2c_sda_pdd2,
+                    drive_gen8_i2c_scl_pdd1, drive_spi2_mosi_pcc2,
+                    drive_gen2_i2c_scl_pcc7, drive_spi2_cs0_pcc3,
+                    drive_gen2_i2c_sda_pdd0, drive_spi2_sck_pcc0,
+                    drive_spi2_miso_pcc1, drive_can1_dout_paa2,
+                    drive_can1_din_paa3, drive_can0_dout_paa0,
+                    drive_can0_din_paa1, drive_can0_stb_paa4,

Documentation/devicetree/bindings/pinctrl/nvidia,tegra234-pinmux-aon.yaml line 58

Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra234-pinmux-aon.yaml new file +10 -0
+                    drive_can0_en_paa5, drive_soc_gpio49_paa6,
+                    drive_can0_err_paa7, drive_can1_stb_pbb0,
+                    drive_can1_en_pbb1, drive_soc_gpio50_pbb2,
+                    drive_can1_err_pbb3, drive_sce_error_pee0,
+                    drive_batt_oc_pee3, drive_bootv_ctl_n_pee7,
+                    drive_power_on_pee4, drive_soc_gpio26_pee5,
+                    drive_soc_gpio27_pee6, drive_ao_retention_n_pee2,
+                    drive_vcomp_alert_pee1, drive_hdmi_cec_pgg0 ]
+
+unevaluatedProperties: false

I missed in the previous review, apologies, can you add here example DTS? Each device binding (except common parts) is expected to have example.

Best regards,
Krzysztof