Skip to contentSkip to conversation

dt-bindings: clock: via,vt8500: Convert to DT Schema

PATCH Superseded Udaya Kiran Challa 3 participants 4 messages May 21 – May 23

Subsystems (3)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 dt-bindings: clock: via,vt8500: Convert to DT Schema

Convert the VIA/Wondermedia VT8500 and Wondermedia WM8xxx series SoCs clock controller binding from the legacy text format to DT schema.

---
Changelog:
Changes since v1:
- Add default value for divisor-mask
- Add required properties compatible and model
- Fix example node name
- Update example size cells and reg value

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

---
 .../bindings/clock/via,vt8500-clock.yaml      | 126 ++++++++++++++++++
 .../devicetree/bindings/clock/vt8500.txt      |  74 ----------
 2 files changed, 126 insertions(+), 74 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml
 delete mode 100644 Documentation/devicetree/bindings/clock/vt8500.txt
Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml new file +126 -0
new file mode 100644
index 000000000000..9e19103866bc
@@ -0,0 +1,126 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/via,vt8500-clock.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: VIA/Wondermedia VT8500 Clock Controller
+
+maintainers:
+  - Michael Turquette <[email protected]>
+  - Stephen Boyd <[email protected]>
+
+description: |
+  Clock controller bindings for VIA/Wondermedia VT8500 and Wondermedia WM8xxx
+  series SoCs.
+
+properties:
+  compatible:
+    enum:
+      - via,vt8500-pll-clock
+      - wm,wm8650-pll-clock
+      - wm,wm8750-pll-clock
+      - wm,wm8850-pll-clock
+      - via,vt8500-device-clock
+
+  reg:
+    maxItems: 1
+    description:
+      Offset of the PLL register within the PMC register space.
+
+  clocks:
+    maxItems: 1
+    description:
+      Parent reference clock.
+
+  "#clock-cells":
+    const: 0
+
+  enable-reg:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Offset of the clock enable register within the PMC register space.
+
+  enable-bit:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    maximum: 31
+    description:
+      Bit index controlling clock enable.
+
+  divisor-reg:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Offset of the clock divisor register within the PMC register space.
+
+  divisor-mask:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    default: 0x1f
+    description:
+      Bitmask describing the divisor field inside divisor-reg.
+
+required:
+  - compatible
+  - "#clock-cells"
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          enum:
+            - via,vt8500-pll-clock
+            - wm,wm8650-pll-clock
+            - wm,wm8750-pll-clock
+            - wm,wm8850-pll-clock
+    then:
+      required:
+        - reg
+        - clocks
+
+  - if:
+      properties:
+        compatible:
+          const: via,vt8500-device-clock
+    then:
+      required:
+        - clocks
+      anyOf:
+        - required:
+            - enable-reg
+            - enable-bit
+        - required:
+            - divisor-reg
+
+additionalProperties: false
+
+examples:
+  - |
+    / {
+        compatible = "via,wm8650";
+        model = "Wondermedia WM8650";
+
+        #address-cells = <1>;
+        #size-cells = <1>;
+
+        ref25: clock-25000000 {
+            compatible = "fixed-clock";
+            #clock-cells = <0>;
+            clock-frequency = <25000000>;
+        };
+
+        plla: clock@200 {
+            compatible = "wm,wm8650-pll-clock";
+            reg = <0x200 0x04>;
+            clocks = <&ref25>;
+            #clock-cells = <0>;
+        };
+
+        clksdhc: clock {
+            compatible = "via,vt8500-device-clock";
+            clocks = <&plla>;
+            divisor-reg = <0x328>;
+            divisor-mask = <0x3f>;
+            enable-reg = <0x254>;
+            enable-bit = <18>;
+            #clock-cells = <0>;
+        };
+    };
Documentation/devicetree/bindings/clock/vt8500.txt deleted +0 -74

74 lines not on this page · raw message

Signature · 1 line
2.43.0
#1 lore raw
Quoted 12 lines · Udaya Kiran Challa

Convert the VIA/Wondermedia VT8500 and Wondermedia WM8xxx series SoCs clock controller binding from the legacy text format to DT schema.

---
Changelog:
Changes since v1:
- Add default value for divisor-mask
- Add required properties compatible and model
- Fix example node name
- Update example size cells and reg value

Quoted 8 lines

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

---
 .../bindings/clock/via,vt8500-clock.yaml      | 126 ++++++++++++++++++
 .../devicetree/bindings/clock/vt8500.txt      |  74 ----------
 2 files changed, 126 insertions(+), 74 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml
 delete mode 100644 Documentation/devicetree/bindings/clock/vt8500.txt

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/clock/via,vt8500-clock.example.dtb: /: failed to match any schema with compatible: ['via,wm8650']

doc reference errors (make refcheckdocs):

See https://patchwork.kernel.org/project/devicetree/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

#2 lore raw
In reply to Udaya Kiran Challa
Quoted 29 lines · Udaya Kiran Challa

Convert the VIA/Wondermedia VT8500 and Wondermedia WM8xxx series SoCs clock controller binding from the legacy text format to DT schema.

---
Changelog:
Changes since v1:
- Add default value for divisor-mask
- Add required properties compatible and model
- Fix example node name
- Update example size cells and reg value

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

---
 .../bindings/clock/via,vt8500-clock.yaml      | 126 ++++++++++++++++++
 .../devicetree/bindings/clock/vt8500.txt      |  74 ----------
 2 files changed, 126 insertions(+), 74 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml
 delete mode 100644 Documentation/devicetree/bindings/clock/vt8500.txt
Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml new file +3 -0
new file mode 100644
index 000000000000..9e19103866bc
@@ -0,0 +1,126 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---

Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml line 13

Quoted 10 lines
Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml new file +10 -0
+$id: http://devicetree.org/schemas/clock/via,vt8500-clock.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: VIA/Wondermedia VT8500 Clock Controller
+
+maintainers:
+  - Michael Turquette <[email protected]>
+  - Stephen Boyd <[email protected]>
+
+description: |

Do not need '|' unless you need to preserve formatting.

Quoted 11 lines
Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml new file +11 -0
+  Clock controller bindings for VIA/Wondermedia VT8500 and Wondermedia WM8xxx
+  series SoCs.
+
+properties:
+  compatible:
+    enum:
+      - via,vt8500-pll-clock
+      - wm,wm8650-pll-clock
+      - wm,wm8750-pll-clock
+      - wm,wm8850-pll-clock
+      - via,vt8500-device-clock

Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml line 34

Quoted 10 lines
Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml new file +10 -0
+
+  reg:
+    maxItems: 1
+    description:
+      Offset of the PLL register within the PMC register space.
+
+  clocks:
+    maxItems: 1
+    description:
+      Parent reference clock.

Drop description

Quoted 47 lines
Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml new file +47 -0
+
+  "#clock-cells":
+    const: 0
+
+  enable-reg:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Offset of the clock enable register within the PMC register space.
+
+  enable-bit:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    maximum: 31
+    description:
+      Bit index controlling clock enable.
+
+  divisor-reg:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Offset of the clock divisor register within the PMC register space.
+
+  divisor-mask:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    default: 0x1f
+    description:
+      Bitmask describing the divisor field inside divisor-reg.
+
+required:
+  - compatible
+  - "#clock-cells"
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          enum:
+            - via,vt8500-pll-clock
+            - wm,wm8650-pll-clock
+            - wm,wm8750-pll-clock
+            - wm,wm8850-pll-clock
+    then:
+      required:
+        - reg
+        - clocks
+
+  - if:
+      properties:
+        compatible:

Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml line 91

Quoted 10 lines
Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml new file +10 -0
+          const: via,vt8500-device-clock
+    then:
+      required:
+        - clocks
+      anyOf:
+        - required:
+            - enable-reg
+            - enable-bit
+        - required:
+            - divisor-reg

reg: false, no?

Quoted 7 lines
Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml new file +7 -0
+
+additionalProperties: false
+
+examples:
+  - |
+    / {
+        compatible = "via,wm8650";

Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml line 108

Quoted 10 lines
Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml new file +10 -0
+        model = "Wondermedia WM8650";
+
+        #address-cells = <1>;
+        #size-cells = <1>;
+
+        ref25: clock-25000000 {
+            compatible = "fixed-clock";
+            #clock-cells = <0>;
+            clock-frequency = <25000000>;
+        };

Drop everything above

Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml line 117

Quoted 9 lines
Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml new file +9 -0
+
+        plla: clock@200 {
+            compatible = "wm,wm8650-pll-clock";
+            reg = <0x200 0x04>;
+            clocks = <&ref25>;
+            #clock-cells = <0>;
+        };
+
+        clksdhc: clock {

Entire binding is for part of other device, so where is the rest? This should not be done separately from the parent. And then example goes only to one place.

Best regards,
Krzysztof

author
#3 lore raw
Quoted 5 lines · Krzysztof Kozlowski
Quoted 5 lines
Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml new file +5 -0
+
+        plla: clock@200 {
+            compatible = "wm,wm8650-pll-clock";
+            reg = <0x200 0x04>;
+            clocks = <&ref25>;
Quoted 8 lines

Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml line 117

Quoted 4 lines
Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml new file +4 -0
+            #clock-cells = <0>;
+        };
+
+        clksdhc: clock {

Entire binding is for part of other device, so where is the rest? This should not be done separately from the parent. And then example goes only to one place.

Thanks for the review Krzysztof.

And sorry, I initially converted the legacy clock/vt8500.txt binding directly to YAML and missed that the clock nodes are actually child nodes of the PMC device, which already has a separate binding documented in:

Documentation/devicetree/bindings/arm/vt8500/via,vt8500-pmc.txt

I'll rework this by splitting the conversion into two schemas:

via,vt8500-pmc.yaml for the PMC device itself via,vt8500-clock.yaml for the clocks child node and the PLL/device clock child bindings

The clock binding example will retain the PMC hierarchy context, but the PMC properties themselves will be described in the PMC schema instead of duplicating them in the clock binding.

Regards,
Udaya Kiran Challa