dt-bindings: clock: via,vt8500: Convert to DT Schema
Subsystems (3)
PATCH v3 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 v2:
- Drop redundant description for clocks
- Disable reg property for device clocks
- Fix schema hierarchy to match actual DTS structure
Link to v2:https://lore.kernel.org/all/[email protected]/
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 | 179 ++++++++++++++++++ .../devicetree/bindings/clock/vt8500.txt | 74 -------- 2 files changed, 179 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 +179 -0
@@ -0,0 +1,179 @@ +# 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: + clocks: + type: object + additionalProperties: true + + properties: + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + required: + - "#address-cells" + - "#size-cells" + + patternProperties: + "^[a-z0-9]+(@[0-9a-f]+)?$": + type: object + + 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 + + "#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: + properties: + reg: false + + required: + - clocks + + anyOf: + - required: + - enable-reg + - enable-bit + + - required: + - divisor-reg + + additionalProperties: false + +required: + - clocks + +additionalProperties: false + +examples: + - | + pmc@d8130000 { + compatible = "via,vt8500-pmc"; + reg = <0xd8130000 0x1000>; + + clocks { + #address-cells = <1>; + #size-cells = <0>; + + ref24: clock-24000000 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <24000000>; + }; + + ref25: clock-25000000 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <25000000>; + }; + + plla: clock@200 { + compatible = "wm,wm8650-pll-clock"; + #clock-cells = <0>; + clocks = <&ref25>; + reg = <0x200>; + }; + + clkarm: arm { + compatible = "via,vt8500-device-clock"; + #clock-cells = <0>; + clocks = <&plla>; + divisor-reg = <0x300>; + }; + + clkuart0: uart0 { + compatible = "via,vt8500-device-clock"; + #clock-cells = <0>; + clocks = <&ref24>; + enable-reg = <0x250>; + enable-bit = <1>; + }; + + clksdhc: sdhc { + compatible = "via,vt8500-device-clock"; + #clock-cells = <0>; + clocks = <&plla>; + divisor-reg = <0x328>; + divisor-mask = <0x3f>; + enable-reg = <0x254>; + enable-bit = <18>; + }; + }; + };
Documentation/devicetree/bindings/clock/vt8500.txt deleted +0 -74
74 lines not on this page · raw message
Signature · 1 line
2.43.0
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider: - [Medium] Broken DT Schema Structure and Selection - [Low] Incorrect Regex Pattern for Node Names - [Low]…
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Medium] Broken DT Schema Structure and Selection
- [Low] Incorrect Regex Pattern for Node Names
- [Low] Missing Dependency Logic for Gated Clock Properties
--
commit 009c99928a4e9dc4ede2113118b784ee611924f0
Author: Udaya Kiran Challa <[email protected]>
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.
Quoted 6 lines
Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml new file +0
-0@@ -0,0 +1,179 @@
[ ... ]
Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml line 18
Quoted 6 lines
Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml new file +6
-0+description: + Clock controller bindings for VIA/Wondermedia VT8500 and Wondermedia WM8xxx + series SoCs. + +properties: + clocks:
[Severity: Medium]
Is this schema structured correctly? By wrapping the node definitions inside a parent clocks object, the root level lacks a compatible property or a custom select statement. Will dt-validate ever automatically apply this schema to devicetree nodes in practice?
Also, since the root level has additionalProperties: false (at the bottom of the file) but lacks definitions for compatible and reg, won't the provided example fail dt_binding_check since it includes compatible = "via,vt8500-pmc" and reg?
Quoted 6 lines
Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml new file +6
-0+ type: object + additionalProperties: true + + properties: + "#address-cells": + const: 1
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+ + "#size-cells": + const: 0 + + required: + - "#address-cells" + - "#size-cells" + + patternProperties: + "^[a-z0-9]+(@[0-9a-f]+)?$":
[Severity: Low]
Does this regex inadvertently exclude hyphens? Standard devicetree node names, such as clock-24000000 found in the example below, contain hyphens. Since the parent clocks object uses additionalProperties: true, do these nodes silently fall through and bypass schema validation entirely?
Quoted 3 lines
Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml new file +3
-0+ type: object + + properties:
[ ... ]
Quoted 8 lines
Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml new file +8
-0+ - if: + properties: + compatible: + const: via,vt8500-device-clock + then: + properties: + reg: false +
Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml line 116
Quoted 10 lines
Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml new file +10
-0+ required: + - clocks + + anyOf: + - required: + - enable-reg + - enable-bit + + - required: + - divisor-reg
[Severity: Low]
If a clock implements both features, does this anyOf condition allow it to provide divisor-reg and enable-reg, but illegally omit enable-bit without failing validation? Should this relationship be enforced using dependentRequired for enable-reg to require enable-bit?
Quoted 7 lines
Documentation/devicetree/bindings/clock/via,vt8500-clock.yaml new file +7
-0+ + additionalProperties: false + +required: + - clocks + +additionalProperties: false
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Rob Herring (Arm)
maintainerQuoted 19 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.
Signed-off-by Udaya Kiran Challa <[email protected]>---
Changelog:
Changes since v2:
- Drop redundant description for clocks
- Disable reg property for device clocks
- Fix schema hierarchy to match actual DTS structureLink to v2:https://lore.kernel.org/all/[email protected]/
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 | 179 ++++++++++++++++++ .../devicetree/bindings/clock/vt8500.txt | 74 -------- 2 files changed, 179 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: /example-0/pmc@d8130000: failed to match any schema with compatible: ['via,vt8500-pmc']
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.