Skip to contentSkip to conversation

Cirrus Logic CS2600 clock device

PATCH Superseded Paul Handrigan 2 participants 5 messages Dec 27, 2024 – Dec 29, 2024

Subsystems (2)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 cover Cirrus Logic CS2600 clock device

This patch set provides Common Clock Framework support for the latest Cirrus Logic clocking device, the CS2600.

This device has two input clocks and three output clocks. One of the input clocks, the REFCLK, can be a constant reference clock input, a crystal reference input, or not available and use the internal clock. The second input is the CLK_IN digital clock input.

The three clock outputs are CLK_OUT, BCLK_OUT, and FSYNC_OUT.

v2 changes:
- Remove | from after "discription" in DT binding.
- Remove discription from "clocks" in DT binding.
- Change ref_clk to xti
- Clarify auxiliary clock pin
- Change DT example to not have "reg" for the bus
- Change DT example to change i2c@0 to i2c
- Remove "OUTPUT" from the clock ouputs in the dt binding include file.
- Remove AUX_OUT defines
- Use do_div when dividing u64 by a u32
- Include the dt bindings include file
- Use the includes from the dt bindings include file aux output.
- Move of_device_id and i2c_device_id tables next to i2c_driver struct.

v3 changes:
- Changed clock-names in device tree to an emum since the both clocks are not always required.
- Changed cirrus,aux-output-source to a string input.
- Added cirrus,clock-mode as a string input.
- Fixed ordering in DT example.
- Removed dt-bindings .h file.
- Add in_range to allow for acceptable ranges for clock rates.

Paul Handrigan (2):
dt-binding: clock: cs2600: Add support for the CS2600
clk: cs2600: Add Fractional-N clock driver

 .../bindings/clock/cirrus,cs2600.yaml         |   89 ++
 drivers/clk/Kconfig                           |    9 +
 drivers/clk/Makefile                          |    1 +
 drivers/clk/clk-cs2600.c                      | 1177 +++++++++++++++++
 drivers/clk/clk-cs2600.h                      |  173 +++
 5 files changed, 1449 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml
 create mode 100644 drivers/clk/clk-cs2600.c
 create mode 100644 drivers/clk/clk-cs2600.h
Signature · 1 line
2.34.1
#1 lore raw

PATCH v3 1/2 dt-binding: clock: cs2600: Add support for the CS2600

Add device tree support for the Cirrus Logic CS2600 clock device.

---
 .../bindings/clock/cirrus,cs2600.yaml         | 89 +++++++++++++++++++
 1 file changed, 89 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml
Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml new file +89 -0
new file mode 100644
index 000000000000..0be613c78a9c
@@ -0,0 +1,89 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/cirrus,cs2600.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Cirrus Logic Fractional-N Clock Synthesizer & Clock Multiplier
+
+maintainers:
+  - Paul Handrigan <[email protected]>
+  - [email protected]>
+
+description:
+  The CS2600 is a system-clocking device that enables frequency synthesis and
+  clock generation from a stable timing reference clock. The device can
+  generate low-jitter clocks from a noisy clock reference at frequencies
+  as low as 50 Hz.
+
+properties:
+  compatible:
+    enum:
+      - cirrus,cs2600
+
+  clocks:
+    maxItems: 2
+
+  clock-names:
+    items:
+      enum:
+        - xti
+        - clk_in
+    minItems: 1
+    maxItems: 2
+
+  '#clock-cells':
+    const: 1
+
+  reg:
+    maxItems: 1
+
+  vdd-supply:
+    description: Power Supply
+
+  clock-output-names:
+    maxItems: 3
+    description: Names for CLK_OUT, BCLK_OUT and FSYNC_OUT clocks.
+
+  cirrus,aux-output-source:
+    description:
+      Specifies the function of the auxiliary output pin with "PHASE_UNLOCK"
+      to indicate the input and output clocks are not in phase, "FREQ_UNLOCK"
+      to indicate the PLL is unlocked, and NO_CLKIN to indicate the clock on
+      the clk_in pin is not present.
+    $ref: /schemas/types.yaml#/definitions/string
+
+  cirrus,clock-mode:
+    description:
+      Sets the device into smart mode whith "SMART_MODE" and sets the device
+      into smart mode that only outputs a clock when clk_in starts with
+      "SMART_CLKIN_ONLY_MODE".
+    $ref: /schemas/types.yaml#/definitions/string
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - '#clock-cells'
+
+unevaluatedProperties: false
+
+examples:
+  - |
+
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      clock-controller@2c {
+        compatible = "cirrus,cs2600";
+        reg = <0x2c>;
+        #clock-cells = <1>;
+        clocks = <&xtl_clk>, <&sync_clock>;
+        clock-names = "xti", "clk_in";
+        clock-output-names = "audio_clk_out", "audio_bclk", "audio_lrclk";
+        cirrus,aux-output-source = "FREQ_UNLOCK";
+        vdd-supply = <&vreg>;
+      };
+    };
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v3 1/2] dt-binding: clock: cs2600: Add support for the CS2600

Quoted 38 lines · Paul Handrigan

Add device tree support for the Cirrus Logic CS2600 clock device.

---
 .../bindings/clock/cirrus,cs2600.yaml         | 89 +++++++++++++++++++
 1 file changed, 89 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml
Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml new file +23 -0
new file mode 100644
index 000000000000..0be613c78a9c
@@ -0,0 +1,89 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/cirrus,cs2600.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Cirrus Logic Fractional-N Clock Synthesizer & Clock Multiplier
+
+maintainers:
+  - Paul Handrigan <[email protected]>
+  - [email protected]>
+
+description:
+  The CS2600 is a system-clocking device that enables frequency synthesis and
+  clock generation from a stable timing reference clock. The device can
+  generate low-jitter clocks from a noisy clock reference at frequencies
+  as low as 50 Hz.
+
+properties:
+  compatible:
+    enum:
+      - cirrus,cs2600
+

Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml line 33

Quoted 10 lines
Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml new file +10 -0
+  clocks:
+    maxItems: 2
+
+  clock-names:
+    items:
+      enum:
+        - xti
+        - clk_in
+    minItems: 1
+    maxItems: 2

This does not match clocks. Nothing here, neither commit msg nor description, explains why this is so flexible.

Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml line 39

Quoted 6 lines
Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml new file +6 -0
+
+  '#clock-cells':
+    const: 1
+
+  reg:
+    maxItems: 1

Keep the same order of properties as in required list.

Quoted 4 lines
Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml new file +4 -0
+
+  vdd-supply:
+    description: Power Supply
+

Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml line 53

Quoted 10 lines
Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml new file +10 -0
+  clock-output-names:
+    maxItems: 3
+    description: Names for CLK_OUT, BCLK_OUT and FSYNC_OUT clocks.
+
+  cirrus,aux-output-source:
+    description:
+      Specifies the function of the auxiliary output pin with "PHASE_UNLOCK"
+      to indicate the input and output clocks are not in phase, "FREQ_UNLOCK"
+      to indicate the PLL is unlocked, and NO_CLKIN to indicate the clock on
+      the clk_in pin is not present.

enum and lower-case

Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml line 60

Quoted 7 lines
Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml new file +7 -0
+    $ref: /schemas/types.yaml#/definitions/string
+
+  cirrus,clock-mode:
+    description:
+      Sets the device into smart mode whith "SMART_MODE" and sets the device
+      into smart mode that only outputs a clock when clk_in starts with
+      "SMART_CLKIN_ONLY_MODE".

enum and lower-case

Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml line 70

Quoted 10 lines
Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml new file +10 -0
+    $ref: /schemas/types.yaml#/definitions/string
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - '#clock-cells'
+
+unevaluatedProperties: false

This is supposed to be additionalProperties. See example-schema.

Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml line 74

Quoted 4 lines
Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml new file +4 -0
+
+examples:
+  - |
+

Drop blank line

Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml line 77

Quoted 3 lines
Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml new file +3 -0
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;

Best regards,
Krzysztof

#3 lore raw

Re: [PATCH v3 1/2] dt-binding: clock: cs2600: Add support for the CS2600

Quoted 6 lines
Quoted 6 lines
Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml new file +6 -0
+
+  clocks:
+    maxItems: 2
+
+  clock-names:
+    items:
Quoted 8 lines

Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml line 33

Quoted 5 lines
Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml new file +5 -0
+      enum:
+        - xti
+        - clk_in
+    minItems: 1
+    maxItems: 2

This does not match clocks. Nothing here, neither commit msg nor description, explains why this is so flexible.

I will add more detial into the discription. You can have one of xti and clk_in as clock sources or both.

Quoted 4 lines

Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml line 39

Quoted 2 lines
Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml new file +2 -0
+  reg:
+    maxItems: 1

Keep the same order of properties as in required list.

Ack

Quoted 11 lines

Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml line 53

Quoted 10 lines
Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml new file +10 -0
+  clock-output-names:
+    maxItems: 3
+    description: Names for CLK_OUT, BCLK_OUT and FSYNC_OUT clocks.
+
+  cirrus,aux-output-source:
+    description:
+      Specifies the function of the auxiliary output pin with "PHASE_UNLOCK"
+      to indicate the input and output clocks are not in phase, "FREQ_UNLOCK"
+      to indicate the PLL is unlocked, and NO_CLKIN to indicate the clock on
+      the clk_in pin is not present.
Quoted 1 line

enum and lower-case

I'll change this back to an enum with lower-case strings as the input.

Quoted 10 lines

Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml line 60

Quoted 8 lines
Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml new file +7 -0
+    $ref: /schemas/types.yaml#/definitions/string
+
+  cirrus,clock-mode:
+    description:
+      Sets the device into smart mode whith "SMART_MODE" and sets the device
+      into smart mode that only outputs a clock when clk_in starts with
+      "SMART_CLKIN_ONLY_MODE".

enum and lower-case

Ack

Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+unevaluatedProperties: false

This is supposed to be additionalProperties. See example-schema.

Ack

Quoted 7 lines

Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml line 74

Quoted 5 lines
Documentation/devicetree/bindings/clock/cirrus,cs2600.yaml new file +4 -0
+
+examples:
+  - |
+

Drop blank line

Ack

Regards,
Paul

#4 lore raw

PATCH v3 2/2 clk: cs2600: Add Fractional-N clock driver

In reply to Paul Handrigan

Add support for the CS2600 Fractional-N Clock Synthesizer and Multiplier driver.

---
 drivers/clk/Kconfig      |    9 +
 drivers/clk/Makefile     |    1 +
 drivers/clk/clk-cs2600.c | 1177 ++++++++++++++++++++++++++++++++++++++
 drivers/clk/clk-cs2600.h |  173 ++++++
 4 files changed, 1360 insertions(+)
 create mode 100644 drivers/clk/clk-cs2600.c
 create mode 100644 drivers/clk/clk-cs2600.h
drivers/clk/Kconfig +9 -0
index 713573b6c86c..6b279ebf9c80 100644
@@ -209,6 +209,15 @@ config COMMON_CLK_CS2000_CP
 	help
 	  If you say yes here you get support for the CS2000 clock multiplier.
 
+config COMMON_CLK_CS2600
+	tristate "Clock driver for CS2600 Fractional-N Clock Synthesizer & Clock Multiplier"
+	depends on I2C
+	depends on OF
+	select REGMAP_I2C
+	help
+	  If you say yes here you get support for the CS2600 clock synthesizer
+	  and multiplier.
+
 config COMMON_CLK_EN7523
 	bool "Clock driver for Airoha EN7523 SoC system clocks"
 	depends on OF
drivers/clk/Makefile +1 -0
index bf4bd45adc3a..5d5264432613 100644
@@ -53,6 +53,7 @@ obj-$(CONFIG_COMMON_CLK_CDCE706)	+= clk-cdce706.o
 obj-$(CONFIG_COMMON_CLK_CDCE925)	+= clk-cdce925.o
 obj-$(CONFIG_ARCH_CLPS711X)		+= clk-clps711x.o
 obj-$(CONFIG_COMMON_CLK_CS2000_CP)	+= clk-cs2000-cp.o
+obj-$(CONFIG_COMMON_CLK_CS2600)		+= clk-cs2600.o
 obj-$(CONFIG_COMMON_CLK_EP93XX)		+= clk-ep93xx.o
 obj-$(CONFIG_ARCH_SPARX5)		+= clk-sparx5.o
 obj-$(CONFIG_COMMON_CLK_EN7523)		+= clk-en7523.o
drivers/clk/clk-cs2600.c new file +1177 -0

1,177 lines not on this page · raw message

drivers/clk/clk-cs2600.h new file +173 -0

173 lines not on this page · raw message

Signature · 1 line
2.34.1