Skip to contentSkip to conversation

clk: Add a driver for the Xilinx Clocking Wizard block

PATCH New Boris Brezillon 4 participants 9 messages Aug 1, 2018 – Aug 14, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 clk: Add a driver for the Xilinx Clocking Wizard block

Add a clk driver for Xilinx Clocking Wizard IP.

---
 drivers/clk/Kconfig           |   1 +
 drivers/clk/zynq/Kconfig      |   5 +
 drivers/clk/zynq/Makefile     |   2 +
 drivers/clk/zynq/clk-wizard.c | 408 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 416 insertions(+)
 create mode 100644 drivers/clk/zynq/Kconfig
 create mode 100644 drivers/clk/zynq/clk-wizard.c
drivers/clk/Kconfig +1 -0
index 721572a8c429..6c14f48b4f19 100644
@@ -293,5 +293,6 @@ source "drivers/clk/sunxi-ng/Kconfig"
 source "drivers/clk/tegra/Kconfig"
 source "drivers/clk/ti/Kconfig"
 source "drivers/clk/uniphier/Kconfig"
+source "drivers/clk/zynq/Kconfig"
 
 endmenu
drivers/clk/zynq/Kconfig new file +5 -0
new file mode 100644
index 000000000000..654d72ef0349
@@ -0,0 +1,5 @@
+config CLK_ZYNQ_CLK_WIZARD
+	tristate "Xilinx clocking wizard driver"
+	depends on ARCH_ZYNQ || COMPILE_TEST
+	help
+	  Enable the driver for Xilinx clocking wizard IP.
drivers/clk/zynq/Makefile +2 -0
index 0afc2e7cc5c1..ac2a5e09fad9 100644
@@ -1,3 +1,5 @@
 # Zynq clock specific Makefile
 
 obj-y	+= clkc.o pll.o
+
+obj-$(CONFIG_CLK_ZYNQ_CLK_WIZARD)	+= clk-wizard.o
drivers/clk/zynq/clk-wizard.c new file +408 -0

408 lines not on this page · raw message

Signature · 1 line
2.14.1
#1 lore raw

PATCH 2/2 dt-bindings: clock: Add bindings for the Clocking Wizard IP

Document Xilinx Clocking Wizard bindings.

---
 .../devicetree/bindings/clock/xlnx,clk-wizard.txt  | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/xlnx,clk-wizard.txt
Documentation/devicetree/bindings/clock/xlnx,clk-wizard.txt new file +28 -0
new file mode 100644
index 000000000000..1bf7a764f4a9
@@ -0,0 +1,28 @@
+Device Tree Clock bindings for the "Clocking Wizard" IP provided by Xilinx
+
+This block can be used to generate up to 4 clock signals out of a single input
+clock. It embeds a PLL to generate an intermediate clock which then feeds 4
+clock dividers whose divider value can be adjusted based on the user needs.
+
+Required properties:
+ - #clock-cells: must be 1. The cell is encoding the id of the output clk
+		 (from 0 to xlnx,clk-wizard-num-outputs - 1)
+ - compatible: must be "xlnx,clk-wizard-5.1"
+ - clocks: 2 clocks are required
+ - clock-names: should contain 2 clock names: "aclk" and "clkin".
+		"aclk" is driving the register interface and "clk_in" is the
+		input clock signal that is used by the PLL block
+ - xlnx,clk-wizard-num-outputs: this describe the number of output clocks
+				(chosen at synthesization time)
+ - reg: registers used to configure the Clocking wizard block
+
+Example:
+
+	clkwizard: clkwizard at 43c20000 {
+		compatible = "xlnx,clk-wizard-5.1";
+		reg = <0x43c20000 0x10000>;
+		clocks = <&clkc 18>, <&clkc 18>;
+		clock-names = "aclk", "clk_in1";
+		#clock-cells = <1>;
+		xlnx,clk-wizard-num-outputs = <2>;
+	};
Signature · 1 line
2.14.1
#2 lore raw

PATCH 2/2 dt-bindings: clock: Add bindings for the Clocking Wizard IP

Hi Boris,

Quoted 33 lines · Boris Brezillon

Document Xilinx Clocking Wizard bindings.

---
 .../devicetree/bindings/clock/xlnx,clk-wizard.txt  | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/xlnx,clk-wizard.txt
Documentation/devicetree/bindings/clock/xlnx,clk-wizard.txt new file +18 -0
new file mode 100644
index 000000000000..1bf7a764f4a9
@@ -0,0 +1,28 @@
+Device Tree Clock bindings for the "Clocking Wizard" IP provided by Xilinx
+
+This block can be used to generate up to 4 clock signals out of a single input
+clock. It embeds a PLL to generate an intermediate clock which then feeds 4
+clock dividers whose divider value can be adjusted based on the user needs.
+
+Required properties:
+ - #clock-cells: must be 1. The cell is encoding the id of the output clk
+		 (from 0 to xlnx,clk-wizard-num-outputs - 1)
+ - compatible: must be "xlnx,clk-wizard-5.1"
+ - clocks: 2 clocks are required
+ - clock-names: should contain 2 clock names: "aclk" and "clkin".
+		"aclk" is driving the register interface and "clk_in" is the
+		input clock signal that is used by the PLL block
+ - xlnx,clk-wizard-num-outputs: this describe the number of output clocks
+				(chosen at synthesization time)
+ - reg: registers used to configure the Clocking wizard block
+

Documentation/devicetree/bindings/clock/xlnx,clk-wizard.txt line 28

Quoted 10 lines
Documentation/devicetree/bindings/clock/xlnx,clk-wizard.txt new file +10 -0
+Example:
+
+	clkwizard: clkwizard at 43c20000 {
+		compatible = "xlnx,clk-wizard-5.1";
+		reg = <0x43c20000 0x10000>;
+		clocks = <&clkc 18>, <&clkc 18>;
+		clock-names = "aclk", "clk_in1";
+		#clock-cells = <1>;
+		xlnx,clk-wizard-num-outputs = <2>;
+	};

First of all this should be 1/2.

The second is that this driver is already in staging area (drivers/staging/clocking-wizard) for a while. That's why please use this driver or send patches on the top of this.

I know we have been doing some changes in this driver recently but not sure if they reach our tree or mainline.

Thanks,
Michal

#3 lore raw

PATCH 2/2 dt-bindings: clock: Add bindings for the Clocking Wizard IP

Hi Michal,

Quoted 40 lines · On Wed, 1 Aug 2018 10:26:11 +0200 Michal Simek <[email protected]> wrote:

Hi Boris,

Quoted 37 lines · Boris Brezillon

Document Xilinx Clocking Wizard bindings.

---
 .../devicetree/bindings/clock/xlnx,clk-wizard.txt  | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/xlnx,clk-wizard.txt
Documentation/devicetree/bindings/clock/xlnx,clk-wizard.txt new file +23 -0
new file mode 100644
index 000000000000..1bf7a764f4a9
@@ -0,0 +1,28 @@
+Device Tree Clock bindings for the "Clocking Wizard" IP provided by Xilinx
+
+This block can be used to generate up to 4 clock signals out of a single input
+clock. It embeds a PLL to generate an intermediate clock which then feeds 4
+clock dividers whose divider value can be adjusted based on the user needs.
+
+Required properties:
+ - #clock-cells: must be 1. The cell is encoding the id of the output clk
+		 (from 0 to xlnx,clk-wizard-num-outputs - 1)
+ - compatible: must be "xlnx,clk-wizard-5.1"
+ - clocks: 2 clocks are required
+ - clock-names: should contain 2 clock names: "aclk" and "clkin".
+		"aclk" is driving the register interface and "clk_in" is the
+		input clock signal that is used by the PLL block
+ - xlnx,clk-wizard-num-outputs: this describe the number of output clocks
+				(chosen at synthesization time)
+ - reg: registers used to configure the Clocking wizard block
+
+Example:
+
+	clkwizard: clkwizard at 43c20000 {
+		compatible = "xlnx,clk-wizard-5.1";
+		reg = <0x43c20000 0x10000>;
Quoted 8 lines

Documentation/devicetree/bindings/clock/xlnx,clk-wizard.txt line 28

Quoted 6 lines
Documentation/devicetree/bindings/clock/xlnx,clk-wizard.txt new file +5 -0
+		clocks = <&clkc 18>, <&clkc 18>;
+		clock-names = "aclk", "clk_in1";
+		#clock-cells = <1>;
+		xlnx,clk-wizard-num-outputs = <2>;
+	};

First of all this should be 1/2.

Hm, okay. Didn't know the order was important.

Quoted 4 lines

The second is that this driver is already in staging area (drivers/staging/clocking-wizard) for a while. That's why please use this driver or send patches on the top of this.

Crap! I didn't look in staging. BTW, any reason this driver is in staging?

Quoted 3 lines

I know we have been doing some changes in this driver recently but not sure if they reach our tree or mainline.

Okay. Can you point me to the patches touching this driver?

Thanks,

Boris

#4 lore raw

PATCH 2/2 dt-bindings: clock: Add bindings for the Clocking Wizard IP

Quoted 57 lines · On Wed, 1 Aug 2018 10:34:04 +0200 Boris Brezillon…

Hi Michal,

Quoted 40 lines · On Wed, 1 Aug 2018 10:26:11 +0200 Michal Simek <[email protected]> wrote:

Hi Boris,

Quoted 37 lines · Boris Brezillon

Document Xilinx Clocking Wizard bindings.

---
 .../devicetree/bindings/clock/xlnx,clk-wizard.txt  | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/xlnx,clk-wizard.txt
Documentation/devicetree/bindings/clock/xlnx,clk-wizard.txt new file +23 -0
new file mode 100644
index 000000000000..1bf7a764f4a9
@@ -0,0 +1,28 @@
+Device Tree Clock bindings for the "Clocking Wizard" IP provided by Xilinx
+
+This block can be used to generate up to 4 clock signals out of a single input
+clock. It embeds a PLL to generate an intermediate clock which then feeds 4
+clock dividers whose divider value can be adjusted based on the user needs.
+
+Required properties:
+ - #clock-cells: must be 1. The cell is encoding the id of the output clk
+		 (from 0 to xlnx,clk-wizard-num-outputs - 1)
+ - compatible: must be "xlnx,clk-wizard-5.1"
+ - clocks: 2 clocks are required
+ - clock-names: should contain 2 clock names: "aclk" and "clkin".
+		"aclk" is driving the register interface and "clk_in" is the
+		input clock signal that is used by the PLL block
+ - xlnx,clk-wizard-num-outputs: this describe the number of output clocks
+				(chosen at synthesization time)
+ - reg: registers used to configure the Clocking wizard block
+
+Example:
+
+	clkwizard: clkwizard at 43c20000 {
+		compatible = "xlnx,clk-wizard-5.1";
+		reg = <0x43c20000 0x10000>;
Quoted 8 lines

Documentation/devicetree/bindings/clock/xlnx,clk-wizard.txt line 28

Quoted 6 lines
Documentation/devicetree/bindings/clock/xlnx,clk-wizard.txt new file +5 -0
+		clocks = <&clkc 18>, <&clkc 18>;
+		clock-names = "aclk", "clk_in1";
+		#clock-cells = <1>;
+		xlnx,clk-wizard-num-outputs = <2>;
+	};

First of all this should be 1/2.

Hm, okay. Didn't know the order was important.

Quoted 1 line
Quoted 6 lines
Quoted 3 lines

The second is that this driver is already in staging area (drivers/staging/clocking-wizard) for a while. That's why please use this driver or send patches on the top of this.

Crap! I didn't look in staging. BTW, any reason this driver is in staging?

Nevermind, it's described in the TODO file. Looks like I'll need to add clk-phase ops for my use case.

#5 lore raw

PATCH 2/2 dt-bindings: clock: Add bindings for the Clocking Wizard IP

Quoted 64 lines · Boris Brezillon
Quoted 61 lines · On Wed, 1 Aug 2018 10:34:04 +0200 Boris Brezillon…

Hi Michal,

Quoted 40 lines · On Wed, 1 Aug 2018 10:26:11 +0200 Michal Simek <[email protected]> wrote:

Hi Boris,

Quoted 37 lines · Boris Brezillon

Document Xilinx Clocking Wizard bindings.

---
 .../devicetree/bindings/clock/xlnx,clk-wizard.txt  | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/xlnx,clk-wizard.txt
Documentation/devicetree/bindings/clock/xlnx,clk-wizard.txt new file +23 -0
new file mode 100644
index 000000000000..1bf7a764f4a9
@@ -0,0 +1,28 @@
+Device Tree Clock bindings for the "Clocking Wizard" IP provided by Xilinx
+
+This block can be used to generate up to 4 clock signals out of a single input
+clock. It embeds a PLL to generate an intermediate clock which then feeds 4
+clock dividers whose divider value can be adjusted based on the user needs.
+
+Required properties:
+ - #clock-cells: must be 1. The cell is encoding the id of the output clk
+		 (from 0 to xlnx,clk-wizard-num-outputs - 1)
+ - compatible: must be "xlnx,clk-wizard-5.1"
+ - clocks: 2 clocks are required
+ - clock-names: should contain 2 clock names: "aclk" and "clkin".
+		"aclk" is driving the register interface and "clk_in" is the
+		input clock signal that is used by the PLL block
+ - xlnx,clk-wizard-num-outputs: this describe the number of output clocks
+				(chosen at synthesization time)
+ - reg: registers used to configure the Clocking wizard block
+
+Example:
+
+	clkwizard: clkwizard at 43c20000 {
+		compatible = "xlnx,clk-wizard-5.1";
+		reg = <0x43c20000 0x10000>;
Quoted 8 lines

Documentation/devicetree/bindings/clock/xlnx,clk-wizard.txt line 28

Quoted 6 lines
Documentation/devicetree/bindings/clock/xlnx,clk-wizard.txt new file +5 -0
+		clocks = <&clkc 18>, <&clkc 18>;
+		clock-names = "aclk", "clk_in1";
+		#clock-cells = <1>;
+		xlnx,clk-wizard-num-outputs = <2>;
+	};

First of all this should be 1/2.

Hm, okay. Didn't know the order was important.

Quoted 4 lines

The second is that this driver is already in staging area (drivers/staging/clocking-wizard) for a while. That's why please use this driver or send patches on the top of this.

Quoted 5 lines
Quoted 2 lines

Crap! I didn't look in staging. BTW, any reason this driver is in staging?

Nevermind, it's described in the TODO file. Looks like I'll need to add clk-phase ops for my use case.

Please check https://github.com/Xilinx/linux-xlnx
and IIRC the use case which is not supported and should be is that clocking-wizard itself can be configured to fixed configuration without register access. But it is questionable if this can be done by current fixed-factor-clock or not.
But maybe there was something else too.

Thanks,
Michal

#6 lore raw

PATCH 2/2 dt-bindings: clock: Add bindings for the Clocking Wizard IP

In reply to Boris Brezillon

Hi Boris,

Quoted 2 lines · Boris Brezillon

Document Xilinx Clocking Wizard bindings.

Thanks for the patches.
Are you planning to post another version patching the staging?

#7 lore raw

PATCH 2/2 dt-bindings: clock: Add bindings for the Clocking Wizard IP

Hi Shubhrajyoti,

Quoted 10 lines · On Sat, 11 Aug 2018 16:18:54 +0530 Shubhrajyoti Datta…

Hi Boris,

Quoted 2 lines · Boris Brezillon

Document Xilinx Clocking Wizard bindings.

Thanks for the patches.
Are you planning to post another version patching the staging?

Yes, but that won't happen before a few weeks, so, if you can't wait, feel free to port my changes to the existing driver. Would be good to also address the aspect that initially prevented this driver from being merged in the clk subsystem, so that we can finally move it there.

Regards,

Boris

maintainer
#8 lore raw

PATCH 2/2 dt-bindings: clock: Add bindings for the Clocking Wizard IP

In reply to Boris Brezillon
Quoted 7 lines · Boris Brezillon

Document Xilinx Clocking Wizard bindings.

---
 .../devicetree/bindings/clock/xlnx,clk-wizard.txt  | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/xlnx,clk-wizard.txt