dt-bindings: clk: rs9: Add Renesas 9-series I2C PCIe clock generator
Subsystems (3)
PATCH v3 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.
To: [email protected]
---
V2: - Drop clock consumer from the binding example
- Make clocks, i.e. xtal, mandatory
V3: - Rename renesas,out-amplitude to renesas,out-amplitude-microvolt
- Drop type ref: from renesas,out-amplitude-microvolt property
- Explain 'pcm' in description text as 1/1000 of percent
- Add newlines
--- .../bindings/clock/renesas,9series.yaml | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/renesas,9series.yaml
Documentation/devicetree/bindings/clock/renesas,9series.yaml new file +97 -0
@@ -0,0 +1,97 @@ +# 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-microvolt: + enum: [ 600000, 700000, 800000, 900000 ] + description: Output clock signal amplitude + + renesas,out-spread-spectrum: + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [ 100000, 99750, 99500 ] + description: Output clock down spread in pcm (1/1000 of percent) + +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
PATCH v3 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.
To: [email protected]
---
V2: - New patch
V3: - No change
--- 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
@@ -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
@@ -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
Re: [PATCH v3 2/3] clk: Make __clk_hw_register_fixed_factor non-static
Quoting Marek Vasut (2022-02-25 20:07:22)
Quoted 6 lines
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 setparent_nameto NULL andparent_indexto 0, and access to this function permits it to do just that.
Quoted 7 lines
Signed-off-by Marek Vasut <[email protected]>Cc Michael Turquette <[email protected]>Cc Rob Herring <[email protected]>Cc Stephen Boyd <[email protected]>To: [email protected]
---
Applied to clk-next
Stephen Boyd
maintainerRe: [PATCH v3 2/3] clk: Make __clk_hw_register_fixed_factor non-static
In reply to Marek VasutQuoting Marek Vasut (2022-02-25 20:07:22)
Quoted 11 lines
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 setparent_nameto NULL andparent_indexto 0, and access to this function permits it to do just that.Signed-off-by Marek Vasut <[email protected]>Cc Michael Turquette <[email protected]>Cc Rob Herring <[email protected]>Cc Stephen Boyd <[email protected]>
Quoted 4 lines
To: [email protected]
---
V2: - New patch
V3: - No change
This isn't exported. Given that we don't typically export an internal function (hence the double underscore) I'm going to change this to be a new function. See the attached patch.
---8<----
drivers/clk/clk-fixed-factor.c +23 -1
@@ -76,7 +76,7 @@ static void devm_clk_hw_register_fixed_factor_release(struct device *dev, void *clk_hw_unregister (&fix->hw); } -struct clk_hw * +static 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,
@@ -131,6 +131,28 @@ __clk_hw_register_fixed_factor(struct device *dev, struct device_node *np,return hw; } +/** +* devm_clk_hw_register_fixed_factor_index - Register a fixed factor clock with +* parent from DT index +* @dev: device that is registering this clock +* @name: name of this clock +* @index: index of phandle in @dev 'clocks' property +* @flags: fixed factor flags +* @mult: multiplier +* @div: divider +* +* Return: Pointer to fixed factor clk_hw structure that was registered or +* an error pointer. +*/ +struct clk_hw *devm_clk_hw_register_fixed_factor_index (struct device *dev, +const char *name,unsigned int index,unsigned long flags, +unsigned int mult,unsigned int div) +{ +return __clk_hw_register_fixed_factor (dev,NULL , name,NULL , index, + flags, mult, div, true); +} +EXPORT_SYMBOL_GPL (devm_clk_hw_register_fixed_factor_index); +struct clk_hw *clk_hw_register_fixed_factor (struct device *dev,const char *name,const char *parent_name,unsigned long flags,unsigned int mult,unsigned int div)
drivers/clk/clk-renesas-pcie.c +2 -2
@@ -250,8 +250,8 @@ static int rs9_probe(struct i2c_client *client, const struct i2c_device_id *id)/* Register clock */ for (i =0 ; i < rs9->chip_info->num_clks; i++) {snprintf (name,5 ,"DIF%d" , i); - hw =__clk_hw_register_fixed_factor (&client->dev,NULL , name, -NULL ,0 ,0 ,4 ,1 , true); + hw =devm_clk_hw_register_fixed_factor_index (&client->dev, name, +0 ,0 ,4 ,1 );if (IS_ERR (hw))return PTR_ERR (hw);
include/linux/clk-provider.h +3 -5
@@ -992,11 +992,6 @@ 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);
@@ -1008,6 +1003,9 @@ void clk_hw_unregister_fixed_factor(struct clk_hw *hw);struct clk_hw *devm_clk_hw_register_fixed_factor (struct device *dev,const char *name,const char *parent_name,unsigned long flags,unsigned int mult,unsigned int div); +struct clk_hw *devm_clk_hw_register_fixed_factor_index (struct device *dev, +const char *name,unsigned int index,unsigned long flags, +unsigned int mult,unsigned int div);/** * struct clk_fractional_divider - adjustable fractional divider clock *
Re: [PATCH v3 2/3] clk: Make __clk_hw_register_fixed_factor non-static
Quoted 17 lines · Stephen Boyd
Quoting Marek Vasut (2022-02-25 20:07:22)
Quoted 11 lines
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 setparent_nameto NULL andparent_indexto 0, and access to this function permits it to do just that.Signed-off-by Marek Vasut <[email protected]>Cc Michael Turquette <[email protected]>Cc Rob Herring <[email protected]>Cc Stephen Boyd <[email protected]>Quoted 4 lines
To: [email protected]
---
V2: - New patch
V3: - No change
Quoted 3 lines
This isn't exported. Given that we don't typically export an internal function (hence the double underscore) I'm going to change this to be a new function. See the attached patch.
I can confirm the change works and looks OK.
Do you want me to send a V4 or will you squash it into these patches yourself when applying?
Stephen Boyd
maintainerRe: [PATCH v3 2/3] clk: Make __clk_hw_register_fixed_factor non-static
Quoting Marek Vasut (2022-03-20 06:23:14)
Quoted 18 lines · Stephen Boyd
Quoted 17 lines
Quoting Marek Vasut (2022-02-25 20:07:22)
Quoted 15 lines
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 setparent_nameto NULL andparent_indexto 0, and access to this function permits it to do just that.Signed-off-by Marek Vasut <[email protected]>Cc Michael Turquette <[email protected]>Cc Rob Herring <[email protected]>Cc Stephen Boyd <[email protected]>To: [email protected]
---
V2: - New patch
V3: - No change
Quoted 8 lines
Quoted 3 lines
This isn't exported. Given that we don't typically export an internal function (hence the double underscore) I'm going to change this to be a new function. See the attached patch.
I can confirm the change works and looks OK.
Do you want me to send a V4 or will you squash it into these patches yourself when applying?
No need I fixed it up and pushed it out.
Re: [PATCH v3 2/3] clk: Make __clk_hw_register_fixed_factor non-static
Quoted 23 lines · Stephen Boyd
Quoting Marek Vasut (2022-03-20 06:23:14)
Quoted 22 lines · Stephen Boyd
Quoted 20 lines
Quoting Marek Vasut (2022-02-25 20:07:22)
Quoted 11 lines
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 setparent_nameto NULL andparent_indexto 0, and access to this function permits it to do just that.Signed-off-by Marek Vasut <[email protected]>Cc Michael Turquette <[email protected]>Cc Rob Herring <[email protected]>Cc Stephen Boyd <[email protected]>Quoted 4 lines
To: [email protected]
---
V2: - New patch
V3: - No changeThis isn't exported. Given that we don't typically export an internal function (hence the double underscore) I'm going to change this to be a new function. See the attached patch.
Quoted 6 lines
Quoted 4 lines
I can confirm the change works and looks OK.
Do you want me to send a V4 or will you squash it into these patches yourself when applying?
No need I fixed it up and pushed it out.
Thank you
PATCH v3 3/3 clk: rs9: Add Renesas 9-series PCIe clock generator driver
In reply to Marek VasutAdd 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.
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
V3: - Rename renesas,out-amplitude to renesas,out-amplitude-microvolt
--- drivers/clk/Kconfig | 9 + drivers/clk/Makefile | 1 + drivers/clk/clk-renesas-pcie.c | 322 +++++++++++++++++++++++++++++++++ 3 files changed, 332 insertions(+) create mode 100644 drivers/clk/clk-renesas-pcie.c
drivers/clk/Kconfig +9 -0
@@ -343,6 +343,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
@@ -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 +322 -0
322 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH v3 3/3] clk: rs9: Add Renesas 9-series PCIe clock generator driver
Quoted 13 lines · 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.
Signed-off-by Marek Vasut <[email protected]>Cc Michael Turquette <[email protected]>Cc Rob Herring <[email protected]>Cc Stephen Boyd <[email protected]>
Quoted 11 lines
To: [email protected]
---
V2: - Drop unused includes
- UseREGCACHE_FLATfor smaller reg file
- Moveof_node_put()inrs9_get_output_config()a bit higher up
- Drop forward declaration ofclk_rs9_of_match
- Usedevice_get_match_data()instead ofof_device_get_match_data()and check for its return value, verify it is non-NULL
- Use newly available__clk_hw_register_fixed_factor()withparent_dataindex=0 and dropof_clk_get_parent_name()altogether
V3: - Rename renesas,out-amplitude to renesas,out-amplitude-microvolt
Are there any news on this series ?
Re: [PATCH v3 3/3] clk: rs9: Add Renesas 9-series PCIe clock generator driver
In reply to Marek VasutQuoting Marek Vasut (2022-02-25 20:07:23)
Quoted 8 lines
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.
Quoted 7 lines
Signed-off-by Marek Vasut <[email protected]>Cc Michael Turquette <[email protected]>Cc Rob Herring <[email protected]>Cc Stephen Boyd <[email protected]>To: [email protected]
---
Applied to clk-next
Quoted 18 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.
Signed-off-by Marek Vasut <[email protected]>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
V3: - Rename renesas,out-amplitude to renesas,out-amplitude-microvolt
- Drop type ref: from renesas,out-amplitude-microvolt property
- Explain 'pcm' in description text as 1/1000 of percent
- Add newlines
Quoted 5 lines
--- .../bindings/clock/renesas,9series.yaml | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/renesas,9series.yaml
Quoting Marek Vasut (2022-02-25 20:07:21)
Quoted 5 lines
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.
Quoted 7 lines
Signed-off-by Marek Vasut <[email protected]>Cc Michael Turquette <[email protected]>Cc Rob Herring <[email protected]>Cc Stephen Boyd <[email protected]>To: [email protected]
---
Applied to clk-next