Skip to contentSkip to conversation

dt-bindings: arm: vt8500: via,vt8500-pmc: Convert to DT Schema

PATCH Superseded Udaya Kiran Challa 3 participants 5 messages May 24 – Jun 1

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dt-bindings: arm: vt8500: via,vt8500-pmc: Convert to DT Schema

Convert the VIA/Wondermedia VT8500 Power Management controller binding from the legacy text format to DT schema.

---
 .../bindings/arm/vt8500/via,vt8500-pmc.txt    | 13 -------
 .../bindings/arm/vt8500/via,vt8500-pmc.yaml   | 38 +++++++++++++++++++
 2 files changed, 38 insertions(+), 13 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/arm/vt8500/via,vt8500-pmc.txt
 create mode 100644 Documentation/devicetree/bindings/arm/vt8500/via,vt8500-pmc.yaml
Documentation/devicetree/bindings/arm/vt8500/via,vt8500-pmc.txt deleted +0 -13
deleted file mode 100644
index 521b9c7de933..000000000000
@@ -1,13 +0,0 @@
-VIA/Wondermedia VT8500 Power Management Controller
------------------------------------------------------
-
-Required properties:
-- compatible : "via,vt8500-pmc"
-- reg : Should contain 1 register ranges(address and length)
-
-Example:
-
-	pmc@d8130000 {
-		compatible = "via,vt8500-pmc";
-		reg = <0xd8130000 0x1000>;
-	};
Documentation/devicetree/bindings/arm/vt8500/via,vt8500-pmc.yaml new file +38 -0
new file mode 100644
index 000000000000..ac603fd4efec
@@ -0,0 +1,38 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/arm/vt8500/via,vt8500-pmc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: VIA/Wondermedia VT8500 Power Management Controller
+
+maintainers:
+  - Tony Prisk <[email protected]>
+
+description:
+  The VIA/Wondermedia Power Management Controller provides register access for
+  clock and power management functions on VT8500 and WM8xxx series SoCs.
+
+properties:
+  compatible:
+    const: via,vt8500-pmc
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    type: object
+    additionalProperties: true
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    pmc@d8130000 {
+        compatible = "via,vt8500-pmc";
+        reg = <0xd8130000 0x1000>;
+    };
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] Redefining the standard 'clocks' property as an object violates the core DT meta-schema and…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Redefining the standard 'clocks' property as an object violates the core DT meta-schema and bypasses child node validation. --

commit 1dba768055c24a5e16b0109bd342a32c68535b08
Author: Udaya Kiran Challa <[email protected]>

dt-bindings: arm: vt8500: via,vt8500-pmc: Convert to DT Schema

This commit converts the VIA/Wondermedia VT8500 Power Management controller binding from the legacy text format to the new DT schema format.

Quoted 5 lines
Documentation/devicetree/bindings/arm/vt8500/via,vt8500-pmc.yaml new file +0 -0
new file mode 100644
index 0000000000000..ac603fd4efec9

[ ... ]

Documentation/devicetree/bindings/arm/vt8500/via,vt8500-pmc.yaml line 25

Quoted 10 lines
Documentation/devicetree/bindings/arm/vt8500/via,vt8500-pmc.yaml new file +10 -0
+properties:
+  compatible:
+    const: via,vt8500-pmc
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    type: object
+    additionalProperties: true

[Severity: Medium]
Does redefining the standard clocks property as an object conflict with the core DT meta-schema?

The clocks property is globally defined by the core dtschema as an array of phandles. Defining it here as an object creates a type conflict, which will cause validation to fail since the schema will require it to be both an array and an object. Furthermore, using additionalProperties: true disables schema validation for nested properties and child nodes.

If the intention is to document a legacy child node named clocks, should it be defined using patternProperties (like "^clocks$") to avoid conflicting with the standard property definition?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#2 lore raw
In reply to Udaya Kiran Challa

Documentation/devicetree/bindings/arm/vt8500/via,vt8500-pmc.yaml line 25

Quoted 10 lines · Udaya Kiran Challa
Documentation/devicetree/bindings/arm/vt8500/via,vt8500-pmc.yaml new file +10 -0
+properties:
+  compatible:
+    const: via,vt8500-pmc
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    type: object
+    additionalProperties: true

No, binding must be constrained. See writing-bindings or any other binding. If you are unsure how to do something - open other existing bindings. Do you see anywhere such syntax?

Best regards,
Krzysztof

author
#3 lore raw
Quoted 6 lines
Quoted 6 lines
Documentation/devicetree/bindings/arm/vt8500/via,vt8500-pmc.yaml new file +6 -0
+properties:
+  compatible:
+    const: via,vt8500-pmc
+
+  reg:
+    maxItems: 1
Quoted 8 lines

Documentation/devicetree/bindings/arm/vt8500/via,vt8500-pmc.yaml line 25

Quoted 4 lines
Documentation/devicetree/bindings/arm/vt8500/via,vt8500-pmc.yaml new file +4 -0
+
+  clocks:
+    type: object
+    additionalProperties: true

No, binding must be constrained. See writing-bindings or any other binding. If you are unsure how to do something - open other existing bindings. Do you see anywhere such syntax?

Agreed. The clocks child node is now fully constrained: #address-cells and #size-cells are declared with fixed values and marked required.
additionalProperties: true is retained only because the child clock nodes inside have their own schema (via,vt8500-clock.yaml) with
additionalProperties: false, which is the pattern described in example-schema.yaml for child nodes with their own device schema.

Regards,
Udaya Kiran Challa

#4 lore raw
Quoted 15 lines · Uday Kiran
Quoted 6 lines
Quoted 6 lines
Documentation/devicetree/bindings/arm/vt8500/via,vt8500-pmc.yaml new file +6 -0
+properties:
+  compatible:
+    const: via,vt8500-pmc
+
+  reg:
+    maxItems: 1
Quoted 8 lines

Documentation/devicetree/bindings/arm/vt8500/via,vt8500-pmc.yaml line 25

Quoted 4 lines
Documentation/devicetree/bindings/arm/vt8500/via,vt8500-pmc.yaml new file +4 -0
+
+  clocks:
+    type: object
+    additionalProperties: true

No, binding must be constrained. See writing-bindings or any other binding. If you are unsure how to do something - open other existing bindings. Do you see anywhere such syntax?

Quoted 1 line

Agreed. The clocks child node is now fully constrained: #address-cells and

No, it is not. What are you speaking about? Open this patch and look - how anything "IS" there constrained?

Best regards,
Krzysztof