Skip to contentSkip to conversation

dt-bindings: pinctrl: Convert TI DA850 pupd to DT schema

PATCH In review Eduard Bostina 4 participants 4 messages Aug 12 – Aug 14

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

PATCH v3 1/1 dt-bindings: pinctrl: Convert TI DA850 pupd to DT schema

Convert the Texas Instruments DA850/OMAP-L138/AM18x pullup/down controller bindings to DT schema.

---
Changes in v3:
- Restricted the pin group node names to 'disable', 'pull-up' and 'pull-down'.
- Switched the pin group nodes to 'additionalProperties: false' since all of the valid properties are listed.

Changes in v2:
- Excluded the 'phandle' property from the pin group node pattern so it is no longer validated as a pin configuration node. This fixes the 'make dt_binding_check' failure.

Link to v2: https://lore.kernel.org/all/[email protected]/
Link to v1: https://lore.kernel.org/all/[email protected]/

 .../bindings/pinctrl/ti,da850-pupd.txt        | 55 --------------
 .../bindings/pinctrl/ti,da850-pupd.yaml       | 74 +++++++++++++++++++
 2 files changed, 74 insertions(+), 55 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/ti,da850-pupd.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/ti,da850-pupd.yaml
Documentation/devicetree/bindings/pinctrl/ti,da850-pupd.txt deleted +0 -55
deleted file mode 100644
index 7f2980567c9f..000000000000
@@ -1,55 +0,0 @@
-* Pin configuration for TI DA850/OMAP-L138/AM18x
-
-These SoCs have a separate controller for setting bias (internal pullup/down).
-Bias can only be selected for groups rather than individual pins.
-
-Required Properties:
-
-  - compatible: Must be "ti,da850-pupd"
-  - reg: Base address and length of the memory resource used by the pullup/down
-    controller hardware module.
-
-The controller node also acts as a container for pin group configuration nodes.
-The names of these groups are ignored.
-
-Pin Group Node Properties:
-
-- groups: An array of strings, each string containing the name of a pin group.
-          Valid names are "cp0".."cp31".
-
-The pin configuration parameters use the generic pinconf bindings defined in
-pinctrl-bindings.txt in this directory. The supported parameters are
-bias-disable, bias-pull-up, bias-pull-down.
-
-
-Example
--------
-
-In common dtsi file:
-
-	pinconf: pin-controller@22c00c {
-		compatible = "ti,da850-pupd";
-		reg = <0x22c00c 0x8>;
-	};
-
-In board-specific file:
-
-	&pinconf {
-		pinctrl-0 = <&pinconf_bias_groups>;
-		pinctrl-names = "default";
-
-		pinconf_bias_groups: bias-groups {
-			pull-up {
-				groups = "cp30", "cp31";
-				bias-pull-up;
-			};
-			pull-down {
-				groups = "cp29", "cp28";
-				bias-pull-down;
-			};
-			disable {
-				groups = "cp27", "cp26";
-				bias-disable;
-			};
-		};
-	};
Documentation/devicetree/bindings/pinctrl/ti,da850-pupd.yaml new file +74 -0

74 lines not on this page · raw message

Signature · 1 line
2.43.0
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The device tree schema for pin configuration subnodes fails to require the 'groups' property…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The device tree schema for pin configuration subnodes fails to require the 'groups' property, allowing functionally empty nodes to silently pass validation. --

--- Patch [1]: [PATCH v3] dt-bindings: pinctrl: Convert TI DA850 pupd to DT schema --- commit 559e4d94cd353ab8a1d382bd65a364531394cb80
Author: Eduard Bostina <[email protected]>

dt-bindings: pinctrl: Convert TI DA850 pupd to DT schema

Convert the Texas Instruments DA850/OMAP-L138/AM18x pullup/down controller bindings to DT schema.

Link to v2: https://lore.kernel.org/all/[email protected]/
Link to v1: https://lore.kernel.org/all/[email protected]/

Quoted 5 lines
Documentation/devicetree/bindings/pinctrl/ti,da850-pupd.yaml new file +0 -0
new file mode 100644
index 0000000000000..21d439e08d4b7

[ ... ]

Quoted 8 lines
Documentation/devicetree/bindings/pinctrl/ti,da850-pupd.yaml new file +7 -0
@@ -28,17 +28,17 @@
+patternProperties:
+  "-groups$":
+    type: object
+    additionalProperties: false
+    patternProperties:
+      "^(disable|pull-(up|down))$":
+        $ref: /schemas/pinctrl/pincfg-node.yaml#

Documentation/devicetree/bindings/pinctrl/ti,da850-pupd.yaml line 44

Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/ti,da850-pupd.yaml new file +10 -0
+        properties:
+          groups:
+            $ref: /schemas/types.yaml#/definitions/string-array
+            description: An array of strings containing the name of a pin group.
+            items:
+              pattern: "^cp([0-9]|[1-2][0-9]|3[0-1])$"
+          bias-disable: true
+          bias-pull-up: true
+          bias-pull-down: true
+        additionalProperties: false

[Severity: Medium]
Should the groups property be explicitly listed as a required property in this schema block?

Without a required: [ groups ] constraint here, a functionally empty node could silently pass device tree schema validation. For example, a developer could define a subnode like:

    pull-up {
        bias-pull-up;
    };

Since the kernel driver ignores nodes without target groups, the target hardware pins would remain unconfigured at runtime without raising any schema validation warnings.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
maintainer Reviewed-by on v3 1/1
#2 lore raw
In reply to Eduard Bostina
Quoted 16 lines · Eduard Bostina

Convert the Texas Instruments DA850/OMAP-L138/AM18x pullup/down controller bindings to DT schema.

---
Changes in v3:
- Restricted the pin group node names to 'disable', 'pull-up' and 'pull-down'.
- Switched the pin group nodes to 'additionalProperties: false' since all of the valid properties are listed.

Changes in v2:
- Excluded the 'phandle' property from the pin group node pattern so it is no longer validated as a pin configuration node. This fixes the 'make dt_binding_check' failure.

Quoted 9 lines

Link to v2: https://lore.kernel.org/all/[email protected]/
Link to v1: https://lore.kernel.org/all/[email protected]/

 .../bindings/pinctrl/ti,da850-pupd.txt        | 55 --------------
 .../bindings/pinctrl/ti,da850-pupd.yaml       | 74 +++++++++++++++++++
 2 files changed, 74 insertions(+), 55 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/ti,da850-pupd.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/ti,da850-pupd.yaml