Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8]  clk: clocking-wizard: Add static-config clock provider support
@ 2026-06-15  3:48 Shubhrajyoti Datta
  2026-06-15  3:48 ` [PATCH 1/8] dt-bindings: clock: clocking-wizard: Add xlnx,clk-mul-div property Shubhrajyoti Datta
                   ` (7 more replies)
  0 siblings, 8 replies; 11+ messages in thread
From: Shubhrajyoti Datta @ 2026-06-15  3:48 UTC (permalink / raw)
  To: linux-clk, linux-kernel
  Cc: git, Michael Turquette, Stephen Boyd, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Michal Simek,
	Shubhrajyoti Datta, devicetree, linux-arm-kernel

 The Xilinx clocking-wizard IP can be used in a static-config mode
 where the hardware is pre-programmed at boot and no dynamic register
 access is required. In that case the driver should skip ioremap,
 read the fixed multiplier/divisor pairs from the device tree, and
 register fixed-factor clocks derived from clk_in1.

 Currently the xlnx,static-config is not functional as it doesnot
 model the output clocks. The series fixes the same.

 This series:
   - adds the xlnx,clk-mul-div binding to carry mul/div pairs
   - makes the reg property optional for static-config nodes
   - skips ioremap when xlnx,static-config is present
   - moves clk_in1 acquisition before the static-config check so it
     is available in both code paths
   - registers fixed-factor output clocks in static-config mode


Shubhrajyoti Datta (8):
  dt-bindings: clock: clocking-wizard: Add xlnx,clk-mul-div property
  dt-bindings: clock: clocking-wizard: Make reg optional for
    static-config
  dt-bindings: clock: clocking-wizard: Make s_axi_aclk optional for
    static-config
  clk: clocking-wizard: Do not map the memory for static-config
  clk: clocking-wizard: Move clk_in1 acquisition before static-config
    check
  clk: clocking-wizard: Add static-config clock provider support
  clk: clocking-wizard: Skip s_axi_aclk for static-config
  clk: clocking-wizard: Use dev_err_probe() when mapping registers

 .../bindings/clock/xlnx,clocking-wizard.yaml  |  50 ++++-
 drivers/clk/xilinx/clk-xlnx-clock-wizard.c    | 181 ++++++++++++++++--
 2 files changed, 205 insertions(+), 26 deletions(-)

-- 
2.34.1



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

* [PATCH 1/8] dt-bindings: clock: clocking-wizard: Add xlnx,clk-mul-div property
  2026-06-15  3:48 [PATCH 0/8] clk: clocking-wizard: Add static-config clock provider support Shubhrajyoti Datta
@ 2026-06-15  3:48 ` Shubhrajyoti Datta
  2026-06-15  3:48 ` [PATCH 2/8] dt-bindings: clock: clocking-wizard: Make reg optional for static-config Shubhrajyoti Datta
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Shubhrajyoti Datta @ 2026-06-15  3:48 UTC (permalink / raw)
  To: linux-clk, linux-kernel
  Cc: git, Michael Turquette, Stephen Boyd, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Michal Simek,
	Shubhrajyoti Datta, devicetree, linux-arm-kernel

Static-config MMCM/PLL ratios are fixed at IP build time, so the kernel
cannot read per-output multiply/divide from registers and needs DT pairs
to register fixed-factor clocks. Also add the tuples by pair in example.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
---

 .../bindings/clock/xlnx,clocking-wizard.yaml  | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/Documentation/devicetree/bindings/clock/xlnx,clocking-wizard.yaml b/Documentation/devicetree/bindings/clock/xlnx,clocking-wizard.yaml
index b497c28e8094..8316654b0a91 100644
--- a/Documentation/devicetree/bindings/clock/xlnx,clocking-wizard.yaml
+++ b/Documentation/devicetree/bindings/clock/xlnx,clocking-wizard.yaml
@@ -57,6 +57,21 @@ properties:
     description:
       Number of outputs.
 
+  xlnx,clk-mul-div:
+    $ref: /schemas/types.yaml#/definitions/uint32-matrix
+    description:
+      Fixed MMCM/PLL multiply/divide ratios, one (multiplier, divisor)
+      pair per clock output relative to clk_in1. The number of entries
+      must equal xlnx,nr-outputs.
+    minItems: 1
+    maxItems: 8
+    items:
+      items:
+        - description: multiplier
+          minimum: 1
+        - description: divisor
+          minimum: 1
+
 required:
   - compatible
   - reg
@@ -66,6 +81,14 @@ required:
   - xlnx,speed-grade
   - xlnx,nr-outputs
 
+allOf:
+  - if:
+      required:
+        - xlnx,static-config
+    then:
+      required:
+        - xlnx,clk-mul-div
+
 additionalProperties: false
 
 examples:
@@ -77,6 +100,7 @@ examples:
         xlnx,static-config;
         xlnx,speed-grade = <1>;
         xlnx,nr-outputs = <6>;
+        xlnx,clk-mul-div = <12 1>, <10 2>, <8 1>, <6 1>, <4 2>, <2 1>;
         clock-names = "clk_in1", "s_axi_aclk";
         clocks = <&clkc 15>, <&clkc 15>;
     };
-- 
2.49.1



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

* [PATCH 2/8] dt-bindings: clock: clocking-wizard: Make reg optional for static-config
  2026-06-15  3:48 [PATCH 0/8] clk: clocking-wizard: Add static-config clock provider support Shubhrajyoti Datta
  2026-06-15  3:48 ` [PATCH 1/8] dt-bindings: clock: clocking-wizard: Add xlnx,clk-mul-div property Shubhrajyoti Datta
@ 2026-06-15  3:48 ` Shubhrajyoti Datta
  2026-06-15  3:48 ` [PATCH 3/8] dt-bindings: clock: clocking-wizard: Make s_axi_aclk " Shubhrajyoti Datta
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Shubhrajyoti Datta @ 2026-06-15  3:48 UTC (permalink / raw)
  To: linux-clk, linux-kernel
  Cc: git, Michael Turquette, Stephen Boyd, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Michal Simek,
	Shubhrajyoti Datta, devicetree, linux-arm-kernel

In static-config mode the IP exposes only fixed-factor clock outputs and
has no runtime-programmable registers, so reg is not required.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
---

 .../bindings/clock/xlnx,clocking-wizard.yaml  | 22 ++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/clock/xlnx,clocking-wizard.yaml b/Documentation/devicetree/bindings/clock/xlnx,clocking-wizard.yaml
index 8316654b0a91..aa397550d107 100644
--- a/Documentation/devicetree/bindings/clock/xlnx,clocking-wizard.yaml
+++ b/Documentation/devicetree/bindings/clock/xlnx,clocking-wizard.yaml
@@ -74,7 +74,6 @@ properties:
 
 required:
   - compatible
-  - reg
   - "#clock-cells"
   - clocks
   - clock-names
@@ -88,20 +87,33 @@ allOf:
     then:
       required:
         - xlnx,clk-mul-div
+    else:
+      required:
+        - reg
 
 additionalProperties: false
 
 examples:
   - |
-    clock-controller@b0000000  {
+    clock-controller@b0000000 {
         compatible = "xlnx,clocking-wizard";
         reg = <0xb0000000 0x10000>;
         #clock-cells = <1>;
-        xlnx,static-config;
+        clocks = <&clkc 15>, <&clkc 18>;
+        clock-names = "clk_in1", "s_axi_aclk";
+        xlnx,nr-outputs = <6>;
         xlnx,speed-grade = <1>;
+    };
+
+  - |
+    clock-controller {
+        compatible = "xlnx,clocking-wizard";
+        #clock-cells = <1>;
+        clocks = <&clkc 15>, <&clkc 18>;
+        clock-names = "clk_in1", "s_axi_aclk";
         xlnx,nr-outputs = <6>;
+        xlnx,speed-grade = <1>;
+        xlnx,static-config;
         xlnx,clk-mul-div = <12 1>, <10 2>, <8 1>, <6 1>, <4 2>, <2 1>;
-        clock-names = "clk_in1", "s_axi_aclk";
-        clocks = <&clkc 15>, <&clkc 15>;
     };
 ...
-- 
2.49.1



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

* [PATCH 3/8] dt-bindings: clock: clocking-wizard: Make s_axi_aclk optional for static-config
  2026-06-15  3:48 [PATCH 0/8] clk: clocking-wizard: Add static-config clock provider support Shubhrajyoti Datta
  2026-06-15  3:48 ` [PATCH 1/8] dt-bindings: clock: clocking-wizard: Add xlnx,clk-mul-div property Shubhrajyoti Datta
  2026-06-15  3:48 ` [PATCH 2/8] dt-bindings: clock: clocking-wizard: Make reg optional for static-config Shubhrajyoti Datta
@ 2026-06-15  3:48 ` Shubhrajyoti Datta
  2026-06-15 16:42   ` Conor Dooley
  2026-06-15  3:48 ` [PATCH 4/8] clk: clocking-wizard: Do not map the memory " Shubhrajyoti Datta
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 11+ messages in thread
From: Shubhrajyoti Datta @ 2026-06-15  3:48 UTC (permalink / raw)
  To: linux-clk, linux-kernel
  Cc: git, Michael Turquette, Stephen Boyd, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Michal Simek,
	Shubhrajyoti Datta, devicetree, linux-arm-kernel

In static-config mode the AXI bus interface is unused, so s_axi_aclk
is not required. Allow clocks/clock-names to have only one entry
(clk_in1) when xlnx,static-config is present and enforce two entries
otherwise. Update the static-config example accordingly.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
---

 .../bindings/clock/xlnx,clocking-wizard.yaml     | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/clock/xlnx,clocking-wizard.yaml b/Documentation/devicetree/bindings/clock/xlnx,clocking-wizard.yaml
index aa397550d107..0daefe89ea89 100644
--- a/Documentation/devicetree/bindings/clock/xlnx,clocking-wizard.yaml
+++ b/Documentation/devicetree/bindings/clock/xlnx,clocking-wizard.yaml
@@ -29,11 +29,13 @@ properties:
     const: 1
 
   clocks:
+    minItems: 1
     items:
       - description: clock input
       - description: axi clock
 
   clock-names:
+    minItems: 1
     items:
       - const: clk_in1
       - const: s_axi_aclk
@@ -87,9 +89,19 @@ allOf:
     then:
       required:
         - xlnx,clk-mul-div
+      properties:
+        clocks:
+          maxItems: 1
+        clock-names:
+          maxItems: 1
     else:
       required:
         - reg
+      properties:
+        clocks:
+          minItems: 2
+        clock-names:
+          minItems: 2
 
 additionalProperties: false
 
@@ -109,8 +121,8 @@ examples:
     clock-controller {
         compatible = "xlnx,clocking-wizard";
         #clock-cells = <1>;
-        clocks = <&clkc 15>, <&clkc 18>;
-        clock-names = "clk_in1", "s_axi_aclk";
+        clocks = <&clkc 15>;
+        clock-names = "clk_in1";
         xlnx,nr-outputs = <6>;
         xlnx,speed-grade = <1>;
         xlnx,static-config;
-- 
2.49.1



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

* [PATCH 4/8] clk: clocking-wizard: Do not map the memory for static-config
  2026-06-15  3:48 [PATCH 0/8] clk: clocking-wizard: Add static-config clock provider support Shubhrajyoti Datta
                   ` (2 preceding siblings ...)
  2026-06-15  3:48 ` [PATCH 3/8] dt-bindings: clock: clocking-wizard: Make s_axi_aclk " Shubhrajyoti Datta
@ 2026-06-15  3:48 ` Shubhrajyoti Datta
  2026-06-15  3:48 ` [PATCH 5/8] clk: clocking-wizard: Move clk_in1 acquisition before static-config check Shubhrajyoti Datta
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Shubhrajyoti Datta @ 2026-06-15  3:48 UTC (permalink / raw)
  To: linux-clk, linux-kernel
  Cc: git, Michael Turquette, Stephen Boyd, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Michal Simek,
	Shubhrajyoti Datta, devicetree, linux-arm-kernel

With xlnx,static-config the MMCM/PLL topology is fixed at synthesis time
and no register programming is performed; only the dynamic path needs
the AXI register block. Move devm_platform_ioremap_resource() under the
non-static-config branch.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
---

 drivers/clk/xilinx/clk-xlnx-clock-wizard.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/xilinx/clk-xlnx-clock-wizard.c b/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
index 4a0136349f71..e082051221be 100644
--- a/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
+++ b/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
@@ -1168,10 +1168,6 @@ static int clk_wzrd_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	platform_set_drvdata(pdev, clk_wzrd);
 
-	clk_wzrd->base = devm_platform_ioremap_resource(pdev, 0);
-	if (IS_ERR(clk_wzrd->base))
-		return PTR_ERR(clk_wzrd->base);
-
 	clk_wzrd->axi_clk = devm_clk_get_enabled(&pdev->dev, "s_axi_aclk");
 	if (IS_ERR(clk_wzrd->axi_clk))
 		return dev_err_probe(&pdev->dev, PTR_ERR(clk_wzrd->axi_clk),
@@ -1183,6 +1179,10 @@ static int clk_wzrd_probe(struct platform_device *pdev)
 	}
 
 	if (!of_property_present(np, "xlnx,static-config")) {
+		clk_wzrd->base = devm_platform_ioremap_resource(pdev, 0);
+		if (IS_ERR(clk_wzrd->base))
+			return PTR_ERR(clk_wzrd->base);
+
 		ret = of_property_read_u32(np, "xlnx,speed-grade", &clk_wzrd->speed_grade);
 		if (!ret) {
 			if (clk_wzrd->speed_grade < 1 || clk_wzrd->speed_grade > 3) {
-- 
2.49.1



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

* [PATCH 5/8] clk: clocking-wizard: Move clk_in1 acquisition before static-config check
  2026-06-15  3:48 [PATCH 0/8] clk: clocking-wizard: Add static-config clock provider support Shubhrajyoti Datta
                   ` (3 preceding siblings ...)
  2026-06-15  3:48 ` [PATCH 4/8] clk: clocking-wizard: Do not map the memory " Shubhrajyoti Datta
@ 2026-06-15  3:48 ` Shubhrajyoti Datta
  2026-06-15  3:48 ` [PATCH 6/8] clk: clocking-wizard: Add static-config clock provider support Shubhrajyoti Datta
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Shubhrajyoti Datta @ 2026-06-15  3:48 UTC (permalink / raw)
  To: linux-clk, linux-kernel
  Cc: git, Michael Turquette, Stephen Boyd, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Michal Simek,
	Shubhrajyoti Datta, devicetree, linux-arm-kernel

The clk_in1 is the input clock for both the dynamic reconfig and the
static-config paths. Acquire clk_in1 for static-config as well. Output
clocks are registered as fixed-factor children of clk_in1.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
---

 drivers/clk/xilinx/clk-xlnx-clock-wizard.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/xilinx/clk-xlnx-clock-wizard.c b/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
index e082051221be..ffc78c90bee6 100644
--- a/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
+++ b/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
@@ -1178,6 +1178,11 @@ static int clk_wzrd_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
+	clk_wzrd->clk_in1 = devm_clk_get(&pdev->dev, "clk_in1");
+	if (IS_ERR(clk_wzrd->clk_in1))
+		return dev_err_probe(&pdev->dev, PTR_ERR(clk_wzrd->clk_in1),
+				     "failed to get clk_in1\n");
+
 	if (!of_property_present(np, "xlnx,static-config")) {
 		clk_wzrd->base = devm_platform_ioremap_resource(pdev, 0);
 		if (IS_ERR(clk_wzrd->base))
@@ -1192,11 +1197,6 @@ static int clk_wzrd_probe(struct platform_device *pdev)
 			}
 		}
 
-		clk_wzrd->clk_in1 = devm_clk_get(&pdev->dev, "clk_in1");
-		if (IS_ERR(clk_wzrd->clk_in1))
-			return dev_err_probe(&pdev->dev, PTR_ERR(clk_wzrd->clk_in1),
-					     "clk_in1 not found\n");
-
 		ret = clk_wzrd_register_output_clocks(&pdev->dev, nr_outputs);
 		if (ret)
 			return ret;
-- 
2.49.1



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

* [PATCH 6/8] clk: clocking-wizard: Add static-config clock provider support
  2026-06-15  3:48 [PATCH 0/8] clk: clocking-wizard: Add static-config clock provider support Shubhrajyoti Datta
                   ` (4 preceding siblings ...)
  2026-06-15  3:48 ` [PATCH 5/8] clk: clocking-wizard: Move clk_in1 acquisition before static-config check Shubhrajyoti Datta
@ 2026-06-15  3:48 ` Shubhrajyoti Datta
  2026-06-15  3:48 ` [PATCH 7/8] clk: clocking-wizard: Skip s_axi_aclk for static-config Shubhrajyoti Datta
  2026-06-15  3:48 ` [PATCH 8/8] clk: clocking-wizard: Use dev_err_probe() when mapping registers Shubhrajyoti Datta
  7 siblings, 0 replies; 11+ messages in thread
From: Shubhrajyoti Datta @ 2026-06-15  3:48 UTC (permalink / raw)
  To: linux-clk, linux-kernel
  Cc: git, Michael Turquette, Stephen Boyd, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Michal Simek,
	Shubhrajyoti Datta, devicetree, linux-arm-kernel

When xlnx,static-config is present the divider/multiplier path is
synthesized inside the Wizard without exposing runtime MMIO
reconfiguration, so omit the AXI register mapping and advertise each
routed output clock as a clk_fixed_factor child of clk_in1 using the
synthesized ratios exported through xlnx,clk-mul-div.

However the parent clock of clk_in1 can still be gated, disabled, or
(re-)enabled after FPGA programming (typical FPGA Manager flows,
CCF-managed parents, PLL fabric power sequencing).

Add a 10 us delay in each output clock's .enable() hook so consumers
wait for reference settling before first access.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
---

 drivers/clk/xilinx/clk-xlnx-clock-wizard.c | 137 ++++++++++++++++++++-
 1 file changed, 136 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/xilinx/clk-xlnx-clock-wizard.c b/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
index ffc78c90bee6..5470a717fccc 100644
--- a/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
+++ b/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
@@ -12,6 +12,7 @@
 #include <linux/platform_device.h>
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
+#include <linux/delay.h>
 #include <linux/slab.h>
 #include <linux/io.h>
 #include <linux/of.h>
@@ -107,6 +108,7 @@
 #define VER_WZRD_O_MAX			511
 #define WZRD_MIN_ERR			20000
 #define WZRD_FRAC_POINTS		1000
+#define WZRD_ENABLE_DELAY_US		10
 
 /* Get the mask from width */
 #define div_mask(width)			((1 << (width)) - 1)
@@ -697,6 +699,13 @@ static int clk_wzrd_ver_determine_rate_all(struct clk_hw *hw,
 	return 0;
 }
 
+static int clk_wzrd_enable(struct clk_hw *hw)
+{
+	/* Allow the output clock to settle after enable */
+	udelay(WZRD_ENABLE_DELAY_US);
+	return 0;
+}
+
 static const struct clk_ops clk_wzrd_ver_divider_ops = {
 	.determine_rate = clk_wzrd_determine_rate,
 	.set_rate = clk_wzrd_ver_dynamic_reconfig,
@@ -790,6 +799,85 @@ static const struct clk_ops clk_wzrd_clk_divider_ops_f = {
 	.recalc_rate = clk_wzrd_recalc_ratef,
 };
 
+static unsigned long
+clk_wzrd_static_factor_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
+{
+	struct clk_fixed_factor *fix = to_clk_fixed_factor(hw);
+	unsigned long long rate;
+
+	rate = (unsigned long long)parent_rate * fix->mult;
+	do_div(rate, fix->div);
+	return (unsigned long)rate;
+}
+
+static int clk_wzrd_static_factor_determine_rate(struct clk_hw *hw,
+						 struct clk_rate_request *req)
+{
+	struct clk_fixed_factor *fix = to_clk_fixed_factor(hw);
+
+	if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) {
+		unsigned long best_parent;
+
+		best_parent = (req->rate / fix->mult) * fix->div;
+		req->best_parent_rate =
+			clk_hw_round_rate(clk_hw_get_parent(hw), best_parent);
+	}
+
+	req->rate = (req->best_parent_rate / fix->div) * fix->mult;
+
+	return 0;
+}
+
+static int clk_wzrd_static_factor_set_rate(struct clk_hw *hw,
+					   unsigned long rate,
+					   unsigned long parent_rate)
+{
+	return 0;
+}
+
+static const struct clk_ops clk_wzrd_static_fixed_factor_ops = {
+	.enable = clk_wzrd_enable,
+	.determine_rate = clk_wzrd_static_factor_determine_rate,
+	.set_rate = clk_wzrd_static_factor_set_rate,
+	.recalc_rate = clk_wzrd_static_factor_recalc_rate,
+};
+
+static struct clk_hw *
+clk_wzrd_devm_register_static_fixed_factor(struct device *dev,
+					   const char *name,
+					   const struct clk_parent_data *parent_data,
+					   unsigned long flags,
+					   unsigned int mult,
+					   unsigned int div)
+{
+	struct clk_init_data init = {};
+	struct clk_fixed_factor *fix;
+	struct clk_hw *hw;
+	int ret;
+
+	fix = devm_kzalloc(dev, sizeof(*fix), GFP_KERNEL);
+	if (!fix)
+		return ERR_PTR(-ENOMEM);
+
+	fix->mult = mult;
+	fix->div = div;
+
+	init.name = name;
+	init.ops = &clk_wzrd_static_fixed_factor_ops;
+	init.flags = flags;
+	init.parent_data = parent_data;
+	init.num_parents = 1;
+
+	fix->hw.init = &init;
+
+	hw = &fix->hw;
+	ret = devm_clk_hw_register(dev, hw);
+	if (ret)
+		return ERR_PTR(ret);
+
+	return hw;
+}
+
 static struct clk_hw *clk_wzrd_register_divf(struct device *dev,
 					  const char *name,
 					  const char *parent_name,
@@ -1154,9 +1242,11 @@ static int clk_wzrd_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
 	struct clk_wzrd *clk_wzrd;
+	const char *clk_name;
 	unsigned long rate;
+	struct clk_hw *hw;
 	int nr_outputs;
-	int ret;
+	int ret, i;
 
 	ret = of_property_read_u32(np, "xlnx,nr-outputs", &nr_outputs);
 	if (ret || nr_outputs > WZRD_NUM_OUTPUTS)
@@ -1224,6 +1314,51 @@ static int clk_wzrd_probe(struct platform_device *pdev)
 				dev_warn(&pdev->dev,
 					 "unable to register clock notifier\n");
 		}
+	} else {
+		u32 mul_div[WZRD_NUM_OUTPUTS * 2];
+		const struct clk_parent_data parent_data = { .fw_name = "clk_in1" };
+		int num_elems = nr_outputs * 2;
+
+		/*
+		 * xlnx,clk-mul-div is a uint32-matrix of <mul div> pairs;
+		 * FDT encodes it as a flat u32 array so we can read it directly.
+		 */
+		ret = of_property_read_u32_array(np, "xlnx,clk-mul-div",
+						 mul_div, num_elems);
+		if (ret) {
+			dev_err(&pdev->dev, "xlnx,clk-mul-div missing or invalid\n");
+			return ret;
+		}
+
+		for (i = 0; i < nr_outputs; i++) {
+			u32 mul = mul_div[2 * i];
+			u32 div = mul_div[2 * i + 1];
+
+			if (!mul || !div)
+				return dev_err_probe(&pdev->dev, -EINVAL,
+						     "invalid mul/div for clkout%d\n", i);
+
+			clk_name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
+						  "%s_out%d", dev_name(&pdev->dev), i);
+			if (!clk_name)
+				return -ENOMEM;
+
+			hw = clk_wzrd_devm_register_static_fixed_factor(&pdev->dev, clk_name,
+									&parent_data,
+									CLK_SET_RATE_PARENT,
+									mul, div);
+			if (IS_ERR(hw))
+				return PTR_ERR(hw);
+			clk_wzrd->clk_data.hws[i] = hw;
+		}
+
+		clk_wzrd->clk_data.num = nr_outputs;
+
+		ret = devm_of_clk_add_hw_provider(&pdev->dev, of_clk_hw_onecell_get,
+						  &clk_wzrd->clk_data);
+		if (ret)
+			return dev_err_probe(&pdev->dev, ret,
+					     "unable to register clock provider\n");
 	}
 
 	return 0;
-- 
2.49.1



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

* [PATCH 7/8] clk: clocking-wizard: Skip s_axi_aclk for static-config
  2026-06-15  3:48 [PATCH 0/8] clk: clocking-wizard: Add static-config clock provider support Shubhrajyoti Datta
                   ` (5 preceding siblings ...)
  2026-06-15  3:48 ` [PATCH 6/8] clk: clocking-wizard: Add static-config clock provider support Shubhrajyoti Datta
@ 2026-06-15  3:48 ` Shubhrajyoti Datta
  2026-06-15  3:48 ` [PATCH 8/8] clk: clocking-wizard: Use dev_err_probe() when mapping registers Shubhrajyoti Datta
  7 siblings, 0 replies; 11+ messages in thread
From: Shubhrajyoti Datta @ 2026-06-15  3:48 UTC (permalink / raw)
  To: linux-clk, linux-kernel
  Cc: git, Michael Turquette, Stephen Boyd, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Michal Simek,
	Shubhrajyoti Datta, devicetree, linux-arm-kernel

For static-config mode the AXI bus interface is not used, so there is
no need to get and enable s_axi_aclk. Move the axi_clk setup inside
the non-static-config branch.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
---

 drivers/clk/xilinx/clk-xlnx-clock-wizard.c | 23 +++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/clk/xilinx/clk-xlnx-clock-wizard.c b/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
index 5470a717fccc..fe73ee02b54e 100644
--- a/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
+++ b/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
@@ -1243,7 +1243,6 @@ static int clk_wzrd_probe(struct platform_device *pdev)
 	struct device_node *np = pdev->dev.of_node;
 	struct clk_wzrd *clk_wzrd;
 	const char *clk_name;
-	unsigned long rate;
 	struct clk_hw *hw;
 	int nr_outputs;
 	int ret, i;
@@ -1258,22 +1257,24 @@ static int clk_wzrd_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	platform_set_drvdata(pdev, clk_wzrd);
 
-	clk_wzrd->axi_clk = devm_clk_get_enabled(&pdev->dev, "s_axi_aclk");
-	if (IS_ERR(clk_wzrd->axi_clk))
-		return dev_err_probe(&pdev->dev, PTR_ERR(clk_wzrd->axi_clk),
-				     "s_axi_aclk not found\n");
-	rate = clk_get_rate(clk_wzrd->axi_clk);
-	if (rate > WZRD_ACLK_MAX_FREQ) {
-		dev_err(&pdev->dev, "s_axi_aclk frequency (%lu) too high\n", rate);
-		return -EINVAL;
-	}
-
 	clk_wzrd->clk_in1 = devm_clk_get(&pdev->dev, "clk_in1");
 	if (IS_ERR(clk_wzrd->clk_in1))
 		return dev_err_probe(&pdev->dev, PTR_ERR(clk_wzrd->clk_in1),
 				     "failed to get clk_in1\n");
 
 	if (!of_property_present(np, "xlnx,static-config")) {
+		unsigned long rate;
+
+		clk_wzrd->axi_clk = devm_clk_get_enabled(&pdev->dev, "s_axi_aclk");
+		if (IS_ERR(clk_wzrd->axi_clk))
+			return dev_err_probe(&pdev->dev, PTR_ERR(clk_wzrd->axi_clk),
+					     "s_axi_aclk not found\n");
+		rate = clk_get_rate(clk_wzrd->axi_clk);
+		if (rate > WZRD_ACLK_MAX_FREQ) {
+			dev_err(&pdev->dev, "s_axi_aclk frequency (%lu) too high\n", rate);
+			return -EINVAL;
+		}
+
 		clk_wzrd->base = devm_platform_ioremap_resource(pdev, 0);
 		if (IS_ERR(clk_wzrd->base))
 			return PTR_ERR(clk_wzrd->base);
-- 
2.49.1



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

* [PATCH 8/8] clk: clocking-wizard: Use dev_err_probe() when mapping registers
  2026-06-15  3:48 [PATCH 0/8] clk: clocking-wizard: Add static-config clock provider support Shubhrajyoti Datta
                   ` (6 preceding siblings ...)
  2026-06-15  3:48 ` [PATCH 7/8] clk: clocking-wizard: Skip s_axi_aclk for static-config Shubhrajyoti Datta
@ 2026-06-15  3:48 ` Shubhrajyoti Datta
  7 siblings, 0 replies; 11+ messages in thread
From: Shubhrajyoti Datta @ 2026-06-15  3:48 UTC (permalink / raw)
  To: linux-clk, linux-kernel
  Cc: git, Michael Turquette, Stephen Boyd, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Michal Simek,
	Shubhrajyoti Datta, devicetree, linux-arm-kernel

Align the devm_platform_ioremap_resource() error path with clk_in1 and
s_axi_aclk handling for consistent logging and deferred-probe behavior.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
---

 drivers/clk/xilinx/clk-xlnx-clock-wizard.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/xilinx/clk-xlnx-clock-wizard.c b/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
index fe73ee02b54e..381e396aef0e 100644
--- a/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
+++ b/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
@@ -1277,7 +1277,8 @@ static int clk_wzrd_probe(struct platform_device *pdev)
 
 		clk_wzrd->base = devm_platform_ioremap_resource(pdev, 0);
 		if (IS_ERR(clk_wzrd->base))
-			return PTR_ERR(clk_wzrd->base);
+			return dev_err_probe(&pdev->dev, PTR_ERR(clk_wzrd->base),
+					     "failed to map registers\n");
 
 		ret = of_property_read_u32(np, "xlnx,speed-grade", &clk_wzrd->speed_grade);
 		if (!ret) {
-- 
2.49.1



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

* Re: [PATCH 3/8] dt-bindings: clock: clocking-wizard: Make s_axi_aclk optional for static-config
  2026-06-15  3:48 ` [PATCH 3/8] dt-bindings: clock: clocking-wizard: Make s_axi_aclk " Shubhrajyoti Datta
@ 2026-06-15 16:42   ` Conor Dooley
  2026-06-15 16:44     ` Conor Dooley
  0 siblings, 1 reply; 11+ messages in thread
From: Conor Dooley @ 2026-06-15 16:42 UTC (permalink / raw)
  To: Shubhrajyoti Datta
  Cc: linux-clk, linux-kernel, git, Michael Turquette, Stephen Boyd,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Michal Simek,
	devicetree, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 77 bytes --]



Acked-by: Conor Dooley <conor.dooley@microchip.com>
pw-bot: not-applicable

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH 3/8] dt-bindings: clock: clocking-wizard: Make s_axi_aclk optional for static-config
  2026-06-15 16:42   ` Conor Dooley
@ 2026-06-15 16:44     ` Conor Dooley
  0 siblings, 0 replies; 11+ messages in thread
From: Conor Dooley @ 2026-06-15 16:44 UTC (permalink / raw)
  To: Shubhrajyoti Datta
  Cc: linux-clk, linux-kernel, git, Michael Turquette, Stephen Boyd,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Michal Simek,
	devicetree, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 391 bytes --]

On Mon, Jun 15, 2026 at 05:42:17PM +0100, Conor Dooley wrote:
> 
> 
> Acked-by: Conor Dooley <conor.dooley@microchip.com>
> pw-bot: not-applicable

Actually, I take this back. Patch 1 seems to be what's adding the static
configurations in the first place and then patches 2 and 3 complete that
effort. Instead, please add this static config support as one patch.

Thanks,
Conor.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

end of thread, other threads:[~2026-06-15 16:44 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-15  3:48 [PATCH 0/8] clk: clocking-wizard: Add static-config clock provider support Shubhrajyoti Datta
2026-06-15  3:48 ` [PATCH 1/8] dt-bindings: clock: clocking-wizard: Add xlnx,clk-mul-div property Shubhrajyoti Datta
2026-06-15  3:48 ` [PATCH 2/8] dt-bindings: clock: clocking-wizard: Make reg optional for static-config Shubhrajyoti Datta
2026-06-15  3:48 ` [PATCH 3/8] dt-bindings: clock: clocking-wizard: Make s_axi_aclk " Shubhrajyoti Datta
2026-06-15 16:42   ` Conor Dooley
2026-06-15 16:44     ` Conor Dooley
2026-06-15  3:48 ` [PATCH 4/8] clk: clocking-wizard: Do not map the memory " Shubhrajyoti Datta
2026-06-15  3:48 ` [PATCH 5/8] clk: clocking-wizard: Move clk_in1 acquisition before static-config check Shubhrajyoti Datta
2026-06-15  3:48 ` [PATCH 6/8] clk: clocking-wizard: Add static-config clock provider support Shubhrajyoti Datta
2026-06-15  3:48 ` [PATCH 7/8] clk: clocking-wizard: Skip s_axi_aclk for static-config Shubhrajyoti Datta
2026-06-15  3:48 ` [PATCH 8/8] clk: clocking-wizard: Use dev_err_probe() when mapping registers Shubhrajyoti Datta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox