Skip to contentSkip to conversation

pinctrl: tegra: Separate Tegra194 instances

PATCH In review Thierry Reding 3 participants 11 messages Jul 4, 2022 – Aug 16, 2022

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v2 cover pinctrl: tegra: Separate Tegra194 instances

From: Thierry Reding <[email protected]>

This patch series changes the pin controller DT description on Tegra194 in order to properly describe how the hardware works. Currently a simplified description is used that merges two pin controller instances (called AON and main) into a single DT node. This has some disadvantages such as creating a complicated mapping between the pins in those pin controllers and the corresponding GPIO controllers (which are already separated).

As a prerequisite, the first patch in this series converts the device tree bindings to json-schema. A second patch then adds an additional compatible string for the AON instance (along with more details about each controller's pins) and finally patch 3 converts the driver to cope with these changes. A fourth patch makes the corresponding changes in the Tegra194 DTS file.

Note that while this changes the DT node in an incompatible way, this doesn't have any practical implications for backwards-compatibility. The reason for this is that device trees have only reconfigured a very narrow subset of pins of the main controller, so the new driver will remain backwards-compatible with old device trees.

Changes in v2:
- address Rob's review comments on the DT bindings

Thierry

Thierry Reding (4):
dt-bindings: pinctrl: tegra: Convert to json-schema
dt-bindings: pinctrl: tegra194: Separate instances
pinctrl: tegra: Separate Tegra194 instances
arm64: tegra: Separate AON pinmux from main pinmux on Tegra194

 .../bindings/clock/nvidia,tegra124-dfll.yaml  |   2 +-
 .../pinctrl/nvidia,tegra-pinmux-common.yaml   | 195 ++++++++++++
 .../pinctrl/nvidia,tegra114-pinmux.txt        | 131 --------
 .../pinctrl/nvidia,tegra114-pinmux.yaml       | 162 ++++++++++
 .../pinctrl/nvidia,tegra124-pinmux.txt        | 153 ----------
 .../pinctrl/nvidia,tegra124-pinmux.yaml       | 182 +++++++++++
 .../pinctrl/nvidia,tegra194-pinmux.txt        | 107 -------
 .../pinctrl/nvidia,tegra194-pinmux.yaml       | 285 +++++++++++++++++
 .../pinctrl/nvidia,tegra20-pinmux.txt         | 143 ---------
 .../pinctrl/nvidia,tegra20-pinmux.yaml        | 107 +++++++
 .../pinctrl/nvidia,tegra210-pinmux.txt        | 166 ----------
 .../pinctrl/nvidia,tegra210-pinmux.yaml       | 146 +++++++++
 .../pinctrl/nvidia,tegra30-pinmux.txt         | 144 ---------
 .../pinctrl/nvidia,tegra30-pinmux.yaml        | 176 +++++++++++
 arch/arm64/boot/dts/nvidia/tegra194.dtsi      |  13 +-
 drivers/pinctrl/tegra/pinctrl-tegra.c         |  33 +-
 drivers/pinctrl/tegra/pinctrl-tegra.h         |   2 +
 drivers/pinctrl/tegra/pinctrl-tegra194.c      | 286 ++++++++++--------
 18 files changed, 1437 insertions(+), 996 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra114-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra114-pinmux.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra194-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra194-pinmux.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra30-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra30-pinmux.yaml
Signature · 1 line
2.36.1
#1 lore raw

PATCH v2 1/4 dt-bindings: pinctrl: tegra: Convert to json-schema

From: Thierry Reding <[email protected]>

Convert the NVIDIA Tegra pinmux controller bindings from the free-form text format to json-schema.

---
Changes in v2:
- wrap lines at 80 characters instead of the standard 100 characters in Linux
- use GPL-2.0-only instead of GPL-2.0+ license for DT bindings
- reorder additionalProperties for better readability
- move common definitions into a shared schema
- remove consumer snippets from examples

 .../bindings/clock/nvidia,tegra124-dfll.yaml  |   2 +-
 .../pinctrl/nvidia,tegra-pinmux-common.yaml   | 195 ++++++++++++++++++
 .../pinctrl/nvidia,tegra114-pinmux.txt        | 131 ------------
 .../pinctrl/nvidia,tegra114-pinmux.yaml       | 162 +++++++++++++++
 .../pinctrl/nvidia,tegra124-pinmux.txt        | 153 --------------
 .../pinctrl/nvidia,tegra124-pinmux.yaml       | 182 ++++++++++++++++
 .../pinctrl/nvidia,tegra194-pinmux.txt        | 107 ----------
 .../pinctrl/nvidia,tegra194-pinmux.yaml       |  88 ++++++++
 .../pinctrl/nvidia,tegra20-pinmux.txt         | 143 -------------
 .../pinctrl/nvidia,tegra20-pinmux.yaml        | 107 ++++++++++
 .../pinctrl/nvidia,tegra210-pinmux.txt        | 166 ---------------
 .../pinctrl/nvidia,tegra210-pinmux.yaml       | 146 +++++++++++++
 .../pinctrl/nvidia,tegra30-pinmux.txt         | 144 -------------
 .../pinctrl/nvidia,tegra30-pinmux.yaml        | 176 ++++++++++++++++
 14 files changed, 1057 insertions(+), 845 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra114-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra114-pinmux.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra194-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra194-pinmux.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra30-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra30-pinmux.yaml
Documentation/devicetree/bindings/clock/nvidia,tegra124-dfll.yaml +1 -1
index 85234a48b590..96c54c215f77 100644
@@ -219,7 +219,7 @@ examples:
 
     /*
      * pinmux nodes added for completeness. Binding doc can be found in:
-     * Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.txt
+     * Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.yaml
      */
 
     pinmux: pinmux@700008d4 {
Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml new file +195 -0

195 lines not on this page · raw message

Documentation/devicetree/bindings/pinctrl/nvidia,tegra114-pinmux.txt deleted +0 -131

131 lines not on this page · raw message

Documentation/devicetree/bindings/pinctrl/nvidia,tegra114-pinmux.yaml new file +162 -0

162 lines not on this page · raw message

Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt deleted +0 -153

153 lines not on this page · raw message

Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.yaml new file +182 -0

182 lines not on this page · raw message

Documentation/devicetree/bindings/pinctrl/nvidia,tegra194-pinmux.txt deleted +0 -107

107 lines not on this page · raw message

Documentation/devicetree/bindings/pinctrl/nvidia,tegra194-pinmux.yaml new file +88 -0

88 lines not on this page · raw message

Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.txt deleted +0 -143

143 lines not on this page · raw message

Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.yaml new file +107 -0

107 lines not on this page · raw message

Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.txt deleted +0 -166

166 lines not on this page · raw message

Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.yaml new file +146 -0

146 lines not on this page · raw message

Documentation/devicetree/bindings/pinctrl/nvidia,tegra30-pinmux.txt deleted +0 -144

144 lines not on this page · raw message

Documentation/devicetree/bindings/pinctrl/nvidia,tegra30-pinmux.yaml new file +176 -0

176 lines not on this page · raw message

Signature · 1 line
2.36.1
maintainer
#2 lore raw

Re: [PATCH v2 1/4] dt-bindings: pinctrl: tegra: Convert to json-schema

Quoted 65 lines · Thierry Reding

From: Thierry Reding <[email protected]>

Convert the NVIDIA Tegra pinmux controller bindings from the free-form text format to json-schema.

---
Changes in v2:
- wrap lines at 80 characters instead of the standard 100 characters in Linux
- use GPL-2.0-only instead of GPL-2.0+ license for DT bindings
- reorder additionalProperties for better readability
- move common definitions into a shared schema
- remove consumer snippets from examples

 .../bindings/clock/nvidia,tegra124-dfll.yaml  |   2 +-
 .../pinctrl/nvidia,tegra-pinmux-common.yaml   | 195 ++++++++++++++++++
 .../pinctrl/nvidia,tegra114-pinmux.txt        | 131 ------------
 .../pinctrl/nvidia,tegra114-pinmux.yaml       | 162 +++++++++++++++
 .../pinctrl/nvidia,tegra124-pinmux.txt        | 153 --------------
 .../pinctrl/nvidia,tegra124-pinmux.yaml       | 182 ++++++++++++++++
 .../pinctrl/nvidia,tegra194-pinmux.txt        | 107 ----------
 .../pinctrl/nvidia,tegra194-pinmux.yaml       |  88 ++++++++
 .../pinctrl/nvidia,tegra20-pinmux.txt         | 143 -------------
 .../pinctrl/nvidia,tegra20-pinmux.yaml        | 107 ++++++++++
 .../pinctrl/nvidia,tegra210-pinmux.txt        | 166 ---------------
 .../pinctrl/nvidia,tegra210-pinmux.yaml       | 146 +++++++++++++
 .../pinctrl/nvidia,tegra30-pinmux.txt         | 144 -------------
 .../pinctrl/nvidia,tegra30-pinmux.yaml        | 176 ++++++++++++++++
 14 files changed, 1057 insertions(+), 845 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra114-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra114-pinmux.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra194-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra194-pinmux.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra30-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra30-pinmux.yaml
Documentation/devicetree/bindings/clock/nvidia,tegra124-dfll.yaml +1 -1
index 85234a48b590..96c54c215f77 100644
@@ -219,7 +219,7 @@ examples:
 
     /*
      * pinmux nodes added for completeness. Binding doc can be found in:
-     * Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.txt
+     * Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.yaml
      */
 
     pinmux: pinmux@700008d4 {
Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml new file +3 -0
new file mode 100644
index 000000000000..cb6b722b89af
@@ -0,0 +1,195 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---

Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml line 13

Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml new file +10 -0
+$id: http://devicetree.org/schemas/pinctrl/nvidia,tegra-pinmux-common.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NVIDIA Tegra Pinmux Controller
+
+maintainers:
+  - Thierry Reding <[email protected]>
+  - Jonathan Hunter <[email protected]>
+
+definitions:

This likely doesn't work because 'definitions' doesn't get fixups applied. '$defs' would, but in general I prefer avoiding this pattern except when really needed. I don't think it helps here. More below.

Quoted 25 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml new file +25 -0
+  pinconf-node:
+    type: object
+    description: |
+      Please refer to pinctrl-bindings.txt in this directory for details of the
+      common pinctrl bindings used by client devices, including the meaning of
+      the phrase "pin configuration node".
+
+      Tegra's pin configuration nodes act as a container for an arbitrary number
+      of subnodes. Each of these subnodes represents some desired configuration
+      for a pin, a group, or a list of pins or groups. This configuration can
+      include the mux function to select on those pin(s)/ group(s), and various
+      pin configuration parameters, such as pull-up, tristate, drive strength,
+      etc.
+
+      The name of each subnode is not important; all subnodes should be
+      enumerated and processed purely based on their content.
+
+      Each subnode only affects those parameters that are explicitly listed. In
+      other words, a subnode that lists a mux function but no pin configuration
+      parameters implies no information about any pin configuration parameters.
+
+      Similarly, a pin subnode that describes a pullup parameter implies no
+      information about e.g.  the mux function or tristate parameter. For this
+      reason, even seemingly boolean values are actually tristates in this
+      binding: unspecified, off, or on. Unspecified is represented as an absent

Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml line 48

Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml new file +10 -0
+      property, and off/on are represented as integer values 0 and 1.
+
+      Note that many of these properties are only valid for certain specific pins
+      or groups. See the Tegra TRM and various pinmux spreadsheets for complete
+      details regarding which groups support which functionality. The Linux
+      pinctrl driver may also be a useful reference, since it consolidates,
+      disambiguates, and corrects data from all those sources.
+
+    patternProperties:
+      "^pinmux(-[a-z0-9-_]+)?$":

Drop this and make all the below be at the top level (i.e. no indent).

Quoted 46 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml new file +46 -0
+        type: object
+        properties:
+          nvidia,pins:
+            $ref: /schemas/types.yaml#/definitions/string-array
+            description: An array of strings. Each string contains the name of
+              a pin or group.  Valid values for these names are listed below.
+
+          nvidia,function:
+            $ref: /schemas/types.yaml#/definitions/string
+            description: A string containing the name of the function to mux to
+              the pin or group. Valid values for function names are listed
+              below. See the Tegra TRM to determine which are valid for each
+              pin or group.
+
+          nvidia,pull:
+            description: Pull-down/up setting to apply to the pin.
+            $ref: /schemas/types.yaml#/definitions/uint32
+            oneOf:
+              - description: none
+                const: 0
+              - description: down
+                const: 1
+              - description: up
+                const: 2
+
+          nvidia,tristate:
+            description: Tristate setting to apply to the pin.
+            $ref: /schemas/types.yaml#/definitions/uint32
+            oneOf:
+              - description: drive
+                const: 0
+              - description: tristate
+                const: 1
+
+          nvidia,schmitt:
+            description: Enable Schmitt trigger on the input.
+            $ref: /schemas/types.yaml#/definitions/uint32
+            oneOf:
+              - description: disable Schmitt trigger on the input
+                const: 0
+              - description: enable Schmitt trigger on the input
+                const: 1
+
+          nvidia,pull-down-strength:
+            description: Controls drive strength. 0 is weakest. The range of
+              valid values depends on the pingroup. See "CAL_DRVDN" in the

Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml line 104

Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml new file +10 -0
+              Tegra TRM.
+            $ref: /schemas/types.yaml#/definitions/uint32
+
+          nvidia,pull-up-strength:
+            description: Controls drive strength. 0 is weakest. The range of
+              valid values depends on the pingroup. See "CAL_DRVUP" in the
+              Tegra TRM.
+            $ref: /schemas/types.yaml#/definitions/uint32
+
+  high-speed-mode:

Why do all these need to be definitions? They all have the same name and apply to the pinmux nodes. Just move them there with the right name.

Quoted 78 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml new file +78 -0
+    description: Enable high speed mode the pins.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    oneOf:
+      - description: normal speed mode
+        const: 0
+      - description: high speed mode
+        const: 1
+
+  low-power-mode:
+    description: Controls the drive power or current. Valid values are
+      from 0 through 3, where 0 specifies the least power and 3 specifies
+      the most power. See "Low Power Mode" or "LPMD1" and "LPMD0" in the
+      Tegra TRM.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [ 0, 1, 2, 3 ]
+
+  enable-input:
+    description: Enable the pin's input path.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    oneOf:
+      - description: disable input (i.e. output only)
+        const: 0
+      - description: enable input
+        const: 1
+
+  open-drain:
+    description: Open-drain configuration for the pin.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    oneOf:
+      - description: disable open-drain
+        const: 0
+      - description: enable open-drain
+        const: 1
+
+  lock:
+    description: Lock the pin configuration against further changes until
+      reset.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    oneOf:
+      - description: disable pin configuration lock
+        const: 0
+      - description: enable pin configuration lock
+        const: 1
+
+  io-reset:
+    description: reset the I/O path
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [ 0, 1 ]
+
+  rcv-sel:
+    description: select VIL/VIH receivers
+    $ref: /schemas/types.yaml#/definitions/uint32
+    oneOf:
+      - description: normal receivers
+        const: 0
+      - description: high-voltage receivers
+        const: 1
+
+  drive-type:
+    description: Drive type to configure for the pin.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [ 0, 1, 2, 3 ]
+
+  io-hv:
+    description: Select high-voltage receivers.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    oneOf:
+      - description: Use normal receivers.
+        const: 0
+      - description: Use high-voltage receivers.
+        const: 1
+
+  slew-rate-rising:
+    description: Controls rising signal slew rate. 0 is fastest. The
+      range of valid values depends on the pingroup. See "DRVDN_SLWR" in
+      the Tegra TRM.
+    $ref: /schemas/types.yaml#/definitions/uint32
+

Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml line 192

Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml new file +10 -0
+  slew-rate-falling:
+    description: Controls falling signal slew rate. 0 is fastest. The
+      range of valid values depends on the pingroup. See "DRVUP_SLWF" in
+      the Tegra TRM.
+    $ref: /schemas/types.yaml#/definitions/uint32
+
+properties:
+  reg:
+    minItems: 1
+    maxItems: 4

This doesn't get used anywhere.

Quoted 27 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml new file +3 -0
+
+additionalProperties: true
+...
Documentation/devicetree/bindings/pinctrl/nvidia,tegra114-pinmux.yaml new file +16 -0
new file mode 100644
index 000000000000..e0a3f58b5535
@@ -0,0 +1,162 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pinctrl/nvidia,tegra114-pinmux.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NVIDIA Tegra114 pinmux Controller
+
+maintainers:
+  - Thierry Reding <[email protected]>
+  - Jon Hunter <[email protected]>
+
+properties:
+  compatible:
+    const: nvidia,tegra114-pinmux
+

Documentation/devicetree/bindings/pinctrl/nvidia,tegra114-pinmux.yaml line 26

Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra114-pinmux.yaml new file +10 -0
+  reg:
+    items:
+      - description: pad control registers
+      - description: mux registers
+
+additionalProperties:
+  $ref: 'nvidia,tegra-pinmux-common.yaml#/definitions/pinconf-node'
+  patternProperties:
+    "^pinmux(-[a-z0-9-_]+)?$":
+      additionalProperties: false

The reference to the common schema should then be here.

If you want to keep which properties apply, then keep 'additionalProperties' and just list them out:

nvidia,enable-input: true

Quoted 104 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra114-pinmux.yaml new file +104 -0
+      properties:
+        nvidia,pins:
+          items:
+            enum: [ ulpi_data0_po1, ulpi_data1_po2, ulpi_data2_po3,
+                    ulpi_data3_po4, ulpi_data4_po5, ulpi_data5_po6,
+                    ulpi_data6_po7, ulpi_data7_po0, ulpi_clk_py0, ulpi_dir_py1,
+                    ulpi_nxt_py2, ulpi_stp_py3, dap3_fs_pp0, dap3_din_pp1,
+                    dap3_dout_pp2, dap3_sclk_pp3, pv0, pv1, sdmmc1_clk_pz0,
+                    sdmmc1_cmd_pz1, sdmmc1_dat3_py4, sdmmc1_dat2_py5,
+                    sdmmc1_dat1_py6, sdmmc1_dat0_py7, clk2_out_pw5,
+                    clk2_req_pcc5, hdmi_int_pn7, ddc_scl_pv4, ddc_sda_pv5,
+                    uart2_rxd_pc3, uart2_txd_pc2, uart2_rts_n_pj6,
+                    uart2_cts_n_pj5, uart3_txd_pw6, uart3_rxd_pw7,
+                    uart3_cts_n_pa1, uart3_rts_n_pc0, pu0, pu1, pu2, pu3, pu4,
+                    pu5, pu6, gen1_i2c_sda_pc5, gen1_i2c_scl_pc4, dap4_fs_pp4,
+                    dap4_din_pp5, dap4_dout_pp6, dap4_sclk_pp7, clk3_out_pee0,
+                    clk3_req_pee1, gmi_wp_n_pc7, gmi_iordy_pi5, gmi_wait_pi7,
+                    gmi_adv_n_pk0, gmi_clk_pk1, gmi_cs0_n_pj0, gmi_cs1_n_pj2,
+                    gmi_cs2_n_pk3, gmi_cs3_n_pk4, gmi_cs4_n_pk2, gmi_cs6_n_pi3,
+                    gmi_cs7_n_pi6, gmi_ad0_pg0, gmi_ad1_pg1, gmi_ad2_pg2,
+                    gmi_ad3_pg3, gmi_ad4_pg4, gmi_ad5_pg5, gmi_ad6_pg6,
+                    gmi_ad7_pg7, gmi_ad8_ph0, gmi_ad9_ph1, gmi_ad10_ph2,
+                    gmi_ad11_ph3, gmi_ad12_ph4, gmi_ad13_ph5, gmi_ad14_ph6,
+                    gmi_ad15_ph7, gmi_a16_pj7, gmi_a17_pb0, gmi_a18_pb1,
+                    gmi_a19_pk7, gmi_wr_n_pi0, gmi_oe_n_pi1, gmi_dqs_p_pj3,
+                    gmi_rst_n_pi4, gen2_i2c_scl_pt5, gen2_i2c_sda_pt6,
+                    sdmmc4_clk_pcc4, sdmmc4_cmd_pt7, sdmmc4_dat0_paa0,
+                    sdmmc4_dat1_paa1, sdmmc4_dat2_paa2, sdmmc4_dat3_paa3,
+                    sdmmc4_dat4_paa4, sdmmc4_dat5_paa5, sdmmc4_dat6_paa6,
+                    sdmmc4_dat7_paa7, cam_mclk_pcc0, pcc1, pbb0,
+                    cam_i2c_scl_pbb1, cam_i2c_sda_pbb2, pbb3, pbb4, pbb5, pbb6,
+                    pbb7, pcc2, pwr_i2c_scl_pz6, pwr_i2c_sda_pz7, kb_row0_pr0,
+                    kb_row1_pr1, kb_row2_pr2, kb_row3_pr3, kb_row4_pr4,
+                    kb_row5_pr5, kb_row6_pr6, kb_row7_pr7, kb_row8_ps0,
+                    kb_row9_ps1, kb_row10_ps2, kb_col0_pq0, kb_col1_pq1,
+                    kb_col2_pq2, kb_col3_pq3, kb_col4_pq4, kb_col5_pq5,
+                    kb_col6_pq6, kb_col7_pq7, clk_32k_out_pa0, sys_clk_req_pz5,
+                    core_pwr_req, cpu_pwr_req, pwr_int_n, owr, dap1_fs_pn0,
+                    dap1_din_pn1, dap1_dout_pn2, dap1_sclk_pn3, clk1_req_pee2,
+                    clk1_out_pw4, spdif_in_pk6, spdif_out_pk5, dap2_fs_pa2,
+                    dap2_din_pa4, dap2_dout_pa5, dap2_sclk_pa3, dvfs_pwm_px0,
+                    gpio_x1_aud_px1, gpio_x3_aud_px3, dvfs_clk_px2,
+                    gpio_x4_aud_px4, gpio_x5_aud_px5, gpio_x6_aud_px6,
+                    gpio_x7_aud_px7, sdmmc3_clk_pa6, sdmmc3_cmd_pa7,
+                    sdmmc3_dat0_pb7, sdmmc3_dat1_pb6, sdmmc3_dat2_pb5,
+                    sdmmc3_dat3_pb4, hdmi_cec_pee3, sdmmc1_wp_n_pv3,
+                    sdmmc3_cd_n_pv2, gpio_w2_aud_pw2, gpio_w3_aud_pw3,
+                    usb_vbus_en0_pn4, usb_vbus_en1_pn5, sdmmc3_clk_lb_in_pee5,
+                    sdmmc3_clk_lb_out_pee4, reset_out_n,
+                    # drive groups
+                    drive_ao1, drive_ao2, drive_at1, drive_at2, drive_at3,
+                    drive_at4, drive_at5, drive_cdev1, drive_cdev2, drive_dap1,
+                    drive_dap2, drive_dap3, drive_dap4, drive_dbg, drive_sdio3,
+                    drive_spi, drive_uaa, drive_uab, drive_uart2, drive_uart3,
+                    drive_sdio1, drive_ddc, drive_gma, drive_gme, drive_gmf,
+                    drive_gmg, drive_gmh, drive_owr, drive_uda ]
+
+        nvidia,function:
+          enum: [ blink, cec, cldvfs, clk12, cpu, dap, dap1, dap2, dev3,
+                  displaya, displaya_alt, displayb, dtv, emc_dll, extperiph1,
+                  extperiph2, extperiph3, gmi, gmi_alt, hda, hsi, i2c1, i2c2,
+                  i2c3, i2c4, i2cpwr, i2s0, i2s1, i2s2, i2s3, i2s4, irda, kbc,
+                  nand, nand_alt, owr, pmi, pwm0, pwm1, pwm2, pwm3, pwron,
+                  reset_out_n, rsvd1, rsvd2, rsvd3, rsvd4, sdmmc1, sdmmc2,
+                  sdmmc3, sdmmc4, soc, spdif, spi1, spi2, spi3, spi4, spi5,
+                  spi6, sysclk, trace, uarta, uartb, uartc, uartd, ulpi, usb,
+                  vgp1, vgp2, vgp3, vgp4, vgp5, vgp6, vi, vi_alt1, vi_alt3 ]
+
+        nvidia,enable-input:
+          $ref: 'nvidia,tegra-pinmux-common.yaml#/definitions/enable-input'
+
+        nvidia,open-drain:
+          $ref: 'nvidia,tegra-pinmux-common.yaml#/definitions/open-drain'
+
+        nvidia,lock:
+          $ref: 'nvidia,tegra-pinmux-common.yaml#/definitions/lock'
+
+        nvidia,io-reset:
+          $ref: 'nvidia,tegra-pinmux-common.yaml#/definitions/io-reset'
+
+        nvidia,rcv-sel:
+          $ref: 'nvidia,tegra-pinmux-common.yaml#/definitions/rcv-sel'
+
+        nvidia,high-speed-mode:
+          $ref: 'nvidia,tegra-pinmux-common.yaml#/definitions/high-speed-mode'
+
+        nvidia,low-power-mode:
+          $ref: 'nvidia,tegra-pinmux-common.yaml#/definitions/low-power-mode'
+
+        nvidia,drive-type:
+          $ref: 'nvidia,tegra-pinmux-common.yaml#/definitions/drive-type'
+
+        nvidia,slew-rate-rising:
+          $ref: 'nvidia,tegra-pinmux-common.yaml#/definitions/slew-rate-rising'
+
+        nvidia,slew-rate-falling:
+          $ref: 'nvidia,tegra-pinmux-common.yaml#/definitions/slew-rate-falling'
+
+      required:
+        - nvidia,pins
+
+required:
+  - compatible
+  - reg

Documentation/devicetree/bindings/pinctrl/nvidia,tegra114-pinmux.yaml line 140

Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra114-pinmux.yaml new file +10 -0
+
+examples:
+  - |
+    pinmux@70000868 {
+      compatible = "nvidia,tegra114-pinmux";
+      reg = <0x70000868 0x148>, /* Pad control registers */
+            <0x70003000 0x40c>; /* PinMux registers */
+
+      pinmux {
+        sdmmc4_clk_pcc4 {

Humm, this doesn't even match the schema. The child and grandchild are swapped. It's saying any child node has only child nodes named "^pinmux(-[a-z0-9-_]+)?$".

Please test your patches. This didn't apply, so no automated checks ran. But that's not a free testing service anyways. :(

Rob

#3 lore raw

Re: [PATCH v2 1/4] dt-bindings: pinctrl: tegra: Convert to json-schema

Quoted 110 lines · Rob Herring
Quoted 65 lines · Thierry Reding

From: Thierry Reding <[email protected]>

Convert the NVIDIA Tegra pinmux controller bindings from the free-form text format to json-schema.

---
Changes in v2:
- wrap lines at 80 characters instead of the standard 100 characters in Linux
- use GPL-2.0-only instead of GPL-2.0+ license for DT bindings
- reorder additionalProperties for better readability
- move common definitions into a shared schema
- remove consumer snippets from examples

 .../bindings/clock/nvidia,tegra124-dfll.yaml  |   2 +-
 .../pinctrl/nvidia,tegra-pinmux-common.yaml   | 195 ++++++++++++++++++
 .../pinctrl/nvidia,tegra114-pinmux.txt        | 131 ------------
 .../pinctrl/nvidia,tegra114-pinmux.yaml       | 162 +++++++++++++++
 .../pinctrl/nvidia,tegra124-pinmux.txt        | 153 --------------
 .../pinctrl/nvidia,tegra124-pinmux.yaml       | 182 ++++++++++++++++
 .../pinctrl/nvidia,tegra194-pinmux.txt        | 107 ----------
 .../pinctrl/nvidia,tegra194-pinmux.yaml       |  88 ++++++++
 .../pinctrl/nvidia,tegra20-pinmux.txt         | 143 -------------
 .../pinctrl/nvidia,tegra20-pinmux.yaml        | 107 ++++++++++
 .../pinctrl/nvidia,tegra210-pinmux.txt        | 166 ---------------
 .../pinctrl/nvidia,tegra210-pinmux.yaml       | 146 +++++++++++++
 .../pinctrl/nvidia,tegra30-pinmux.txt         | 144 -------------
 .../pinctrl/nvidia,tegra30-pinmux.yaml        | 176 ++++++++++++++++
 14 files changed, 1057 insertions(+), 845 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra114-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra114-pinmux.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra194-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra194-pinmux.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra30-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra30-pinmux.yaml
Documentation/devicetree/bindings/clock/nvidia,tegra124-dfll.yaml +1 -1
index 85234a48b590..96c54c215f77 100644
@@ -219,7 +219,7 @@ examples:
 
     /*
      * pinmux nodes added for completeness. Binding doc can be found in:
-     * Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.txt
+     * Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.yaml
      */
 
     pinmux: pinmux@700008d4 {
Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml new file +3 -0
new file mode 100644
index 000000000000..cb6b722b89af
@@ -0,0 +1,195 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---

Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml line 13

Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml new file +10 -0
+$id: http://devicetree.org/schemas/pinctrl/nvidia,tegra-pinmux-common.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NVIDIA Tegra Pinmux Controller
+
+maintainers:
+  - Thierry Reding <[email protected]>
+  - Jonathan Hunter <[email protected]>
+
+definitions:

This likely doesn't work because 'definitions' doesn't get fixups applied. '$defs' would, but in general I prefer avoiding this pattern except when really needed. I don't think it helps here. More below.

Quoted 29 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml new file +29 -0
+  pinconf-node:
+    type: object
+    description: |
+      Please refer to pinctrl-bindings.txt in this directory for details of the
+      common pinctrl bindings used by client devices, including the meaning of
+      the phrase "pin configuration node".
+
+      Tegra's pin configuration nodes act as a container for an arbitrary number
+      of subnodes. Each of these subnodes represents some desired configuration
+      for a pin, a group, or a list of pins or groups. This configuration can
+      include the mux function to select on those pin(s)/ group(s), and various
+      pin configuration parameters, such as pull-up, tristate, drive strength,
+      etc.
+
+      The name of each subnode is not important; all subnodes should be
+      enumerated and processed purely based on their content.
+
+      Each subnode only affects those parameters that are explicitly listed. In
+      other words, a subnode that lists a mux function but no pin configuration
+      parameters implies no information about any pin configuration parameters.
+
+      Similarly, a pin subnode that describes a pullup parameter implies no
+      information about e.g.  the mux function or tristate parameter. For this
+      reason, even seemingly boolean values are actually tristates in this
+      binding: unspecified, off, or on. Unspecified is represented as an absent
+      property, and off/on are represented as integer values 0 and 1.
+
+      Note that many of these properties are only valid for certain specific pins
+      or groups. See the Tegra TRM and various pinmux spreadsheets for complete
Quoted 8 lines

Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml line 48

Quoted 6 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml new file +6 -0
+      details regarding which groups support which functionality. The Linux
+      pinctrl driver may also be a useful reference, since it consolidates,
+      disambiguates, and corrects data from all those sources.
+
+    patternProperties:
+      "^pinmux(-[a-z0-9-_]+)?$":

Drop this and make all the below be at the top level (i.e. no indent).

The intention was to include the general structure as well as the description in each of the derived schemas. Some of the description could perhaps be dropped, but especially the bit about the tristate nature of some of these properties should stay in because it has caused confusion in the past.

Is there any other way that the description can be shared with your proposal (other than duplicating it in each binding document).

Quoted 52 lines
Quoted 52 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml new file +51 -0
+        type: object
+        properties:
+          nvidia,pins:
+            $ref: /schemas/types.yaml#/definitions/string-array
+            description: An array of strings. Each string contains the name of
+              a pin or group.  Valid values for these names are listed below.
+
+          nvidia,function:
+            $ref: /schemas/types.yaml#/definitions/string
+            description: A string containing the name of the function to mux to
+              the pin or group. Valid values for function names are listed
+              below. See the Tegra TRM to determine which are valid for each
+              pin or group.
+
+          nvidia,pull:
+            description: Pull-down/up setting to apply to the pin.
+            $ref: /schemas/types.yaml#/definitions/uint32
+            oneOf:
+              - description: none
+                const: 0
+              - description: down
+                const: 1
+              - description: up
+                const: 2
+
+          nvidia,tristate:
+            description: Tristate setting to apply to the pin.
+            $ref: /schemas/types.yaml#/definitions/uint32
+            oneOf:
+              - description: drive
+                const: 0
+              - description: tristate
+                const: 1
+
+          nvidia,schmitt:
+            description: Enable Schmitt trigger on the input.
+            $ref: /schemas/types.yaml#/definitions/uint32
+            oneOf:
+              - description: disable Schmitt trigger on the input
+                const: 0
+              - description: enable Schmitt trigger on the input
+                const: 1
+
+          nvidia,pull-down-strength:
+            description: Controls drive strength. 0 is weakest. The range of
+              valid values depends on the pingroup. See "CAL_DRVDN" in the
+              Tegra TRM.
+            $ref: /schemas/types.yaml#/definitions/uint32
+
+          nvidia,pull-up-strength:
+            description: Controls drive strength. 0 is weakest. The range of
Quoted 8 lines

Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml line 104

Quoted 5 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml new file +5 -0
+              valid values depends on the pingroup. See "CAL_DRVUP" in the
+              Tegra TRM.
+            $ref: /schemas/types.yaml#/definitions/uint32
+
+  high-speed-mode:

Why do all these need to be definitions? They all have the same name and apply to the pinmux nodes. Just move them there with the right name.

All of the ones that are separate definitions are properties that appear for only a subset of the IP generations. So the idea was to create a definition and then derived bindings could cherry-pick these as necessary to complement the pinconf-node definition.

If I move these definitions to the top level, then they'll end up validating properly on devices where they shouldn't exist. Alternatively I'd have to duplicate all of these across various derivative bindings which gets us mostly back to the previous version of the patch (i.e. we don't save very much by only factoring out the truly common properties).

Quoted 82 lines
Quoted 82 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml new file +82 -0
+    description: Enable high speed mode the pins.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    oneOf:
+      - description: normal speed mode
+        const: 0
+      - description: high speed mode
+        const: 1
+
+  low-power-mode:
+    description: Controls the drive power or current. Valid values are
+      from 0 through 3, where 0 specifies the least power and 3 specifies
+      the most power. See "Low Power Mode" or "LPMD1" and "LPMD0" in the
+      Tegra TRM.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [ 0, 1, 2, 3 ]
+
+  enable-input:
+    description: Enable the pin's input path.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    oneOf:
+      - description: disable input (i.e. output only)
+        const: 0
+      - description: enable input
+        const: 1
+
+  open-drain:
+    description: Open-drain configuration for the pin.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    oneOf:
+      - description: disable open-drain
+        const: 0
+      - description: enable open-drain
+        const: 1
+
+  lock:
+    description: Lock the pin configuration against further changes until
+      reset.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    oneOf:
+      - description: disable pin configuration lock
+        const: 0
+      - description: enable pin configuration lock
+        const: 1
+
+  io-reset:
+    description: reset the I/O path
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [ 0, 1 ]
+
+  rcv-sel:
+    description: select VIL/VIH receivers
+    $ref: /schemas/types.yaml#/definitions/uint32
+    oneOf:
+      - description: normal receivers
+        const: 0
+      - description: high-voltage receivers
+        const: 1
+
+  drive-type:
+    description: Drive type to configure for the pin.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [ 0, 1, 2, 3 ]
+
+  io-hv:
+    description: Select high-voltage receivers.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    oneOf:
+      - description: Use normal receivers.
+        const: 0
+      - description: Use high-voltage receivers.
+        const: 1
+
+  slew-rate-rising:
+    description: Controls rising signal slew rate. 0 is fastest. The
+      range of valid values depends on the pingroup. See "DRVDN_SLWR" in
+      the Tegra TRM.
+    $ref: /schemas/types.yaml#/definitions/uint32
+
+  slew-rate-falling:
+    description: Controls falling signal slew rate. 0 is fastest. The
+      range of valid values depends on the pingroup. See "DRVUP_SLWF" in
+      the Tegra TRM.
Quoted 8 lines

Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml line 192

Quoted 6 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml new file +6 -0
+    $ref: /schemas/types.yaml#/definitions/uint32
+
+properties:
+  reg:
+    minItems: 1
+    maxItems: 4

This doesn't get used anywhere.

I think I needed the properties keyword here because the tooling would otherwise consider this schema invalid. Perhaps if I restructure this that error will go away as well.

Quoted 40 lines
Quoted 27 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml new file +3 -0
+
+additionalProperties: true
+...
Documentation/devicetree/bindings/pinctrl/nvidia,tegra114-pinmux.yaml new file +16 -0
new file mode 100644
index 000000000000..e0a3f58b5535
@@ -0,0 +1,162 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pinctrl/nvidia,tegra114-pinmux.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NVIDIA Tegra114 pinmux Controller
+
+maintainers:
+  - Thierry Reding <[email protected]>
+  - Jon Hunter <[email protected]>
+
+properties:
+  compatible:
+    const: nvidia,tegra114-pinmux
+

Documentation/devicetree/bindings/pinctrl/nvidia,tegra114-pinmux.yaml line 26

Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra114-pinmux.yaml new file +10 -0
+  reg:
+    items:
+      - description: pad control registers
+      - description: mux registers
+
+additionalProperties:
+  $ref: 'nvidia,tegra-pinmux-common.yaml#/definitions/pinconf-node'
+  patternProperties:
+    "^pinmux(-[a-z0-9-_]+)?$":
+      additionalProperties: false

The reference to the common schema should then be here.

Quoted 4 lines

If you want to keep which properties apply, then keep 'additionalProperties' and just list them out:

nvidia,enable-input: true

But then if I define the schema for nvidia,enable-input in the common schema, it'll validate for all derivative schemas as well, won't it? Or would I have to explicitly exclude those that aren't applicable to a given derivative schema using something like:

nvidia,enable-input: false

Quoted 120 lines
Quoted 105 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra114-pinmux.yaml new file +104 -0
+      properties:
+        nvidia,pins:
+          items:
+            enum: [ ulpi_data0_po1, ulpi_data1_po2, ulpi_data2_po3,
+                    ulpi_data3_po4, ulpi_data4_po5, ulpi_data5_po6,
+                    ulpi_data6_po7, ulpi_data7_po0, ulpi_clk_py0, ulpi_dir_py1,
+                    ulpi_nxt_py2, ulpi_stp_py3, dap3_fs_pp0, dap3_din_pp1,
+                    dap3_dout_pp2, dap3_sclk_pp3, pv0, pv1, sdmmc1_clk_pz0,
+                    sdmmc1_cmd_pz1, sdmmc1_dat3_py4, sdmmc1_dat2_py5,
+                    sdmmc1_dat1_py6, sdmmc1_dat0_py7, clk2_out_pw5,
+                    clk2_req_pcc5, hdmi_int_pn7, ddc_scl_pv4, ddc_sda_pv5,
+                    uart2_rxd_pc3, uart2_txd_pc2, uart2_rts_n_pj6,
+                    uart2_cts_n_pj5, uart3_txd_pw6, uart3_rxd_pw7,
+                    uart3_cts_n_pa1, uart3_rts_n_pc0, pu0, pu1, pu2, pu3, pu4,
+                    pu5, pu6, gen1_i2c_sda_pc5, gen1_i2c_scl_pc4, dap4_fs_pp4,
+                    dap4_din_pp5, dap4_dout_pp6, dap4_sclk_pp7, clk3_out_pee0,
+                    clk3_req_pee1, gmi_wp_n_pc7, gmi_iordy_pi5, gmi_wait_pi7,
+                    gmi_adv_n_pk0, gmi_clk_pk1, gmi_cs0_n_pj0, gmi_cs1_n_pj2,
+                    gmi_cs2_n_pk3, gmi_cs3_n_pk4, gmi_cs4_n_pk2, gmi_cs6_n_pi3,
+                    gmi_cs7_n_pi6, gmi_ad0_pg0, gmi_ad1_pg1, gmi_ad2_pg2,
+                    gmi_ad3_pg3, gmi_ad4_pg4, gmi_ad5_pg5, gmi_ad6_pg6,
+                    gmi_ad7_pg7, gmi_ad8_ph0, gmi_ad9_ph1, gmi_ad10_ph2,
+                    gmi_ad11_ph3, gmi_ad12_ph4, gmi_ad13_ph5, gmi_ad14_ph6,
+                    gmi_ad15_ph7, gmi_a16_pj7, gmi_a17_pb0, gmi_a18_pb1,
+                    gmi_a19_pk7, gmi_wr_n_pi0, gmi_oe_n_pi1, gmi_dqs_p_pj3,
+                    gmi_rst_n_pi4, gen2_i2c_scl_pt5, gen2_i2c_sda_pt6,
+                    sdmmc4_clk_pcc4, sdmmc4_cmd_pt7, sdmmc4_dat0_paa0,
+                    sdmmc4_dat1_paa1, sdmmc4_dat2_paa2, sdmmc4_dat3_paa3,
+                    sdmmc4_dat4_paa4, sdmmc4_dat5_paa5, sdmmc4_dat6_paa6,
+                    sdmmc4_dat7_paa7, cam_mclk_pcc0, pcc1, pbb0,
+                    cam_i2c_scl_pbb1, cam_i2c_sda_pbb2, pbb3, pbb4, pbb5, pbb6,
+                    pbb7, pcc2, pwr_i2c_scl_pz6, pwr_i2c_sda_pz7, kb_row0_pr0,
+                    kb_row1_pr1, kb_row2_pr2, kb_row3_pr3, kb_row4_pr4,
+                    kb_row5_pr5, kb_row6_pr6, kb_row7_pr7, kb_row8_ps0,
+                    kb_row9_ps1, kb_row10_ps2, kb_col0_pq0, kb_col1_pq1,
+                    kb_col2_pq2, kb_col3_pq3, kb_col4_pq4, kb_col5_pq5,
+                    kb_col6_pq6, kb_col7_pq7, clk_32k_out_pa0, sys_clk_req_pz5,
+                    core_pwr_req, cpu_pwr_req, pwr_int_n, owr, dap1_fs_pn0,
+                    dap1_din_pn1, dap1_dout_pn2, dap1_sclk_pn3, clk1_req_pee2,
+                    clk1_out_pw4, spdif_in_pk6, spdif_out_pk5, dap2_fs_pa2,
+                    dap2_din_pa4, dap2_dout_pa5, dap2_sclk_pa3, dvfs_pwm_px0,
+                    gpio_x1_aud_px1, gpio_x3_aud_px3, dvfs_clk_px2,
+                    gpio_x4_aud_px4, gpio_x5_aud_px5, gpio_x6_aud_px6,
+                    gpio_x7_aud_px7, sdmmc3_clk_pa6, sdmmc3_cmd_pa7,
+                    sdmmc3_dat0_pb7, sdmmc3_dat1_pb6, sdmmc3_dat2_pb5,
+                    sdmmc3_dat3_pb4, hdmi_cec_pee3, sdmmc1_wp_n_pv3,
+                    sdmmc3_cd_n_pv2, gpio_w2_aud_pw2, gpio_w3_aud_pw3,
+                    usb_vbus_en0_pn4, usb_vbus_en1_pn5, sdmmc3_clk_lb_in_pee5,
+                    sdmmc3_clk_lb_out_pee4, reset_out_n,
+                    # drive groups
+                    drive_ao1, drive_ao2, drive_at1, drive_at2, drive_at3,
+                    drive_at4, drive_at5, drive_cdev1, drive_cdev2, drive_dap1,
+                    drive_dap2, drive_dap3, drive_dap4, drive_dbg, drive_sdio3,
+                    drive_spi, drive_uaa, drive_uab, drive_uart2, drive_uart3,
+                    drive_sdio1, drive_ddc, drive_gma, drive_gme, drive_gmf,
+                    drive_gmg, drive_gmh, drive_owr, drive_uda ]
+
+        nvidia,function:
+          enum: [ blink, cec, cldvfs, clk12, cpu, dap, dap1, dap2, dev3,
+                  displaya, displaya_alt, displayb, dtv, emc_dll, extperiph1,
+                  extperiph2, extperiph3, gmi, gmi_alt, hda, hsi, i2c1, i2c2,
+                  i2c3, i2c4, i2cpwr, i2s0, i2s1, i2s2, i2s3, i2s4, irda, kbc,
+                  nand, nand_alt, owr, pmi, pwm0, pwm1, pwm2, pwm3, pwron,
+                  reset_out_n, rsvd1, rsvd2, rsvd3, rsvd4, sdmmc1, sdmmc2,
+                  sdmmc3, sdmmc4, soc, spdif, spi1, spi2, spi3, spi4, spi5,
+                  spi6, sysclk, trace, uarta, uartb, uartc, uartd, ulpi, usb,
+                  vgp1, vgp2, vgp3, vgp4, vgp5, vgp6, vi, vi_alt1, vi_alt3 ]
+
+        nvidia,enable-input:
+          $ref: 'nvidia,tegra-pinmux-common.yaml#/definitions/enable-input'
+
+        nvidia,open-drain:
+          $ref: 'nvidia,tegra-pinmux-common.yaml#/definitions/open-drain'
+
+        nvidia,lock:
+          $ref: 'nvidia,tegra-pinmux-common.yaml#/definitions/lock'
+
+        nvidia,io-reset:
+          $ref: 'nvidia,tegra-pinmux-common.yaml#/definitions/io-reset'
+
+        nvidia,rcv-sel:
+          $ref: 'nvidia,tegra-pinmux-common.yaml#/definitions/rcv-sel'
+
+        nvidia,high-speed-mode:
+          $ref: 'nvidia,tegra-pinmux-common.yaml#/definitions/high-speed-mode'
+
+        nvidia,low-power-mode:
+          $ref: 'nvidia,tegra-pinmux-common.yaml#/definitions/low-power-mode'
+
+        nvidia,drive-type:
+          $ref: 'nvidia,tegra-pinmux-common.yaml#/definitions/drive-type'
+
+        nvidia,slew-rate-rising:
+          $ref: 'nvidia,tegra-pinmux-common.yaml#/definitions/slew-rate-rising'
+
+        nvidia,slew-rate-falling:
+          $ref: 'nvidia,tegra-pinmux-common.yaml#/definitions/slew-rate-falling'
+
+      required:
+        - nvidia,pins
+
+required:
+  - compatible
+  - reg

Documentation/devicetree/bindings/pinctrl/nvidia,tegra114-pinmux.yaml line 140

Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra114-pinmux.yaml new file +10 -0
+
+examples:
+  - |
+    pinmux@70000868 {
+      compatible = "nvidia,tegra114-pinmux";
+      reg = <0x70000868 0x148>, /* Pad control registers */
+            <0x70003000 0x40c>; /* PinMux registers */
+
+      pinmux {
+        sdmmc4_clk_pcc4 {

Humm, this doesn't even match the schema. The child and grandchild are swapped. It's saying any child node has only child nodes named "^pinmux(-[a-z0-9-_]+)?$".

Quoted 2 lines

Please test your patches. This didn't apply, so no automated checks ran. But that's not a free testing service anyways. :(

I messed this up as I was rebasing, so the fixes for this ended up in an unrelated patch, but the end result still worked for me... =(

Thierry

maintainer
#4 lore raw

Re: [PATCH v2 1/4] dt-bindings: pinctrl: tegra: Convert to json-schema

Quoted 120 lines · Thierry Reding
Quoted 110 lines · Rob Herring
Quoted 65 lines · Thierry Reding

From: Thierry Reding <[email protected]>

Convert the NVIDIA Tegra pinmux controller bindings from the free-form text format to json-schema.

---
Changes in v2:
- wrap lines at 80 characters instead of the standard 100 characters in Linux
- use GPL-2.0-only instead of GPL-2.0+ license for DT bindings
- reorder additionalProperties for better readability
- move common definitions into a shared schema
- remove consumer snippets from examples

 .../bindings/clock/nvidia,tegra124-dfll.yaml  |   2 +-
 .../pinctrl/nvidia,tegra-pinmux-common.yaml   | 195 ++++++++++++++++++
 .../pinctrl/nvidia,tegra114-pinmux.txt        | 131 ------------
 .../pinctrl/nvidia,tegra114-pinmux.yaml       | 162 +++++++++++++++
 .../pinctrl/nvidia,tegra124-pinmux.txt        | 153 --------------
 .../pinctrl/nvidia,tegra124-pinmux.yaml       | 182 ++++++++++++++++
 .../pinctrl/nvidia,tegra194-pinmux.txt        | 107 ----------
 .../pinctrl/nvidia,tegra194-pinmux.yaml       |  88 ++++++++
 .../pinctrl/nvidia,tegra20-pinmux.txt         | 143 -------------
 .../pinctrl/nvidia,tegra20-pinmux.yaml        | 107 ++++++++++
 .../pinctrl/nvidia,tegra210-pinmux.txt        | 166 ---------------
 .../pinctrl/nvidia,tegra210-pinmux.yaml       | 146 +++++++++++++
 .../pinctrl/nvidia,tegra30-pinmux.txt         | 144 -------------
 .../pinctrl/nvidia,tegra30-pinmux.yaml        | 176 ++++++++++++++++
 14 files changed, 1057 insertions(+), 845 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra114-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra114-pinmux.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra194-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra194-pinmux.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.yaml
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra30-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra30-pinmux.yaml
Documentation/devicetree/bindings/clock/nvidia,tegra124-dfll.yaml +1 -1
index 85234a48b590..96c54c215f77 100644
@@ -219,7 +219,7 @@ examples:
 
     /*
      * pinmux nodes added for completeness. Binding doc can be found in:
-     * Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.txt
+     * Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.yaml
      */
 
     pinmux: pinmux@700008d4 {
Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml new file +3 -0
new file mode 100644
index 000000000000..cb6b722b89af
@@ -0,0 +1,195 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---

Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml line 13

Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml new file +10 -0
+$id: http://devicetree.org/schemas/pinctrl/nvidia,tegra-pinmux-common.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NVIDIA Tegra Pinmux Controller
+
+maintainers:
+  - Thierry Reding <[email protected]>
+  - Jonathan Hunter <[email protected]>
+
+definitions:

This likely doesn't work because 'definitions' doesn't get fixups applied. '$defs' would, but in general I prefer avoiding this pattern except when really needed. I don't think it helps here. More below.

Quoted 29 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml new file +29 -0
+  pinconf-node:
+    type: object
+    description: |
+      Please refer to pinctrl-bindings.txt in this directory for details of the
+      common pinctrl bindings used by client devices, including the meaning of
+      the phrase "pin configuration node".
+
+      Tegra's pin configuration nodes act as a container for an arbitrary number
+      of subnodes. Each of these subnodes represents some desired configuration
+      for a pin, a group, or a list of pins or groups. This configuration can
+      include the mux function to select on those pin(s)/ group(s), and various
+      pin configuration parameters, such as pull-up, tristate, drive strength,
+      etc.
+
+      The name of each subnode is not important; all subnodes should be
+      enumerated and processed purely based on their content.
+
+      Each subnode only affects those parameters that are explicitly listed. In
+      other words, a subnode that lists a mux function but no pin configuration
+      parameters implies no information about any pin configuration parameters.
+
+      Similarly, a pin subnode that describes a pullup parameter implies no
+      information about e.g.  the mux function or tristate parameter. For this
+      reason, even seemingly boolean values are actually tristates in this
+      binding: unspecified, off, or on. Unspecified is represented as an absent
+      property, and off/on are represented as integer values 0 and 1.
+
+      Note that many of these properties are only valid for certain specific pins
+      or groups. See the Tegra TRM and various pinmux spreadsheets for complete
Quoted 8 lines

Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml line 48

Quoted 6 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml new file +6 -0
+      details regarding which groups support which functionality. The Linux
+      pinctrl driver may also be a useful reference, since it consolidates,
+      disambiguates, and corrects data from all those sources.
+
+    patternProperties:
+      "^pinmux(-[a-z0-9-_]+)?$":

Drop this and make all the below be at the top level (i.e. no indent).

Quoted 8 lines

The intention was to include the general structure as well as the description in each of the derived schemas. Some of the description could perhaps be dropped, but especially the bit about the tristate nature of some of these properties should stay in because it has caused confusion in the past.

Is there any other way that the description can be shared with your proposal (other than duplicating it in each binding document).

The 'description' above? You can move that to top-level too.

Quoted 65 lines
Quoted 51 lines
Quoted 51 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml new file +51 -0
+        type: object
+        properties:
+          nvidia,pins:
+            $ref: /schemas/types.yaml#/definitions/string-array
+            description: An array of strings. Each string contains the name of
+              a pin or group.  Valid values for these names are listed below.
+
+          nvidia,function:
+            $ref: /schemas/types.yaml#/definitions/string
+            description: A string containing the name of the function to mux to
+              the pin or group. Valid values for function names are listed
+              below. See the Tegra TRM to determine which are valid for each
+              pin or group.
+
+          nvidia,pull:
+            description: Pull-down/up setting to apply to the pin.
+            $ref: /schemas/types.yaml#/definitions/uint32
+            oneOf:
+              - description: none
+                const: 0
+              - description: down
+                const: 1
+              - description: up
+                const: 2
+
+          nvidia,tristate:
+            description: Tristate setting to apply to the pin.
+            $ref: /schemas/types.yaml#/definitions/uint32
+            oneOf:
+              - description: drive
+                const: 0
+              - description: tristate
+                const: 1
+
+          nvidia,schmitt:
+            description: Enable Schmitt trigger on the input.
+            $ref: /schemas/types.yaml#/definitions/uint32
+            oneOf:
+              - description: disable Schmitt trigger on the input
+                const: 0
+              - description: enable Schmitt trigger on the input
+                const: 1
+
+          nvidia,pull-down-strength:
+            description: Controls drive strength. 0 is weakest. The range of
+              valid values depends on the pingroup. See "CAL_DRVDN" in the
+              Tegra TRM.
+            $ref: /schemas/types.yaml#/definitions/uint32
+
+          nvidia,pull-up-strength:
+            description: Controls drive strength. 0 is weakest. The range of
Quoted 8 lines

Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml line 104

Quoted 5 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml new file +5 -0
+              valid values depends on the pingroup. See "CAL_DRVUP" in the
+              Tegra TRM.
+            $ref: /schemas/types.yaml#/definitions/uint32
+
+  high-speed-mode:

Why do all these need to be definitions? They all have the same name and apply to the pinmux nodes. Just move them there with the right name.

All of the ones that are separate definitions are properties that appear for only a subset of the IP generations. So the idea was to create a definition and then derived bindings could cherry-pick these as necessary to complement the pinconf-node definition.

Quoted 5 lines

If I move these definitions to the top level, then they'll end up validating properly on devices where they shouldn't exist. Alternatively I'd have to duplicate all of these across various derivative bindings which gets us mostly back to the previous version of the patch (i.e. we don't save very much by only factoring out the truly common properties).

Not if you use 'additionalProperties: false'. Since it doesn't see into $ref's like unevaluatedProperties does, you have to list out which properties you are using in the derived binding:

$ref: list-of-common-props.yaml#

properties:
high-speed-mode: true

additionalProperties: false

list-of-common-props.yaml could have a gazillion properties in it, but anything not listed locally will be disallowed.

Quoted 91 lines
Quoted 82 lines
Quoted 82 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml new file +82 -0
+    description: Enable high speed mode the pins.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    oneOf:
+      - description: normal speed mode
+        const: 0
+      - description: high speed mode
+        const: 1
+
+  low-power-mode:
+    description: Controls the drive power or current. Valid values are
+      from 0 through 3, where 0 specifies the least power and 3 specifies
+      the most power. See "Low Power Mode" or "LPMD1" and "LPMD0" in the
+      Tegra TRM.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [ 0, 1, 2, 3 ]
+
+  enable-input:
+    description: Enable the pin's input path.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    oneOf:
+      - description: disable input (i.e. output only)
+        const: 0
+      - description: enable input
+        const: 1
+
+  open-drain:
+    description: Open-drain configuration for the pin.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    oneOf:
+      - description: disable open-drain
+        const: 0
+      - description: enable open-drain
+        const: 1
+
+  lock:
+    description: Lock the pin configuration against further changes until
+      reset.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    oneOf:
+      - description: disable pin configuration lock
+        const: 0
+      - description: enable pin configuration lock
+        const: 1
+
+  io-reset:
+    description: reset the I/O path
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [ 0, 1 ]
+
+  rcv-sel:
+    description: select VIL/VIH receivers
+    $ref: /schemas/types.yaml#/definitions/uint32
+    oneOf:
+      - description: normal receivers
+        const: 0
+      - description: high-voltage receivers
+        const: 1
+
+  drive-type:
+    description: Drive type to configure for the pin.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [ 0, 1, 2, 3 ]
+
+  io-hv:
+    description: Select high-voltage receivers.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    oneOf:
+      - description: Use normal receivers.
+        const: 0
+      - description: Use high-voltage receivers.
+        const: 1
+
+  slew-rate-rising:
+    description: Controls rising signal slew rate. 0 is fastest. The
+      range of valid values depends on the pingroup. See "DRVDN_SLWR" in
+      the Tegra TRM.
+    $ref: /schemas/types.yaml#/definitions/uint32
+
+  slew-rate-falling:
+    description: Controls falling signal slew rate. 0 is fastest. The
+      range of valid values depends on the pingroup. See "DRVUP_SLWF" in
+      the Tegra TRM.
Quoted 8 lines

Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml line 192

Quoted 6 lines
Documentation/devicetree/bindings/pinctrl/nvidia,tegra-pinmux-common.yaml new file +6 -0
+    $ref: /schemas/types.yaml#/definitions/uint32
+
+properties:
+  reg:
+    minItems: 1
+    maxItems: 4

This doesn't get used anywhere.

Quoted 3 lines

I think I needed the properties keyword here because the tooling would otherwise consider this schema invalid. Perhaps if I restructure this that error will go away as well.

Probably so. All part of keeping people within the lines. :)

Rob

#5 lore raw

Re: [PATCH v2 1/4] dt-bindings: pinctrl: tegra: Convert to json-schema

Quoted 18 lines · Rob Herring
Quoted 10 lines · Thierry Reding

All of the ones that are separate definitions are properties that appear for only a subset of the IP generations. So the idea was to create a definition and then derived bindings could cherry-pick these as necessary to complement the pinconf-node definition.

If I move these definitions to the top level, then they'll end up validating properly on devices where they shouldn't exist. Alternatively I'd have to duplicate all of these across various derivative bindings which gets us mostly back to the previous version of the patch (i.e. we don't save very much by only factoring out the truly common properties).

Not if you use 'additionalProperties: false'. Since it doesn't see into $ref's like unevaluatedProperties does, you have to list out which properties you are using in the derived binding:

$ref: list-of-common-props.yaml#

Quoted 7 lines

properties:
high-speed-mode: true

additionalProperties: false

list-of-common-props.yaml could have a gazillion properties in it, but anything not listed locally will be disallowed.

I tried to restructure as you suggested and things do look better. Unfortunately I can't find a way to get the result to validate properly. The problem I'm running into is that these are vendor-specific properties (with the "nvidia," prefix) and therefore the tools complain when I list them as above, like so:

	.../Documentation/devicetree/bindings/pinctrl/nvidia,tegra194-pinmux.yaml: patternProperties:^pinmux(-[a-z0-9-_]+)?$:properties:nvidia,drive-type: True is not of type 'object'
	hint: Vendor specific properties must have a type and description unless they have a defined, common suffix.
	from schema $id: http://devicetree.org/meta-schemas/vendor-props.yaml#
	.../Documentation/devicetree/bindings/pinctrl/nvidia,tegra194-pinmux.yaml: patternProperties:^pinmux(-[a-z0-9-_]+)?$:properties:nvidia,drive-type: More than one condition true in oneOf schema:
	{'description': 'Vendor specific properties must have a type and '
	                'description unless they have a defined, common '
	                'suffix.',
	 'oneOf': [{'additionalProperties': False,
	            'description': 'A vendor boolean property can use "type: '
	                           'boolean"',
	            'properties': {'deprecated': True,
	                           'description': True,
	                           'type': {'const': 'boolean'}},
	            'required': ['type', 'description']},
	           {'additionalProperties': False,
	            'description': 'A vendor string property with exact values '
	                           'has an implicit type',
	            'oneOf': [{'required': ['enum']}, {'required': ['const']}],
	            'properties': {'const': {'type': 'string'},
	                           'deprecated': True,
	                           'description': True,
	                           'enum': {'items': {'type': 'string'}}},
	            'required': ['description']},
	           {'description': 'A vendor property needs a $ref to '
	                           'types.yaml',
	            'oneOf': [{'required': ['$ref']}, {'required': ['allOf']}],
	            'properties': {'$ref': {'pattern': 'types.yaml#/definitions/'},
	                           'allOf': {'items': [{'properties': {'$ref': {'pattern': 'types.yaml#/definitions/'}},
	                                                'required': ['$ref']}]}},
	            'required': ['description']},
	           {'description': 'A vendor property can have a $ref to a a '
	                           '$defs schema',
	            'properties': {'$ref': {'pattern': '^#/(definitions|\\$defs)/'}},
	            'required': ['$ref']}],
	 'type': 'object'}
	hint: Vendor specific properties must have a type and description unless they have a defined, common suffix.
	from schema $id: http://devicetree.org/meta-schemas/vendor-props.yaml#

I'm attaching two example files (not the actual patch, because that'd make this a bit more difficult to review) but this happens for all the derivatives.

I've been scratching my head for a while now and tried different combinations, but I can't think of a way to make this work. I'm also not sure if I'm reading that error report right, but it sounds like the tooling wants the vendor properties to be fully defined, even for the simple cases where I just want to mark them as valid (i.e. cancel out the effect of 'additionalProperties: false'). Is there some special mechanism that I could somehow enable regular behaviour for these vendor-specific properties?

Any other ideas on how to fix this?

Thierry

# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/pinctrl/nvidia,tegra-pinmux-common.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: NVIDIA Tegra Pinmux Controller

maintainers:
- Thierry Reding <[email protected]>
- Jonathan Hunter <[email protected]>

description: |
Please refer to pinctrl-bindings.txt in this directory for details of the common pinctrl bindings used by client devices, including the meaning of the phrase "pin configuration node".

Tegra's pin configuration nodes act as a container for an arbitrary number of subnodes. Each of these subnodes represents some desired configuration for a pin, a group, or a list of pins or groups. This configuration can include the mux function to select on those pin(s)/ group(s), and various pin configuration parameters, such as pull-up, tristate, drive strength, etc.

The name of each subnode is not important; all subnodes should be enumerated and processed purely based on their content.

Each subnode only affects those parameters that are explicitly listed. In other words, a subnode that lists a mux function but no pin configuration parameters implies no information about any pin configuration parameters.

Similarly, a pin subnode that describes a pullup parameter implies no information about e.g. the mux function or tristate parameter. For this reason, even seemingly boolean values are actually tristates in this
binding: unspecified, off, or on. Unspecified is represented as an absent property, and off/on are represented as integer values 0 and 1.

Note that many of these properties are only valid for certain specific pins or groups. See the Tegra TRM and various pinmux spreadsheets for complete details regarding which groups support which functionality. The Linux pinctrl driver may also be a useful reference, since it consolidates, disambiguates, and corrects data from all those sources.

properties:
nvidia,pins:
$ref: /schemas/types.yaml#/definitions/string-array
description: An array of strings. Each string contains the name of a pin
or group. Valid values for these names are listed below.

nvidia,function:
$ref: /schemas/types.yaml#/definitions/string
description: A string containing the name of the function to mux to the
pin or group. Valid values for function names are listed below. See the Tegra TRM to determine which are valid for each pin or group.

nvidia,pull:
description: Pull-down/up setting to apply to the pin. $ref: /schemas/types.yaml#/definitions/uint32 oneOf:
- description: none
const: 0
- description: down
const: 1
- description: up
const: 2

nvidia,tristate:
description: Tristate setting to apply to the pin. $ref: /schemas/types.yaml#/definitions/uint32 oneOf:
- description: drive
const: 0
- description: tristate
const: 1

nvidia,schmitt:
description: Enable Schmitt trigger on the input. $ref: /schemas/types.yaml#/definitions/uint32 oneOf:
- description: disable Schmitt trigger on the input
const: 0
- description: enable Schmitt trigger on the input
const: 1

nvidia,pull-down-strength:
description: Controls drive strength. 0 is weakest. The range of valid
values depends on the pingroup. See "CAL_DRVDN" in the Tegra TRM.
$ref: /schemas/types.yaml#/definitions/uint32

nvidia,pull-up-strength:
description: Controls drive strength. 0 is weakest. The range of valid
values depends on the pingroup. See "CAL_DRVUP" in the Tegra TRM.
$ref: /schemas/types.yaml#/definitions/uint32

nvidia,high-speed-mode:
description: Enable high speed mode the pins.
$ref: /schemas/types.yaml#/definitions/uint32
oneOf:
- description: normal speed mode
const: 0
- description: high speed mode
const: 1

nvidia,low-power-mode:
description: Controls the drive power or current. Valid values are from 0
through 3, where 0 specifies the least power and 3 specifies the most power. See "Low Power Mode" or "LPMD1" and "LPMD0" in the Tegra TRM.
$ref: /schemas/types.yaml#/definitions/uint32
enum: [ 0, 1, 2, 3 ]

nvidia,enable-input:
description: Enable the pin's input path. $ref: /schemas/types.yaml#/definitions/uint32 oneOf:
- description: disable input (i.e. output only)
const: 0
- description: enable input
const: 1

nvidia,open-drain:
description: Open-drain configuration for the pin. $ref: /schemas/types.yaml#/definitions/uint32 oneOf:
- description: disable open-drain
const: 0
- description: enable open-drain
const: 1

nvidia,lock:
description: Lock the pin configuration against further changes until
reset.
$ref: /schemas/types.yaml#/definitions/uint32
oneOf:
- description: disable pin configuration lock
const: 0
- description: enable pin configuration lock
const: 1

nvidia,io-reset:
description: reset the I/O path
$ref: /schemas/types.yaml#/definitions/uint32
enum: [ 0, 1 ]

nvidia,rcv-sel:
description: select VIL/VIH receivers
$ref: /schemas/types.yaml#/definitions/uint32
oneOf:
- description: normal receivers
const: 0
- description: high-voltage receivers
const: 1

nvidia,drive-type:
description: Drive type to configure for the pin. $ref: /schemas/types.yaml#/definitions/uint32
enum: [ 0, 1, 2, 3 ]

nvidia,io-hv:
description: Select high-voltage receivers.
$ref: /schemas/types.yaml#/definitions/uint32
oneOf:
- description: Use normal receivers.
const: 0
- description: Use high-voltage receivers.
const: 1

nvidia,slew-rate-rising:
description: Controls rising signal slew rate. 0 is fastest. The range of
valid values depends on the pingroup. See "DRVDN_SLWR" in the Tegra TRM.
$ref: /schemas/types.yaml#/definitions/uint32

nvidia,slew-rate-falling:
description: Controls falling signal slew rate. 0 is fastest. The range of
valid values depends on the pingroup. See "DRVUP_SLWF" in the Tegra TRM.
$ref: /schemas/types.yaml#/definitions/uint32

additionalProperties: true
...

# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) %YAML 1.2
---
$id: http://devicetree.org/schemas/pinctrl/nvidia,tegra194-pinmux.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: NVIDIA Tegra194 Pinmux Controller

maintainers:
- Thierry Reding <[email protected]>
- Jon Hunter <[email protected]>

properties:
compatible:
enum:
- nvidia,tegra194-pinmux
- nvidia,tegra194-pinmux-aon

reg:
items:
- description: pinmux registers

patternProperties:
"^pinmux(-[a-z0-9-_]+)?$":
$ref: nvidia,tegra-pinmux-common.yaml
additionalProperties: false
properties:
nvidia,function:
enum: [ aud, can0, can1, ccla, dca, dcb, dgpu, directdc, directdc1,
displaya, displayb, dmic1, dmic2, dmic3, dmic4, dmic5, dp, dspk0, dspk1, eqos, extperiph1, extperiph2, extperiph3, extperiph4, gp, gpio, hdmi, i2c1, i2c2, i2c3, i2c5, i2c8, i2s1, i2s2, i2s3, i2s4, i2s5, i2s6, igpu, iqc1, iqc2, mipi, nv, pe0, pe1, pe2, pe3, pe4, pe5, qspi, qspi0, qspi1, rsvd0, rsvd1, rsvd2, rsvd3, sata, sce, sdmmc1, sdmmc3, sdmmc4, slvs, soc, spdif, spi1, spi2, spi3, touch, uarta, uartb, uartc, uartd, uarte, uartg, ufs0, usb, vgp1, vgp2, vgp3, vgp4, vgp5, vgp6, wdt ]

nvidia,enable-input: true
nvidia,open-drain: true
nvidia,lock: true
nvidia,io-hv: true
nvidia,drive-type: true

required:
- nvidia,pins

additionalProperties: false

allOf:
- if:

      properties:
        compatible:
          const: nvidia,tegra194-pinmux
    then:
      patternProperties:
        "^pinmux(-[a-z0-9-_]+)?$":
          type: object
          properties:
            nvidia,pins:
              description: An array of strings. Each string contains the name
                of a pin or group. Valid values for these names are listed
                below.

                Note that the pex_l5_clkreq_n_pgg0 and pex_l5_rst_n_pgg1 pins
                are part of PCIE C5 power partition. Client devices must
                enable this partition before accessing the configuration for
                these pins.
              items:
                enum: [ dap6_sclk_pa0, dap6_dout_pa1, dap6_din_pa2,
                        dap6_fs_pa3, dap4_sclk_pa4, dap4_dout_pa5,
                        dap4_din_pa6, dap4_fs_pa7, cpu_pwr_req_0_pb0,
                        cpu_pwr_req_1_pb1, qspi0_sck_pc0, qspi0_cs_n_pc1,
                        qspi0_io0_pc2, qspi0_io1_pc3, qspi0_io2_pc4,
                        qspi0_io3_pc5, qspi1_sck_pc6, qspi1_cs_n_pc7,
                        qspi1_io0_pd0, qspi1_io1_pd1, qspi1_io2_pd2,
                        qspi1_io3_pd3, eqos_txc_pe0, eqos_td0_pe1,
                        eqos_td1_pe2, eqos_td2_pe3, eqos_td3_pe4,
                        eqos_tx_ctl_pe5, eqos_rd0_pe6, eqos_rd1_pe7,
                        eqos_rd2_pf0, eqos_rd3_pf1, eqos_rx_ctl_pf2,
                        eqos_rxc_pf3, eqos_sma_mdio_pf4, eqos_sma_mdc_pf5,
                        soc_gpio00_pg0, soc_gpio01_pg1, soc_gpio02_pg2,
                        soc_gpio03_pg3, soc_gpio08_pg4, soc_gpio09_pg5,
                        soc_gpio10_pg6, soc_gpio11_pg7, soc_gpio12_ph0,
                        soc_gpio13_ph1, soc_gpio14_ph2, uart4_tx_ph3,
                        uart4_rx_ph4, uart4_rts_ph5, uart4_cts_ph6,
                        dap2_sclk_ph7, dap2_dout_pi0, dap2_din_pi1,
                        dap2_fs_pi2, gen1_i2c_scl_pi3, gen1_i2c_sda_pi4,
                        sdmmc1_clk_pj0, sdmmc1_cmd_pj1, sdmmc1_dat0_pj2,
                        sdmmc1_dat1_pj3, sdmmc1_dat2_pj4, sdmmc1_dat3_pj5,
                        pex_l0_clkreq_n_pk0, pex_l0_rst_n_pk1,
                        pex_l1_clkreq_n_pk2, pex_l1_rst_n_pk3,
                        pex_l2_clkreq_n_pk4, pex_l2_rst_n_pk5,
                        pex_l3_clkreq_n_pk6, pex_l3_rst_n_pk7,
                        pex_l4_clkreq_n_pl0, pex_l4_rst_n_pl1,
                        pex_wake_n_pl2, sata_dev_slp_pl3, dp_aux_ch0_hpd_pm0,
                        dp_aux_ch1_hpd_pm1, dp_aux_ch2_hpd_pm2,
                        dp_aux_ch3_hpd_pm3, hdmi_cec_pm4, soc_gpio50_pm5,
                        soc_gpio51_pm6, soc_gpio52_pm7, soc_gpio53_pn0,
                        soc_gpio54_pn1, soc_gpio55_pn2, sdmmc3_clk_po0,
                        sdmmc3_cmd_po1, sdmmc3_dat0_po2, sdmmc3_dat1_po3,
                        sdmmc3_dat2_po4, sdmmc3_dat3_po5, extperiph1_clk_pp0,
                        extperiph2_clk_pp1, cam_i2c_scl_pp2, cam_i2c_sda_pp3,
                        soc_gpio04_pp4, soc_gpio05_pp5, soc_gpio06_pp6,
                        soc_gpio07_pp7, soc_gpio20_pq0, soc_gpio21_pq1,
                        soc_gpio22_pq2, soc_gpio23_pq3, soc_gpio40_pq4,
                        soc_gpio41_pq5, soc_gpio42_pq6, soc_gpio43_pq7,
                        soc_gpio44_pr0, soc_gpio45_pr1, uart1_tx_pr2,
                        uart1_rx_pr3, uart1_rts_pr4, uart1_cts_pr5,
                        dap1_sclk_ps0, dap1_dout_ps1, dap1_din_ps2,
                        dap1_fs_ps3, aud_mclk_ps4, soc_gpio30_ps5,
                        soc_gpio31_ps6, soc_gpio32_ps7, soc_gpio33_pt0,
                        dap3_sclk_pt1, dap3_dout_pt2, dap3_din_pt3,
                        dap3_fs_pt4, dap5_sclk_pt5, dap5_dout_pt6,
                        dap5_din_pt7, dap5_fs_pu0, directdc1_clk_pv0,
                        directdc1_in_pv1, directdc1_out0_pv2,
                        directdc1_out1_pv3, directdc1_out2_pv4,
                        directdc1_out3_pv5, directdc1_out4_pv6,
                        directdc1_out5_pv7, directdc1_out6_pw0,
                        directdc1_out7_pw1, gpu_pwr_req_px0, cv_pwr_req_px1,
                        gp_pwm2_px2, gp_pwm3_px3, uart2_tx_px4, uart2_rx_px5,
                        uart2_rts_px6, uart2_cts_px7, spi3_sck_py0,
                        spi3_miso_py1, spi3_mosi_py2, spi3_cs0_py3,
                        spi3_cs1_py4, uart5_tx_py5, uart5_rx_py6,
                        uart5_rts_py7, uart5_cts_pz0, usb_vbus_en0_pz1,
                        usb_vbus_en1_pz2, spi1_sck_pz3, spi1_miso_pz4,
                        spi1_mosi_pz5, spi1_cs0_pz6, spi1_cs1_pz7,
                        ufs0_ref_clk_pff0, ufs0_rst_pff1,
                        pex_l5_clkreq_n_pgg0, pex_l5_rst_n_pgg1,
                        directdc_comp, sdmmc4_clk, sdmmc4_cmd, sdmmc4_dqs,
                        sdmmc4_dat7, sdmmc4_dat6, sdmmc4_dat5, sdmmc4_dat4,
                        sdmmc4_dat3, sdmmc4_dat2, sdmmc4_dat1, sdmmc4_dat0,
                        sdmmc1_comp, sdmmc1_hv_trim, sdmmc3_comp,
                        sdmmc3_hv_trim, eqos_comp, qspi_comp,
                        # drive groups
                        drive_soc_gpio33_pt0, drive_soc_gpio32_ps7,
                        drive_soc_gpio31_ps6, drive_soc_gpio30_ps5,
                        drive_aud_mclk_ps4, drive_dap1_fs_ps3,
                        drive_dap1_din_ps2, drive_dap1_dout_ps1,
                        drive_dap1_sclk_ps0, drive_dap3_fs_pt4,
                        drive_dap3_din_pt3, drive_dap3_dout_pt2,
                        drive_dap3_sclk_pt1, drive_dap5_fs_pu0,
                        drive_dap5_din_pt7, drive_dap5_dout_pt6,
                        drive_dap5_sclk_pt5, drive_dap6_fs_pa3,
                        drive_dap6_din_pa2, drive_dap6_dout_pa1,
                        drive_dap6_sclk_pa0, drive_dap4_fs_pa7,
                        drive_dap4_din_pa6, drive_dap4_dout_pa5,
                        drive_dap4_sclk_pa4, drive_extperiph2_clk_pp1,
                        drive_extperiph1_clk_pp0, drive_cam_i2c_sda_pp3,
                        drive_cam_i2c_scl_pp2, drive_soc_gpio40_pq4,
                        drive_soc_gpio41_pq5, drive_soc_gpio42_pq6,
                        drive_soc_gpio43_pq7, drive_soc_gpio44_pr0,
                        drive_soc_gpio45_pr1, drive_soc_gpio20_pq0,
                        drive_soc_gpio21_pq1, drive_soc_gpio22_pq2,
                        drive_soc_gpio23_pq3, drive_soc_gpio04_pp4,
                        drive_soc_gpio05_pp5, drive_soc_gpio06_pp6,
                        drive_soc_gpio07_pp7, drive_uart1_cts_pr5,
                        drive_uart1_rts_pr4, drive_uart1_rx_pr3,
                        drive_uart1_tx_pr2, drive_dap2_din_pi1,
                        drive_dap2_dout_pi0, drive_dap2_fs_pi2,
                        drive_dap2_sclk_ph7, drive_uart4_cts_ph6,
                        drive_uart4_rts_ph5, drive_uart4_rx_ph4,
                        drive_uart4_tx_ph3, drive_soc_gpio03_pg3,
                        drive_soc_gpio02_pg2, drive_soc_gpio01_pg1,
                        drive_soc_gpio00_pg0, drive_gen1_i2c_scl_pi3,
                        drive_gen1_i2c_sda_pi4, drive_soc_gpio08_pg4,
                        drive_soc_gpio09_pg5, drive_soc_gpio10_pg6,
                        drive_soc_gpio11_pg7, drive_soc_gpio12_ph0,
                        drive_soc_gpio13_ph1, drive_soc_gpio14_ph2,
                        drive_soc_gpio50_pm5, drive_soc_gpio51_pm6,
                        drive_soc_gpio52_pm7, drive_soc_gpio53_pn0,
                        drive_soc_gpio54_pn1, drive_soc_gpio55_pn2,
                        drive_dp_aux_ch0_hpd_pm0, drive_dp_aux_ch1_hpd_pm1,
                        drive_dp_aux_ch2_hpd_pm2, drive_dp_aux_ch3_hpd_pm3,
                        drive_hdmi_cec_pm4, drive_pex_l2_clkreq_n_pk4,
                        drive_pex_wake_n_pl2, drive_pex_l1_clkreq_n_pk2,
                        drive_pex_l1_rst_n_pk3, drive_pex_l0_clkreq_n_pk0,
                        drive_pex_l0_rst_n_pk1, drive_pex_l2_rst_n_pk5,
                        drive_pex_l3_clkreq_n_pk6, drive_pex_l3_rst_n_pk7,
                        drive_pex_l4_clkreq_n_pl0, drive_pex_l4_rst_n_pl1,
                        drive_sata_dev_slp_pl3, drive_pex_l5_clkreq_n_pgg0,
                        drive_pex_l5_rst_n_pgg1, drive_cpu_pwr_req_1_pb1,
                        drive_cpu_pwr_req_0_pb0, drive_sdmmc1_clk_pj0,
                        drive_sdmmc1_cmd_pj1, drive_sdmmc1_dat3_pj5,
                        drive_sdmmc1_dat2_pj4, drive_sdmmc1_dat1_pj3,
                        drive_sdmmc1_dat0_pj2, drive_sdmmc3_dat3_po5,
                        drive_sdmmc3_dat2_po4, drive_sdmmc3_dat1_po3,
                        drive_sdmmc3_dat0_po2, drive_sdmmc3_cmd_po1,
                        drive_sdmmc3_clk_po0, drive_gpu_pwr_req_px0,
                        drive_spi3_miso_py1, drive_spi1_cs0_pz6,
                        drive_spi3_cs0_py3, drive_spi1_miso_pz4,
                        drive_spi3_cs1_py4, drive_gp_pwm3_px3,
                        drive_gp_pwm2_px2, drive_spi1_sck_pz3,
                        drive_spi3_sck_py0, drive_spi1_cs1_pz7,
                        drive_spi1_mosi_pz5, drive_spi3_mosi_py2,
                        drive_cv_pwr_req_px1, drive_uart2_tx_px4,
                        drive_uart2_rx_px5, drive_uart2_rts_px6,
                        drive_uart2_cts_px7, drive_uart5_rx_py6,
                        drive_uart5_tx_py5, drive_uart5_rts_py7,
                        drive_uart5_cts_pz0, drive_usb_vbus_en0_pz1,
                        drive_usb_vbus_en1_pz2, drive_ufs0_rst_pff1,
                        drive_ufs0_ref_clk_pff0 ]

- if:

      properties:
        compatible:
          const: nvidia,tegra194-pinmux-aon
    then:
      patternProperties:
        "^pinmux(-[a-z0-9-_]+)?$":
          type: object
          properties:
            nvidia,pins:
              items:
                enum: [ can1_dout_paa0, can1_din_paa1, can0_dout_paa2,
                        can0_din_paa3, can0_stb_paa4, can0_en_paa5,
                        can0_wake_paa6, can0_err_paa7, can1_stb_pbb0,
                        can1_en_pbb1, can1_wake_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,
                        safe_state_pee0, vcomp_alert_pee1,
                        ao_retention_n_pee2, batt_oc_pee3, power_on_pee4,
                        pwr_i2c_scl_pee5, pwr_i2c_sda_pee6, sys_reset_n,
                        shutdown_n, pmu_int_n, soc_pwr_req, clk_32k_in,
                        # drive groups
                        drive_shutdown_n, drive_pmu_int_n,
                        drive_safe_state_pee0, drive_vcomp_alert_pee1,
                        drive_soc_pwr_req, drive_batt_oc_pee3,
                        drive_clk_32k_in, drive_power_on_pee4,
                        drive_pwr_i2c_scl_pee5, drive_pwr_i2c_sda_pee6,
                        drive_ao_retention_n_pee2, 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_paa0, drive_can1_din_paa1,
                        drive_can0_dout_paa2, drive_can0_din_paa3,
                        drive_can0_stb_paa4, drive_can0_en_paa5,
                        drive_can0_wake_paa6, drive_can0_err_paa7,
                        drive_can1_stb_pbb0, drive_can1_en_pbb1,
                        drive_can1_wake_pbb2, drive_can1_err_pbb3 ]

required:
- compatible
- reg

examples:
- |

    #include <dt-bindings/pinctrl/pinctrl-tegra.h>

    pinmux@2430000 {
      compatible = "nvidia,tegra194-pinmux";
      reg = <0x2430000 0x17000>;

      pinctrl-names = "pex_rst";
      pinctrl-0 = <&pex_rst_c5_out_state>;

      pex_rst_c5_out_state: pex_rst_c5_out {
        pex_rst {
          nvidia,pins = "pex_l5_rst_n_pgg1";
          nvidia,schmitt = <TEGRA_PIN_DISABLE>;
          nvidia,enable-input = <TEGRA_PIN_DISABLE>;
          nvidia,io-hv = <TEGRA_PIN_ENABLE>;
          nvidia,tristate = <TEGRA_PIN_DISABLE>;
          nvidia,pull = <TEGRA_PIN_PULL_NONE>;
        };
      };
    };

...

#6 lore raw

PATCH v2 2/4 dt-bindings: pinctrl: tegra194: Separate instances

In reply to Thierry Reding

From: Thierry Reding <[email protected]>

Tegra194 has two separate instances of the pin controller, one called AON (in the always-on domain) and another called "main". Instead of treating them as a single pin controller, split them up into two separate controllers. Doing so allows the mapping between the pinmux and GPIO controllers to be trivial identity mappings and more cleanly separates the AON from the main IP blocks.

Note that while this changes the DT node in an incompatible way, this doesn't have any practical implications for backwards-compatibility. The reason for this is that device trees have only reconfigured a very narrow subset of pins of the main controller, so the new driver will remain backwards-compatible with old device trees.

---
Changes in v2:
- add missing "type: object" to patternProperties nodes
- add note about backwards-compatibility

 .../pinctrl/nvidia,tegra194-pinmux.yaml       | 235 ++++++++++++++++--
 1 file changed, 216 insertions(+), 19 deletions(-)
Documentation/devicetree/bindings/pinctrl/nvidia,tegra194-pinmux.yaml +216 -19
index 322e146d52dd..0dd2ff6ace0f 100644
@@ -1,4 +1,4 @@
-# SPDX-License-Identifier: (GPL-2.0+ OR BSD-2-Clause)
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
 %YAML 1.2
 ---
 $id: http://devicetree.org/schemas/pinctrl/nvidia,tegra194-pinmux.yaml#
@@ -12,12 +12,13 @@ maintainers:
 
 properties:
   compatible:
-    const: nvidia,tegra194-pinmux
+    enum:
+      - nvidia,tegra194-pinmux
+      - nvidia,tegra194-pinmux-aon
 
   reg:
     items:
-      - description: APB_MISC_GP_*_PADCTRL registers (pad control)
-      - description: PINMUX_AUX_* registers (pinmux)
+      - description: pinmux registers
 
 additionalProperties:
   $ref: 'nvidia,tegra-pinmux-common.yaml#/definitions/pinconf-node'
@@ -25,20 +26,17 @@ additionalProperties:
     "^pinmux(-[a-z0-9-_]+)?$":
       additionalProperties: false
       properties:
-        nvidia,pins:
-          description: An array of strings. Each string contains the name of a
-            pin or group. Valid values for these names are listed below.
-
-            Note that the pex_l5_clkreq_n_pgg0 and pex_l5_rst_n_pgg1 pins are
-            part of PCIE C5 power partition. Client devices must enable this
-            partition before accessing the configuration for these pins.
-          items:
-            enum: [ pex_l5_clkreq_n_pgg0, pex_l5_rst_n_pgg1,
-                    # drive groups
-                    drive_pex_l5_clkreq_n_pgg0, drive_pex_l5_rst_n_pgg1 ]
-
         nvidia,function:
-          enum: [ pe5 ]
+          enum: [ aud, can0, can1, ccla, dca, dcb, dgpu, directdc, directdc1,
+                  displaya, displayb, dmic1, dmic2, dmic3, dmic4, dmic5, dp,
+                  dspk0, dspk1, eqos, extperiph1, extperiph2, extperiph3,
+                  extperiph4, gp, gpio, hdmi, i2c1, i2c2, i2c3, i2c5, i2c8,
+                  i2s1, i2s2, i2s3, i2s4, i2s5, i2s6, igpu, iqc1, iqc2, mipi,
+                  nv, pe0, pe1, pe2, pe3, pe4, pe5, qspi, qspi0, qspi1, rsvd0,
+                  rsvd1, rsvd2, rsvd3, sata, sce, sdmmc1, sdmmc3, sdmmc4, slvs,
+                  soc, spdif, spi1, spi2, spi3, touch, uarta, uartb, uartc,
+                  uartd, uarte, uartg, ufs0, usb, vgp1, vgp2, vgp3, vgp4, vgp5,
+                  vgp6, wdt ]
 
         nvidia,enable-input:
           $ref: 'nvidia,tegra-pinmux-common.yaml#/definitions/enable-input'
@@ -58,6 +56,206 @@ additionalProperties:
       required:
         - nvidia,pins
 
+allOf:
+  - if:
+      properties:
+        compatible:
+          const: nvidia,tegra194-pinmux
+    then:
+      type: object
+      additionalProperties:
+        patternProperties:
+          "^pinmux(-[a-z0-9-_]+)?$":
+            type: object
+            properties:
+              nvidia,pins:
+                description: An array of strings. Each string contains the name
+                  of a pin or group. Valid values for these names are listed
+                  below.
+
+                  Note that the pex_l5_clkreq_n_pgg0 and pex_l5_rst_n_pgg1 pins
+                  are part of PCIE C5 power partition. Client devices must
+                  enable this partition before accessing the configuration for
+                  these pins.
+                items:
+                  enum: [ dap6_sclk_pa0, dap6_dout_pa1, dap6_din_pa2,
+                          dap6_fs_pa3, dap4_sclk_pa4, dap4_dout_pa5,
+                          dap4_din_pa6, dap4_fs_pa7, cpu_pwr_req_0_pb0,
+                          cpu_pwr_req_1_pb1, qspi0_sck_pc0, qspi0_cs_n_pc1,
+                          qspi0_io0_pc2, qspi0_io1_pc3, qspi0_io2_pc4,
+                          qspi0_io3_pc5, qspi1_sck_pc6, qspi1_cs_n_pc7,
+                          qspi1_io0_pd0, qspi1_io1_pd1, qspi1_io2_pd2,
+                          qspi1_io3_pd3, eqos_txc_pe0, eqos_td0_pe1,
+                          eqos_td1_pe2, eqos_td2_pe3, eqos_td3_pe4,
+                          eqos_tx_ctl_pe5, eqos_rd0_pe6, eqos_rd1_pe7,
+                          eqos_rd2_pf0, eqos_rd3_pf1, eqos_rx_ctl_pf2,
+                          eqos_rxc_pf3, eqos_sma_mdio_pf4, eqos_sma_mdc_pf5,
+                          soc_gpio00_pg0, soc_gpio01_pg1, soc_gpio02_pg2,
+                          soc_gpio03_pg3, soc_gpio08_pg4, soc_gpio09_pg5,
+                          soc_gpio10_pg6, soc_gpio11_pg7, soc_gpio12_ph0,
+                          soc_gpio13_ph1, soc_gpio14_ph2, uart4_tx_ph3,
+                          uart4_rx_ph4, uart4_rts_ph5, uart4_cts_ph6,
+                          dap2_sclk_ph7, dap2_dout_pi0, dap2_din_pi1,
+                          dap2_fs_pi2, gen1_i2c_scl_pi3, gen1_i2c_sda_pi4,
+                          sdmmc1_clk_pj0, sdmmc1_cmd_pj1, sdmmc1_dat0_pj2,
+                          sdmmc1_dat1_pj3, sdmmc1_dat2_pj4, sdmmc1_dat3_pj5,
+                          pex_l0_clkreq_n_pk0, pex_l0_rst_n_pk1,
+                          pex_l1_clkreq_n_pk2, pex_l1_rst_n_pk3,
+                          pex_l2_clkreq_n_pk4, pex_l2_rst_n_pk5,
+                          pex_l3_clkreq_n_pk6, pex_l3_rst_n_pk7,
+                          pex_l4_clkreq_n_pl0, pex_l4_rst_n_pl1,
+                          pex_wake_n_pl2, sata_dev_slp_pl3, dp_aux_ch0_hpd_pm0,
+                          dp_aux_ch1_hpd_pm1, dp_aux_ch2_hpd_pm2,
+                          dp_aux_ch3_hpd_pm3, hdmi_cec_pm4, soc_gpio50_pm5,
+                          soc_gpio51_pm6, soc_gpio52_pm7, soc_gpio53_pn0,
+                          soc_gpio54_pn1, soc_gpio55_pn2, sdmmc3_clk_po0,
+                          sdmmc3_cmd_po1, sdmmc3_dat0_po2, sdmmc3_dat1_po3,
+                          sdmmc3_dat2_po4, sdmmc3_dat3_po5, extperiph1_clk_pp0,
+                          extperiph2_clk_pp1, cam_i2c_scl_pp2, cam_i2c_sda_pp3,
+                          soc_gpio04_pp4, soc_gpio05_pp5, soc_gpio06_pp6,
+                          soc_gpio07_pp7, soc_gpio20_pq0, soc_gpio21_pq1,
+                          soc_gpio22_pq2, soc_gpio23_pq3, soc_gpio40_pq4,
+                          soc_gpio41_pq5, soc_gpio42_pq6, soc_gpio43_pq7,
+                          soc_gpio44_pr0, soc_gpio45_pr1, uart1_tx_pr2,
+                          uart1_rx_pr3, uart1_rts_pr4, uart1_cts_pr5,
+                          dap1_sclk_ps0, dap1_dout_ps1, dap1_din_ps2,
+                          dap1_fs_ps3, aud_mclk_ps4, soc_gpio30_ps5,
+                          soc_gpio31_ps6, soc_gpio32_ps7, soc_gpio33_pt0,
+                          dap3_sclk_pt1, dap3_dout_pt2, dap3_din_pt3,
+                          dap3_fs_pt4, dap5_sclk_pt5, dap5_dout_pt6,
+                          dap5_din_pt7, dap5_fs_pu0, directdc1_clk_pv0,
+                          directdc1_in_pv1, directdc1_out0_pv2,
+                          directdc1_out1_pv3, directdc1_out2_pv4,
+                          directdc1_out3_pv5, directdc1_out4_pv6,
+                          directdc1_out5_pv7, directdc1_out6_pw0,
+                          directdc1_out7_pw1, gpu_pwr_req_px0, cv_pwr_req_px1,
+                          gp_pwm2_px2, gp_pwm3_px3, uart2_tx_px4, uart2_rx_px5,
+                          uart2_rts_px6, uart2_cts_px7, spi3_sck_py0,
+                          spi3_miso_py1, spi3_mosi_py2, spi3_cs0_py3,
+                          spi3_cs1_py4, uart5_tx_py5, uart5_rx_py6,
+                          uart5_rts_py7, uart5_cts_pz0, usb_vbus_en0_pz1,
+                          usb_vbus_en1_pz2, spi1_sck_pz3, spi1_miso_pz4,
+                          spi1_mosi_pz5, spi1_cs0_pz6, spi1_cs1_pz7,
+                          ufs0_ref_clk_pff0, ufs0_rst_pff1,
+                          pex_l5_clkreq_n_pgg0, pex_l5_rst_n_pgg1,
+                          directdc_comp, sdmmc4_clk, sdmmc4_cmd, sdmmc4_dqs,
+                          sdmmc4_dat7, sdmmc4_dat6, sdmmc4_dat5, sdmmc4_dat4,
+                          sdmmc4_dat3, sdmmc4_dat2, sdmmc4_dat1, sdmmc4_dat0,
+                          sdmmc1_comp, sdmmc1_hv_trim, sdmmc3_comp,
+                          sdmmc3_hv_trim, eqos_comp, qspi_comp,
+                          # drive groups
+                          drive_soc_gpio33_pt0, drive_soc_gpio32_ps7,
+                          drive_soc_gpio31_ps6, drive_soc_gpio30_ps5,
+                          drive_aud_mclk_ps4, drive_dap1_fs_ps3,
+                          drive_dap1_din_ps2, drive_dap1_dout_ps1,
+                          drive_dap1_sclk_ps0, drive_dap3_fs_pt4,
+                          drive_dap3_din_pt3, drive_dap3_dout_pt2,
+                          drive_dap3_sclk_pt1, drive_dap5_fs_pu0,
+                          drive_dap5_din_pt7, drive_dap5_dout_pt6,
+                          drive_dap5_sclk_pt5, drive_dap6_fs_pa3,
+                          drive_dap6_din_pa2, drive_dap6_dout_pa1,
+                          drive_dap6_sclk_pa0, drive_dap4_fs_pa7,
+                          drive_dap4_din_pa6, drive_dap4_dout_pa5,
+                          drive_dap4_sclk_pa4, drive_extperiph2_clk_pp1,
+                          drive_extperiph1_clk_pp0, drive_cam_i2c_sda_pp3,
+                          drive_cam_i2c_scl_pp2, drive_soc_gpio40_pq4,
+                          drive_soc_gpio41_pq5, drive_soc_gpio42_pq6,
+                          drive_soc_gpio43_pq7, drive_soc_gpio44_pr0,
+                          drive_soc_gpio45_pr1, drive_soc_gpio20_pq0,
+                          drive_soc_gpio21_pq1, drive_soc_gpio22_pq2,
+                          drive_soc_gpio23_pq3, drive_soc_gpio04_pp4,
+                          drive_soc_gpio05_pp5, drive_soc_gpio06_pp6,
+                          drive_soc_gpio07_pp7, drive_uart1_cts_pr5,
+                          drive_uart1_rts_pr4, drive_uart1_rx_pr3,
+                          drive_uart1_tx_pr2, drive_dap2_din_pi1,
+                          drive_dap2_dout_pi0, drive_dap2_fs_pi2,
+                          drive_dap2_sclk_ph7, drive_uart4_cts_ph6,
+                          drive_uart4_rts_ph5, drive_uart4_rx_ph4,
+                          drive_uart4_tx_ph3, drive_soc_gpio03_pg3,
+                          drive_soc_gpio02_pg2, drive_soc_gpio01_pg1,
+                          drive_soc_gpio00_pg0, drive_gen1_i2c_scl_pi3,
+                          drive_gen1_i2c_sda_pi4, drive_soc_gpio08_pg4,
+                          drive_soc_gpio09_pg5, drive_soc_gpio10_pg6,
+                          drive_soc_gpio11_pg7, drive_soc_gpio12_ph0,
+                          drive_soc_gpio13_ph1, drive_soc_gpio14_ph2,
+                          drive_soc_gpio50_pm5, drive_soc_gpio51_pm6,
+                          drive_soc_gpio52_pm7, drive_soc_gpio53_pn0,
+                          drive_soc_gpio54_pn1, drive_soc_gpio55_pn2,
+                          drive_dp_aux_ch0_hpd_pm0, drive_dp_aux_ch1_hpd_pm1,
+                          drive_dp_aux_ch2_hpd_pm2, drive_dp_aux_ch3_hpd_pm3,
+                          drive_hdmi_cec_pm4, drive_pex_l2_clkreq_n_pk4,
+                          drive_pex_wake_n_pl2, drive_pex_l1_clkreq_n_pk2,
+                          drive_pex_l1_rst_n_pk3, drive_pex_l0_clkreq_n_pk0,
+                          drive_pex_l0_rst_n_pk1, drive_pex_l2_rst_n_pk5,
+                          drive_pex_l3_clkreq_n_pk6, drive_pex_l3_rst_n_pk7,
+                          drive_pex_l4_clkreq_n_pl0, drive_pex_l4_rst_n_pl1,
+                          drive_sata_dev_slp_pl3, drive_pex_l5_clkreq_n_pgg0,
+                          drive_pex_l5_rst_n_pgg1, drive_cpu_pwr_req_1_pb1,
+                          drive_cpu_pwr_req_0_pb0, drive_sdmmc1_clk_pj0,
+                          drive_sdmmc1_cmd_pj1, drive_sdmmc1_dat3_pj5,
+                          drive_sdmmc1_dat2_pj4, drive_sdmmc1_dat1_pj3,
+                          drive_sdmmc1_dat0_pj2, drive_sdmmc3_dat3_po5,
+                          drive_sdmmc3_dat2_po4, drive_sdmmc3_dat1_po3,
+                          drive_sdmmc3_dat0_po2, drive_sdmmc3_cmd_po1,
+                          drive_sdmmc3_clk_po0, drive_gpu_pwr_req_px0,
+                          drive_spi3_miso_py1, drive_spi1_cs0_pz6,
+                          drive_spi3_cs0_py3, drive_spi1_miso_pz4,
+                          drive_spi3_cs1_py4, drive_gp_pwm3_px3,
+                          drive_gp_pwm2_px2, drive_spi1_sck_pz3,
+                          drive_spi3_sck_py0, drive_spi1_cs1_pz7,
+                          drive_spi1_mosi_pz5, drive_spi3_mosi_py2,
+                          drive_cv_pwr_req_px1, drive_uart2_tx_px4,
+                          drive_uart2_rx_px5, drive_uart2_rts_px6,
+                          drive_uart2_cts_px7, drive_uart5_rx_py6,
+                          drive_uart5_tx_py5, drive_uart5_rts_py7,
+                          drive_uart5_cts_pz0, drive_usb_vbus_en0_pz1,
+                          drive_usb_vbus_en1_pz2, drive_ufs0_rst_pff1,
+                          drive_ufs0_ref_clk_pff0 ]
+
+  - if:
+      properties:
+        compatible:
+          const: nvidia,tegra194-pinmux-aon
+    then:
+      type: object
+      additionalProperties:
+        patternProperties:
+          "^pinmux(-[a-z0-9-_]+)?$":
+            type: object
+            properties:
+              nvidia,pins:
+                items:
+                  enum: [ can1_dout_paa0, can1_din_paa1, can0_dout_paa2,
+                          can0_din_paa3, can0_stb_paa4, can0_en_paa5,
+                          can0_wake_paa6, can0_err_paa7, can1_stb_pbb0,
+                          can1_en_pbb1, can1_wake_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,
+                          safe_state_pee0, vcomp_alert_pee1,
+                          ao_retention_n_pee2, batt_oc_pee3, power_on_pee4,
+                          pwr_i2c_scl_pee5, pwr_i2c_sda_pee6, sys_reset_n,
+                          shutdown_n, pmu_int_n, soc_pwr_req, clk_32k_in,
+                          # drive groups
+                          drive_shutdown_n, drive_pmu_int_n,
+                          drive_safe_state_pee0, drive_vcomp_alert_pee1,
+                          drive_soc_pwr_req, drive_batt_oc_pee3,
+                          drive_clk_32k_in, drive_power_on_pee4,
+                          drive_pwr_i2c_scl_pee5, drive_pwr_i2c_sda_pee6,
+                          drive_ao_retention_n_pee2, 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_paa0, drive_can1_din_paa1,
+                          drive_can0_dout_paa2, drive_can0_din_paa3,
+                          drive_can0_stb_paa4, drive_can0_en_paa5,
+                          drive_can0_wake_paa6, drive_can0_err_paa7,
+                          drive_can1_stb_pbb0, drive_can1_en_pbb1,
+                          drive_can1_wake_pbb2, drive_can1_err_pbb3 ]
+
 required:
   - compatible
   - reg
@@ -68,8 +266,7 @@ examples:
 
     pinmux@2430000 {
       compatible = "nvidia,tegra194-pinmux";
-      reg = <0x2430000 0x17000>,
-            <0xc300000 0x04000>;
+      reg = <0x2430000 0x17000>;
 
       pinctrl-names = "pex_rst";
       pinctrl-0 = <&pex_rst_c5_out_state>;
Signature · 1 line
2.36.1
Acked-by on v2 2/4
#7 lore raw

Re: [PATCH v2 2/4] dt-bindings: pinctrl: tegra194: Separate instances

Quoted 4 lines · Thierry Reding

From: Thierry Reding <[email protected]>

Tegra194 has two separate instances of the pin controller, one called AON (in the always-on domain) and another called "main".

Maybe this information should be in the bindings themselves too?

Other than that:

Yours,
Linus Walleij

#8 lore raw

PATCH v2 3/4 pinctrl: tegra: Separate Tegra194 instances

In reply to Thierry Reding

From: Thierry Reding <[email protected]>

Tegra194 has two separate instances of the pin controller, one called AON (in the always-on domain) and another called "main". Instead of treating them as a single pin controller, split them up into two separate controllers. Doing so allows the mapping between the pinmux and GPIO controllers to be trivial identity mappings and more cleanly separates the AON from the main IP blocks.

---
 drivers/pinctrl/tegra/pinctrl-tegra.c    |  33 ++-
 drivers/pinctrl/tegra/pinctrl-tegra.h    |   2 +
 drivers/pinctrl/tegra/pinctrl-tegra194.c | 286 +++++++++++++----------
 3 files changed, 173 insertions(+), 148 deletions(-)
drivers/pinctrl/tegra/pinctrl-tegra.c +14 -19
index 50bd26a30ac0..0fcbaa425ff5 100644
@@ -668,19 +668,6 @@ static const struct pinconf_ops tegra_pinconf_ops = {
 #endif
 };
 
-static struct pinctrl_gpio_range tegra_pinctrl_gpio_range = {
-	.name = "Tegra GPIOs",
-	.id = 0,
-	.base = 0,
-};
-
-static struct pinctrl_desc tegra_pinctrl_desc = {
-	.pctlops = &tegra_pinctrl_ops,
-	.pmxops = &tegra_pinmux_ops,
-	.confops = &tegra_pinconf_ops,
-	.owner = THIS_MODULE,
-};
-
 static void tegra_pinctrl_clear_parked_bits(struct tegra_pmx *pmx)
 {
 	int i = 0;
@@ -831,10 +818,18 @@ int tegra_pinctrl_probe(struct platform_device *pdev,
 		}
 	}
 
-	tegra_pinctrl_gpio_range.npins = pmx->soc->ngpios;
-	tegra_pinctrl_desc.name = dev_name(&pdev->dev);
-	tegra_pinctrl_desc.pins = pmx->soc->pins;
-	tegra_pinctrl_desc.npins = pmx->soc->npins;
+	pmx->gpio_range.name = "Tegra GPIOs";
+	pmx->gpio_range.id = 0;
+	pmx->gpio_range.base = 0;
+	pmx->gpio_range.npins = pmx->soc->ngpios;
+
+	pmx->desc.pctlops = &tegra_pinctrl_ops;
+	pmx->desc.pmxops = &tegra_pinmux_ops;
+	pmx->desc.confops = &tegra_pinconf_ops;
+	pmx->desc.owner = THIS_MODULE;
+	pmx->desc.name = dev_name(&pdev->dev);
+	pmx->desc.pins = pmx->soc->pins;
+	pmx->desc.npins = pmx->soc->npins;
 
 	for (i = 0; ; i++) {
 		res = platform_get_resource(pdev, IORESOURCE_MEM, i);
@@ -860,7 +855,7 @@ int tegra_pinctrl_probe(struct platform_device *pdev,
 			return PTR_ERR(pmx->regs[i]);
 	}
 
-	pmx->pctl = devm_pinctrl_register(&pdev->dev, &tegra_pinctrl_desc, pmx);
+	pmx->pctl = devm_pinctrl_register(&pdev->dev, &pmx->desc, pmx);
 	if (IS_ERR(pmx->pctl)) {
 		dev_err(&pdev->dev, "Couldn't register pinctrl driver\n");
 		return PTR_ERR(pmx->pctl);
@@ -869,7 +864,7 @@ int tegra_pinctrl_probe(struct platform_device *pdev,
 	tegra_pinctrl_clear_parked_bits(pmx);
 
 	if (pmx->soc->ngpios > 0 && !tegra_pinctrl_gpio_node_has_range(pmx))
-		pinctrl_add_gpio_range(pmx->pctl, &tegra_pinctrl_gpio_range);
+		pinctrl_add_gpio_range(pmx->pctl, &pmx->gpio_range);
 
 	platform_set_drvdata(pdev, pmx);
 
drivers/pinctrl/tegra/pinctrl-tegra.h +2 -0
index f8269858eb78..6130cba7cce5 100644
@@ -15,6 +15,8 @@ struct tegra_pmx {
 	const struct tegra_pinctrl_soc_data *soc;
 	const char **group_pins;
 
+	struct pinctrl_gpio_range gpio_range;
+	struct pinctrl_desc desc;
 	int nbanks;
 	void __iomem **regs;
 	u32 *backup_regs;
drivers/pinctrl/tegra/pinctrl-tegra194.c +157 -129

363 lines not on this page · raw message

Signature · 1 line
2.36.1
#9 lore raw

PATCH v2 4/4 arm64: tegra: Separate AON pinmux from main pinmux on Tegra194

In reply to Thierry Reding

From: Thierry Reding <[email protected]>

The registers for the AON pinmux reside in a partition different from the registers for the main pinmux. Instead of treating them as one and the same device, split them up so that they are each their own devices. Also add gpio-ranges properties to the corresponding GPIO controllers such that the pinmux and GPIO controllers can be paired up properly.

---
 arch/arm64/boot/dts/nvidia/tegra194.dtsi | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/nvidia/tegra194.dtsi +10 -3
index 78277b538002..2638e480e7da 100644
@@ -86,6 +86,7 @@ gpio: gpio@2200000 {
 			interrupt-controller;
 			#gpio-cells = <2>;
 			gpio-controller;
+			gpio-ranges = <&pinmux 0 0 169>;
 		};
 
 		cbb-noc@2300000 {
@@ -626,9 +627,7 @@ tegra_asrc: asrc@2910000 {
 
 		pinmux: pinmux@2430000 {
 			compatible = "nvidia,tegra194-pinmux";
-			reg = <0x2430000 0x17000>,
-			      <0xc300000 0x4000>;
-
+			reg = <0x2430000 0x17000>;
 			status = "okay";
 
 			pex_rst_c5_out_state: pex_rst_c5_out {
@@ -1638,6 +1637,14 @@ gpio_aon: gpio@c2f0000 {
 			#gpio-cells = <2>;
 			interrupt-controller;
 			#interrupt-cells = <2>;
+			gpio-range = <&pinmux_aon 0 0 30>;
+		};
+
+		pinmux_aon: pinmux@c300000 {
+			compatible = "nvidia,tegra194-pinmux-aon";
+			reg = <0xc300000 0x4000>;
+
+			status = "okay";
 		};
 
 		pwm4: pwm@c340000 {
Signature · 1 line
2.36.1
Acked-by on the v2 series
#10 lore raw
In reply to Thierry Reding
Quoted 17 lines · Thierry Reding

From: Thierry Reding <[email protected]>

This patch series changes the pin controller DT description on Tegra194 in order to properly describe how the hardware works. Currently a simplified description is used that merges two pin controller instances (called AON and main) into a single DT node. This has some disadvantages such as creating a complicated mapping between the pins in those pin controllers and the corresponding GPIO controllers (which are already separated).

As a prerequisite, the first patch in this series converts the device tree bindings to json-schema. A second patch then adds an additional compatible string for the AON instance (along with more details about each controller's pins) and finally patch 3 converts the driver to cope with these changes. A fourth patch makes the corresponding changes in the Tegra194 DTS file.

Quoted 5 lines

Note that while this changes the DT node in an incompatible way, this doesn't have any practical implications for backwards-compatibility. The reason for this is that device trees have only reconfigured a very narrow subset of pins of the main controller, so the new driver will remain backwards-compatible with old device trees.

Works for me, this is much closer to the hardware and therefore better (fixing a bug in the old bindings essentially).

The whole set:

I can merge patches 1-3 whenever we have Rob's ACK. I assume you will take patch 4 thru the SoC tree?

Yours,
Linus Walleij