devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] dt-bindings: clock: convert cs2000-cp bindings to yaml
@ 2021-05-17 12:29 Daniel Mack
  2021-05-17 12:29 ` [PATCH 2/3] dt-bindings: clk: cs2000-cp: Document aux-output-source Daniel Mack
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Daniel Mack @ 2021-05-17 12:29 UTC (permalink / raw)
  To: linux-clk, devicetree
  Cc: robh+dt, kuninori.morimoto.gx, mturquette, sboyd, Daniel Mack

The original author of the file was added as maintainer.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 .../bindings/clock/cirrus,cs2000-cp.yaml      | 64 +++++++++++++++++++
 .../devicetree/bindings/clock/cs2000-cp.txt   | 22 -------
 2 files changed, 64 insertions(+), 22 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/cirrus,cs2000-cp.yaml
 delete mode 100644 Documentation/devicetree/bindings/clock/cs2000-cp.txt

diff --git a/Documentation/devicetree/bindings/clock/cirrus,cs2000-cp.yaml b/Documentation/devicetree/bindings/clock/cirrus,cs2000-cp.yaml
new file mode 100644
index 000000000000..3af81087e5f9
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/cirrus,cs2000-cp.yaml
@@ -0,0 +1,64 @@
+# 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 <kuninori.morimoto.gx@renesas.com>
+
+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:
+    minItems: 2
+    maxItems: 2
+
+  '#clock-cells':
+    const: 0
+
+  reg:
+    description:
+      The chip select number on the I2C bus
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - '#clock-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c@0 {
+      reg = <0x0 0x100>;
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      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";
+      };
+    };
diff --git a/Documentation/devicetree/bindings/clock/cs2000-cp.txt b/Documentation/devicetree/bindings/clock/cs2000-cp.txt
deleted file mode 100644
index 54e6df0bee8a..000000000000
--- a/Documentation/devicetree/bindings/clock/cs2000-cp.txt
+++ /dev/null
@@ -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";
-	};
-};
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] dt-bindings: clk: cs2000-cp: Document aux-output-source
  2021-05-17 12:29 [PATCH 1/3] dt-bindings: clock: convert cs2000-cp bindings to yaml Daniel Mack
@ 2021-05-17 12:29 ` Daniel Mack
  2021-05-19 19:03   ` Rob Herring
  2021-05-17 12:29 ` [PATCH 3/3] clk: cs2000-cp: Make aux output function controllable Daniel Mack
  2021-05-19 19:00 ` [PATCH 1/3] dt-bindings: clock: convert cs2000-cp bindings to yaml Rob Herring
  2 siblings, 1 reply; 5+ messages in thread
From: Daniel Mack @ 2021-05-17 12:29 UTC (permalink / raw)
  To: linux-clk, devicetree
  Cc: robh+dt, kuninori.morimoto.gx, mturquette, sboyd, 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 <daniel@zonque.org>
---
 .../bindings/clock/cirrus,cs2000-cp.yaml          | 15 ++++++++++++++-
 include/dt-bindings/clock/cirrus,cs2000-cp.h      | 14 ++++++++++++++
 2 files changed, 28 insertions(+), 1 deletion(-)
 create mode 100644 include/dt-bindings/clock/cirrus,cs2000-cp.h

diff --git a/Documentation/devicetree/bindings/clock/cirrus,cs2000-cp.yaml b/Documentation/devicetree/bindings/clock/cirrus,cs2000-cp.yaml
index 3af81087e5f9..d20ed0aabcb0 100644
--- a/Documentation/devicetree/bindings/clock/cirrus,cs2000-cp.yaml
+++ b/Documentation/devicetree/bindings/clock/cirrus,cs2000-cp.yaml
@@ -38,6 +38,16 @@ properties:
       The chip select number on the I2C bus
     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
@@ -45,10 +55,12 @@ required:
   - clock-names
   - '#clock-cells'
 
-additionalProperties: false
+additionalProperties: true
 
 examples:
   - |
+    #include <dt-bindings/clock/cirrus,cs2000-cp.h>
+
     i2c@0 {
       reg = <0x0 0x100>;
       #address-cells = <1>;
@@ -60,5 +72,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>;
       };
     };
diff --git a/include/dt-bindings/clock/cirrus,cs2000-cp.h b/include/dt-bindings/clock/cirrus,cs2000-cp.h
new file mode 100644
index 000000000000..b9b13cfc8fbd
--- /dev/null
+++ b/include/dt-bindings/clock/cirrus,cs2000-cp.h
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * 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 */
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] clk: cs2000-cp: Make aux output function controllable
  2021-05-17 12:29 [PATCH 1/3] dt-bindings: clock: convert cs2000-cp bindings to yaml Daniel Mack
  2021-05-17 12:29 ` [PATCH 2/3] dt-bindings: clk: cs2000-cp: Document aux-output-source Daniel Mack
@ 2021-05-17 12:29 ` Daniel Mack
  2021-05-19 19:00 ` [PATCH 1/3] dt-bindings: clock: convert cs2000-cp bindings to yaml Rob Herring
  2 siblings, 0 replies; 5+ messages in thread
From: Daniel Mack @ 2021-05-17 12:29 UTC (permalink / raw)
  To: linux-clk, devicetree
  Cc: robh+dt, kuninori.morimoto.gx, mturquette, sboyd, Daniel Mack

The 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.

Signed-off-by: Daniel Mack <daniel@zonque.org>
---
 drivers/clk/clk-cs2000-cp.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/clk/clk-cs2000-cp.c b/drivers/clk/clk-cs2000-cp.c
index 92bc4aca0f95..db7290621cef 100644
--- a/drivers/clk/clk-cs2000-cp.c
+++ b/drivers/clk/clk-cs2000-cp.c
@@ -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
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/3] dt-bindings: clock: convert cs2000-cp bindings to yaml
  2021-05-17 12:29 [PATCH 1/3] dt-bindings: clock: convert cs2000-cp bindings to yaml Daniel Mack
  2021-05-17 12:29 ` [PATCH 2/3] dt-bindings: clk: cs2000-cp: Document aux-output-source Daniel Mack
  2021-05-17 12:29 ` [PATCH 3/3] clk: cs2000-cp: Make aux output function controllable Daniel Mack
@ 2021-05-19 19:00 ` Rob Herring
  2 siblings, 0 replies; 5+ messages in thread
From: Rob Herring @ 2021-05-19 19:00 UTC (permalink / raw)
  To: Daniel Mack
  Cc: linux-clk, devicetree, kuninori.morimoto.gx, mturquette, sboyd

On Mon, May 17, 2021 at 02:29:24PM +0200, Daniel Mack wrote:
> The original author of the file was added as maintainer.
> 
> Signed-off-by: Daniel Mack <daniel@zonque.org>
> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  .../bindings/clock/cirrus,cs2000-cp.yaml      | 64 +++++++++++++++++++
>  .../devicetree/bindings/clock/cs2000-cp.txt   | 22 -------
>  2 files changed, 64 insertions(+), 22 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/clock/cirrus,cs2000-cp.yaml
>  delete mode 100644 Documentation/devicetree/bindings/clock/cs2000-cp.txt
> 
> diff --git a/Documentation/devicetree/bindings/clock/cirrus,cs2000-cp.yaml b/Documentation/devicetree/bindings/clock/cirrus,cs2000-cp.yaml
> new file mode 100644
> index 000000000000..3af81087e5f9
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/clock/cirrus,cs2000-cp.yaml
> @@ -0,0 +1,64 @@
> +# 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 <kuninori.morimoto.gx@renesas.com>
> +
> +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:
> +    minItems: 2
> +    maxItems: 2

Need to define the names and order.

> +
> +  '#clock-cells':
> +    const: 0
> +
> +  reg:
> +    description:
> +      The chip select number on the I2C bus

Drop. That's 'reg' for every I2C device.

> +    maxItems: 1
> +
> +required:
> +  - compatible
> +  - reg
> +  - clocks
> +  - clock-names
> +  - '#clock-cells'
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    i2c@0 {
> +      reg = <0x0 0x100>;
> +      #address-cells = <1>;
> +      #size-cells = <0>;
> +
> +      cs2000: clk_multiplier@4f {

clock-controller@4f

And drop cs2000 as it is unused here.

> +        #clock-cells = <0>;
> +        compatible = "cirrus,cs2000-cp";
> +        reg = <0x4f>;
> +        clocks = <&rcar_sound 0>, <&x12_clk>;
> +        clock-names = "clk_in", "ref_clk";
> +      };
> +    };
> diff --git a/Documentation/devicetree/bindings/clock/cs2000-cp.txt b/Documentation/devicetree/bindings/clock/cs2000-cp.txt
> deleted file mode 100644
> index 54e6df0bee8a..000000000000
> --- a/Documentation/devicetree/bindings/clock/cs2000-cp.txt
> +++ /dev/null
> @@ -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";
> -	};
> -};
> -- 
> 2.31.1
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/3] dt-bindings: clk: cs2000-cp: Document aux-output-source
  2021-05-17 12:29 ` [PATCH 2/3] dt-bindings: clk: cs2000-cp: Document aux-output-source Daniel Mack
@ 2021-05-19 19:03   ` Rob Herring
  0 siblings, 0 replies; 5+ messages in thread
From: Rob Herring @ 2021-05-19 19:03 UTC (permalink / raw)
  To: Daniel Mack
  Cc: linux-clk, devicetree, kuninori.morimoto.gx, mturquette, sboyd

On Mon, May 17, 2021 at 02:29:25PM +0200, Daniel Mack wrote:
> 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 <daniel@zonque.org>
> ---
>  .../bindings/clock/cirrus,cs2000-cp.yaml          | 15 ++++++++++++++-
>  include/dt-bindings/clock/cirrus,cs2000-cp.h      | 14 ++++++++++++++
>  2 files changed, 28 insertions(+), 1 deletion(-)
>  create mode 100644 include/dt-bindings/clock/cirrus,cs2000-cp.h
> 
> diff --git a/Documentation/devicetree/bindings/clock/cirrus,cs2000-cp.yaml b/Documentation/devicetree/bindings/clock/cirrus,cs2000-cp.yaml
> index 3af81087e5f9..d20ed0aabcb0 100644
> --- a/Documentation/devicetree/bindings/clock/cirrus,cs2000-cp.yaml
> +++ b/Documentation/devicetree/bindings/clock/cirrus,cs2000-cp.yaml
> @@ -38,6 +38,16 @@ properties:
>        The chip select number on the I2C bus
>      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
> @@ -45,10 +55,12 @@ required:
>    - clock-names
>    - '#clock-cells'
>  
> -additionalProperties: false
> +additionalProperties: true

No, that's only correct for collections of common properties.

>  
>  examples:
>    - |
> +    #include <dt-bindings/clock/cirrus,cs2000-cp.h>
> +
>      i2c@0 {
>        reg = <0x0 0x100>;
>        #address-cells = <1>;
> @@ -60,5 +72,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>;
>        };
>      };
> diff --git a/include/dt-bindings/clock/cirrus,cs2000-cp.h b/include/dt-bindings/clock/cirrus,cs2000-cp.h
> new file mode 100644
> index 000000000000..b9b13cfc8fbd
> --- /dev/null
> +++ b/include/dt-bindings/clock/cirrus,cs2000-cp.h
> @@ -0,0 +1,14 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */

What about non-GPL users?

> +/*
> + * 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 */
> -- 
> 2.31.1
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-05-19 19:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-17 12:29 [PATCH 1/3] dt-bindings: clock: convert cs2000-cp bindings to yaml Daniel Mack
2021-05-17 12:29 ` [PATCH 2/3] dt-bindings: clk: cs2000-cp: Document aux-output-source Daniel Mack
2021-05-19 19:03   ` Rob Herring
2021-05-17 12:29 ` [PATCH 3/3] clk: cs2000-cp: Make aux output function controllable Daniel Mack
2021-05-19 19:00 ` [PATCH 1/3] dt-bindings: clock: convert cs2000-cp bindings to yaml Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).