clk: clocking-wizard: Driver updates
Subsystems (3)
v13 cover clk: clocking-wizard: Driver updates
The patch does the following
Update the versions of the clocking wizard ip.
Move from staging to clk directory.
Update the bindings.
v12:
No change.
Rebased
v13:
Update the clocking compatible
Add the change removing the driver from staging
Shubhrajyoti Datta (5):
dt-bindings: add documentation of xilinx clocking wizard
clk: clocking-wizard: Add the clockwizard to clk directory
clk: clocking-wizard: Rename nr-outputs to xlnx,nr-outputs
clk: clocking-wizard: Fix the reconfig for 5.2
clk: clocking-wizard: Update the compatible
.../bindings/clock/xlnx,clocking-wizard.yaml | 77 +++++++++++++++++++
drivers/clk/Kconfig | 9 +++
drivers/clk/Makefile | 1 +
.../clk-xlnx-clock-wizard.c | 19 +++--
drivers/staging/Kconfig | 2 -
drivers/staging/Makefile | 1 -
drivers/staging/clocking-wizard/Kconfig | 10 ---
drivers/staging/clocking-wizard/Makefile | 2 -
drivers/staging/clocking-wizard/TODO | 13 ----
.../staging/clocking-wizard/dt-binding.txt | 30 --------
10 files changed, 101 insertions(+), 63 deletions(-)
create mode 100644 Documentation/devicetree/bindings/clock/xlnx,clocking-wizard.yaml
rename drivers/{staging/clocking-wizard => clk}/clk-xlnx-clock-wizard.c (96%)
delete mode 100644 drivers/staging/clocking-wizard/Kconfig
delete mode 100644 drivers/staging/clocking-wizard/Makefile
delete mode 100644 drivers/staging/clocking-wizard/TODO
delete mode 100644 drivers/staging/clocking-wizard/dt-binding.txtSignature · 1 line
2.25.1
PATCH v13 1/5 dt-bindings: add documentation of xilinx clocking wizard
Add the devicetree binding for the xilinx clocking wizard.
--- .../bindings/clock/xlnx,clocking-wizard.yaml | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/xlnx,clocking-wizard.yaml
Documentation/devicetree/bindings/clock/xlnx,clocking-wizard.yaml new file +77 -0
@@ -0,0 +1,77 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/clock/xlnx,clocking-wizard.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Xilinx clocking wizard + +maintainers: + - Shubhrajyoti Datta <[email protected]> + +description: + The clocking wizard is a soft ip clocking block of Xilinx versal. It + reads required input clock frequencies from the devicetree and acts as clock + clock output. + +properties: + compatible: + enum: + - xlnx,clocking-wizard + - xlnx,clocking-wizard-v5.2 + - xlnx,clocking-wizard-v6.0 + + + reg: + maxItems: 1 + + "#clock-cells": + const: 1 + + clocks: + items: + - description: clock input + - description: axi clock + + clock-names: + items: + - const: clk_in1 + - const: s_axi_aclk + + + xlnx,speed-grade: + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [1, 2, 3] + description: + Speed grade of the device. Higher the speed grade faster is the FPGA device. + + xlnx,nr-outputs: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 1 + maximum: 8 + description: + Number of outputs. + +required: + - compatible + - reg + - "#clock-cells" + - clocks + - clock-names + - xlnx,speed-grade + - xlnx,nr-outputs + +additionalProperties: false + +examples: + - | + clock-controller@b0000000 { + compatible = "xlnx,clocking-wizard"; + reg = <0xb0000000 0x10000>; + #clock-cells = <1>; + xlnx,speed-grade = <1>; + xlnx,nr-outputs = <6>; + clock-names = "clk_in1", "s_axi_aclk"; + clocks = <&clkc 15>, <&clkc 15>; + }; +...
Signature · 1 line
2.25.1
PATCH v13 3/5 clk: clocking-wizard: Rename nr-outputs to xlnx,nr-outputs
In reply to Shubhrajyoti DattaRename nr-outputs to xlnx,output.
--- drivers/clk/clk-xlnx-clock-wizard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-xlnx-clock-wizard.c +1 -1
@@ -480,7 +480,7 @@ static int clk_wzrd_probe(struct platform_device *pdev) goto err_disable_clk; } - ret =of_property_read_u32 (np,"nr-outputs" , &nr_outputs); + ret =of_property_read_u32 (np,"xlnx,nr-outputs" , &nr_outputs);if (ret || nr_outputs >WZRD_NUM_OUTPUTS ) { ret = -EINVAL ; goto err_disable_clk;
Signature · 1 line
2.25.1
PATCH v13 2/5 clk: clocking-wizard: Add the clockwizard to clk directory
In reply to Shubhrajyoti DattaAdd clocking wizard driver to clk.
And delete the driver from the staging as it is in drivers/clk.
---
drivers/clk/Kconfig | 9 ++++++
drivers/clk/Makefile | 1 +
.../clk-xlnx-clock-wizard.c | 3 +-
drivers/staging/Kconfig | 2 --
drivers/staging/Makefile | 1 -
drivers/staging/clocking-wizard/Kconfig | 10 -------
drivers/staging/clocking-wizard/Makefile | 2 --
drivers/staging/clocking-wizard/TODO | 13 --------
.../staging/clocking-wizard/dt-binding.txt | 30 -------------------
9 files changed, 12 insertions(+), 59 deletions(-)
rename drivers/{staging/clocking-wizard => clk}/clk-xlnx-clock-wizard.c (99%)
delete mode 100644 drivers/staging/clocking-wizard/Kconfig
delete mode 100644 drivers/staging/clocking-wizard/Makefile
delete mode 100644 drivers/staging/clocking-wizard/TODO
delete mode 100644 drivers/staging/clocking-wizard/dt-binding.txtdrivers/clk/Kconfig +9 -0
@@ -390,6 +390,15 @@ config COMMON_CLK_K210 help Support for the Canaan Kendryte K210 RISC-V SoC clocks. +config COMMON_CLK_XLNX_CLKWZRD + tristate "Xilinx Clocking Wizard" + depends on COMMON_CLK && OF + help + Support for the Xilinx Clocking Wizard IP core clock generator. + Adds support for clocking wizard and compatible. + This driver supports the Xilinx clocking wizard programmable clock + synthesizer. The number of output is configurable in the design. + source "drivers/clk/actions/Kconfig" source "drivers/clk/analogbits/Kconfig" source "drivers/clk/baikal-t1/Kconfig"
drivers/clk/Makefile +1 -0
@@ -68,6 +68,7 @@ obj-$(CONFIG_ARCH_VT8500) += clk-vt8500.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 +obj-$(CONFIG_COMMON_CLK_XLNX_CLKWZRD) += clk-xlnx-clock-wizard.o # please keep this section sorted lexicographically by directory path name obj-y += actions/
drivers/clk/clk-xlnx-clock-wizard.c renamed from drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c +2 -1
@@ -2,9 +2,10 @@/* * Xilinx 'Clocking Wizard' driver * -* Copyright (C) 2013 - 2014 Xilinx +* Copyright (C) 2013 - 2021 Xilinx * * Sören Brinkmann <[email protected]> +* */ #include <linux/platform_device.h>
drivers/staging/Kconfig +0 -2
@@ -72,8 +72,6 @@ source "drivers/staging/gs_fpgaboot/Kconfig" source "drivers/staging/unisys/Kconfig" -source "drivers/staging/clocking-wizard/Kconfig" - source "drivers/staging/fbtft/Kconfig" source "drivers/staging/most/Kconfig"
drivers/staging/Makefile +0 -1
@@ -26,7 +26,6 @@ obj-$(CONFIG_LTE_GDM724X) += gdm724x/ obj-$(CONFIG_FIREWIRE_SERIAL) += fwserial/ obj-$(CONFIG_GS_FPGABOOT) += gs_fpgaboot/ obj-$(CONFIG_UNISYSSPAR) += unisys/ -obj-$(CONFIG_COMMON_CLK_XLNX_CLKWZRD) += clocking-wizard/ obj-$(CONFIG_FB_TFT) += fbtft/ obj-$(CONFIG_MOST) += most/ obj-$(CONFIG_KS7010) += ks7010/
drivers/staging/clocking-wizard/Kconfig deleted +0 -10
@@ -1,10 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Xilinx Clocking Wizard Driver -# - -config COMMON_CLK_XLNX_CLKWZRD - tristate "Xilinx Clocking Wizard" - depends on COMMON_CLK && OF && HAS_IOMEM - help - Support for the Xilinx Clocking Wizard IP core clock generator.
drivers/staging/clocking-wizard/Makefile deleted +0 -2
@@ -1,2 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_COMMON_CLK_XLNX_CLKWZRD) += clk-xlnx-clock-wizard.o
drivers/staging/clocking-wizard/TODO deleted +0 -13
@@ -1,13 +0,0 @@ -TODO: - - support for fractional multiplier - - support for fractional divider (output 0 only) - - support for set_rate() operations (may benefit from Stephen Boyd's - refactoring of the clk primitives: - https://lore.kernel.org/lkml/[email protected]) - - review arithmetic - - overflow after multiplication? - - maximize accuracy before divisions - -Patches to: - Greg Kroah-Hartman <[email protected]> - Sören Brinkmann <[email protected]>
drivers/staging/clocking-wizard/dt-binding.txt deleted +0 -30
@@ -1,30 +0,0 @@ -Binding for Xilinx Clocking Wizard IP Core - -This binding uses the common clock binding[1]. Details about the devices can be -found in the product guide[2]. - -[1] Documentation/devicetree/bindings/clock/clock-bindings.txt -[2] Clocking Wizard Product Guide -https://www.xilinx.com/support/documentation/ip_documentation/clk_wiz/v5_1/pg065-clk-wiz.pdf - -Required properties: - - compatible: Must be 'xlnx,clocking-wizard' - - reg: Base and size of the cores register space - - clocks: Handle to input clock - - clock-names: Tuple containing 'clk_in1' and 's_axi_aclk' - - clock-output-names: Names for the output clocks - -Optional properties: - - speed-grade: Speed grade of the device (valid values are 1..3) - -Example: - clock-generator@40040000 { - reg = <0x40040000 0x1000>; - compatible = "xlnx,clocking-wizard"; - speed-grade = <1>; - clock-names = "clk_in1", "s_axi_aclk"; - clocks = <&clkc 15>, <&clkc 15>; - clock-output-names = "clk_out0", "clk_out1", "clk_out2", - "clk_out3", "clk_out4", "clk_out5", - "clk_out6", "clk_out7"; - };
Signature · 1 line
2.25.1
PATCH v13 4/5 clk: clocking-wizard: Fix the reconfig for 5.2
In reply to Shubhrajyoti DattaThe 5.2 the reconfig is triggered by writing 7 followed by 2 to the reconfig reg. Add the same. Also 6.0 is backward compatible so it should be fine.
--- drivers/clk/clk-xlnx-clock-wizard.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/clk/clk-xlnx-clock-wizard.c +9 -3
@@ -44,6 +44,8 @@#define WZRD_DR_INIT_REG_OFFSET 0x25C#define WZRD_DR_DIV_TO_PHASE_OFFSET 4#define WZRD_DR_BEGIN_DYNA_RECONF 0x03 +#define WZRD_DR_BEGIN_DYNA_RECONF_5_2 0x07 +#define WZRD_DR_BEGIN_DYNA_RECONF1_5_2 0x02#define WZRD_USEC_POLL 10#define WZRD_TIMEOUT_POLL 1000
@@ -165,7 +167,9 @@ static int clk_wzrd_dynamic_reconfig(struct clk_hw *hw, unsigned long rate, goto err_reconfig;/* Initiate reconfiguration */ -writel (WZRD_DR_BEGIN_DYNA_RECONF , +writel (WZRD_DR_BEGIN_DYNA_RECONF_5_2 , + divider->base +WZRD_DR_INIT_REG_OFFSET ); +writel (WZRD_DR_BEGIN_DYNA_RECONF1_5_2 , divider->base +WZRD_DR_INIT_REG_OFFSET );/* Check status register */
@@ -224,7 +228,7 @@ static int clk_wzrd_dynamic_reconfig_f(struct clk_hw *hw, unsigned long rate,struct clk_wzrd_divider *divider =to_clk_wzrd_divider (hw);void __iomem *div_addr = divider->base + divider->offset; - rate_div = ((parent_rate *1000 ) / rate); + rate_div =DIV_ROUND_DOWN_ULL (parent_rate *1000 , rate); clockout0_div = rate_div /1000 ; pre =DIV_ROUND_CLOSEST ((parent_rate *1000 ), rate);
@@ -246,7 +250,9 @@ static int clk_wzrd_dynamic_reconfig_f(struct clk_hw *hw, unsigned long rate,return err;/* Initiate reconfiguration */ -writel (WZRD_DR_BEGIN_DYNA_RECONF , +writel (WZRD_DR_BEGIN_DYNA_RECONF_5_2 , + divider->base +WZRD_DR_INIT_REG_OFFSET ); +writel (WZRD_DR_BEGIN_DYNA_RECONF1_5_2 , divider->base +WZRD_DR_INIT_REG_OFFSET );/* Check status register */
Signature · 1 line
2.25.1
PATCH v13 5/5 clk: clocking-wizard: Update the compatible
In reply to Shubhrajyoti DattaUpdate the compatible to indicate support for both 5.2 and 6.0
--- drivers/clk/clk-xlnx-clock-wizard.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/clk-xlnx-clock-wizard.c +2 -0
@@ -621,6 +621,8 @@ static int clk_wzrd_remove(struct platform_device *pdev)static const struct of_device_id clk_wzrd_ids[] = { { .compatible ="xlnx,clocking-wizard" }, + { .compatible ="xlnx,clocking-wizard-v5.2" }, + { .compatible ="xlnx,clocking-wizard-v6.0" }, { }, };MODULE_DEVICE_TABLE (of, clk_wzrd_ids);
Signature · 1 line
2.25.1
Re: [PATCH v13 1/5] dt-bindings: add documentation of xilinx clocking wizard
In reply to Shubhrajyoti DattaQuoted 8 lines · Shubhrajyoti Datta
Add the devicetree binding for the xilinx clocking wizard.
Signed-off-by Shubhrajyoti Datta <[email protected]>--- .../bindings/clock/xlnx,clocking-wizard.yaml | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/xlnx,clocking-wizard.yaml
Hi ,
Could this patch series be merged if there are not further comments.
Quoted 14 lines · Shubhrajyoti Datta
The patch does the following
Update the versions of the clocking wizard ip.
Move from staging to clk directory.
Update the bindings.v12:
No change.
Rebased
v13:
Update the clocking compatible
Add the change removing the driver from staging
Stephen Boyd
maintainerRe: [PATCH v13 2/5] clk: clocking-wizard: Add the clockwizard to clk directory
In reply to Shubhrajyoti DattaQuoting Shubhrajyoti Datta (2021-09-14 05:57:42)
drivers/clk/Kconfig config COMMON_CLK_K210 · line 393
Quoted 9 lines
drivers/clk/Kconfig +1
-0@@ -390,6 +390,15 @@ config COMMON_CLK_K210 help Support for the Canaan Kendryte K210 RISC-V SoC clocks. +config COMMON_CLK_XLNX_CLKWZRD
Given it is xilinx, can it be moved to drivers/clk/xilinx/ and this Kconfig be put there instead of clk/Kconfig?
Quoted 11 lines
drivers/clk/Kconfig +8
-0+ tristate "Xilinx Clocking Wizard" + depends on COMMON_CLK && OF + help + Support for the Xilinx Clocking Wizard IP core clock generator. + Adds support for clocking wizard and compatible. + This driver supports the Xilinx clocking wizard programmable clock + synthesizer. The number of output is configurable in the design. + source "drivers/clk/actions/Kconfig" source "drivers/clk/analogbits/Kconfig" source "drivers/clk/baikal-t1/Kconfig"
Stephen Boyd
maintainerQuoting Shubhrajyoti Datta (2021-11-14 21:31:10)
Quoted 2 lines
Hi ,
Could this patch series be merged if there are not further comments.
I'll merge it after the merge window closes. One comment on the location. Also, the subject would be better as "move out of staging" and ideally an Ack from Greg on that patch.