Skip to contentSkip to conversation

dt-bindings: clock: Add binding for TI clksel

PATCH Superseded Tony Lindgren 2 participants 5 messages Dec 17, 2021 – Jan 10, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dt-bindings: clock: Add binding for TI clksel

In order to prepare for fixing lots of devicetree unique_unit_address warnings for the TI clock nodes, let's add a binding for the clksel clocks. This allows us to move the overlapping devicetree clocks to be children of the related clksel nodes. And then we need the reg property only for the parent clksel node.

We want to set #clock-cells = <1> in case we ever start parsing the clkcsel clocks directly using a clksel driver rather than using the existing component clock drivers and child nodes. We also need to update the clock drivers to get the IO address from the parent clksel node before updating the dts files. These will be posted as separate patches.

---
 .../bindings/clock/ti/ti,clksel.yaml          | 41 +++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/ti/ti,clksel.yaml
Documentation/devicetree/bindings/clock/ti/ti,clksel.yaml new file +41 -0
new file mode 100644
@@ -0,0 +1,41 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/ti/ti,clksel.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Binding for TI clksel clock
+
+maintainers:
+  - Tony Lindgren <[email protected]>
+
+description: |
+  The TI CLKSEL clocks consist of consist of a mux, divider, multiplier and
+  gate bits.
+
+properties:
+  compatible:
+    const: ti,clksel
+
+  reg:
+    maxItems: 1
+    description: The CLKSEL register
+
+  "#clock-cells":
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - "#clock-cells"
+
+additionalProperties: true
+
+examples:
+  - |
+    clksel_gfx_fclk: clock@52c {
+      compatible = "ti,clksel";
+      reg = <0x25c 0x4>;
+      #clock-cells = <1>;
+    };
+...
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 46 lines · Tony Lindgren

In order to prepare for fixing lots of devicetree unique_unit_address warnings for the TI clock nodes, let's add a binding for the clksel clocks. This allows us to move the overlapping devicetree clocks to be children of the related clksel nodes. And then we need the reg property only for the parent clksel node.

We want to set #clock-cells = <1> in case we ever start parsing the clkcsel clocks directly using a clksel driver rather than using the existing component clock drivers and child nodes. We also need to update the clock drivers to get the IO address from the parent clksel node before updating the dts files. These will be posted as separate patches.

---
 .../bindings/clock/ti/ti,clksel.yaml          | 41 +++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/ti/ti,clksel.yaml
Documentation/devicetree/bindings/clock/ti/ti,clksel.yaml new file +22 -0
new file mode 100644
@@ -0,0 +1,41 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/ti/ti,clksel.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Binding for TI clksel clock
+
+maintainers:
+  - Tony Lindgren <[email protected]>
+
+description: |
+  The TI CLKSEL clocks consist of consist of a mux, divider, multiplier and
+  gate bits.
+
+properties:
+  compatible:
+    const: ti,clksel
+
+  reg:
+    maxItems: 1
+    description: The CLKSEL register

Documentation/devicetree/bindings/clock/ti/ti,clksel.yaml line 32

Quoted 10 lines
Documentation/devicetree/bindings/clock/ti/ti,clksel.yaml new file +10 -0
+
+  "#clock-cells":
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - "#clock-cells"
+
+additionalProperties: true

Like what properties?

true is only used for common, incomplete schemas referenced by device schemas.

Quoted 12 lines
Documentation/devicetree/bindings/clock/ti/ti,clksel.yaml new file +9 -0
+
+examples:
+  - |
+    clksel_gfx_fclk: clock@52c {
+      compatible = "ti,clksel";
+      reg = <0x25c 0x4>;
+      #clock-cells = <1>;
+    };
+...
Signature · 1 line
2.34.1
#2 lore raw

Hi,

Quoted 7 lines · Rob Herring
Quoted 1 line · Tony Lindgren

+additionalProperties: true

Like what properties?

true is only used for common, incomplete schemas referenced by device schemas.

There is a collection of the current component clock child nodes for each clksel instance. I got warnings with "additionalProperties: false", but maybe the child clock nodes need to be somehow specified in the binding?

For example, below is a sample patch for am335x CLKSEL_GFX_FCLK using a clksel parent node with the child nodes moved to fix warnings for unique_unit_address. It also has clock-output-names property added to avoid the node naming warnings. For the other clksel instances, they can be a collection of dividers, multipliers, gates and muxes.

Regards,

Tony

8< --------

arch/arm/boot/dts/am33xx-clocks.dtsi +20 -13
@@ -494,20 +494,27 @@ mmc_clk: mmc_clk {
 		clock-div = <2>;
 	};
 
-	gfx_fclk_clksel_ck: gfx_fclk_clksel_ck@52c {
-		#clock-cells = <0>;
-		compatible = "ti,mux-clock";
-		clocks = <&dpll_core_m4_ck>, <&dpll_per_m2_ck>;
-		ti,bit-shift = <1>;
-		reg = <0x052c>;
-	};
+	clock@52c {
+		compatible = "ti,clksel";
+		reg = <0x52c>;
+		#clock-cells = <1>;
+		#address-cells = <0>;
+
+		gfx_fclk_clksel_ck: clock-gfx-fclk-clksel {
+			#clock-cells = <0>;
+			compatible = "ti,mux-clock";
+			clock-output-names = "gfx_fclk_clksel_ck";
+			clocks = <&dpll_core_m4_ck>, <&dpll_per_m2_ck>;
+			ti,bit-shift = <1>;
+		};
 
-	gfx_fck_div_ck: gfx_fck_div_ck@52c {
-		#clock-cells = <0>;
-		compatible = "ti,divider-clock";
-		clocks = <&gfx_fclk_clksel_ck>;
-		reg = <0x052c>;
-		ti,max-div = <2>;
+		gfx_fck_div_ck: clock-gfx-fck-div {
+			#clock-cells = <0>;
+			compatible = "ti,divider-clock";
+			clock-output-names = "gfx_fck_div_ck";
+			clocks = <&gfx_fclk_clksel_ck>;
+			ti,max-div = <2>;
+		};
 	};
 
 	sysclkout_pre_ck: sysclkout_pre_ck@700 {
maintainer
#3 lore raw
Quoted 7 lines · Tony Lindgren

Hi,

Quoted 3 lines · Rob Herring
Quoted 1 line · Tony Lindgren

+additionalProperties: true

Quoted 8 lines
Quoted 4 lines

Like what properties?

true is only used for common, incomplete schemas referenced by device schemas.

There is a collection of the current component clock child nodes for each clksel instance. I got warnings with "additionalProperties: false", but maybe the child clock nodes need to be somehow specified in the binding?

If everything else is a child node, then you can do:

additionalProperties:
type: object

Quoted 56 lines

For example, below is a sample patch for am335x CLKSEL_GFX_FCLK using a clksel parent node with the child nodes moved to fix warnings for unique_unit_address. It also has clock-output-names property added to avoid the node naming warnings. For the other clksel instances, they can be a collection of dividers, multipliers, gates and muxes.

Regards,

Tony

8< --------

arch/arm/boot/dts/am33xx-clocks.dtsi +20 -13
@@ -494,20 +494,27 @@ mmc_clk: mmc_clk {
                clock-div = <2>;
        };
 
-       gfx_fclk_clksel_ck: gfx_fclk_clksel_ck@52c {
-               #clock-cells = <0>;
-               compatible = "ti,mux-clock";
-               clocks = <&dpll_core_m4_ck>, <&dpll_per_m2_ck>;
-               ti,bit-shift = <1>;
-               reg = <0x052c>;
-       };
+       clock@52c {
+               compatible = "ti,clksel";
+               reg = <0x52c>;
+               #clock-cells = <1>;
+               #address-cells = <0>;
+
+               gfx_fclk_clksel_ck: clock-gfx-fclk-clksel {
+                       #clock-cells = <0>;
+                       compatible = "ti,mux-clock";
+                       clock-output-names = "gfx_fclk_clksel_ck";
+                       clocks = <&dpll_core_m4_ck>, <&dpll_per_m2_ck>;
+                       ti,bit-shift = <1>;
+               };
 
-       gfx_fck_div_ck: gfx_fck_div_ck@52c {
-               #clock-cells = <0>;
-               compatible = "ti,divider-clock";
-               clocks = <&gfx_fclk_clksel_ck>;
-               reg = <0x052c>;
-               ti,max-div = <2>;
+               gfx_fck_div_ck: clock-gfx-fck-div {
+                       #clock-cells = <0>;
+                       compatible = "ti,divider-clock";
+                       clock-output-names = "gfx_fck_div_ck";
+                       clocks = <&gfx_fclk_clksel_ck>;
+                       ti,max-div = <2>;
+               };
        };
 
        sysclkout_pre_ck: sysclkout_pre_ck@700 {
#4 lore raw
Quoted 13 lines · Rob Herring
Quoted 12 lines · Tony Lindgren

Hi,

Quoted 7 lines · Rob Herring
Quoted 1 line · Tony Lindgren

+additionalProperties: true

Like what properties?

true is only used for common, incomplete schemas referenced by device schemas.

Quoted 8 lines
Quoted 3 lines

There is a collection of the current component clock child nodes for each clksel instance. I got warnings with "additionalProperties: false", but maybe the child clock nodes need to be somehow specified in the binding?

If everything else is a child node, then you can do:

additionalProperties:
type: object

OK thanks will do, the additional properties are always child nodes.

Regards,

Tony