diff mbox series

dt-bindings: clock: ti: Convert interface.txt to json-schema

Message ID 20231127202359.145778-1-andreas@kemnade.info
State New
Headers show
Series dt-bindings: clock: ti: Convert interface.txt to json-schema | expand

Commit Message

Andreas Kemnade Nov. 27, 2023, 8:23 p.m. UTC
Convert the OMAP interface clock device tree binding to json-schema
and fix up reg property which is optional and taken from parent if
not specified.
Specify the creator of the original binding as a maintainer.

Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
 .../bindings/clock/ti/interface.txt           | 57 ------------
 .../bindings/clock/ti/ti,interface-clock.yaml | 90 +++++++++++++++++++
 2 files changed, 90 insertions(+), 57 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/clock/ti/interface.txt
 create mode 100644 Documentation/devicetree/bindings/clock/ti/ti,interface-clock.yaml

Comments

Andreas Kemnade Dec. 3, 2023, 10:46 p.m. UTC | #1
On Fri, 1 Dec 2023 15:45:06 +0100
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:

> On 01/12/2023 15:41, Andreas Kemnade wrote:
> > On Fri, 1 Dec 2023 15:17:46 +0100
> > Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:
> >   
> >> On 01/12/2023 15:09, Andreas Kemnade wrote:  
> >>> Am Wed, 29 Nov 2023 09:15:57 +0100
> >>> schrieb Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>:
> >>>     
> >>>> On 28/11/2023 21:41, Andreas Kemnade wrote:    
> >>>>> Am Tue, 28 Nov 2023 09:41:23 +0100
> >>>>> schrieb Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>:      
> >>>>>>> If the interface clock is not below a ti,clksel then we have reg.
> >>>>>>>        
> >>>>>>
> >>>>>> This should be expressed in the bindings. It's fine to make the reg
> >>>>>> optional (skip the description, it's confusing), but the ti,clksel
> >>>>>> should reference this schema and enforce it on the children.
> >>>>>>      
> >>>>> Well there are other compatibles below ti,clksel, too, so should we
> >>>>> rather add them when the other .txt files are converted?      
> >>>>
> >>>> This binding should already be referenced by ti,clksel. When the other
> >>>> are ready, you will change additionalProperties from object to false.
> >>>>    
> >>> I played around with it:
> >>>
> >>> --- a/Documentation/devicetree/bindings/clock/ti/ti,clksel.yaml
> >>> +++ b/Documentation/devicetree/bindings/clock/ti/ti,clksel.yaml
> >>> @@ -33,6 +33,11 @@ properties:
> >>>      const: 2
> >>>      description: The CLKSEL register and bit offset
> >>>  
> >>> +patternProperties:
> >>> +  "-ick$":
> >>> +    $ref: /schemas/clock/ti/ti,interface-clock.yaml#
> >>> +    type: object
> >>> +
> >>>  required:
> >>>    - compatible
> >>>    - reg
> >>>
> >>>  
> >>> That generates warnings, which look more serious than just a
> >>> non-converted compatible, so lowering the overall "signal-noise-ratio".
> >>>
> >>> e.g.
> >>> from schema $id:
> >>> http://devicetree.org/schemas/clock/ti/ti,clksel.yaml#
> >>> /home/andi/linux-dtbs/arch/arm/boot/dts/ti/omap/omap3-overo-tobiduo.dtb:
> >>> clock@c40: clock-rm-ick: 'ti,index-starts-at-one', 'ti,max-div' do not
> >>> match any of the regexes: 'pinctrl-[0-9]+'
> >>>
> >>> I think we should rather postpone such referencing.    
> >>
> >> Are you sure in such case that your binding is correct? The warnings
> >> suggest that not, therefore please do not postpone.
> >>  
> > well, there is not only stuff from clock/ti/ti,interface.yaml but also from
> > clock/ti/divider.txt below ti,clksel. So I have one warning about the missing
> > compatible there and also about the properties belonging to that compatible.  
> 
> Ah, you have other bindings for the "-ick" nodes? Then you cannot match
> by pattern now, indeed. Maybe skipping ref but adding "compatible" into
> node, like we do for Qualcomm mdss bindings, would work. But in general
> all these should be converted at the same time.
> 
Yes, there are other bindings for the "-ick" nodes. But these bindings
are not exclusive to the "-ick" nodes. I personally would prefer not
having to do the whole clock/ti/*.txt directory at once.

Regards,
Andreas
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/clock/ti/interface.txt b/Documentation/devicetree/bindings/clock/ti/interface.txt
deleted file mode 100644
index d3eb5ca92a7fe..0000000000000
--- a/Documentation/devicetree/bindings/clock/ti/interface.txt
+++ /dev/null
@@ -1,57 +0,0 @@ 
-Binding for Texas Instruments interface clock.
-
-Binding status: Unstable - ABI compatibility may be broken in the future
-
-This binding uses the common clock binding[1]. This clock is
-quite much similar to the basic gate-clock [2], however,
-it supports a number of additional features, including
-companion clock finding (match corresponding functional gate
-clock) and hardware autoidle enable / disable.
-
-[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
-[2] Documentation/devicetree/bindings/clock/gpio-gate-clock.yaml
-
-Required properties:
-- compatible : shall be one of:
-  "ti,omap3-interface-clock" - basic OMAP3 interface clock
-  "ti,omap3-no-wait-interface-clock" - interface clock which has no hardware
-				       capability for waiting clock to be ready
-  "ti,omap3-hsotgusb-interface-clock" - interface clock with USB specific HW
-					handling
-  "ti,omap3-dss-interface-clock" - interface clock with DSS specific HW handling
-  "ti,omap3-ssi-interface-clock" - interface clock with SSI specific HW handling
-  "ti,am35xx-interface-clock" - interface clock with AM35xx specific HW handling
-  "ti,omap2430-interface-clock" - interface clock with OMAP2430 specific HW
-				  handling
-- #clock-cells : from common clock binding; shall be set to 0
-- clocks : link to phandle of parent clock
-- reg : base address for the control register
-
-Optional properties:
-- clock-output-names : from common clock binding.
-- ti,bit-shift : bit shift for the bit enabling/disabling the clock (default 0)
-
-Examples:
-	aes1_ick: aes1_ick@48004a14 {
-		#clock-cells = <0>;
-		compatible = "ti,omap3-interface-clock";
-		clocks = <&security_l4_ick2>;
-		reg = <0x48004a14 0x4>;
-		ti,bit-shift = <3>;
-	};
-
-	cam_ick: cam_ick@48004f10 {
-		#clock-cells = <0>;
-		compatible = "ti,omap3-no-wait-interface-clock";
-		clocks = <&l4_ick>;
-		reg = <0x48004f10 0x4>;
-		ti,bit-shift = <0>;
-	};
-
-	ssi_ick_3430es2: ssi_ick_3430es2@48004a10 {
-		#clock-cells = <0>;
-		compatible = "ti,omap3-ssi-interface-clock";
-		clocks = <&ssi_l4_ick>;
-		reg = <0x48004a10 0x4>;
-		ti,bit-shift = <0>;
-	};
diff --git a/Documentation/devicetree/bindings/clock/ti/ti,interface-clock.yaml b/Documentation/devicetree/bindings/clock/ti/ti,interface-clock.yaml
new file mode 100644
index 0000000000000..48a54caeb3857
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/ti/ti,interface-clock.yaml
@@ -0,0 +1,90 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/ti/ti,interface-clock.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Texas Instruments interface clock.
+
+maintainers:
+  - Tero Kristo <kristo@kernel.org>
+
+description: |
+  This binding uses the common clock binding[1]. This clock is
+  quite much similar to the basic gate-clock[2], however,
+  it supports a number of additional features, including
+  companion clock finding (match corresponding functional gate
+  clock) and hardware autoidle enable / disable.
+
+  [1] Documentation/devicetree/bindings/clock/clock-bindings.txt
+  [2] Documentation/devicetree/bindings/clock/gpio-gate-clock.yaml
+
+
+properties:
+  compatible:
+    enum:
+      - ti,omap3-interface-clock           # basic OMAP3 interface clock
+      - ti,omap3-no-wait-interface-clock   # interface clock which has no hardware
+                                           # capability for waiting clock to be ready
+      - ti,omap3-hsotgusb-interface-clock  # interface clock with USB specific HW handling
+      - ti,omap3-dss-interface-clock       # interface clock with DSS specific HW handling
+      - ti,omap3-ssi-interface-clock       # interface clock with SSI specific HW handling
+      - ti,am35xx-interface-clock          # interface clock with AM35xx specific HW handling
+      - ti,omap2430-interface-clock        # interface clock with OMAP2430 specific HW handling
+  "#clock-cells":
+    const: 0
+
+  clocks:
+    maxItems: 1
+
+  clock-output-names:
+    maxItems: 1
+
+  reg:
+    description:
+      if not specified, value from parent is used
+    maxItems: 1
+
+  ti,bit-shift:
+    description:
+      bit shift for the bit enabling/disabling the clock
+    $ref: /schemas/types.yaml#/definitions/uint32
+    default: 0
+
+required:
+  - compatible
+  - clocks
+  - '#clock-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    bus {
+      #address-cells = <1>;
+      #size-cells = <1>;
+
+      aes1_ick: aes1-ick@48004a14 {
+        #clock-cells = <0>;
+        compatible = "ti,omap3-interface-clock";
+        clocks = <&security_l4_ick2>;
+        reg = <0x48004a14 0x4>;
+        ti,bit-shift = <3>;
+      };
+
+      cam_ick: cam-ick@48004f10 {
+        #clock-cells = <0>;
+        compatible = "ti,omap3-no-wait-interface-clock";
+        clocks = <&l4_ick>;
+        reg = <0x48004f10 0x4>;
+        ti,bit-shift = <0>;
+      };
+
+      ssi_ick_3430es2: ssi-ick-3430es2@48004a10 {
+        #clock-cells = <0>;
+        compatible = "ti,omap3-ssi-interface-clock";
+        clocks = <&ssi_l4_ick>;
+        reg = <0x48004a10 0x4>;
+        ti,bit-shift = <0>;
+      };
+    };