clk: cs2000-cp: make aux output pin configurable
Subsystems (2)
v2 cover clk: cs2000-cp: make aux output pin configurable
v2:
* Address review comments from Rob Herring on the dt bindings
Daniel Mack (3):
dt-bindings: clock: convert cs2000-cp bindings to yaml
dt-bindings: clock: cs2000-cp: Document aux-output-source
clk: cs2000-cp: Make aux output function controllable
.../bindings/clock/cirrus,cs2000-cp.yaml | 73 +++++++++++++++++++ .../devicetree/bindings/clock/cs2000-cp.txt | 22 ------ drivers/clk/clk-cs2000-cp.c | 9 +++ include/dt-bindings/clock/cirrus,cs2000-cp.h | 14 ++++ 4 files changed, 96 insertions(+), 22 deletions(-) create mode 100644 Documentation/devicetree/bindings/clock/cirrus,cs2000-cp.yaml delete mode 100644 Documentation/devicetree/bindings/clock/cs2000-cp.txt create mode 100644 include/dt-bindings/clock/cirrus,cs2000-cp.h
Signature · 1 line
2.31.1
PATCH v2 1/3 dt-bindings: clock: convert cs2000-cp bindings to yaml
The original author of the file was added as maintainer.
--- .../bindings/clock/cirrus,cs2000-cp.yaml | 63 +++++++++++++++++++ .../devicetree/bindings/clock/cs2000-cp.txt | 22 ------- 2 files changed, 63 insertions(+), 22 deletions(-) create mode 100644 Documentation/devicetree/bindings/clock/cirrus,cs2000-cp.yaml delete mode 100644 Documentation/devicetree/bindings/clock/cs2000-cp.txt
Documentation/devicetree/bindings/clock/cirrus,cs2000-cp.yaml new file +63 -0
@@ -0,0 +1,63 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/cirrus,cs2000-cp.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Binding CIRRUS LOGIC Fractional-N Clock Synthesizer & Clock Multiplier + +maintainers: + - Kuninori Morimoto <[email protected]> + +description: | + The CS2000-CP is an extremely versatile system clocking device that + utilizes a programmable phase lock loop. + + Link: https://www.cirrus.com/products/cs2000/ + +properties: + compatible: + enum: + - cirrus,cs2000-cp + + clocks: + description: + Common clock binding for CLK_IN, XTI/REF_CLK + minItems: 2 + maxItems: 2 + + clock-names: + items: + - const: clk_in + - const: ref_clk + + '#clock-cells': + const: 0 + + reg: + maxItems: 1 + +required: + - compatible + - reg + - clocks + - clock-names + - '#clock-cells' + +additionalProperties: false + +examples: + - | + i2c@0 { + reg = <0x0 0x100>; + #address-cells = <1>; + #size-cells = <0>; + + clock-controller@4f { + #clock-cells = <0>; + compatible = "cirrus,cs2000-cp"; + reg = <0x4f>; + clocks = <&rcar_sound 0>, <&x12_clk>; + clock-names = "clk_in", "ref_clk"; + }; + };
Documentation/devicetree/bindings/clock/cs2000-cp.txt deleted +0 -22
@@ -1,22 +0,0 @@ -CIRRUS LOGIC Fractional-N Clock Synthesizer & Clock Multiplier - -Required properties: - -- compatible: "cirrus,cs2000-cp" -- reg: The chip select number on the I2C bus -- clocks: common clock binding for CLK_IN, XTI/REF_CLK -- clock-names: CLK_IN : clk_in, XTI/REF_CLK : ref_clk -- #clock-cells: must be <0> - -Example: - -&i2c2 { - ... - cs2000: clk_multiplier@4f { - #clock-cells = <0>; - compatible = "cirrus,cs2000-cp"; - reg = <0x4f>; - clocks = <&rcar_sound 0>, <&x12_clk>; - clock-names = "clk_in", "ref_clk"; - }; -};
Signature · 1 line
2.31.1
Re: [PATCH v2 1/3] dt-bindings: clock: convert cs2000-cp bindings to yaml
Quoted 5 lines · Daniel Mack
The original author of the file was added as maintainer.
Signed-off-by Daniel Mack <[email protected]>Cc Kuninori Morimoto <[email protected]>Signed-off-by Daniel Mack <[email protected]>
Quoted 7 lines
--- .../bindings/clock/cirrus,cs2000-cp.yaml | 63 +++++++++++++++++++ .../devicetree/bindings/clock/cs2000-cp.txt | 22 ------- 2 files changed, 63 insertions(+), 22 deletions(-) create mode 100644 Documentation/devicetree/bindings/clock/cirrus,cs2000-cp.yaml delete mode 100644 Documentation/devicetree/bindings/clock/cs2000-cp.txt
PATCH v2 2/3 dt-bindings: clock: cs2000-cp: Document aux-output-source
In reply to Daniel MackThis new optional property can be used to control the function of the auxiliary output pin. Introduce a new dt-bindings include file that contains the numerical values.
--- .../bindings/clock/cirrus,cs2000-cp.yaml | 13 +++++++++++++ include/dt-bindings/clock/cirrus,cs2000-cp.h | 14 ++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 include/dt-bindings/clock/cirrus,cs2000-cp.h
Documentation/devicetree/bindings/clock/cirrus,cs2000-cp.yaml +13 -0
@@ -37,6 +37,16 @@ properties: reg: maxItems: 1 + cirrus,aux-output-source: + description: + Specfies the function of the auxililary clock output pin + $ref: /schemas/types.yaml#/definitions/uint32 + enum: + - 0 # CS2000CP_AUX_OUTPUT_REF_CLK: ref_clk input + - 1 # CS2000CP_AUX_OUTPUT_CLK_IN: clk_in input + - 2 # CS2000CP_AUX_OUTPUT_CLK_OUT: clk_out output + - 3 # CS2000CP_AUX_OUTPUT_PLL_LOCK: pll lock status + required: - compatible - reg
@@ -48,6 +58,8 @@ additionalProperties: false examples: - | + #include <dt-bindings/clock/cirrus,cs2000-cp.h> + i2c@0 { reg = <0x0 0x100>; #address-cells = <1>;
@@ -59,5 +71,6 @@ examples: reg = <0x4f>; clocks = <&rcar_sound 0>, <&x12_clk>; clock-names = "clk_in", "ref_clk"; + cirrus,aux-output-source = <CS2000CP_AUX_OUTPUT_CLK_OUT>; }; };
include/dt-bindings/clock/cirrus,cs2000-cp.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +/* +* Copyright (C) 2021 Daniel Mack +*/ + +#ifndef __DT_BINDINGS_CS2000CP_CLK_H +#define __DT_BINDINGS_CS2000CP_CLK_H + +#define CS2000CP_AUX_OUTPUT_REF_CLK 0 +#define CS2000CP_AUX_OUTPUT_CLK_IN 1 +#define CS2000CP_AUX_OUTPUT_CLK_OUT 2 +#define CS2000CP_AUX_OUTPUT_PLL_LOCK 3 + +#endif /* __DT_BINDINGS_CS2000CP_CLK_H */
Signature · 1 line
2.31.1
Re: [PATCH v2 2/3] dt-bindings: clock: cs2000-cp: Document aux-output-source
Quoted 11 lines · Daniel Mack
This new optional property can be used to control the function of the auxiliary output pin. Introduce a new dt-bindings include file that contains the numerical values.
Signed-off-by Daniel Mack <[email protected]>--- .../bindings/clock/cirrus,cs2000-cp.yaml | 13 +++++++++++++ include/dt-bindings/clock/cirrus,cs2000-cp.h | 14 ++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 include/dt-bindings/clock/cirrus,cs2000-cp.h
Re: [PATCH v2 2/3] dt-bindings: clock: cs2000-cp: Document aux-output-source
Quoted 13 lines · Rob Herring
Quoted 11 lines · Daniel Mack
This new optional property can be used to control the function of the auxiliary output pin. Introduce a new dt-bindings include file that contains the numerical values.
Signed-off-by Daniel Mack <[email protected]>--- .../bindings/clock/cirrus,cs2000-cp.yaml | 13 +++++++++++++ include/dt-bindings/clock/cirrus,cs2000-cp.h | 14 ++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 include/dt-bindings/clock/cirrus,cs2000-cp.h
Quoted 2 lines
Reviewed-by Rob Herring <[email protected]>
Thanks Rob!
Mike, Stephen, do you want me to resend with Rob's ack?
Thanks,
Daniel
Re: [PATCH v2 2/3] dt-bindings: clock: cs2000-cp: Document aux-output-source
In reply to Daniel MackHi Daniel,
Quoted 5 lines · Daniel Mack
This new optional property can be used to control the function of the auxiliary output pin. Introduce a new dt-bindings include file that contains the numerical values.
Signed-off-by Daniel Mack <[email protected]>
Thanks for your patch!
Documentation/devicetree/bindings/clock/cirrus,cs2000-cp.yaml properties: · line 42
Quoted 9 lines
Documentation/devicetree/bindings/clock/cirrus,cs2000-cp.yaml +3
-0@@ -37,6 +37,16 @@ properties: reg: maxItems: 1 + cirrus,aux-output-source: + description: + Specfies the function of the auxililary clock output pin
Specifies ... auxiliary
Documentation/devicetree/bindings/clock/cirrus,cs2000-cp.yaml properties: · line 48
Quoted 6 lines
Documentation/devicetree/bindings/clock/cirrus,cs2000-cp.yaml +6
-0+ $ref: /schemas/types.yaml#/definitions/uint32 + enum: + - 0 # CS2000CP_AUX_OUTPUT_REF_CLK: ref_clk input + - 1 # CS2000CP_AUX_OUTPUT_CLK_IN: clk_in input + - 2 # CS2000CP_AUX_OUTPUT_CLK_OUT: clk_out output + - 3 # CS2000CP_AUX_OUTPUT_PLL_LOCK: pll lock status
Should the default be documented? "default: 0"?
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH v2 2/3] dt-bindings: clock: cs2000-cp: Document aux-output-source
Hi Geert,
Thanks for looking into this patch!
Quoted 6 lines · Geert Uytterhoeven
Documentation/devicetree/bindings/clock/cirrus,cs2000-cp.yaml properties: · line 42
Quoted 3 lines
Documentation/devicetree/bindings/clock/cirrus,cs2000-cp.yaml +3
-0+ cirrus,aux-output-source: + description: + Specfies the function of the auxililary clock output pinSpecifies ... auxiliary
Quoted 8 lines
Documentation/devicetree/bindings/clock/cirrus,cs2000-cp.yaml properties: · line 48
Quoted 6 lines
Documentation/devicetree/bindings/clock/cirrus,cs2000-cp.yaml +6
-0+ $ref: /schemas/types.yaml#/definitions/uint32 + enum: + - 0 # CS2000CP_AUX_OUTPUT_REF_CLK: ref_clk input + - 1 # CS2000CP_AUX_OUTPUT_CLK_IN: clk_in input + - 2 # CS2000CP_AUX_OUTPUT_CLK_OUT: clk_out output + - 3 # CS2000CP_AUX_OUTPUT_PLL_LOCK: pll lock statusShould the default be documented? "default: 0"?
Both addressed. I will send a new series soon that supersedes this one and carries some more changes.
Daniel
PATCH v2 3/3 clk: cs2000-cp: Make aux output function controllable
In reply to Daniel MackThe aux output pin can be configured to output either of the two clock inputs, the generated clock or the pll lock status. Allow access to this feature through a new optional device-tree property.
--- drivers/clk/clk-cs2000-cp.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/clk/clk-cs2000-cp.c +9 -0
@@ -39,6 +39,8 @@/* DEVICE_CFG1 */ #define RSEL (x) (((x) & 0x3) << 3)#define RSEL_MASK RSEL(0x3) +#define AUXOUTSRC (x) (((x) & 0x3) << 1) +#define AUXOUTSRC_MASK AUXOUTSRC(0x3)#define ENDEV1 (0x1)/* DEVICE_CFG2 */
@@ -421,12 +423,19 @@ static int cs2000_clk_register(struct cs2000_priv *priv)struct clk_init_data init;const char *name = np->name;static const char *parent_names[CLK_MAX ]; +u32 aux_out =0 ;int ch =0 ;/* it uses ch0 only at this point */ int rate;int ret;of_property_read_string (np,"clock-output-names" , &name); +of_property_read_u32 (np,"cirrus,aux-output-source" , &aux_out); + ret =cs2000_bset (priv,DEVICE_CFG1 , +AUXOUTSRC_MASK ,AUXOUTSRC (aux_out)); +if (ret <0 ) +return ret; +/* * set default rate as 1/1. * otherwise .set_rate which setup ratio
Signature · 1 line
2.31.1