Skip to contentSkip to conversation

dt-bindings: clk: rs9: Add Renesas 9-series I2C PCIe clock generator

PATCH Superseded Marek Vasut 2 participants 5 messages Feb 19, 2022 – Feb 25, 2022

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 dt-bindings: clk: rs9: Add Renesas 9-series I2C PCIe clock generator

Add binding for Renesas 9-series PCIe clock generators. This binding is designed to support 9FGV/9DBV/9DMV/9FGL/9DML/9QXL/9SQ series I2C PCIe clock generators, currently the only tested and supported chip is 9FGV0241.

Cc Michael Turquette <[email protected]>
Cc Rob Herring <[email protected]>
Cc Stephen Boyd <[email protected]>

To: [email protected]
---
V2: - Drop clock consumer from the binding example
- Make clocks, i.e. xtal, mandatory

---
 .../bindings/clock/renesas,9series.yaml       | 96 +++++++++++++++++++
 1 file changed, 96 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/renesas,9series.yaml
Documentation/devicetree/bindings/clock/renesas,9series.yaml new file +96 -0
new file mode 100644
index 0000000000000..8eb56f38d99e9
@@ -0,0 +1,96 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/renesas,9series.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Binding for Renesas 9-series I2C PCIe clock generators
+
+description: |
+  The Renesas 9-series are I2C PCIe clock generators providing
+  from 1 to 20 output clocks.
+
+  When referencing the provided clock in the DT using phandle
+  and clock specifier, the following mapping applies:
+
+  - 9FGV0241:
+    0 -- DIF0
+    1 -- DIF1
+
+maintainers:
+  - Marek Vasut <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - renesas,9fgv0241
+
+  reg:
+    description: I2C device address
+    enum: [ 0x68, 0x6a ]
+
+  '#clock-cells':
+    const: 1
+
+  clocks:
+    items:
+      - description: XTal input clock
+
+  renesas,out-amplitude:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [ 600000, 700000, 800000, 900000 ]
+    description: Output clock signal amplitude in uV
+
+  renesas,out-spread-spectrum:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [ 100000, 99750, 99500 ]
+    description: Output clock down spread in pcm
+
+patternProperties:
+  "^DIF[0-19]$":
+    type: object
+    description:
+      Description of one of the outputs (DIF0..DIF19).
+    properties:
+      renesas,slew-rate:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        enum: [ 2000000, 3000000 ]
+        description: Output clock slew rate select in V/ns
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - '#clock-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    /* 25MHz reference crystal */
+    ref25: ref25m {
+        compatible = "fixed-clock";
+        #clock-cells = <0>;
+        clock-frequency = <25000000>;
+    };
+
+    i2c@0 {
+        reg = <0x0 0x100>;
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        rs9: clock-generator@6a {
+            compatible = "renesas,9fgv0241";
+            reg = <0x6a>;
+            #clock-cells = <1>;
+
+            clocks = <&ref25m>;
+
+            DIF0 {
+                renesas,slew-rate = <3000000>;
+            };
+        };
+    };
+
+...
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 2/3 clk: Make __clk_hw_register_fixed_factor non-static

Access to the full parameters of __clk_hw_register_fixed_factor() is useful in case a driver is registering fixed clock with only single parent, in which case the driver should set parent_name to NULL and parent_index to 0, and access to this function permits it to do just that.

Cc Michael Turquette <[email protected]>
Cc Rob Herring <[email protected]>
Cc Stephen Boyd <[email protected]>

To: [email protected]
---
V2: - New patch

---
 drivers/clk/clk-fixed-factor.c | 2 +-
 include/linux/clk-provider.h   | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/clk/clk-fixed-factor.c +1 -1
index 4e4b6d3676126..81d8c9e430a23 100644
@@ -76,7 +76,7 @@ static void devm_clk_hw_register_fixed_factor_release(struct device *dev, void *
 	clk_hw_unregister(&fix->hw);
 }
 
-static struct clk_hw *
+struct clk_hw *
 __clk_hw_register_fixed_factor(struct device *dev, struct device_node *np,
 		const char *name, const char *parent_name, int index,
 		unsigned long flags, unsigned int mult, unsigned int div,
include/linux/clk-provider.h +5 -0
index 2faa6f7aa8a87..d216221448d31 100644
@@ -992,6 +992,11 @@ struct clk_fixed_factor {
 #define to_clk_fixed_factor(_hw) container_of(_hw, struct clk_fixed_factor, hw)
 
 extern const struct clk_ops clk_fixed_factor_ops;
+struct clk_hw *
+__clk_hw_register_fixed_factor(struct device *dev, struct device_node *np,
+		const char *name, const char *parent_name, int index,
+		unsigned long flags, unsigned int mult, unsigned int div,
+		bool devm);
 struct clk *clk_register_fixed_factor(struct device *dev, const char *name,
 		const char *parent_name, unsigned long flags,
 		unsigned int mult, unsigned int div);
Signature · 1 line
2.34.1
#2 lore raw

PATCH v2 3/3 clk: rs9: Add Renesas 9-series PCIe clock generator driver

In reply to Marek Vasut

Add driver for Renesas 9-series PCIe clock generators. This driver is designed to support 9FGV/9DBV/9DMV/9FGL/9DML/9QXL/9SQ series I2C PCIe clock generators, currently the only tested and supported chip is 9FGV0241.

The driver is capable of configuring per-chip spread spectrum mode and output amplitude, as well as per-output slew rate.

Cc Michael Turquette <[email protected]>
Cc Rob Herring <[email protected]>
Cc Stephen Boyd <[email protected]>

To: [email protected]
---
V2: - Drop unused includes
- Use REGCACHE_FLAT for smaller reg file
- Move of_node_put() in rs9_get_output_config() a bit higher up
- Drop forward declaration of clk_rs9_of_match
- Use device_get_match_data() instead of of_device_get_match_data() and check for its return value, verify it is non-NULL
- Use newly available __clk_hw_register_fixed_factor() with parent_data index=0 and drop of_clk_get_parent_name() altogether

---
 drivers/clk/Kconfig            |   9 +
 drivers/clk/Makefile           |   1 +
 drivers/clk/clk-renesas-pcie.c | 321 +++++++++++++++++++++++++++++++++
 3 files changed, 331 insertions(+)
 create mode 100644 drivers/clk/clk-renesas-pcie.c
drivers/clk/Kconfig +9 -0
index 3cdf33470a750..05fc6fb2fddd5 100644
@@ -340,6 +340,15 @@ config COMMON_CLK_OXNAS
 	help
 	  Support for the OXNAS SoC Family clocks.
 
+config COMMON_CLK_RS9_PCIE
+	tristate "Clock driver for Renesas 9-series PCIe clock generators"
+	depends on I2C
+	depends on OF
+	select REGMAP_I2C
+	help
+	  This driver supports the Renesas 9-series PCIe clock generator
+	  models 9FGV/9DBV/9DMV/9FGL/9DML/9QXL/9SQ.
+
 config COMMON_CLK_VC5
 	tristate "Clock driver for IDT VersaClock 5,6 devices"
 	depends on I2C
drivers/clk/Makefile +1 -0
index 6a98291350b64..3ec27842ec779 100644
@@ -68,6 +68,7 @@ obj-$(CONFIG_COMMON_CLK_STM32MP157)	+= clk-stm32mp1.o
 obj-$(CONFIG_COMMON_CLK_TPS68470)      += clk-tps68470.o
 obj-$(CONFIG_CLK_TWL6040)		+= clk-twl6040.o
 obj-$(CONFIG_ARCH_VT8500)		+= clk-vt8500.o
+obj-$(CONFIG_COMMON_CLK_RS9_PCIE)	+= clk-renesas-pcie.o
 obj-$(CONFIG_COMMON_CLK_VC5)		+= clk-versaclock5.o
 obj-$(CONFIG_COMMON_CLK_WM831X)		+= clk-wm831x.o
 obj-$(CONFIG_COMMON_CLK_XGENE)		+= clk-xgene.o
drivers/clk/clk-renesas-pcie.c new file +321 -0

321 lines not on this page · raw message

Signature · 1 line
2.34.1
maintainer
#3 lore raw
In reply to Marek Vasut
Quoted 57 lines · Marek Vasut

Add binding for Renesas 9-series PCIe clock generators. This binding is designed to support 9FGV/9DBV/9DMV/9FGL/9DML/9QXL/9SQ series I2C PCIe clock generators, currently the only tested and supported chip is 9FGV0241.

Cc Michael Turquette <[email protected]>
Cc Rob Herring <[email protected]>
Cc Stephen Boyd <[email protected]>

To: [email protected]
---
V2: - Drop clock consumer from the binding example
- Make clocks, i.e. xtal, mandatory

---
 .../bindings/clock/renesas,9series.yaml       | 96 +++++++++++++++++++
 1 file changed, 96 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/renesas,9series.yaml
Documentation/devicetree/bindings/clock/renesas,9series.yaml new file +32 -0
new file mode 100644
index 0000000000000..8eb56f38d99e9
@@ -0,0 +1,96 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/renesas,9series.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Binding for Renesas 9-series I2C PCIe clock generators
+
+description: |
+  The Renesas 9-series are I2C PCIe clock generators providing
+  from 1 to 20 output clocks.
+
+  When referencing the provided clock in the DT using phandle
+  and clock specifier, the following mapping applies:
+
+  - 9FGV0241:
+    0 -- DIF0
+    1 -- DIF1
+
+maintainers:
+  - Marek Vasut <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - renesas,9fgv0241
+
+  reg:
+    description: I2C device address
+    enum: [ 0x68, 0x6a ]
+
+  '#clock-cells':

Documentation/devicetree/bindings/clock/renesas,9series.yaml line 42

Quoted 10 lines
Documentation/devicetree/bindings/clock/renesas,9series.yaml new file +10 -0
+    const: 1
+
+  clocks:
+    items:
+      - description: XTal input clock
+
+  renesas,out-amplitude:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [ 600000, 700000, 800000, 900000 ]
+    description: Output clock signal amplitude in uV

Use the standard unit suffix, -microvolt.

Documentation/devicetree/bindings/clock/renesas,9series.yaml line 47

Quoted 5 lines
Documentation/devicetree/bindings/clock/renesas,9series.yaml new file +5 -0
+
+  renesas,out-spread-spectrum:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [ 100000, 99750, 99500 ]
+    description: Output clock down spread in pcm

pcm?

Documentation/devicetree/bindings/clock/renesas,9series.yaml line 53

Quoted 6 lines
Documentation/devicetree/bindings/clock/renesas,9series.yaml new file +6 -0
+
+patternProperties:
+  "^DIF[0-19]$":
+    type: object
+    description:
+      Description of one of the outputs (DIF0..DIF19).

blank line

Documentation/devicetree/bindings/clock/renesas,9series.yaml line 58

Quoted 5 lines
Documentation/devicetree/bindings/clock/renesas,9series.yaml new file +5 -0
+    properties:
+      renesas,slew-rate:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        enum: [ 2000000, 3000000 ]
+        description: Output clock slew rate select in V/ns

blank line

Quoted 42 lines
Documentation/devicetree/bindings/clock/renesas,9series.yaml new file +38 -0
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - '#clock-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    /* 25MHz reference crystal */
+    ref25: ref25m {
+        compatible = "fixed-clock";
+        #clock-cells = <0>;
+        clock-frequency = <25000000>;
+    };
+
+    i2c@0 {
+        reg = <0x0 0x100>;
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        rs9: clock-generator@6a {
+            compatible = "renesas,9fgv0241";
+            reg = <0x6a>;
+            #clock-cells = <1>;
+
+            clocks = <&ref25m>;
+
+            DIF0 {
+                renesas,slew-rate = <3000000>;
+            };
+        };
+    };
+
+...
Signature · 1 line
2.34.1
#4 lore raw

On 2/25/22 19:47, Rob Herring wrote:

[...]

Quoted 6 lines

Documentation/devicetree/bindings/clock/renesas,9series.yaml line 47

Quoted 4 lines
Documentation/devicetree/bindings/clock/renesas,9series.yaml new file +4 -0
+  renesas,out-spread-spectrum:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [ 100000, 99750, 99500 ]
+    description: Output clock down spread in pcm

pcm?

per cent mille , 1/1000th of percent.

https://en.wikipedia.org/wiki/Per_cent_mille

[...]