Skip to contentSkip to conversation

Add ums512 clocks and relative bindings file

PATCH Superseded Cixi Geng 2 participants 18 messages Apr 18, 2022 – Apr 27, 2022

Subsystems (3)

v3 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

Cixi Geng

author
#0 lore raw

v3 cover Add ums512 clocks and relative bindings file

From: Cixi Geng <[email protected]>

This patchset is add the UMS512 clocks support

v2 changes:
adjust description and add the "sprd,ums512-glbregs,syscon,simple-mfd" compatibles to fix match failed logs in the dt_binding_check. add the property license and copyright notice.

v3 changes:
fix wrong indentation and hint: "maxItems" is not needed with an "items" list when use the latest dtschema.

Cixi Geng (3):
dt-bindings: clk: sprd: Add bindings for ums512 clock controller
clk: sprd: Add dt-bindings include file for UMS512
clk: sprd: Add clocks support for UMS512

 .../bindings/clock/sprd,ums512-clk.yaml       |  112 +
 drivers/clk/sprd/Kconfig                      |    6 +
 drivers/clk/sprd/Makefile                     |    1 +
 drivers/clk/sprd/ums512-clk.c                 | 2199 +++++++++++++++++
 include/dt-bindings/clock/sprd,ums512-clk.h   |  397 +++
 5 files changed, 2715 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml
 create mode 100644 drivers/clk/sprd/ums512-clk.c
 create mode 100644 include/dt-bindings/clock/sprd,ums512-clk.h
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH v3 1/3 dt-bindings: clk: sprd: Add bindings for ums512 clock controller

From: Cixi Geng <[email protected]>

Add a new bindings to describe ums512 clock compatible string.

---
 .../bindings/clock/sprd,ums512-clk.yaml       | 112 ++++++++++++++++++
 1 file changed, 112 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +112 -0
new file mode 100644
index 000000000000..89824d7c6be4
@@ -0,0 +1,112 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright 2022 Unisoc Inc.
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/clock/sprd,ums512-clk.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: UMS512 Clock Control Unit Device Tree Bindings
+
+maintainers:
+  - Orson Zhai <[email protected]>
+  - Baolin Wang <[email protected]>
+  - Chunyan Zhang <[email protected]>
+
+properties:
+  "#clock-cells":
+    const: 1
+
+  compatible:
+    oneOf:
+      - items:
+          - const: sprd,ums512-glbregs
+          - const: syscon
+          - const: simple-mfd
+      - items:
+          - enum:
+              - sprd,ums512-apahb-gate
+              - sprd,ums512-ap-clk
+              - sprd,ums512-aonapb-clk
+              - sprd,ums512-pmu-gate
+              - sprd,ums512-g0-pll
+              - sprd,ums512-g2-pll
+              - sprd,ums512-g3-pll
+              - sprd,ums512-gc-pll
+              - sprd,ums512-aon-gate
+              - sprd,ums512-audcpapb-gate
+              - sprd,ums512-audcpahb-gate
+              - sprd,ums512-gpu-clk
+              - sprd,ums512-mm-clk
+              - sprd,ums512-mm-gate-clk
+              - sprd,ums512-apapb-gate
+
+  clocks:
+    minItems: 1
+    description: |
+      The input parent clock(s) phandle for this clock, only list fixed
+      clocks which are declared in devicetree.
+
+  clock-names:
+    minItems: 1
+    items:
+      - const: ext-26m
+      - const: ext-32k
+      - const: ext-4m
+      - const: rco-100m
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - '#clock-cells'
+
+if:
+  properties:
+    compatible:
+      enum:
+        - sprd,ums512-ap-clk
+        - sprd,ums512-aonapb-clk
+        - sprd,ums512-mm-clk
+then:
+  required:
+    - reg
+
+else:
+  description: |
+    Other UMS512 clock nodes should be the child of a syscon node in
+    which compatible string should be:
+            "sprd,ums512-glbregs", "syscon", "simple-mfd"
+
+    The 'reg' property for the clock node is also required if there is a sub
+    range of registers for the clocks.
+
+additionalProperties: true
+
+examples:
+  - |
+    ap_clk: clock-controller@20200000 {
+      compatible = "sprd,ums512-ap-clk";
+      reg = <0x20200000 0x1000>;
+      clocks = <&ext_26m>;
+      clock-names = "ext-26m";
+      #clock-cells = <1>;
+    };
+
+  - |
+    ap_apb_regs: syscon@71000000 {
+      compatible = "sprd,ums512-glbregs", "syscon", "simple-mfd";
+      reg = <0x71000000 0x3000>;
+      #address-cells = <1>;
+      #size-cells = <1>;
+      #clock-cells = <1>;
+      ranges = <0 0x71000000 0x3000>;
+
+      apahb_gate: clock-controller@0 {
+        compatible = "sprd,ums512-apahb-gate";
+        reg = <0x0 0x2000>;
+        #clock-cells = <1>;
+      };
+    };
+
+...
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH V3 1/3] dt-bindings: clk: sprd: Add bindings for ums512 clock controller

Quoted 16 lines · Cixi Geng

From: Cixi Geng <[email protected]>

Add a new bindings to describe ums512 clock compatible string.

---
 .../bindings/clock/sprd,ums512-clk.yaml       | 112 ++++++++++++++++++
 1 file changed, 112 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +0 -0
new file mode 100644
index 000000000000..89824d7c6be4

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 8

Quoted 8 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +8 -0
@@ -0,0 +1,112 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright 2022 Unisoc Inc.
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/clock/sprd,ums512-clk.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: UMS512 Clock Control Unit Device Tree Bindings

Remove "Device Tree Bindings". You could do the same also in the subject, because you repeat the prefix ("dt-bindings: clk: sprd: Add ums512 clock controller").

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 19

Quoted 11 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +11 -0
+
+maintainers:
+  - Orson Zhai <[email protected]>
+  - Baolin Wang <[email protected]>
+  - Chunyan Zhang <[email protected]>
+
+properties:
+  "#clock-cells":
+    const: 1
+
+  compatible:

Put the compatible first, by convention and makes finding matching bindings easier.

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 24

Quoted 5 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +5 -0
+    oneOf:
+      - items:
+          - const: sprd,ums512-glbregs
+          - const: syscon
+          - const: simple-mfd

Why do you need simple-mfd for these? This looks like a regular syscon, so usually does not come with children. What is more, why this "usual syscon" is a separate clock controller in these bindings?

Quoted 10 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +10 -0
+      - items:
+          - enum:
+              - sprd,ums512-apahb-gate
+              - sprd,ums512-ap-clk
+              - sprd,ums512-aonapb-clk
+              - sprd,ums512-pmu-gate
+              - sprd,ums512-g0-pll
+              - sprd,ums512-g2-pll
+              - sprd,ums512-g3-pll
+              - sprd,ums512-gc-pll

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 44

Quoted 10 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +10 -0
+              - sprd,ums512-aon-gate
+              - sprd,ums512-audcpapb-gate
+              - sprd,ums512-audcpahb-gate
+              - sprd,ums512-gpu-clk
+              - sprd,ums512-mm-clk
+              - sprd,ums512-mm-gate-clk
+              - sprd,ums512-apapb-gate
+
+  clocks:
+    minItems: 1

maxItems needed

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 47

Quoted 3 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +3 -0
+    description: |
+      The input parent clock(s) phandle for this clock, only list fixed
+      clocks which are declared in devicetree.

The description does not make sense. These are bindings for a clock controller, but you say here "for this clock", so what does "this" mean here?

Quoted 5 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +5 -0
+
+  clock-names:
+    minItems: 1
+    items:
+      - const: ext-26m

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 62

Quoted 10 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +10 -0
+      - const: ext-32k
+      - const: ext-4m
+      - const: rco-100m
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - '#clock-cells'

Isn't reg also required? Always? Do you have examples where it is not required? How do you configure the clocks without "reg"? I see you copied a lot from sprd,sc9863a-clk.yaml but that file does not look correct.

You have nodes with reg but without unit address ("rpll"). These nodes are modeled as children but they are not children - it's a workaround for exposing syscon, isn't it? The sc9863a looks like broken design, so please do not duplicate it here.

Quoted 12 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +12 -0
+
+if:
+  properties:
+    compatible:
+      enum:
+        - sprd,ums512-ap-clk
+        - sprd,ums512-aonapb-clk
+        - sprd,ums512-mm-clk
+then:
+  required:
+    - reg
+

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 84

Quoted 10 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +10 -0
+else:
+  description: |
+    Other UMS512 clock nodes should be the child of a syscon node in
+    which compatible string should be:
+            "sprd,ums512-glbregs", "syscon", "simple-mfd"
+
+    The 'reg' property for the clock node is also required if there is a sub
+    range of registers for the clocks.
+
+additionalProperties: true

false

Quoted 4 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +4 -0
+
+examples:
+  - |
+    ap_clk: clock-controller@20200000 {

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 98

Quoted 10 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +10 -0
+      compatible = "sprd,ums512-ap-clk";
+      reg = <0x20200000 0x1000>;
+      clocks = <&ext_26m>;
+      clock-names = "ext-26m";
+      #clock-cells = <1>;
+    };
+
+  - |
+    ap_apb_regs: syscon@71000000 {
+      compatible = "sprd,ums512-glbregs", "syscon", "simple-mfd";

So here is the answer why you added MFD, but I still don't get why do you need it for one child? It is quite a dance here and in your drivers, instead of adding "syscon" to your clock controller.

This also pollutes the actual bindings because you did not add properties required for clock controllers, because of describing here the syscon part.

Quoted 4 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +4 -0
+      reg = <0x71000000 0x3000>;
+      #address-cells = <1>;
+      #size-cells = <1>;
+      #clock-cells = <1>;

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 112

Quoted 10 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +10 -0
+      ranges = <0 0x71000000 0x3000>;
+
+      apahb_gate: clock-controller@0 {
+        compatible = "sprd,ums512-apahb-gate";
+        reg = <0x0 0x2000>;
+        #clock-cells = <1>;
+      };
+    };
+
+...

Best regards,
Krzysztof

author
#3 lore raw

Re: [PATCH V3 1/3] dt-bindings: clk: sprd: Add bindings for ums512 clock controller

Quoted 52 lines · Krzysztof Kozlowski <[email protected]> 于2022年4月19日周二 00:28写道:
Quoted 16 lines · Cixi Geng

From: Cixi Geng <[email protected]>

Add a new bindings to describe ums512 clock compatible string.

---
 .../bindings/clock/sprd,ums512-clk.yaml       | 112 ++++++++++++++++++
 1 file changed, 112 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +0 -0
new file mode 100644
index 000000000000..89824d7c6be4

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 8

Quoted 8 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +8 -0
@@ -0,0 +1,112 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright 2022 Unisoc Inc.
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/clock/sprd,ums512-clk.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: UMS512 Clock Control Unit Device Tree Bindings

Remove "Device Tree Bindings". You could do the same also in the subject, because you repeat the prefix ("dt-bindings: clk: sprd: Add ums512 clock controller").

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 19

Quoted 11 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +11 -0
+
+maintainers:
+  - Orson Zhai <[email protected]>
+  - Baolin Wang <[email protected]>
+  - Chunyan Zhang <[email protected]>
+
+properties:
+  "#clock-cells":
+    const: 1
+
+  compatible:

Put the compatible first, by convention and makes finding matching bindings easier.

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 24

Quoted 5 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +5 -0
+    oneOf:
+      - items:
+          - const: sprd,ums512-glbregs
+          - const: syscon
+          - const: simple-mfd
Quoted 3 lines

Why do you need simple-mfd for these? This looks like a regular syscon, so usually does not come with children. What is more, why this "usual syscon" is a separate clock controller in these bindings?

there is a warning log before add these const. and the reason we need the simply-mfd
is some clock is a child of syscon node,which should set these compatible. failed to match any schema with compatible: ['sprd,ums512-glbregs', 'syscon', 'simple-mfd']

Quoted 22 lines
Quoted 11 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +10 -0
+      - items:
+          - enum:
+              - sprd,ums512-apahb-gate
+              - sprd,ums512-ap-clk
+              - sprd,ums512-aonapb-clk
+              - sprd,ums512-pmu-gate
+              - sprd,ums512-g0-pll
+              - sprd,ums512-g2-pll
+              - sprd,ums512-g3-pll
+              - sprd,ums512-gc-pll

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 44

Quoted 10 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +10 -0
+              - sprd,ums512-aon-gate
+              - sprd,ums512-audcpapb-gate
+              - sprd,ums512-audcpahb-gate
+              - sprd,ums512-gpu-clk
+              - sprd,ums512-mm-clk
+              - sprd,ums512-mm-gate-clk
+              - sprd,ums512-apapb-gate
+
+  clocks:
+    minItems: 1
Quoted 1 line

maxItems needed

the previous version did has the maxitems, but makes error when run 'make DT_CHECKER_FLAGS=-m dt_binding_check O=./dt-out \
DT_SCHEMA_FILES=Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml'
CHKDT Documentation/devicetree/bindings/processed-schema.json
/path-to-linux/Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml:
properties:clock-names: {'minItems': 1, 'maxItems': 4, 'items':
[{'const': 'ext-26m'}, {'const': 'ext-32k'}, {'const': 'ext-4m'}, {'const': 'rco-100m'}]} should not be valid under {'required':
['maxItems']}
hint: "maxItems" is not needed with an "items" list

Quoted 50 lines

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 47

Quoted 4 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +3 -0
+    description: |
+      The input parent clock(s) phandle for this clock, only list fixed
+      clocks which are declared in devicetree.

The description does not make sense. These are bindings for a clock controller, but you say here "for this clock", so what does "this" mean here?

Quoted 5 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +5 -0
+
+  clock-names:
+    minItems: 1
+    items:
+      - const: ext-26m

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 62

Quoted 10 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +10 -0
+      - const: ext-32k
+      - const: ext-4m
+      - const: rco-100m
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - '#clock-cells'

Isn't reg also required? Always? Do you have examples where it is not required? How do you configure the clocks without "reg"? I see you copied a lot from sprd,sc9863a-clk.yaml but that file does not look correct.

You have nodes with reg but without unit address ("rpll"). These nodes are modeled as children but they are not children - it's a workaround for exposing syscon, isn't it? The sc9863a looks like broken design, so please do not duplicate it here.

Quoted 16 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +16 -0
+
+if:
+  properties:
+    compatible:
+      enum:
+        - sprd,ums512-ap-clk
+        - sprd,ums512-aonapb-clk
+        - sprd,ums512-mm-clk
+then:
+  required:
+    - reg
+
+else:
+  description: |
+    Other UMS512 clock nodes should be the child of a syscon node in
+    which compatible string should be:
Quoted 8 lines

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 84

Quoted 6 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +6 -0
+            "sprd,ums512-glbregs", "syscon", "simple-mfd"
+
+    The 'reg' property for the clock node is also required if there is a sub
+    range of registers for the clocks.
+
+additionalProperties: true

false

the "false" makes error log:
/path-to-linux/Documentation/devicetree/bindings/clock/sprd,ums512-clk.example.dtb:
syscon@71000000: '#address-cells', '#size-cells', 'clock-controller@0', 'ranges' do not match any of the regexes:
'pinctrl-[0-9]+'
and I reference the patch
[https://www.spinics.net/lists/linux-leds/msg17032.html]

Quoted 11 lines
Quoted 11 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +10 -0
+
+examples:
+  - |
+    ap_clk: clock-controller@20200000 {
+      compatible = "sprd,ums512-ap-clk";
+      reg = <0x20200000 0x1000>;
+      clocks = <&ext_26m>;
+      clock-names = "ext-26m";
+      #clock-cells = <1>;
+    };
Quoted 8 lines

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 98

Quoted 4 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +4 -0
+
+  - |
+    ap_apb_regs: syscon@71000000 {
+      compatible = "sprd,ums512-glbregs", "syscon", "simple-mfd";

So here is the answer why you added MFD, but I still don't get why do you need it for one child? It is quite a dance here and in your drivers, instead of adding "syscon" to your clock controller.

[1]in the if/else describtion, th other UMS512 clock nodes should be the child of a syscon node in
which compatible string should be: "sprd,ums512-glbregs", "syscon",
"simple-mfd"

Quoted 23 lines

This also pollutes the actual bindings because you did not add properties required for clock controllers, because of describing here the syscon part.

Quoted 4 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +4 -0
+      reg = <0x71000000 0x3000>;
+      #address-cells = <1>;
+      #size-cells = <1>;
+      #clock-cells = <1>;

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 112

Quoted 10 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +10 -0
+      ranges = <0 0x71000000 0x3000>;
+
+      apahb_gate: clock-controller@0 {
+        compatible = "sprd,ums512-apahb-gate";
+        reg = <0x0 0x2000>;
+        #clock-cells = <1>;
+      };
+    };
+
+...

Best regards,
Krzysztof

#4 lore raw

Re: [PATCH V3 1/3] dt-bindings: clk: sprd: Add bindings for ums512 clock controller

Quoted 53 lines · Cixi Geng
Quoted 52 lines · Krzysztof Kozlowski <[email protected]> 于2022年4月19日周二 00:28写道:
Quoted 16 lines · Cixi Geng

From: Cixi Geng <[email protected]>

Add a new bindings to describe ums512 clock compatible string.

---
 .../bindings/clock/sprd,ums512-clk.yaml       | 112 ++++++++++++++++++
 1 file changed, 112 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +0 -0
new file mode 100644
index 000000000000..89824d7c6be4

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 8

Quoted 8 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +8 -0
@@ -0,0 +1,112 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright 2022 Unisoc Inc.
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/clock/sprd,ums512-clk.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: UMS512 Clock Control Unit Device Tree Bindings

Remove "Device Tree Bindings". You could do the same also in the subject, because you repeat the prefix ("dt-bindings: clk: sprd: Add ums512 clock controller").

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 19

Quoted 11 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +11 -0
+
+maintainers:
+  - Orson Zhai <[email protected]>
+  - Baolin Wang <[email protected]>
+  - Chunyan Zhang <[email protected]>
+
+properties:
+  "#clock-cells":
+    const: 1
+
+  compatible:

Put the compatible first, by convention and makes finding matching bindings easier.

Quoted 5 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +5 -0
+    oneOf:
+      - items:
+          - const: sprd,ums512-glbregs
+          - const: syscon
+          - const: simple-mfd
Quoted 8 lines
Quoted 3 lines

Why do you need simple-mfd for these? This looks like a regular syscon, so usually does not come with children. What is more, why this "usual syscon" is a separate clock controller in these bindings?

there is a warning log before add these const. and the reason we need the simply-mfd
is some clock is a child of syscon node,which should set these compatible. failed to match any schema with compatible: ['sprd,ums512-glbregs', 'syscon', 'simple-mfd']

Neither here nor later you did not answer the question - why do you need such complex construction, instead of adding syscon to the clock controller?

Let me paste again my concerns:

You have nodes with reg but without unit address ("rpll"). These nodes are modeled as children but they are not children - it's a workaround for exposing syscon, isn't it? The sc9863a looks like broken design, so please do not duplicate it here.

IOW, sc9863a uses similar pattern as here and the DTS is made wrong. Because of this you need to create complex ways to get the regmap for the clock controller... Why not making it simple? Clock controller with syscon?

Quoted 23 lines
Quoted 22 lines
Quoted 11 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +10 -0
+      - items:
+          - enum:
+              - sprd,ums512-apahb-gate
+              - sprd,ums512-ap-clk
+              - sprd,ums512-aonapb-clk
+              - sprd,ums512-pmu-gate
+              - sprd,ums512-g0-pll
+              - sprd,ums512-g2-pll
+              - sprd,ums512-g3-pll
+              - sprd,ums512-gc-pll

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 44

Quoted 10 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +10 -0
+              - sprd,ums512-aon-gate
+              - sprd,ums512-audcpapb-gate
+              - sprd,ums512-audcpahb-gate
+              - sprd,ums512-gpu-clk
+              - sprd,ums512-mm-clk
+              - sprd,ums512-mm-gate-clk
+              - sprd,ums512-apapb-gate
+
+  clocks:
+    minItems: 1
Quoted 1 line

maxItems needed

Quoted 10 lines

the previous version did has the maxitems, but makes error when run 'make DT_CHECKER_FLAGS=-m dt_binding_check O=./dt-out \
DT_SCHEMA_FILES=Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml'
CHKDT Documentation/devicetree/bindings/processed-schema.json
/path-to-linux/Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml:
properties:clock-names: {'minItems': 1, 'maxItems': 4, 'items':
[{'const': 'ext-26m'}, {'const': 'ext-32k'}, {'const': 'ext-4m'}, {'const': 'rco-100m'}]} should not be valid under {'required':
['maxItems']}
hint: "maxItems" is not needed with an "items" list

Warning is about clock-names, not about clocks. Fix the bindings.

Quoted 59 lines
Quoted 51 lines

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 47

Quoted 5 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +3 -0
+    description: |
+      The input parent clock(s) phandle for this clock, only list fixed
+      clocks which are declared in devicetree.

The description does not make sense. These are bindings for a clock controller, but you say here "for this clock", so what does "this" mean here?

Quoted 5 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +5 -0
+
+  clock-names:
+    minItems: 1
+    items:
+      - const: ext-26m

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 62

Quoted 10 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +10 -0
+      - const: ext-32k
+      - const: ext-4m
+      - const: rco-100m
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - '#clock-cells'

Isn't reg also required? Always? Do you have examples where it is not required? How do you configure the clocks without "reg"? I see you copied a lot from sprd,sc9863a-clk.yaml but that file does not look correct.

You have nodes with reg but without unit address ("rpll"). These nodes are modeled as children but they are not children - it's a workaround for exposing syscon, isn't it? The sc9863a looks like broken design, so please do not duplicate it here.

Quoted 16 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +16 -0
+
+if:
+  properties:
+    compatible:
+      enum:
+        - sprd,ums512-ap-clk
+        - sprd,ums512-aonapb-clk
+        - sprd,ums512-mm-clk
+then:
+  required:
+    - reg
+
+else:
+  description: |
+    Other UMS512 clock nodes should be the child of a syscon node in
+    which compatible string should be:
Quoted 8 lines

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 84

Quoted 6 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +6 -0
+            "sprd,ums512-glbregs", "syscon", "simple-mfd"
+
+    The 'reg' property for the clock node is also required if there is a sub
+    range of registers for the clocks.
+
+additionalProperties: true

false

Quoted 7 lines

the "false" makes error log:
/path-to-linux/Documentation/devicetree/bindings/clock/sprd,ums512-clk.example.dtb:
syscon@71000000: '#address-cells', '#size-cells', 'clock-controller@0', 'ranges' do not match any of the regexes:
'pinctrl-[0-9]+'
and I reference the patch
[https://www.spinics.net/lists/linux-leds/msg17032.html]

Which needs fixing. The "false" is a strict requirement for such end (non-extendable) bindings.

Quoted 21 lines
Quoted 12 lines
Quoted 12 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +10 -0
+
+examples:
+  - |
+    ap_clk: clock-controller@20200000 {
+      compatible = "sprd,ums512-ap-clk";
+      reg = <0x20200000 0x1000>;
+      clocks = <&ext_26m>;
+      clock-names = "ext-26m";
+      #clock-cells = <1>;
+    };
Quoted 8 lines

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 98

Quoted 4 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +4 -0
+
+  - |
+    ap_apb_regs: syscon@71000000 {
+      compatible = "sprd,ums512-glbregs", "syscon", "simple-mfd";

So here is the answer why you added MFD, but I still don't get why do you need it for one child? It is quite a dance here and in your drivers, instead of adding "syscon" to your clock controller.

Quoted 4 lines

[1]in the if/else describtion, th other UMS512 clock nodes should be the child of a syscon node in
which compatible string should be: "sprd,ums512-glbregs", "syscon",
"simple-mfd"

No, it should not. Fix the drivers, fix the DTS and the bindings. Then the "should" disappears.

Quoted 5 lines
Quoted 5 lines

This also pollutes the actual bindings because you did not add properties required for clock controllers, because of describing here the syscon part.

Best regards,
Krzysztof

author
#5 lore raw

Re: [PATCH V3 1/3] dt-bindings: clk: sprd: Add bindings for ums512 clock controller

Hi Krzysztof:
I find the history discuss about the sp9863 clock[1] and last ums512-clk dt-bindings patch[2] which from chunyan. please refer to the reasons below.

These clocks are at the same register range with global registers. the registers shared with more than one devices
which basically are multimedia devices. You may noticed that these
are all gate clocks which are in the global registers
ranges and are used to controll the enable status of some devices or
some part of devices.

[1].https://lore.kernel.org/all/CAAfSe-s0gcehu0ZDj=FTe5S7CzAHC5mahXBH2fJm7mXS7Xys1Q@mail.gmail.com/ [2].https://lore.kernel.org/all/163425295208.1688384.11023187625793114662@swboyd.mtv.corp.google.com/

Quoted 223 lines · Krzysztof Kozlowski <[email protected]> 于2022年4月19日周二 14:38写道:
Quoted 53 lines · Cixi Geng
Quoted 52 lines · Krzysztof Kozlowski <[email protected]> 于2022年4月19日周二 00:28写道:
Quoted 16 lines · Cixi Geng

From: Cixi Geng <[email protected]>

Add a new bindings to describe ums512 clock compatible string.

---
 .../bindings/clock/sprd,ums512-clk.yaml       | 112 ++++++++++++++++++
 1 file changed, 112 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +0 -0
new file mode 100644
index 000000000000..89824d7c6be4

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 8

Quoted 8 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +8 -0
@@ -0,0 +1,112 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright 2022 Unisoc Inc.
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/clock/sprd,ums512-clk.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: UMS512 Clock Control Unit Device Tree Bindings

Remove "Device Tree Bindings". You could do the same also in the subject, because you repeat the prefix ("dt-bindings: clk: sprd: Add ums512 clock controller").

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 19

Quoted 11 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +11 -0
+
+maintainers:
+  - Orson Zhai <[email protected]>
+  - Baolin Wang <[email protected]>
+  - Chunyan Zhang <[email protected]>
+
+properties:
+  "#clock-cells":
+    const: 1
+
+  compatible:

Put the compatible first, by convention and makes finding matching bindings easier.

Quoted 5 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +5 -0
+    oneOf:
+      - items:
+          - const: sprd,ums512-glbregs
+          - const: syscon
+          - const: simple-mfd
Quoted 8 lines
Quoted 3 lines

Why do you need simple-mfd for these? This looks like a regular syscon, so usually does not come with children. What is more, why this "usual syscon" is a separate clock controller in these bindings?

there is a warning log before add these const. and the reason we need the simply-mfd
is some clock is a child of syscon node,which should set these compatible. failed to match any schema with compatible: ['sprd,ums512-glbregs', 'syscon', 'simple-mfd']

Neither here nor later you did not answer the question - why do you need such complex construction, instead of adding syscon to the clock controller?

Let me paste again my concerns:

You have nodes with reg but without unit address ("rpll"). These nodes are modeled as children but they are not children - it's a workaround for exposing syscon, isn't it? The sc9863a looks like broken design, so please do not duplicate it here.

IOW, sc9863a uses similar pattern as here and the DTS is made wrong. Because of this you need to create complex ways to get the regmap for the clock controller... Why not making it simple? Clock controller with syscon?

Quoted 23 lines
Quoted 22 lines
Quoted 11 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +10 -0
+      - items:
+          - enum:
+              - sprd,ums512-apahb-gate
+              - sprd,ums512-ap-clk
+              - sprd,ums512-aonapb-clk
+              - sprd,ums512-pmu-gate
+              - sprd,ums512-g0-pll
+              - sprd,ums512-g2-pll
+              - sprd,ums512-g3-pll
+              - sprd,ums512-gc-pll

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 44

Quoted 10 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +10 -0
+              - sprd,ums512-aon-gate
+              - sprd,ums512-audcpapb-gate
+              - sprd,ums512-audcpahb-gate
+              - sprd,ums512-gpu-clk
+              - sprd,ums512-mm-clk
+              - sprd,ums512-mm-gate-clk
+              - sprd,ums512-apapb-gate
+
+  clocks:
+    minItems: 1
Quoted 1 line

maxItems needed

Quoted 10 lines

the previous version did has the maxitems, but makes error when run 'make DT_CHECKER_FLAGS=-m dt_binding_check O=./dt-out \
DT_SCHEMA_FILES=Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml'
CHKDT Documentation/devicetree/bindings/processed-schema.json
/path-to-linux/Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml:
properties:clock-names: {'minItems': 1, 'maxItems': 4, 'items':
[{'const': 'ext-26m'}, {'const': 'ext-32k'}, {'const': 'ext-4m'}, {'const': 'rco-100m'}]} should not be valid under {'required':
['maxItems']}
hint: "maxItems" is not needed with an "items" list

Warning is about clock-names, not about clocks. Fix the bindings.

Quoted 59 lines
Quoted 51 lines

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 47

Quoted 5 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +3 -0
+    description: |
+      The input parent clock(s) phandle for this clock, only list fixed
+      clocks which are declared in devicetree.

The description does not make sense. These are bindings for a clock controller, but you say here "for this clock", so what does "this" mean here?

Quoted 5 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +5 -0
+
+  clock-names:
+    minItems: 1
+    items:
+      - const: ext-26m

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 62

Quoted 10 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +10 -0
+      - const: ext-32k
+      - const: ext-4m
+      - const: rco-100m
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - '#clock-cells'

Isn't reg also required? Always? Do you have examples where it is not required? How do you configure the clocks without "reg"? I see you copied a lot from sprd,sc9863a-clk.yaml but that file does not look correct.

You have nodes with reg but without unit address ("rpll"). These nodes are modeled as children but they are not children - it's a workaround for exposing syscon, isn't it? The sc9863a looks like broken design, so please do not duplicate it here.

Quoted 16 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +16 -0
+
+if:
+  properties:
+    compatible:
+      enum:
+        - sprd,ums512-ap-clk
+        - sprd,ums512-aonapb-clk
+        - sprd,ums512-mm-clk
+then:
+  required:
+    - reg
+
+else:
+  description: |
+    Other UMS512 clock nodes should be the child of a syscon node in
+    which compatible string should be:
Quoted 8 lines

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 84

Quoted 6 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +6 -0
+            "sprd,ums512-glbregs", "syscon", "simple-mfd"
+
+    The 'reg' property for the clock node is also required if there is a sub
+    range of registers for the clocks.
+
+additionalProperties: true

false

Quoted 7 lines

the "false" makes error log:
/path-to-linux/Documentation/devicetree/bindings/clock/sprd,ums512-clk.example.dtb:
syscon@71000000: '#address-cells', '#size-cells', 'clock-controller@0', 'ranges' do not match any of the regexes:
'pinctrl-[0-9]+'
and I reference the patch
[https://www.spinics.net/lists/linux-leds/msg17032.html]

Which needs fixing. The "false" is a strict requirement for such end (non-extendable) bindings.

Quoted 21 lines
Quoted 12 lines
Quoted 12 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +10 -0
+
+examples:
+  - |
+    ap_clk: clock-controller@20200000 {
+      compatible = "sprd,ums512-ap-clk";
+      reg = <0x20200000 0x1000>;
+      clocks = <&ext_26m>;
+      clock-names = "ext-26m";
+      #clock-cells = <1>;
+    };
Quoted 8 lines

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 98

Quoted 4 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +4 -0
+
+  - |
+    ap_apb_regs: syscon@71000000 {
+      compatible = "sprd,ums512-glbregs", "syscon", "simple-mfd";

So here is the answer why you added MFD, but I still don't get why do you need it for one child? It is quite a dance here and in your drivers, instead of adding "syscon" to your clock controller.

Quoted 4 lines

[1]in the if/else describtion, th other UMS512 clock nodes should be the child of a syscon node in
which compatible string should be: "sprd,ums512-glbregs", "syscon",
"simple-mfd"

No, it should not. Fix the drivers, fix the DTS and the bindings. Then the "should" disappears.

Quoted 5 lines
Quoted 5 lines

This also pollutes the actual bindings because you did not add properties required for clock controllers, because of describing here the syscon part.

Best regards,
Krzysztof

#6 lore raw

Re: [PATCH V3 1/3] dt-bindings: clk: sprd: Add bindings for ums512 clock controller

Quoted 11 lines · Cixi Geng

Hi Krzysztof:
I find the history discuss about the sp9863 clock[1] and last ums512-clk dt-bindings patch[2] which from chunyan. please refer to the reasons below.

These clocks are at the same register range with global registers. the registers shared with more than one devices
which basically are multimedia devices. You may noticed that these
are all gate clocks which are in the global registers
ranges and are used to controll the enable status of some devices or
some part of devices.

You replied top-post, I don't know what is it about.

Quoted 3 lines

[1].https://lore.kernel.org/all/CAAfSe-s0gcehu0ZDj=FTe5S7CzAHC5mahXBH2fJm7mXS7Xys1Q@mail.gmail.com/ [2].https://lore.kernel.org/all/163425295208.1688384.11023187625793114662@swboyd.mtv.corp.google.com/

Could you keep URLs without any additional characters (so surrounded by whitespace characters) because it makes impossible to open them.

Best regards,
Krzysztof

author
#7 lore raw

Re: [PATCH V3 1/3] dt-bindings: clk: sprd: Add bindings for ums512 clock controller

In reply to Krzysztof Kozlowski
Quoted 74 lines · Krzysztof Kozlowski <[email protected]> 于2022年4月19日周二 14:38写道:
Quoted 53 lines · Cixi Geng
Quoted 52 lines · Krzysztof Kozlowski <[email protected]> 于2022年4月19日周二 00:28写道:
Quoted 16 lines · Cixi Geng

From: Cixi Geng <[email protected]>

Add a new bindings to describe ums512 clock compatible string.

---
 .../bindings/clock/sprd,ums512-clk.yaml       | 112 ++++++++++++++++++
 1 file changed, 112 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +0 -0
new file mode 100644
index 000000000000..89824d7c6be4

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 8

Quoted 8 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +8 -0
@@ -0,0 +1,112 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright 2022 Unisoc Inc.
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/clock/sprd,ums512-clk.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: UMS512 Clock Control Unit Device Tree Bindings

Remove "Device Tree Bindings". You could do the same also in the subject, because you repeat the prefix ("dt-bindings: clk: sprd: Add ums512 clock controller").

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 19

Quoted 11 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +11 -0
+
+maintainers:
+  - Orson Zhai <[email protected]>
+  - Baolin Wang <[email protected]>
+  - Chunyan Zhang <[email protected]>
+
+properties:
+  "#clock-cells":
+    const: 1
+
+  compatible:

Put the compatible first, by convention and makes finding matching bindings easier.

Quoted 5 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +5 -0
+    oneOf:
+      - items:
+          - const: sprd,ums512-glbregs
+          - const: syscon
+          - const: simple-mfd
Quoted 8 lines
Quoted 3 lines

Why do you need simple-mfd for these? This looks like a regular syscon, so usually does not come with children. What is more, why this "usual syscon" is a separate clock controller in these bindings?

there is a warning log before add these const. and the reason we need the simply-mfd
is some clock is a child of syscon node,which should set these compatible. failed to match any schema with compatible: ['sprd,ums512-glbregs', 'syscon', 'simple-mfd']

Neither here nor later you did not answer the question - why do you need such complex construction, instead of adding syscon to the clock controller?

Let me paste again my concerns:

You have nodes with reg but without unit address ("rpll"). These nodes are modeled as children but they are not children - it's a workaround for exposing syscon, isn't it? The sc9863a looks like broken design, so please do not duplicate it here.

Quoted 4 lines

IOW, sc9863a uses similar pattern as here and the DTS is made wrong. Because of this you need to create complex ways to get the regmap for the clock controller... Why not making it simple? Clock controller with syscon?

I find the history discuss about the sp9863 clock[1] and last ums512-clk dt-bindings patch[2] which from chunyan. please refer to the reasons below.

These clocks are at the same register range with global registers. the registers shared with more than one devices which basically are multimedia devices. You may noticed that these are all gate clocks which are in the global registers ranges and are used to controll the enable status of some devices or some part of devices.

[1] https://lore.kernel.org/all/CAAfSe-s0gcehu0ZDj=FTe5S7CzAHC5mahXBH2fJm7mXS7Xys1Q@mail.gmail.com/#r
[2] https://lore.kernel.org/all/163425295208.1688384.11023187625793114662@swboyd.mtv.corp.google.com/#r

Quoted 145 lines
Quoted 24 lines
Quoted 23 lines
Quoted 12 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +10 -0
+      - items:
+          - enum:
+              - sprd,ums512-apahb-gate
+              - sprd,ums512-ap-clk
+              - sprd,ums512-aonapb-clk
+              - sprd,ums512-pmu-gate
+              - sprd,ums512-g0-pll
+              - sprd,ums512-g2-pll
+              - sprd,ums512-g3-pll
+              - sprd,ums512-gc-pll

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 44

Quoted 10 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +10 -0
+              - sprd,ums512-aon-gate
+              - sprd,ums512-audcpapb-gate
+              - sprd,ums512-audcpahb-gate
+              - sprd,ums512-gpu-clk
+              - sprd,ums512-mm-clk
+              - sprd,ums512-mm-gate-clk
+              - sprd,ums512-apapb-gate
+
+  clocks:
+    minItems: 1
Quoted 1 line

maxItems needed

Quoted 10 lines

the previous version did has the maxitems, but makes error when run 'make DT_CHECKER_FLAGS=-m dt_binding_check O=./dt-out \
DT_SCHEMA_FILES=Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml'
CHKDT Documentation/devicetree/bindings/processed-schema.json
/path-to-linux/Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml:
properties:clock-names: {'minItems': 1, 'maxItems': 4, 'items':
[{'const': 'ext-26m'}, {'const': 'ext-32k'}, {'const': 'ext-4m'}, {'const': 'rco-100m'}]} should not be valid under {'required':
['maxItems']}
hint: "maxItems" is not needed with an "items" list

Warning is about clock-names, not about clocks. Fix the bindings.

Quoted 59 lines
Quoted 51 lines

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 47

Quoted 5 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +3 -0
+    description: |
+      The input parent clock(s) phandle for this clock, only list fixed
+      clocks which are declared in devicetree.

The description does not make sense. These are bindings for a clock controller, but you say here "for this clock", so what does "this" mean here?

Quoted 5 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +5 -0
+
+  clock-names:
+    minItems: 1
+    items:
+      - const: ext-26m

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 62

Quoted 10 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +10 -0
+      - const: ext-32k
+      - const: ext-4m
+      - const: rco-100m
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - '#clock-cells'

Isn't reg also required? Always? Do you have examples where it is not required? How do you configure the clocks without "reg"? I see you copied a lot from sprd,sc9863a-clk.yaml but that file does not look correct.

You have nodes with reg but without unit address ("rpll"). These nodes are modeled as children but they are not children - it's a workaround for exposing syscon, isn't it? The sc9863a looks like broken design, so please do not duplicate it here.

Quoted 16 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +16 -0
+
+if:
+  properties:
+    compatible:
+      enum:
+        - sprd,ums512-ap-clk
+        - sprd,ums512-aonapb-clk
+        - sprd,ums512-mm-clk
+then:
+  required:
+    - reg
+
+else:
+  description: |
+    Other UMS512 clock nodes should be the child of a syscon node in
+    which compatible string should be:
Quoted 8 lines

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 84

Quoted 6 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +6 -0
+            "sprd,ums512-glbregs", "syscon", "simple-mfd"
+
+    The 'reg' property for the clock node is also required if there is a sub
+    range of registers for the clocks.
+
+additionalProperties: true

false

Quoted 7 lines

the "false" makes error log:
/path-to-linux/Documentation/devicetree/bindings/clock/sprd,ums512-clk.example.dtb:
syscon@71000000: '#address-cells', '#size-cells', 'clock-controller@0', 'ranges' do not match any of the regexes:
'pinctrl-[0-9]+'
and I reference the patch
[https://www.spinics.net/lists/linux-leds/msg17032.html]

Which needs fixing. The "false" is a strict requirement for such end (non-extendable) bindings.

Quoted 21 lines
Quoted 12 lines
Quoted 12 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +10 -0
+
+examples:
+  - |
+    ap_clk: clock-controller@20200000 {
+      compatible = "sprd,ums512-ap-clk";
+      reg = <0x20200000 0x1000>;
+      clocks = <&ext_26m>;
+      clock-names = "ext-26m";
+      #clock-cells = <1>;
+    };
Quoted 8 lines

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 98

Quoted 4 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +4 -0
+
+  - |
+    ap_apb_regs: syscon@71000000 {
+      compatible = "sprd,ums512-glbregs", "syscon", "simple-mfd";

So here is the answer why you added MFD, but I still don't get why do you need it for one child? It is quite a dance here and in your drivers, instead of adding "syscon" to your clock controller.

Quoted 4 lines

[1]in the if/else describtion, th other UMS512 clock nodes should be the child of a syscon node in
which compatible string should be: "sprd,ums512-glbregs", "syscon",
"simple-mfd"

No, it should not. Fix the drivers, fix the DTS and the bindings. Then the "should" disappears.

Quoted 5 lines
Quoted 5 lines

This also pollutes the actual bindings because you did not add properties required for clock controllers, because of describing here the syscon part.

Best regards,
Krzysztof

#8 lore raw

Re: [PATCH V3 1/3] dt-bindings: clk: sprd: Add bindings for ums512 clock controller

Quoted 84 lines · Cixi Geng
Quoted 74 lines · Krzysztof Kozlowski <[email protected]> 于2022年4月19日周二 14:38写道:
Quoted 53 lines · Cixi Geng
Quoted 52 lines · Krzysztof Kozlowski <[email protected]> 于2022年4月19日周二 00:28写道:
Quoted 16 lines · Cixi Geng

From: Cixi Geng <[email protected]>

Add a new bindings to describe ums512 clock compatible string.

---
 .../bindings/clock/sprd,ums512-clk.yaml       | 112 ++++++++++++++++++
 1 file changed, 112 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +0 -0
new file mode 100644
index 000000000000..89824d7c6be4

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 8

Quoted 8 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +8 -0
@@ -0,0 +1,112 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright 2022 Unisoc Inc.
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/clock/sprd,ums512-clk.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: UMS512 Clock Control Unit Device Tree Bindings

Remove "Device Tree Bindings". You could do the same also in the subject, because you repeat the prefix ("dt-bindings: clk: sprd: Add ums512 clock controller").

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 19

Quoted 11 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +11 -0
+
+maintainers:
+  - Orson Zhai <[email protected]>
+  - Baolin Wang <[email protected]>
+  - Chunyan Zhang <[email protected]>
+
+properties:
+  "#clock-cells":
+    const: 1
+
+  compatible:

Put the compatible first, by convention and makes finding matching bindings easier.

Quoted 5 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +5 -0
+    oneOf:
+      - items:
+          - const: sprd,ums512-glbregs
+          - const: syscon
+          - const: simple-mfd
Quoted 8 lines
Quoted 3 lines

Why do you need simple-mfd for these? This looks like a regular syscon, so usually does not come with children. What is more, why this "usual syscon" is a separate clock controller in these bindings?

there is a warning log before add these const. and the reason we need the simply-mfd
is some clock is a child of syscon node,which should set these compatible. failed to match any schema with compatible: ['sprd,ums512-glbregs', 'syscon', 'simple-mfd']

Neither here nor later you did not answer the question - why do you need such complex construction, instead of adding syscon to the clock controller?

Let me paste again my concerns:

You have nodes with reg but without unit address ("rpll"). These nodes are modeled as children but they are not children - it's a workaround for exposing syscon, isn't it? The sc9863a looks like broken design, so please do not duplicate it here.

Quoted 4 lines

IOW, sc9863a uses similar pattern as here and the DTS is made wrong. Because of this you need to create complex ways to get the regmap for the clock controller... Why not making it simple? Clock controller with syscon?

I find the history discuss about the sp9863 clock[1] and last ums512-clk dt-bindings patch[2] which from chunyan. please refer to the reasons below.

Quoted 8 lines

These clocks are at the same register range with global registers. the registers shared with more than one devices which basically are multimedia devices. You may noticed that these are all gate clocks which are in the global registers ranges and are used to controll the enable status of some devices or some part of devices.

[1] https://lore.kernel.org/all/CAAfSe-s0gcehu0ZDj=FTe5S7CzAHC5mahXBH2fJm7mXS7Xys1Q@mail.gmail.com/#r
[2] https://lore.kernel.org/all/163425295208.1688384.11023187625793114662@swboyd.mtv.corp.google.com/#r

Which looks like discussion about different bindings. You had there a clock controller and additional clock device using "sprd,syscon". Why the rpll is a subdevice and not a part of clock controller. The same as all other clocks coming from that clock-controller, right? What is so special about rpll that is is a separate device, not part of the clock controller? It's the same address space, isn't it?

Best regards,
Krzysztof

author
#9 lore raw

Re: [PATCH V3 1/3] dt-bindings: clk: sprd: Add bindings for ums512 clock controller

Quoted 95 lines · Krzysztof Kozlowski <[email protected]> 于2022年4月24日周日 19:21写道:
Quoted 84 lines · Cixi Geng
Quoted 74 lines · Krzysztof Kozlowski <[email protected]> 于2022年4月19日周二 14:38写道:
Quoted 53 lines · Cixi Geng
Quoted 52 lines · Krzysztof Kozlowski <[email protected]> 于2022年4月19日周二 00:28写道:
Quoted 16 lines · Cixi Geng

From: Cixi Geng <[email protected]>

Add a new bindings to describe ums512 clock compatible string.

---
 .../bindings/clock/sprd,ums512-clk.yaml       | 112 ++++++++++++++++++
 1 file changed, 112 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +0 -0
new file mode 100644
index 000000000000..89824d7c6be4

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 8

Quoted 8 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +8 -0
@@ -0,0 +1,112 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright 2022 Unisoc Inc.
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/clock/sprd,ums512-clk.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: UMS512 Clock Control Unit Device Tree Bindings

Remove "Device Tree Bindings". You could do the same also in the subject, because you repeat the prefix ("dt-bindings: clk: sprd: Add ums512 clock controller").

Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml line 19

Quoted 11 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +11 -0
+
+maintainers:
+  - Orson Zhai <[email protected]>
+  - Baolin Wang <[email protected]>
+  - Chunyan Zhang <[email protected]>
+
+properties:
+  "#clock-cells":
+    const: 1
+
+  compatible:

Put the compatible first, by convention and makes finding matching bindings easier.

Quoted 5 lines
Documentation/devicetree/bindings/clock/sprd,ums512-clk.yaml new file +5 -0
+    oneOf:
+      - items:
+          - const: sprd,ums512-glbregs
+          - const: syscon
+          - const: simple-mfd
Quoted 8 lines
Quoted 3 lines

Why do you need simple-mfd for these? This looks like a regular syscon, so usually does not come with children. What is more, why this "usual syscon" is a separate clock controller in these bindings?

there is a warning log before add these const. and the reason we need the simply-mfd
is some clock is a child of syscon node,which should set these compatible. failed to match any schema with compatible: ['sprd,ums512-glbregs', 'syscon', 'simple-mfd']

Neither here nor later you did not answer the question - why do you need such complex construction, instead of adding syscon to the clock controller?

Let me paste again my concerns:

You have nodes with reg but without unit address ("rpll"). These nodes are modeled as children but they are not children - it's a workaround for exposing syscon, isn't it? The sc9863a looks like broken design, so please do not duplicate it here.

Quoted 4 lines

IOW, sc9863a uses similar pattern as here and the DTS is made wrong. Because of this you need to create complex ways to get the regmap for the clock controller... Why not making it simple? Clock controller with syscon?

I find the history discuss about the sp9863 clock[1] and last ums512-clk dt-bindings patch[2] which from chunyan. please refer to the reasons below.

Quoted 8 lines

These clocks are at the same register range with global registers. the registers shared with more than one devices which basically are multimedia devices. You may noticed that these are all gate clocks which are in the global registers ranges and are used to controll the enable status of some devices or some part of devices.

[1] https://lore.kernel.org/all/CAAfSe-s0gcehu0ZDj=FTe5S7CzAHC5mahXBH2fJm7mXS7Xys1Q@mail.gmail.com/#r
[2] https://lore.kernel.org/all/163425295208.1688384.11023187625793114662@swboyd.mtv.corp.google.com/#r

Quoted 6 lines

Which looks like discussion about different bindings. You had there a clock controller and additional clock device using "sprd,syscon". Why the rpll is a subdevice and not a part of clock controller. The same as all other clocks coming from that clock-controller, right? What is so special about rpll that is is a separate device, not part of the clock controller? It's the same address space, isn't it?

The hardware spec design these clocks are not belonged to the syscon, the phandle is only used to get virtual map address for clocks which have the same phsical address base with one syscon.(I don't know the historical reason for this design) It also can wroten a clock sperated from syscon by add the reg which same as syscon. but will lead to a duplicate mapping--one is from the clock,and one is from syscon. which make difficulty
in analyzing some panic problems.

Quoted 3 lines

Best regards,
Krzysztof

#10 lore raw

Re: [PATCH V3 1/3] dt-bindings: clk: sprd: Add bindings for ums512 clock controller

Quoted 35 lines · Cixi Geng
Quoted 29 lines
Quoted 20 lines
Quoted 11 lines

Neither here nor later you did not answer the question - why do you need such complex construction, instead of adding syscon to the clock controller?

Let me paste again my concerns:

You have nodes with reg but without unit address ("rpll"). These nodes are modeled as children but they are not children - it's a workaround for exposing syscon, isn't it? The sc9863a looks like broken design, so please do not duplicate it here.

Quoted 4 lines

IOW, sc9863a uses similar pattern as here and the DTS is made wrong. Because of this you need to create complex ways to get the regmap for the clock controller... Why not making it simple? Clock controller with syscon?

I find the history discuss about the sp9863 clock[1] and last ums512-clk dt-bindings patch[2] which from chunyan. please refer to the reasons below.

Quoted 8 lines

These clocks are at the same register range with global registers. the registers shared with more than one devices which basically are multimedia devices. You may noticed that these are all gate clocks which are in the global registers ranges and are used to controll the enable status of some devices or some part of devices.

[1] https://lore.kernel.org/all/CAAfSe-s0gcehu0ZDj=FTe5S7CzAHC5mahXBH2fJm7mXS7Xys1Q@mail.gmail.com/#r
[2] https://lore.kernel.org/all/163425295208.1688384.11023187625793114662@swboyd.mtv.corp.google.com/#r

Quoted 6 lines

Which looks like discussion about different bindings. You had there a clock controller and additional clock device using "sprd,syscon". Why the rpll is a subdevice and not a part of clock controller. The same as all other clocks coming from that clock-controller, right? What is so special about rpll that is is a separate device, not part of the clock controller? It's the same address space, isn't it?

Quoted 7 lines

The hardware spec design these clocks are not belonged to the syscon, the phandle is only used to get virtual map address for clocks which have the same phsical address base with one syscon.(I don't know the historical reason for this design) It also can wroten a clock sperated from syscon by add the reg which same as syscon. but will lead to a duplicate mapping--one is from the clock,and one is from syscon. which make difficulty
in analyzing some panic problems.

I don't understand still. You said that they do not belong to same address space, right? But the sprd,ums512-apahb-gate in this patch or mentioned rpll
(https://elixir.bootlin.com/linux/v5.18-rc3/source/arch/arm64/boot/dts/sprd/sharkl3.dtsi#L106)
does not reference any other address space. It's entire address space is the same as address space of glbregs.

So if it does not belong to the same address space, where is this space defined?

Best regards,
Krzysztof

author
#11 lore raw

Re: [PATCH V3 1/3] dt-bindings: clk: sprd: Add bindings for ums512 clock controller

Quoted 45 lines · Krzysztof Kozlowski <[email protected]> 于2022年4月24日周日 22:30写道:
Quoted 35 lines · Cixi Geng
Quoted 29 lines
Quoted 20 lines
Quoted 11 lines

Neither here nor later you did not answer the question - why do you need such complex construction, instead of adding syscon to the clock controller?

Let me paste again my concerns:

You have nodes with reg but without unit address ("rpll"). These nodes are modeled as children but they are not children - it's a workaround for exposing syscon, isn't it? The sc9863a looks like broken design, so please do not duplicate it here.

Quoted 4 lines

IOW, sc9863a uses similar pattern as here and the DTS is made wrong. Because of this you need to create complex ways to get the regmap for the clock controller... Why not making it simple? Clock controller with syscon?

I find the history discuss about the sp9863 clock[1] and last ums512-clk dt-bindings patch[2] which from chunyan. please refer to the reasons below.

Quoted 8 lines

These clocks are at the same register range with global registers. the registers shared with more than one devices which basically are multimedia devices. You may noticed that these are all gate clocks which are in the global registers ranges and are used to controll the enable status of some devices or some part of devices.

[1] https://lore.kernel.org/all/CAAfSe-s0gcehu0ZDj=FTe5S7CzAHC5mahXBH2fJm7mXS7Xys1Q@mail.gmail.com/#r
[2] https://lore.kernel.org/all/163425295208.1688384.11023187625793114662@swboyd.mtv.corp.google.com/#r

Quoted 6 lines

Which looks like discussion about different bindings. You had there a clock controller and additional clock device using "sprd,syscon". Why the rpll is a subdevice and not a part of clock controller. The same as all other clocks coming from that clock-controller, right? What is so special about rpll that is is a separate device, not part of the clock controller? It's the same address space, isn't it?

Quoted 7 lines

The hardware spec design these clocks are not belonged to the syscon, the phandle is only used to get virtual map address for clocks which have the same phsical address base with one syscon.(I don't know the historical reason for this design) It also can wroten a clock sperated from syscon by add the reg which same as syscon. but will lead to a duplicate mapping--one is from the clock,and one is from syscon. which make difficulty
in analyzing some panic problems.

Quoted 6 lines

I don't understand still. You said that they do not belong to same address space, right? But the sprd,ums512-apahb-gate in this patch or mentioned rpll
(https://elixir.bootlin.com/linux/v5.18-rc3/source/arch/arm64/boot/dts/sprd/sharkl3.dtsi#L106)
does not reference any other address space. It's entire address space is the same as address space of glbregs.

Maybe I didn't describe clearly, what I said is these clocks isn't the syscom sub-clock.
from chunyan's explain:
they are at the same register range with global registers. in
originally we put them
directly onto the bus indeed when submitting the patches for SC9863A clocks last year,
and it had a private property named 'sprd,syscon' which could provide regmap for these clocks.
after follow Rob's suggetion we make them a child of the syscon. these are all gate clocks which
are in the global registers ranges and are used to controll the enable status of some devices
or some part of devices.

Quoted 6 lines

So if it does not belong to the same address space, where is this space defined?

Best regards,
Krzysztof

#12 lore raw

Re: [PATCH V3 1/3] dt-bindings: clk: sprd: Add bindings for ums512 clock controller

Quoted 52 lines · Cixi Geng
Quoted 45 lines · Krzysztof Kozlowski <[email protected]> 于2022年4月24日周日 22:30写道:
Quoted 35 lines · Cixi Geng
Quoted 29 lines
Quoted 20 lines
Quoted 11 lines

Neither here nor later you did not answer the question - why do you need such complex construction, instead of adding syscon to the clock controller?

Let me paste again my concerns:

You have nodes with reg but without unit address ("rpll"). These nodes are modeled as children but they are not children - it's a workaround for exposing syscon, isn't it? The sc9863a looks like broken design, so please do not duplicate it here.

Quoted 4 lines

IOW, sc9863a uses similar pattern as here and the DTS is made wrong. Because of this you need to create complex ways to get the regmap for the clock controller... Why not making it simple? Clock controller with syscon?

I find the history discuss about the sp9863 clock[1] and last ums512-clk dt-bindings patch[2] which from chunyan. please refer to the reasons below.

Quoted 8 lines

These clocks are at the same register range with global registers. the registers shared with more than one devices which basically are multimedia devices. You may noticed that these are all gate clocks which are in the global registers ranges and are used to controll the enable status of some devices or some part of devices.

[1] https://lore.kernel.org/all/CAAfSe-s0gcehu0ZDj=FTe5S7CzAHC5mahXBH2fJm7mXS7Xys1Q@mail.gmail.com/#r
[2] https://lore.kernel.org/all/163425295208.1688384.11023187625793114662@swboyd.mtv.corp.google.com/#r

Quoted 6 lines

Which looks like discussion about different bindings. You had there a clock controller and additional clock device using "sprd,syscon". Why the rpll is a subdevice and not a part of clock controller. The same as all other clocks coming from that clock-controller, right? What is so special about rpll that is is a separate device, not part of the clock controller? It's the same address space, isn't it?

Quoted 7 lines

The hardware spec design these clocks are not belonged to the syscon, the phandle is only used to get virtual map address for clocks which have the same phsical address base with one syscon.(I don't know the historical reason for this design) It also can wroten a clock sperated from syscon by add the reg which same as syscon. but will lead to a duplicate mapping--one is from the clock,and one is from syscon. which make difficulty
in analyzing some panic problems.

Quoted 6 lines

I don't understand still. You said that they do not belong to same address space, right? But the sprd,ums512-apahb-gate in this patch or mentioned rpll
(https://elixir.bootlin.com/linux/v5.18-rc3/source/arch/arm64/boot/dts/sprd/sharkl3.dtsi#L106)
does not reference any other address space. It's entire address space is the same as address space of glbregs.

Quoted 14 lines

Maybe I didn't describe clearly, what I said is these clocks isn't the syscom sub-clock.
from chunyan's explain:
they are at the same register range with global registers. in
originally we put them
directly onto the bus indeed when submitting the patches for SC9863A clocks last year,
and it had a private property named 'sprd,syscon' which could provide regmap for these clocks.
after follow Rob's suggetion we make them a child of the syscon. these are all gate clocks which
are in the global registers ranges and are used to controll the enable status of some devices
or some part of devices.

You need to help me here with the naming. What is "global registers" range? Let's focus on sharkl3.dtsi and syscon@4035c000 with "rpll".

You have a clock controller @4035c000, which provides several clocks, right? Then you have a rpll also @4035c000, so the register range is the same. The register range is the same, isn't it?

I still don't see the answer to my question - why do you need a child device for one clock if this looks like part of the clock-controller?

Best regards,
Krzysztof

author
#13 lore raw

Re: [PATCH V3 1/3] dt-bindings: clk: sprd: Add bindings for ums512 clock controller

Quoted 69 lines · Krzysztof Kozlowski <[email protected]> 于2022年4月25日周一 17:00写道:
Quoted 52 lines · Cixi Geng
Quoted 45 lines · Krzysztof Kozlowski <[email protected]> 于2022年4月24日周日 22:30写道:
Quoted 35 lines · Cixi Geng
Quoted 29 lines
Quoted 20 lines
Quoted 11 lines

Neither here nor later you did not answer the question - why do you need such complex construction, instead of adding syscon to the clock controller?

Let me paste again my concerns:

You have nodes with reg but without unit address ("rpll"). These nodes are modeled as children but they are not children - it's a workaround for exposing syscon, isn't it? The sc9863a looks like broken design, so please do not duplicate it here.

Quoted 4 lines

IOW, sc9863a uses similar pattern as here and the DTS is made wrong. Because of this you need to create complex ways to get the regmap for the clock controller... Why not making it simple? Clock controller with syscon?

I find the history discuss about the sp9863 clock[1] and last ums512-clk dt-bindings patch[2] which from chunyan. please refer to the reasons below.

Quoted 8 lines

These clocks are at the same register range with global registers. the registers shared with more than one devices which basically are multimedia devices. You may noticed that these are all gate clocks which are in the global registers ranges and are used to controll the enable status of some devices or some part of devices.

[1] https://lore.kernel.org/all/CAAfSe-s0gcehu0ZDj=FTe5S7CzAHC5mahXBH2fJm7mXS7Xys1Q@mail.gmail.com/#r
[2] https://lore.kernel.org/all/163425295208.1688384.11023187625793114662@swboyd.mtv.corp.google.com/#r

Quoted 6 lines

Which looks like discussion about different bindings. You had there a clock controller and additional clock device using "sprd,syscon". Why the rpll is a subdevice and not a part of clock controller. The same as all other clocks coming from that clock-controller, right? What is so special about rpll that is is a separate device, not part of the clock controller? It's the same address space, isn't it?

Quoted 7 lines

The hardware spec design these clocks are not belonged to the syscon, the phandle is only used to get virtual map address for clocks which have the same phsical address base with one syscon.(I don't know the historical reason for this design) It also can wroten a clock sperated from syscon by add the reg which same as syscon. but will lead to a duplicate mapping--one is from the clock,and one is from syscon. which make difficulty
in analyzing some panic problems.

Quoted 6 lines

I don't understand still. You said that they do not belong to same address space, right? But the sprd,ums512-apahb-gate in this patch or mentioned rpll
(https://elixir.bootlin.com/linux/v5.18-rc3/source/arch/arm64/boot/dts/sprd/sharkl3.dtsi#L106)
does not reference any other address space. It's entire address space is the same as address space of glbregs.

Quoted 14 lines

Maybe I didn't describe clearly, what I said is these clocks isn't the syscom sub-clock.
from chunyan's explain:
they are at the same register range with global registers. in
originally we put them
directly onto the bus indeed when submitting the patches for SC9863A clocks last year,
and it had a private property named 'sprd,syscon' which could provide regmap for these clocks.
after follow Rob's suggetion we make them a child of the syscon. these are all gate clocks which
are in the global registers ranges and are used to controll the enable status of some devices
or some part of devices.

Quoted 6 lines

You need to help me here with the naming. What is "global registers" range? Let's focus on sharkl3.dtsi and syscon@4035c000 with "rpll".

You have a clock controller @4035c000, which provides several clocks, right? Then you have a rpll also @4035c000, so the register range is the same. The register range is the same, isn't it?

the anlg_phy_g5_regs is not a clock controller.
In fact, this is just to provide an address for other modules to call regmap. not provide a clk interface or device.
The clk configuration of rpll is based on the anlg_phy_g5_regs register. The analog_g5 asic document is not only used to configure rpll, but also other functions can be configured, but currently our driver is only used to provide configuration rpll, so the range of the device node of rpll can be less than or equal to the range of anlg_phy_g5_regs.
Hope this could explains your question

Best regards,
Cixi

Quoted 6 lines

I still don't see the answer to my question - why do you need a child device for one clock if this looks like part of the clock-controller?

Best regards,
Krzysztof

#14 lore raw

Re: [PATCH V3 1/3] dt-bindings: clk: sprd: Add bindings for ums512 clock controller

Quoted 7 lines · Cixi Geng
Quoted 6 lines

You need to help me here with the naming. What is "global registers" range? Let's focus on sharkl3.dtsi and syscon@4035c000 with "rpll".

You have a clock controller @4035c000, which provides several clocks, right? Then you have a rpll also @4035c000, so the register range is the same. The register range is the same, isn't it?

Quoted 9 lines

the anlg_phy_g5_regs is not a clock controller.
In fact, this is just to provide an address for other modules to call regmap. not provide a clk interface or device.
The clk configuration of rpll is based on the anlg_phy_g5_regs register. The analog_g5 asic document is not only used to configure rpll, but also other functions can be configured, but currently our driver is only used to provide configuration rpll, so the range of the device node of rpll can be less than or equal to the range of anlg_phy_g5_regs.
Hope this could explains your question

I see, thanks for explanation. Indeed making entire @4035c000 (anlg_phy_g5_regs) a clock controller would not match actual hardware, since rpll clock is a small part of it. I am afraid though, that you will duplicate such pattern even for the cases where that design/register range would be suitable to be a clock controller and a syscon. In one device.

Please fix the other comments in my review - except this discussed here, the last one from email:
https://lore.kernel.org/all/[email protected]/

Best regards,
Krzysztof

author
#15 lore raw

PATCH v3 2/3 clk: sprd: Add dt-bindings include file for UMS512

In reply to Cixi Geng

From: Cixi Geng <[email protected]>

This file defines all UMS512 clock indexes, it should be included in the device tree in which there's device using the clocks.

---
 include/dt-bindings/clock/sprd,ums512-clk.h | 397 ++++++++++++++++++++
 1 file changed, 397 insertions(+)
 create mode 100644 include/dt-bindings/clock/sprd,ums512-clk.h
include/dt-bindings/clock/sprd,ums512-clk.h new file +397 -0
new file mode 100644
index 000000000000..4f1d90849944
@@ -0,0 +1,397 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
+/*
+ * Unisoc UMS512 SoC DTS file
+ *
+ * Copyright (C) 2022, Unisoc Inc.
+ */
+
+#ifndef _DT_BINDINGS_CLK_UMS512_H_
+#define _DT_BINDINGS_CLK_UMS512_H_
+
+#define CLK_26M_AUD			0
+#define CLK_13M				1
+#define CLK_6M5				2
+#define CLK_4M3				3
+#define CLK_2M				4
+#define CLK_1M				5
+#define CLK_250K			6
+#define CLK_RCO_25M			7
+#define CLK_RCO_4M			8
+#define CLK_RCO_2M			9
+#define CLK_ISPPLL_GATE			10
+#define CLK_DPLL0_GATE			11
+#define CLK_DPLL1_GATE			12
+#define CLK_LPLL_GATE			13
+#define CLK_TWPLL_GATE			14
+#define CLK_GPLL_GATE			15
+#define CLK_RPLL_GATE			16
+#define CLK_CPPLL_GATE			17
+#define CLK_MPLL0_GATE			18
+#define CLK_MPLL1_GATE			19
+#define CLK_MPLL2_GATE			20
+#define CLK_PMU_GATE_NUM		(CLK_MPLL2_GATE + 1)
+
+#define CLK_DPLL0			0
+#define CLK_DPLL0_58M31			1
+#define CLK_ANLG_PHY_G0_NUM		(CLK_DPLL0_58M31 + 1)
+
+#define CLK_MPLL1			0
+#define CLK_MPLL1_63M38			1
+#define CLK_ANLG_PHY_G2_NUM		(CLK_MPLL1_63M38 + 1)
+
+#define CLK_RPLL			0
+#define CLK_AUDIO_GATE			1
+#define CLK_MPLL0			2
+#define CLK_MPLL0_56M88			3
+#define CLK_MPLL2			4
+#define CLK_MPLL2_47M13			5
+#define CLK_ANLG_PHY_G3_NUM		(CLK_MPLL2_47M13 + 1)
+
+#define CLK_TWPLL			0
+#define CLK_TWPLL_768M			1
+#define CLK_TWPLL_384M			2
+#define CLK_TWPLL_192M			3
+#define CLK_TWPLL_96M			4
+#define CLK_TWPLL_48M			5
+#define CLK_TWPLL_24M			6
+#define CLK_TWPLL_12M			7
+#define CLK_TWPLL_512M			8
+#define CLK_TWPLL_256M			9
+#define CLK_TWPLL_128M			10
+#define CLK_TWPLL_64M			11
+#define CLK_TWPLL_307M2			12
+#define CLK_TWPLL_219M4			13
+#define CLK_TWPLL_170M6			14
+#define CLK_TWPLL_153M6			15
+#define CLK_TWPLL_76M8			16
+#define CLK_TWPLL_51M2			17
+#define CLK_TWPLL_38M4			18
+#define CLK_TWPLL_19M2			19
+#define CLK_TWPLL_12M29			20
+#define CLK_LPLL			21
+#define CLK_LPLL_614M4			22
+#define CLK_LPLL_409M6			23
+#define CLK_LPLL_245M76			24
+#define CLK_LPLL_30M72			25
+#define CLK_ISPPLL			26
+#define CLK_ISPPLL_468M			27
+#define CLK_ISPPLL_78M			28
+#define CLK_GPLL			29
+#define CLK_GPLL_40M			30
+#define CLK_CPPLL			31
+#define CLK_CPPLL_39M32			32
+#define CLK_ANLG_PHY_GC_NUM		(CLK_CPPLL_39M32 + 1)
+
+#define CLK_AP_APB			0
+#define CLK_IPI			        1
+#define CLK_AP_UART0			2
+#define CLK_AP_UART1			3
+#define CLK_AP_UART2			4
+#define CLK_AP_I2C0			5
+#define CLK_AP_I2C1			6
+#define CLK_AP_I2C2			7
+#define CLK_AP_I2C3			8
+#define CLK_AP_I2C4			9
+#define CLK_AP_SPI0			10
+#define CLK_AP_SPI1			11
+#define CLK_AP_SPI2			12
+#define CLK_AP_SPI3			13
+#define CLK_AP_IIS0			14
+#define CLK_AP_IIS1			15
+#define CLK_AP_IIS2			16
+#define CLK_AP_SIM			17
+#define CLK_AP_CE			18
+#define CLK_SDIO0_2X			19
+#define CLK_SDIO1_2X			20
+#define CLK_EMMC_2X			21
+#define CLK_VSP				22
+#define CLK_DISPC0			23
+#define CLK_DISPC0_DPI			24
+#define CLK_DSI_APB			25
+#define CLK_DSI_RXESC			26
+#define CLK_DSI_LANEBYTE		27
+#define CLK_VDSP		        28
+#define CLK_VDSP_M		        29
+#define CLK_AP_CLK_NUM			(CLK_VDSP_M + 1)
+
+#define CLK_DSI_EB			0
+#define CLK_DISPC_EB			1
+#define CLK_VSP_EB			2
+#define CLK_VDMA_EB			3
+#define CLK_DMA_PUB_EB			4
+#define CLK_DMA_SEC_EB			5
+#define CLK_IPI_EB			6
+#define CLK_AHB_CKG_EB			7
+#define CLK_BM_CLK_EB			8
+#define CLK_AP_AHB_GATE_NUM		(CLK_BM_CLK_EB + 1)
+
+#define CLK_AON_APB			0
+#define CLK_ADI				1
+#define CLK_AUX0			2
+#define CLK_AUX1			3
+#define CLK_AUX2			4
+#define CLK_PROBE			5
+#define CLK_PWM0			6
+#define CLK_PWM1			7
+#define CLK_PWM2			8
+#define CLK_PWM3			9
+#define CLK_EFUSE			10
+#define CLK_UART0			11
+#define CLK_UART1			12
+#define CLK_THM0			13
+#define CLK_THM1			14
+#define CLK_THM2			15
+#define CLK_THM3			16
+#define CLK_AON_I2C			17
+#define CLK_AON_IIS			18
+#define CLK_SCC				19
+#define CLK_APCPU_DAP			20
+#define CLK_APCPU_DAP_MTCK		21
+#define CLK_APCPU_TS			22
+#define CLK_DEBUG_TS			23
+#define CLK_DSI_TEST_S			24
+#define CLK_DJTAG_TCK			25
+#define CLK_DJTAG_TCK_HW		26
+#define CLK_AON_TMR			27
+#define CLK_AON_PMU			28
+#define CLK_DEBOUNCE			29
+#define CLK_APCPU_PMU			30
+#define CLK_TOP_DVFS			31
+#define CLK_OTG_UTMI			32
+#define CLK_OTG_REF			33
+#define CLK_CSSYS			34
+#define CLK_CSSYS_PUB			35
+#define CLK_CSSYS_APB			36
+#define CLK_AP_AXI			37
+#define CLK_AP_MM			38
+#define CLK_SDIO2_2X			39
+#define CLK_ANALOG_IO_APB		40
+#define CLK_DMC_REF_CLK			41
+#define CLK_EMC				42
+#define CLK_USB				43
+#define CLK_26M_PMU			44
+#define CLK_AON_APB_NUM			(CLK_26M_PMU + 1)
+
+#define CLK_MM_AHB			0
+#define CLK_MM_MTX			1
+#define CLK_SENSOR0			2
+#define CLK_SENSOR1			3
+#define CLK_SENSOR2			4
+#define CLK_CPP				5
+#define CLK_JPG				6
+#define CLK_FD				7
+#define CLK_DCAM_IF			8
+#define CLK_DCAM_AXI			9
+#define CLK_ISP				10
+#define CLK_MIPI_CSI0			11
+#define CLK_MIPI_CSI1			12
+#define CLK_MIPI_CSI2			13
+#define CLK_MM_CLK_NUM			(CLK_MIPI_CSI2 + 1)
+
+#define CLK_RC100M_CAL_EB		0
+#define CLK_DJTAG_TCK_EB		1
+#define CLK_DJTAG_EB			2
+#define CLK_AUX0_EB			3
+#define CLK_AUX1_EB			4
+#define CLK_AUX2_EB			5
+#define CLK_PROBE_EB			6
+#define CLK_MM_EB			7
+#define CLK_GPU_EB			8
+#define CLK_MSPI_EB			9
+#define CLK_APCPU_DAP_EB		10
+#define CLK_AON_CSSYS_EB		11
+#define CLK_CSSYS_APB_EB		12
+#define CLK_CSSYS_PUB_EB		13
+#define CLK_SDPHY_CFG_EB		14
+#define CLK_SDPHY_REF_EB		15
+#define CLK_EFUSE_EB			16
+#define CLK_GPIO_EB			17
+#define CLK_MBOX_EB			18
+#define CLK_KPD_EB			19
+#define CLK_AON_SYST_EB			20
+#define CLK_AP_SYST_EB			21
+#define CLK_AON_TMR_EB			22
+#define CLK_OTG_UTMI_EB			23
+#define CLK_OTG_PHY_EB			24
+#define CLK_SPLK_EB			25
+#define CLK_PIN_EB			26
+#define CLK_ANA_EB			27
+#define CLK_APCPU_TS0_EB		28
+#define CLK_APB_BUSMON_EB		29
+#define CLK_AON_IIS_EB			30
+#define CLK_SCC_EB			31
+#define CLK_THM0_EB			32
+#define CLK_THM1_EB			33
+#define CLK_THM2_EB			34
+#define CLK_ASIM_TOP_EB			35
+#define CLK_I2C_EB			36
+#define CLK_PMU_EB			37
+#define CLK_ADI_EB			38
+#define CLK_EIC_EB			39
+#define CLK_AP_INTC0_EB			40
+#define CLK_AP_INTC1_EB			41
+#define CLK_AP_INTC2_EB			42
+#define CLK_AP_INTC3_EB			43
+#define CLK_AP_INTC4_EB			44
+#define CLK_AP_INTC5_EB			45
+#define CLK_AUDCP_INTC_EB		46
+#define CLK_AP_TMR0_EB			47
+#define CLK_AP_TMR1_EB			48
+#define CLK_AP_TMR2_EB			49
+#define CLK_PWM0_EB			50
+#define CLK_PWM1_EB			51
+#define CLK_PWM2_EB			52
+#define CLK_PWM3_EB			53
+#define CLK_AP_WDG_EB			54
+#define CLK_APCPU_WDG_EB		55
+#define CLK_SERDES_EB			56
+#define CLK_ARCH_RTC_EB			57
+#define CLK_KPD_RTC_EB			58
+#define CLK_AON_SYST_RTC_EB		59
+#define CLK_AP_SYST_RTC_EB		60
+#define CLK_AON_TMR_RTC_EB		61
+#define CLK_EIC_RTC_EB			62
+#define CLK_EIC_RTCDV5_EB		63
+#define CLK_AP_WDG_RTC_EB		64
+#define CLK_AC_WDG_RTC_EB		65
+#define CLK_AP_TMR0_RTC_EB		66
+#define CLK_AP_TMR1_RTC_EB		67
+#define CLK_AP_TMR2_RTC_EB		68
+#define CLK_DCXO_LC_RTC_EB		69
+#define CLK_BB_CAL_RTC_EB		70
+#define CLK_AP_EMMC_RTC_EB		71
+#define CLK_AP_SDIO0_RTC_EB		72
+#define CLK_AP_SDIO1_RTC_EB		73
+#define CLK_AP_SDIO2_RTC_EB		74
+#define CLK_DSI_CSI_TEST_EB		75
+#define CLK_DJTAG_TCK_EN		76
+#define CLK_DPHY_REF_EB			77
+#define CLK_DMC_REF_EB			78
+#define CLK_OTG_REF_EB			79
+#define CLK_TSEN_EB			80
+#define CLK_TMR_EB			81
+#define CLK_RC100M_REF_EB		82
+#define CLK_RC100M_FDK_EB		83
+#define CLK_DEBOUNCE_EB			84
+#define CLK_DET_32K_EB			85
+#define CLK_TOP_CSSYS_EB		86
+#define CLK_AP_AXI_EN			87
+#define CLK_SDIO0_2X_EN			88
+#define CLK_SDIO0_1X_EN			89
+#define CLK_SDIO1_2X_EN			90
+#define CLK_SDIO1_1X_EN			91
+#define CLK_SDIO2_2X_EN			92
+#define CLK_SDIO2_1X_EN			93
+#define CLK_EMMC_2X_EN			94
+#define CLK_EMMC_1X_EN			95
+#define CLK_PLL_TEST_EN			96
+#define CLK_CPHY_CFG_EN			97
+#define CLK_DEBUG_TS_EN			98
+#define CLK_ACCESS_AUD_EN		99
+#define CLK_AON_APB_GATE_NUM		(CLK_ACCESS_AUD_EN + 1)
+
+#define CLK_MM_CPP_EB			0
+#define CLK_MM_JPG_EB			1
+#define CLK_MM_DCAM_EB			2
+#define CLK_MM_ISP_EB			3
+#define CLK_MM_CSI2_EB			4
+#define CLK_MM_CSI1_EB			5
+#define CLK_MM_CSI0_EB			6
+#define CLK_MM_CKG_EB			7
+#define CLK_ISP_AHB_EB			8
+#define CLK_MM_DVFS_EB			9
+#define CLK_MM_FD_EB			10
+#define CLK_MM_SENSOR2_EB		11
+#define CLK_MM_SENSOR1_EB		12
+#define CLK_MM_SENSOR0_EB		13
+#define CLK_MM_MIPI_CSI2_EB		14
+#define CLK_MM_MIPI_CSI1_EB		15
+#define CLK_MM_MIPI_CSI0_EB		16
+#define CLK_DCAM_AXI_EB			17
+#define CLK_ISP_AXI_EB			18
+#define CLK_MM_CPHY_EB			19
+#define CLK_MM_GATE_CLK_NUM		(CLK_MM_CPHY_EB + 1)
+
+#define CLK_SIM0_EB			0
+#define CLK_IIS0_EB			1
+#define CLK_IIS1_EB			2
+#define CLK_IIS2_EB			3
+#define CLK_APB_REG_EB			4
+#define CLK_SPI0_EB			5
+#define CLK_SPI1_EB			6
+#define CLK_SPI2_EB			7
+#define CLK_SPI3_EB			8
+#define CLK_I2C0_EB			9
+#define CLK_I2C1_EB			10
+#define CLK_I2C2_EB			11
+#define CLK_I2C3_EB			12
+#define CLK_I2C4_EB			13
+#define CLK_UART0_EB			14
+#define CLK_UART1_EB			15
+#define CLK_UART2_EB			16
+#define CLK_SIM0_32K_EB			17
+#define CLK_SPI0_LFIN_EB		18
+#define CLK_SPI1_LFIN_EB		19
+#define CLK_SPI2_LFIN_EB		20
+#define CLK_SPI3_LFIN_EB		21
+#define CLK_SDIO0_EB			22
+#define CLK_SDIO1_EB			23
+#define CLK_SDIO2_EB			24
+#define CLK_EMMC_EB			25
+#define CLK_SDIO0_32K_EB		26
+#define CLK_SDIO1_32K_EB		27
+#define CLK_SDIO2_32K_EB		28
+#define CLK_EMMC_32K_EB			29
+#define CLK_AP_APB_GATE_NUM		(CLK_EMMC_32K_EB + 1)
+
+#define CLK_GPU_CORE_EB			0
+#define CLK_GPU_CORE			1
+#define CLK_GPU_MEM_EB			2
+#define CLK_GPU_MEM			3
+#define CLK_GPU_SYS_EB			4
+#define CLK_GPU_SYS			5
+#define CLK_GPU_CLK_NUM			(CLK_GPU_SYS + 1)
+
+#define CLK_AUDCP_IIS0_EB		0
+#define CLK_AUDCP_IIS1_EB		1
+#define CLK_AUDCP_IIS2_EB		2
+#define CLK_AUDCP_UART_EB		3
+#define CLK_AUDCP_DMA_CP_EB		4
+#define CLK_AUDCP_DMA_AP_EB		5
+#define CLK_AUDCP_SRC48K_EB		6
+#define CLK_AUDCP_MCDT_EB		7
+#define CLK_AUDCP_VBCIFD_EB		8
+#define CLK_AUDCP_VBC_EB		9
+#define CLK_AUDCP_SPLK_EB		10
+#define CLK_AUDCP_ICU_EB		11
+#define CLK_AUDCP_DMA_AP_ASHB_EB	12
+#define CLK_AUDCP_DMA_CP_ASHB_EB	13
+#define CLK_AUDCP_AUD_EB		14
+#define CLK_AUDCP_VBC_24M_EB		15
+#define CLK_AUDCP_TMR_26M_EB		16
+#define CLK_AUDCP_DVFS_ASHB_EB		17
+#define CLK_AUDCP_AHB_GATE_NUM		(CLK_AUDCP_DVFS_ASHB_EB + 1)
+
+#define CLK_AUDCP_WDG_EB		0
+#define CLK_AUDCP_RTC_WDG_EB		1
+#define CLK_AUDCP_TMR0_EB		2
+#define CLK_AUDCP_TMR1_EB		3
+#define CLK_AUDCP_APB_GATE_NUM		(CLK_AUDCP_TMR1_EB + 1)
+
+#define CLK_ACORE0			0
+#define CLK_ACORE1			1
+#define CLK_ACORE2			2
+#define CLK_ACORE3			3
+#define CLK_ACORE4			4
+#define CLK_ACORE5			5
+#define CLK_PCORE0			6
+#define CLK_PCORE1			7
+#define CLK_SCU				8
+#define CLK_ACE				9
+#define CLK_PERIPH			10
+#define CLK_GIC				11
+#define CLK_ATB				12
+#define CLK_DEBUG_APB			13
+#define CLK_APCPU_SEC_NUM		(CLK_DEBUG_APB + 1)
+
+#endif /* _DT_BINDINGS_CLK_UMS512_H_ */
Signature · 1 line
2.25.1
Acked-by on v3 2/3
#16 lore raw

Re: [PATCH V3 2/3] clk: sprd: Add dt-bindings include file for UMS512

Quoted 11 lines · Cixi Geng

From: Cixi Geng <[email protected]>

This file defines all UMS512 clock indexes, it should be included in the device tree in which there's device using the clocks.

---
 include/dt-bindings/clock/sprd,ums512-clk.h | 397 ++++++++++++++++++++
 1 file changed, 397 insertions(+)
 create mode 100644 include/dt-bindings/clock/sprd,ums512-clk.h

Best regards,
Krzysztof

author
#17 lore raw

PATCH v3 3/3 clk: sprd: Add clocks support for UMS512

In reply to Cixi Geng

From: Cixi Geng <[email protected]>

Add the list of clocks for the Unisoc UMS512, along with clock initialization.

---
 drivers/clk/sprd/Kconfig      |    6 +
 drivers/clk/sprd/Makefile     |    1 +
 drivers/clk/sprd/ums512-clk.c | 2199 +++++++++++++++++++++++++++++++++
 3 files changed, 2206 insertions(+)
 create mode 100644 drivers/clk/sprd/ums512-clk.c
drivers/clk/sprd/Kconfig +6 -0
index e18c80fbe804..c744bd9d2f96 100644
@@ -21,4 +21,10 @@ config SPRD_SC9863A_CLK
 	help
 	  Support for the global clock controller on sc9863a devices.
 	  Say Y if you want to use peripheral devices on sc9863a SoC.
+
+config SPRD_UMS512_CLK
+	tristate "Support for the Spreadtrum UMS512 clocks"
+	help
+	  Support for the global clock controller on ums512 devices.
+	  Say Y if you want to use peripheral devices on ums512 SoC.
 endif
drivers/clk/sprd/Makefile +1 -0
index 41d90e0d7863..f25b2c3904fb 100644
@@ -11,3 +11,4 @@ clk-sprd-y	+= pll.o
 ## SoC support
 obj-$(CONFIG_SPRD_SC9860_CLK)	+= sc9860-clk.o
 obj-$(CONFIG_SPRD_SC9863A_CLK)	+= sc9863a-clk.o
+obj-$(CONFIG_SPRD_UMS512_CLK)	+= ums512-clk.o
drivers/clk/sprd/ums512-clk.c new file +2199 -0

2,199 lines not on this page · raw message

Signature · 1 line
2.25.1