Skip to contentSkip to conversation

clock: versal-clk: Fix Versal NET clock binding and switch to CCF

PATCH Superseded Michal Simek 3 participants 14 messages Jul 8

Subsystems (3)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Michal Simek

author maintainer
#0 lore raw

v4 cover clock: versal-clk: Fix Versal NET clock binding and switch to CCF

This series fixes the Versal NET clock controller DT binding validation and switches the platform to use the firmware-based CCF clock interface.

Patch 1 extracts zynqmp to own DT binding file.

Patch 2 restructures the if/then conditions in the versal-clk binding schema so that xlnx,versal-net-clk is matched first before falling back to xlnx,versal-clk. This fixes false "too long" validation errors caused by both conditions matching simultaneously when the fallback compatible is present. A dedicated example for the Versal NET 3-clock configuration is added and all examples are split into separate blocks for independent validation.

Patch 3 switches Versal NET from static fixed-clock definitions to the firmware-based clock interface, enabling proper clock management through platform firmware. DT macro headers for clocks, power domains and resets are added.

Thanks,
Michal

Changes in v4:
- simplify expression to [0-6][0-9] from 0[0-9||[1-6][0-9]
- Update regex from previous patch
- Also update firmware node to match xlnx,versal-firmware enforced by schema

Changes in v3:
- new patch in series
- New patch in series
- Cover change in zynqmp-firmware.yaml
- Move clock-cells to be the last in the example
- Remove comment around (Optional clock) which is obvious from schema itself
- Move clock-cells to be the last property in the example
- use 2 spaces for indentation in example to follow the same style which is already used
- Add fixed tag
- Remove interrupt from zynqmp-power - Versal NET is using event framework instead. No interrupt is required.
- Remove unused GEM{0,1}_REF_{R,T}X macros
- Update commit message
- s/zynqmp/versal-net/ in subject
- Update copyrights
- Make all macro values lower case
- Fix guarding macro names

Changes in v2:
- New patch in series
- Split zynqmp-clk from versal-clk
- Update logic without ZynqMP part in this file and have if/else only around min/maxItems
- use clock-<HZ> node name for fixed clocks
- Reuse existing versal-net-clk.dtsi file

Michal Simek (5):
dt-bindings: firmware: xilinx: Add missing example for ZynqMP
dt-bindings: clock: versal-clk: Fix mio_clk index range in clock-names
pattern
dt-bindings: clock: Move xlnx,zynqmp-clk to its own schema
dt-bindings: clock: versal-clk: Fix Versal NET clock validation
arm64: versal-net: Switch Versal NET to firmware clock interface

 .../bindings/clock/xlnx,versal-clk.yaml       |  93 ++---
 .../bindings/clock/xlnx,zynqmp-clk.yaml       |  68 ++++
 .../firmware/xilinx/xlnx,zynqmp-firmware.yaml |  15 +-
 .../arm64/boot/dts/xilinx/versal-net-clk.dtsi | 345 +++++++++++++-----
 arch/arm64/boot/dts/xilinx/xlnx-versal-clk.h  | 123 +++++++
 .../boot/dts/xilinx/xlnx-versal-net-clk.h     |  74 ++++
 .../boot/dts/xilinx/xlnx-versal-net-power.h   |  38 ++
 .../boot/dts/xilinx/xlnx-versal-net-resets.h  |  53 +++
 .../arm64/boot/dts/xilinx/xlnx-versal-power.h |  55 +++
 .../boot/dts/xilinx/xlnx-versal-resets.h      | 106 ++++++
 10 files changed, 797 insertions(+), 173 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/xlnx,zynqmp-clk.yaml
 create mode 100644 arch/arm64/boot/dts/xilinx/xlnx-versal-clk.h
 create mode 100644 arch/arm64/boot/dts/xilinx/xlnx-versal-net-clk.h
 create mode 100644 arch/arm64/boot/dts/xilinx/xlnx-versal-net-power.h
 create mode 100644 arch/arm64/boot/dts/xilinx/xlnx-versal-net-resets.h
 create mode 100644 arch/arm64/boot/dts/xilinx/xlnx-versal-power.h
 create mode 100644 arch/arm64/boot/dts/xilinx/xlnx-versal-resets.h

---
base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482
branch: xnext/versal-net

Signature · 1 line
2.43.0
author maintainer
#1 lore raw

PATCH v4 1/5 dt-bindings: firmware: xilinx: Add missing example for ZynqMP

Document clock-controller under zynqmp-firmware in the binding example so ZynqMP DTs validate against xlnx,zynqmp-clk.yaml (Versal example already did).

---

(no changes since v3)

Changes in v3:
- new patch in series

 .../bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml    | 8 ++++++++
 1 file changed, 8 insertions(+)
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml +8 -0
index d50438b0fca8..680082c29f01 100644
@@ -132,6 +132,14 @@ examples:
       zynqmp_firmware: zynqmp-firmware {
         compatible = "xlnx,zynqmp-firmware";
         #power-domain-cells = <1>;
+        clock-controller {
+          compatible = "xlnx,zynqmp-clk";
+          clocks = <&pss_ref_clk>, <&video_clk>, <&pss_alt_ref_clk>,
+                   <&aux_ref_clk>, <&gt_crx_ref_clk>;
+          clock-names = "pss_ref_clk", "video_clk", "pss_alt_ref_clk",
+                        "aux_ref_clk", "gt_crx_ref_clk";
+          #clock-cells = <1>;
+        };
         soc-nvmem {
           compatible = "xlnx,zynqmp-nvmem-fw";
           nvmem-layout {
Signature · 1 line
2.43.0
author maintainer
#3 lore raw

PATCH v4 2/5 dt-bindings: clock: versal-clk: Fix mio_clk index range in clock-names pattern

In reply to Michal Simek

The clock-names pattern "^mio_clk[00-77]+.*$" was intended to constrain the MIO index to the valid range 00..77 (ZynqMP has 78 MIO pins), but a regex character class cannot express a multi-digit decimal range. Replace the bogus character class with an explicit alternation that enumerates the two-digit decimal values 00..77.

Fixes 03d4a1004053 ("dt-bindings: clock: versal: Convert the xlnx,zynqmp-clk.txt to yaml")

---

Changes in v4:
- simplify expression to [0-6][0-9] from 0[0-9||[1-6][0-9]

Changes in v3:
- New patch in series

 Documentation/devicetree/bindings/clock/xlnx,versal-clk.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/clock/xlnx,versal-clk.yaml +1 -1
index bef109d163a8..b1623c2ab0f6 100644
@@ -116,7 +116,7 @@ allOf:
             - const: pss_alt_ref_clk
             - const: aux_ref_clk
             - const: gt_crx_ref_clk
-            - pattern: "^mio_clk[00-77]+.*$"
+            - pattern: "^mio_clk([0-6][0-9]|7[0-7])+.*$"
             - pattern: "gem[0-3]+_emio_clk.*$"
             - pattern: "swdt[0-1]+_ext_clk.*$"
 
Signature · 1 line
2.43.0
author maintainer
#10 lore raw

PATCH v4 4/5 dt-bindings: clock: versal-clk: Fix Versal NET clock validation

In reply to Michal Simek

The Versal NET clock controller compatible is specified as:
compatible = "xlnx,versal-net-clk", "xlnx,versal-clk";

with xlnx,versal-clk listed as fallback. The original binding had two separate if/then blocks - one matching xlnx,versal-clk (2 clocks) and another matching xlnx,versal-net-clk (3 clocks). Since both compatible strings are present, both conditions matched simultaneously and JSON Schema applied the more restrictive 2-clock constraint, causing false "too long" validation errors for Versal NET.

Define clock-names at the top-level and use if/then only to constrain the clock count (2 for Versal, 3 for Versal NET). Add a dedicated example for the Versal NET 3-clock configuration.

Fixes 39118392d19a ("dt-bindings: Remove alt_ref from versal")

---

Changes in v4:
- Also update firmware node to match xlnx,versal-firmware enforced by schema

Changes in v3:
- Move clock-cells to be the last property in the example
- use 2 spaces for indentation in example to follow the same style which is already used
- Add fixed tag

Changes in v2:
- Update logic without ZynqMP part in this file and have if/else only around min/maxItems

 .../bindings/clock/xlnx,versal-clk.yaml       | 55 ++++++++-----------
 1 file changed, 24 insertions(+), 31 deletions(-)
Documentation/devicetree/bindings/clock/xlnx,versal-clk.yaml +24 -31
index 12d060c39bfc..1f36ccc4cde1 100644
@@ -30,11 +30,17 @@ properties:
     description: List of clock specifiers which are external input
       clocks to the given clock controller.
     minItems: 2
-    maxItems: 3
+    items:
+      - description: reference clock
+      - description: alternate reference clock for programmable logic
+      - description: alternate reference clock
 
   clock-names:
     minItems: 2
-    maxItems: 3
+    items:
+      - const: ref
+      - const: pl_alt_ref
+      - const: alt_ref
 
 required:
   - compatible
@@ -50,46 +56,25 @@ allOf:
         compatible:
           contains:
             enum:
-              - xlnx,versal-clk
-
+              - xlnx,versal-net-clk
     then:
       properties:
         clocks:
-          items:
-            - description: reference clock
-            - description: alternate reference clock for programmable logic
-
+          minItems: 3
         clock-names:
-          items:
-            - const: ref
-            - const: pl_alt_ref
-
-  - if:
-      properties:
-        compatible:
-          contains:
-            enum:
-              - xlnx,versal-net-clk
-
-    then:
+          minItems: 3
+    else:
       properties:
         clocks:
-          items:
-            - description: reference clock
-            - description: alternate reference clock for programmable logic
-            - description: alternate reference clock
-
+          maxItems: 2
         clock-names:
-          items:
-            - const: ref
-            - const: pl_alt_ref
-            - const: alt_ref
+          maxItems: 2
 
 examples:
   - |
     firmware {
-      zynqmp_firmware: zynqmp-firmware {
-        compatible = "xlnx,zynqmp-firmware";
+      versal-firmware {
+        compatible = "xlnx,versal-firmware";
         method = "smc";
         versal_clk: clock-controller {
           #clock-cells = <1>;
@@ -99,4 +84,12 @@ examples:
         };
       };
     };
+
+  - |
+    clock-controller {
+      compatible = "xlnx,versal-net-clk", "xlnx,versal-clk";
+      clocks = <&ref>, <&pl_alt_ref>, <&alt_ref>;
+      clock-names = "ref", "pl_alt_ref", "alt_ref";
+      #clock-cells = <1>;
+    };
 ...
Signature · 1 line
2.43.0
author maintainer
#6 lore raw

PATCH v4 3/5 dt-bindings: clock: Move xlnx,zynqmp-clk to its own schema

In reply to Michal Simek

The ZynqMP clock controller binding shares only #clock-cells with the Versal bindings. Move it to a dedicated xlnx,zynqmp-clk.yaml schema. Also remove "(Optional clock)" from clock description because it is visible from schema itself.

---

Changes in v4:
- Update regex from previous patch

Changes in v3:
- Cover change in zynqmp-firmware.yaml
- Move clock-cells to be the last in the example
- Remove comment around (Optional clock) which is obvious from schema itself

Changes in v2:
- New patch in series
- Split zynqmp-clk from versal-clk

 .../bindings/clock/xlnx,versal-clk.yaml       | 50 +-------------
 .../bindings/clock/xlnx,zynqmp-clk.yaml       | 68 +++++++++++++++++++
 .../firmware/xilinx/xlnx,zynqmp-firmware.yaml |  7 +-
 3 files changed, 76 insertions(+), 49 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/xlnx,zynqmp-clk.yaml
Documentation/devicetree/bindings/clock/xlnx,versal-clk.yaml +3 -47
index b1623c2ab0f6..12d060c39bfc 100644
@@ -17,9 +17,7 @@ description: |
 properties:
   compatible:
     oneOf:
-      - enum:
-          - xlnx,versal-clk
-          - xlnx,zynqmp-clk
+      - const: xlnx,versal-clk
       - items:
           - enum:
               - xlnx,versal-net-clk
@@ -32,11 +30,11 @@ properties:
     description: List of clock specifiers which are external input
       clocks to the given clock controller.
     minItems: 2
-    maxItems: 8
+    maxItems: 3
 
   clock-names:
     minItems: 2
-    maxItems: 8
+    maxItems: 3
 
 required:
   - compatible
@@ -87,39 +85,6 @@ allOf:
             - const: pl_alt_ref
             - const: alt_ref
 
-  - if:
-      properties:
-        compatible:
-          contains:
-            enum:
-              - xlnx,zynqmp-clk
-
-    then:
-      properties:
-        clocks:
-          minItems: 5
-          items:
-            - description: PS reference clock
-            - description: reference clock for video system
-            - description: alternative PS reference clock
-            - description: auxiliary reference clock
-            - description: transceiver reference clock
-            - description: (E)MIO clock source  (Optional clock)
-            - description: GEM emio clock  (Optional clock)
-            - description: Watchdog external clock (Optional clock)
-
-        clock-names:
-          minItems: 5
-          items:
-            - const: pss_ref_clk
-            - const: video_clk
-            - const: pss_alt_ref_clk
-            - const: aux_ref_clk
-            - const: gt_crx_ref_clk
-            - pattern: "^mio_clk([0-6][0-9]|7[0-7])+.*$"
-            - pattern: "gem[0-3]+_emio_clk.*$"
-            - pattern: "swdt[0-1]+_ext_clk.*$"
-
 examples:
   - |
     firmware {
@@ -134,13 +99,4 @@ examples:
         };
       };
     };
-
-    clock-controller {
-        #clock-cells = <1>;
-        compatible = "xlnx,zynqmp-clk";
-        clocks = <&pss_ref_clk>, <&video_clk>, <&pss_alt_ref_clk>,
-                 <&aux_ref_clk>, <&gt_crx_ref_clk>;
-        clock-names = "pss_ref_clk", "video_clk", "pss_alt_ref_clk",
-                      "aux_ref_clk", "gt_crx_ref_clk";
-    };
 ...
Documentation/devicetree/bindings/clock/xlnx,zynqmp-clk.yaml new file +68 -0

68 lines not on this page · raw message

Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml +5 -2
index 680082c29f01..72af37cdb103 100644
@@ -48,8 +48,7 @@ properties:
     const: 1
 
   clock-controller:
-    $ref: /schemas/clock/xlnx,versal-clk.yaml#
-    description: The clock controller is a hardware block of Xilinx versal
+    description: The clock controller is a hardware block of Xilinx SoC
       clock tree. It reads required input clock frequencies from the devicetree
       and acts as clock provider for all clock consumers of PS clocks.list of
       clock specifiers which are external input clocks to the given clock
@@ -113,10 +112,14 @@ allOf:
             const: xlnx,zynqmp-firmware
     then:
       properties:
+        clock-controller:
+          $ref: /schemas/clock/xlnx,zynqmp-clk.yaml#
         pinctrl:
           $ref: /schemas/pinctrl/xlnx,zynqmp-pinctrl.yaml#
     else:
       properties:
+        clock-controller:
+          $ref: /schemas/clock/xlnx,versal-clk.yaml#
         pinctrl:
           $ref: /schemas/pinctrl/xlnx,versal-pinctrl.yaml#
 
Signature · 1 line
2.43.0
author maintainer
#11 lore raw

PATCH v4 5/5 arm64: versal-net: Switch Versal NET to firmware clock interface

In reply to Michal Simek

Switch Versal NET from using fixed clocks to the firmware-based clock interface (versal-net-clk.dtsi). This enables proper clock management through the platform firmware instead of relying on static fixed-clock definitions.

Add DT macro headers for Versal NET and base Versal clocks, power domains and mandatory resets required by the clock dtsi.

---

(no changes since v3)

Changes in v3:
- Remove interrupt from zynqmp-power - Versal NET is using event framework instead. No interrupt is required.
- Remove unused GEM{0,1}_REF_{R,T}X macros
- Update commit message
- s/zynqmp/versal-net/ in subject
- Update copyrights
- Make all macro values lower case
- Fix guarding macro names

Changes in v2:
- use clock-<HZ> node name for fixed clocks
- Reuse existing versal-net-clk.dtsi file

 .../arm64/boot/dts/xilinx/versal-net-clk.dtsi | 345 +++++++++++++-----
 arch/arm64/boot/dts/xilinx/xlnx-versal-clk.h  | 123 +++++++
 .../boot/dts/xilinx/xlnx-versal-net-clk.h     |  74 ++++
 .../boot/dts/xilinx/xlnx-versal-net-power.h   |  38 ++
 .../boot/dts/xilinx/xlnx-versal-net-resets.h  |  53 +++
 .../arm64/boot/dts/xilinx/xlnx-versal-power.h |  55 +++
 .../boot/dts/xilinx/xlnx-versal-resets.h      | 106 ++++++
 7 files changed, 695 insertions(+), 99 deletions(-)
 create mode 100644 arch/arm64/boot/dts/xilinx/xlnx-versal-clk.h
 create mode 100644 arch/arm64/boot/dts/xilinx/xlnx-versal-net-clk.h
 create mode 100644 arch/arm64/boot/dts/xilinx/xlnx-versal-net-power.h
 create mode 100644 arch/arm64/boot/dts/xilinx/xlnx-versal-net-resets.h
 create mode 100644 arch/arm64/boot/dts/xilinx/xlnx-versal-power.h
 create mode 100644 arch/arm64/boot/dts/xilinx/xlnx-versal-resets.h
arch/arm64/boot/dts/xilinx/versal-net-clk.dtsi +246 -99
index b7a8a1a512cb..d3a27da90090 100644
@@ -1,231 +1,378 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
- * dts file for Xilinx Versal NET fixed clock
+ * dts file for Xilinx Versal NET with PM
  *
- * (C) Copyright 2022, Xilinx, Inc.
- * (C) Copyright 2022 - 2025, Advanced Micro Devices, Inc.
+ * Copyright (C) 2022, Xilinx, Inc.
+ * Copyright (C) 2022 - 2026, Advanced Micro Devices, Inc.
  *
  * Michal Simek <[email protected]>
  */
 
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+#include "xlnx-versal-net-clk.h"
+#include "xlnx-versal-net-power.h"
+#include "xlnx-versal-net-resets.h"
+
 / {
-	clk60: clk60 {
+	ref_clk: clock-33333333 {
 		compatible = "fixed-clock";
+		bootph-all;
+		clock-frequency = <33333333>;
+		clock-output-names = "ref_clk";
 		#clock-cells = <0>;
-		clock-frequency = <60000000>;
 	};
 
-	clk100: clk100 {
+	rtc_clk: clock-32768 {
 		compatible = "fixed-clock";
+		bootph-all;
+		clock-frequency = <32768>;
+		clock-output-names = "rtc_clk";
 		#clock-cells = <0>;
-		clock-frequency = <100000000>;
 	};
 
-	clk125: clk125 {
-		compatible = "fixed-clock";
+	can0_clk: can0-clk {
+		compatible = "fixed-factor-clock";
+		clocks = <&versal_net_clk CAN0_REF_2X>;
+		clock-div = <2>;
+		clock-mult = <1>;
+		clock-output-names = "can0_clk";
 		#clock-cells = <0>;
-		clock-frequency = <125000000>;
 	};
 
-	clk150: clk150 {
-		compatible = "fixed-clock";
+	can1_clk: can1-clk {
+		compatible = "fixed-factor-clock";
+		clocks = <&versal_net_clk CAN1_REF_2X>;
+		clock-div = <2>;
+		clock-mult = <1>;
+		clock-output-names = "can1_clk";
 		#clock-cells = <0>;
-		clock-frequency = <150000000>;
 	};
 
-	clk160: clk160 {
-		compatible = "fixed-clock";
-		#clock-cells = <0>;
-		clock-frequency = <160000000>;
+	firmware {
+		versal_net_firmware: versal-net-firmware {
+			compatible = "xlnx,versal-net-firmware", "xlnx,versal-firmware";
+			bootph-all;
+			method = "smc";
+			#power-domain-cells = <1>;
+
+			versal_net_reset: reset-controller {
+				compatible = "xlnx,versal-net-reset";
+				#reset-cells = <1>;
+			};
+
+			versal_net_clk: clock-controller {
+				compatible = "xlnx,versal-net-clk", "xlnx,versal-clk";
+				bootph-all;
+				clocks = <&ref_clk>, <&ref_clk>, <&ref_clk>;
+				clock-names = "ref", "pl_alt_ref", "alt_ref";
+				#clock-cells = <1>;
+			};
+
+			versal_net_power: power-management {
+				compatible = "xlnx,zynqmp-power";
+				mboxes = <&ipi_mailbox_pmu1 0>,
+					 <&ipi_mailbox_pmu1 1>;
+				mbox-names = "tx", "rx";
+			};
+		};
 	};
 
-	clk200: clk200 {
-		compatible = "fixed-clock";
-		#clock-cells = <0>;
-		clock-frequency = <200000000>;
+	zynqmp-ipi {
+		compatible = "xlnx,zynqmp-ipi-mailbox";
+		interrupt-parent = <&gic>;
+		interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>;
+		xlnx,ipi-id = <2>;
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges;
+
+		ipi_mailbox_pmu1: mailbox@eb3f0440 {
+			compatible = "xlnx,zynqmp-ipi-dest-mailbox";
+			reg = <0 0xeb3f0440 0 0x20>,
+			      <0 0xeb3f0460 0 0x20>,
+			      <0 0xeb3f0280 0 0x20>,
+			      <0 0xeb3f02a0 0 0x20>;
+			reg-names = "local_request_region", "local_response_region",
+				    "remote_request_region", "remote_response_region";
+			#mbox-cells = <1>;
+			xlnx,ipi-id = <1>;
+		};
 	};
+};
 
-	clk250: clk250 {
-		compatible = "fixed-clock";
-		#clock-cells = <0>;
-		clock-frequency = <250000000>;
-	};
+&cpu0 {
+	clocks = <&versal_net_clk ACPU_0>;
+};
 
-	clk300: clk300 {
-		compatible = "fixed-clock";
-		#clock-cells = <0>;
-		clock-frequency = <300000000>;
-	};
+&cpu100 {
+	clocks = <&versal_net_clk ACPU_0>;
+};
 
-	clk450: clk450 {
-		compatible = "fixed-clock";
-		#clock-cells = <0>;
-		clock-frequency = <450000000>;
-	};
+&cpu200 {
+	clocks = <&versal_net_clk ACPU_0>;
+};
 
-	clk1200: clk1200 {
-		compatible = "fixed-clock";
-		#clock-cells = <0>;
-		clock-frequency = <1200000000>;
-	};
+&cpu300 {
+	clocks = <&versal_net_clk ACPU_0>;
+};
 
-	firmware {
-		versal_net_firmware: versal-net-firmware {
-			compatible = "xlnx,versal-net-firmware", "xlnx,versal-firmware";
-			bootph-all;
-			method = "smc";
-		};
-	};
+&cpu10000 {
+	clocks = <&versal_net_clk ACPU_1>;
 };
 
-&adma0 {
-	clocks = <&clk450>, <&clk450>;
+&cpu10100 {
+	clocks = <&versal_net_clk ACPU_1>;
 };
 
-&adma1 {
-	clocks = <&clk450>, <&clk450>;
+&cpu10200 {
+	clocks = <&versal_net_clk ACPU_1>;
 };
 
-&adma2 {
-	clocks = <&clk450>, <&clk450>;
+&cpu10300 {
+	clocks = <&versal_net_clk ACPU_1>;
 };
 
-&adma3 {
-	clocks = <&clk450>, <&clk450>;
+&cpu20000 {
+	clocks = <&versal_net_clk ACPU_2>;
 };
 
-&adma4 {
-	clocks = <&clk450>, <&clk450>;
+&cpu20100 {
+	clocks = <&versal_net_clk ACPU_2>;
 };
 
-&adma5 {
-	clocks = <&clk450>, <&clk450>;
+&cpu20200 {
+	clocks = <&versal_net_clk ACPU_2>;
 };
 
-&adma6 {
-	clocks = <&clk450>, <&clk450>;
+&cpu20300 {
+	clocks = <&versal_net_clk ACPU_2>;
 };
 
-&adma7 {
-	clocks = <&clk450>, <&clk450>;
+&cpu30000 {
+	clocks = <&versal_net_clk ACPU_3>;
+};
+
+&cpu30100 {
+	clocks = <&versal_net_clk ACPU_3>;
+};
+
+&cpu30200 {
+	clocks = <&versal_net_clk ACPU_3>;
+};
+
+&cpu30300 {
+	clocks = <&versal_net_clk ACPU_3>;
 };
 
 &can0 {
-	clocks = <&clk160>, <&clk160>;
+	clocks = <&can0_clk>, <&versal_net_clk LPD_LSBUS>;
+	power-domains = <&versal_net_firmware PM_DEV_CAN_FD_0>;
 };
 
 &can1 {
-	clocks = <&clk160>, <&clk160>;
+	clocks = <&can1_clk>, <&versal_net_clk LPD_LSBUS>;
+	power-domains = <&versal_net_firmware PM_DEV_CAN_FD_1>;
 };
 
 &gem0 {
-	clocks = <&clk125>, <&clk125>, <&clk125>, <&clk125>, <&clk250>;
+	clocks = <&versal_net_clk LPD_LSBUS>,
+		 <&versal_net_clk GEM0_REF>, <&versal_net_clk GEM0_TX>,
+		 <&versal_net_clk GEM0_RX>, <&versal_net_clk GEM_TSU>;
+	power-domains = <&versal_net_firmware PM_DEV_GEM_0>;
 };
 
 &gem1 {
-	clocks = <&clk125>, <&clk125>, <&clk125>, <&clk125>, <&clk250>;
+	clocks = <&versal_net_clk LPD_LSBUS>,
+		 <&versal_net_clk GEM1_REF>, <&versal_net_clk GEM1_TX>,
+		 <&versal_net_clk GEM1_RX>, <&versal_net_clk GEM_TSU>;
+	power-domains = <&versal_net_firmware PM_DEV_GEM_1>;
 };
 
 &gpio0 {
-	clocks = <&clk100>;
+	clocks = <&versal_net_clk LPD_LSBUS>;
+	power-domains = <&versal_net_firmware PM_DEV_GPIO>;
 };
 
 &gpio1 {
-	clocks = <&clk100>;
+	clocks = <&versal_net_clk PMC_LSBUS_REF>;
+	power-domains = <&versal_net_firmware PM_DEV_GPIO_PMC>;
 };
 
 &i2c0 {
-	clocks = <&clk100>;
+	clocks = <&versal_net_clk I3C0_REF>;
+	power-domains = <&versal_net_firmware PM_DEV_I2C_0>;
 };
 
 &i2c1 {
-	clocks = <&clk100>;
+	clocks = <&versal_net_clk I3C1_REF>;
+	power-domains = <&versal_net_firmware PM_DEV_I2C_1>;
 };
 
 &i3c0 {
-	clocks = <&clk100>;
+	clocks = <&versal_net_clk I3C0_REF>;
+	power-domains = <&versal_net_firmware PM_DEV_I2C_0>;
 };
 
 &i3c1 {
-	clocks = <&clk100>;
+	clocks = <&versal_net_clk I3C1_REF>;
+	power-domains = <&versal_net_firmware PM_DEV_I2C_1>;
 };
 
-&ospi {
-	clocks = <&clk200>;
+&adma0 {
+	clocks = <&versal_net_clk ADMA>, <&versal_net_clk LPD_LSBUS>;
+	power-domains = <&versal_net_firmware PM_DEV_ADMA_0>;
 };
 
-&qspi {
-	clocks = <&clk300>, <&clk300>;
+&adma1 {
+	clocks = <&versal_net_clk ADMA>, <&versal_net_clk LPD_LSBUS>;
+	power-domains = <&versal_net_firmware PM_DEV_ADMA_1>;
 };
 
-&rtc {
-	/* Nothing */
+&adma2 {
+	clocks = <&versal_net_clk ADMA>, <&versal_net_clk LPD_LSBUS>;
+	power-domains = <&versal_net_firmware PM_DEV_ADMA_2>;
 };
 
-&sdhci0 {
-	clocks = <&clk200>, <&clk200>, <&clk1200>;
+&adma3 {
+	clocks = <&versal_net_clk ADMA>, <&versal_net_clk LPD_LSBUS>;
+	power-domains = <&versal_net_firmware PM_DEV_ADMA_3>;
 };
 
-&sdhci1 {
-	clocks = <&clk200>, <&clk200>, <&clk1200>;
+&adma4 {
+	clocks = <&versal_net_clk ADMA>, <&versal_net_clk LPD_LSBUS>;
+	power-domains = <&versal_net_firmware PM_DEV_ADMA_4>;
+};
+
+&adma5 {
+	clocks = <&versal_net_clk ADMA>, <&versal_net_clk LPD_LSBUS>;
+	power-domains = <&versal_net_firmware PM_DEV_ADMA_5>;
+};
+
+&adma6 {
+	clocks = <&versal_net_clk ADMA>, <&versal_net_clk LPD_LSBUS>;
+	power-domains = <&versal_net_firmware PM_DEV_ADMA_6>;
+};
+
+&adma7 {
+	clocks = <&versal_net_clk ADMA>, <&versal_net_clk LPD_LSBUS>;
+	power-domains = <&versal_net_firmware PM_DEV_ADMA_7>;
+};
+
+&qspi {
+	clocks = <&versal_net_clk QSPI_REF>, <&versal_net_clk LPD_LSBUS>;
+	power-domains = <&versal_net_firmware PM_DEV_QSPI>;
+};
+
+&ospi {
+	clocks = <&versal_net_clk OSPI_REF>;
+	power-domains = <&versal_net_firmware PM_DEV_OSPI>;
+};
+
+&rtc {
+	clocks = <&rtc_clk>;
+	clock-names = "rtc";
+	power-domains = <&versal_net_firmware PM_DEV_RTC>;
 };
 
 &serial0 {
-	clocks = <&clk100>, <&clk100>;
+	clocks = <&versal_net_clk UART0_REF>, <&versal_net_clk LPD_LSBUS>;
+	power-domains = <&versal_net_firmware PM_DEV_UART_0>;
 };
 
 &serial1 {
-	clocks = <&clk100>, <&clk100>;
+	clocks = <&versal_net_clk UART1_REF>, <&versal_net_clk LPD_LSBUS>;
+	power-domains = <&versal_net_firmware PM_DEV_UART_1>;
+};
+
+&sdhci0 {
+	clocks = <&versal_net_clk SDIO0_REF>, <&versal_net_clk LPD_LSBUS>,
+		 <&versal_net_clk SD_DLL_REF>;
+	power-domains = <&versal_net_firmware PM_DEV_SDIO_0>;
+};
+
+&sdhci1 {
+	clocks = <&versal_net_clk SDIO1_REF>, <&versal_net_clk LPD_LSBUS>,
+		 <&versal_net_clk SD_DLL_REF>;
+	power-domains = <&versal_net_firmware PM_DEV_SDIO_1>;
 };
 
 &spi0 {
-	clocks = <&clk200>, <&clk200>;
+	clocks = <&versal_net_clk SPI0_REF>, <&versal_net_clk LPD_LSBUS>;
+	power-domains = <&versal_net_firmware PM_DEV_SPI_0>;
 };
 
 &spi1 {
-	clocks = <&clk200>, <&clk200>;
+	clocks = <&versal_net_clk SPI1_REF>, <&versal_net_clk LPD_LSBUS>;
+	power-domains = <&versal_net_firmware PM_DEV_SPI_1>;
 };
 
 &ttc0 {
-	clocks = <&clk150>;
+	clocks = <&versal_net_clk TTC0>;
+	power-domains = <&versal_net_firmware PM_DEV_TTC_0>;
+};
+
+&ttc1 {
+	clocks = <&versal_net_clk TTC1>;
+	power-domains = <&versal_net_firmware PM_DEV_TTC_1>;
+};
+
+&ttc2 {
+	clocks = <&versal_net_clk TTC2>;
+	power-domains = <&versal_net_firmware PM_DEV_TTC_2>;
+};
+
+&ttc3 {
+	clocks = <&versal_net_clk TTC3>;
+	power-domains = <&versal_net_firmware PM_DEV_TTC_3>;
 };
 
 &usb0 {
-	clocks = <&clk60>, <&clk60>;
+	clocks = <&versal_net_clk USB0_BUS_REF>, <&versal_net_clk USB0_BUS_REF>;
+	power-domains = <&versal_net_firmware PM_DEV_USB_0>;
+	resets = <&versal_net_reset VERSAL_RST_USB_0>;
 };
 
 &dwc3_0 {
-	clocks = <&clk60>;
+	clocks = <&versal_net_clk USB0_BUS_REF>;
 };
 
 &usb1 {
-	clocks = <&clk60>, <&clk60>;
+	clocks = <&versal_net_clk USB1_BUS_REF>, <&versal_net_clk USB1_BUS_REF>;
+	power-domains = <&versal_net_firmware PM_DEV_USB_1>;
+	resets = <&versal_net_reset VERSAL_RST_USB_1>;
 };
 
 &dwc3_1 {
-	clocks = <&clk60>;
+	clocks = <&versal_net_clk USB1_BUS_REF>;
 };
 
 &wwdt0 {
-	clocks = <&clk150>;
+	clocks = <&versal_net_clk FPD_WWDT0>;
+	power-domains = <&versal_net_firmware PM_DEV_FPD_SWDT_0>;
 };
 
 &wwdt1 {
-	clocks = <&clk150>;
+	clocks = <&versal_net_clk FPD_WWDT1>;
+	power-domains = <&versal_net_firmware PM_DEV_FPD_SWDT_1>;
 };
 
 &wwdt2 {
-	clocks = <&clk150>;
+	clocks = <&versal_net_clk FPD_WWDT2>;
+	power-domains = <&versal_net_firmware PM_DEV_FPD_SWDT_2>;
 };
 
 &wwdt3 {
-	clocks = <&clk150>;
+	clocks = <&versal_net_clk FPD_WWDT3>;
+	power-domains = <&versal_net_firmware PM_DEV_FPD_SWDT_3>;
 };
 
 &lpd_wwdt0 {
-	clocks = <&clk150>;
+	clocks = <&versal_net_clk LPD_WWDT0>;
+	power-domains = <&versal_net_firmware PM_DEV_LPD_SWDT_0>;
 };
 
 &lpd_wwdt1 {
-	clocks = <&clk150>;
+	clocks = <&versal_net_clk LPD_WWDT1>;
+	power-domains = <&versal_net_firmware PM_DEV_LPD_SWDT_1>;
 };
arch/arm64/boot/dts/xilinx/xlnx-versal-clk.h new file +123 -0

123 lines not on this page · raw message

arch/arm64/boot/dts/xilinx/xlnx-versal-net-clk.h new file +74 -0

74 lines not on this page · raw message

arch/arm64/boot/dts/xilinx/xlnx-versal-net-power.h new file +38 -0
new file mode 100644
index 000000000000..4f73593c966b
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2022, Xilinx, Inc.
+ * Copyright (C) 2022 - 2026, Advanced Micro Devices, Inc.
+ */
+
+#ifndef _XLNX_VERSAL_NET_POWER_H
+#define _XLNX_VERSAL_NET_POWER_H
+
+#include "xlnx-versal-power.h"
+
+#define PM_DEV_USB_1				(0x182240d7U)
+#define PM_DEV_FPD_SWDT_0			(0x182240dbU)
+#define PM_DEV_FPD_SWDT_1			(0x182240dcU)
+#define PM_DEV_FPD_SWDT_2			(0x182240ddU)
+#define PM_DEV_FPD_SWDT_3			(0x182240deU)
+#define PM_DEV_TCM_A_0A				(0x183180cbU)
+#define PM_DEV_TCM_A_0B				(0x183180ccU)
+#define PM_DEV_TCM_A_0C				(0x183180cdU)
+#define PM_DEV_RPU_A_0				(0x181100bfU)
+#define PM_DEV_LPD_SWDT_0			(0x182240d9U)
+#define PM_DEV_LPD_SWDT_1			(0x182240daU)
+
+/* Remove Versal specific node IDs */
+#undef PM_DEV_RPU0_0
+#undef PM_DEV_RPU0_1
+#undef PM_DEV_OCM_0
+#undef PM_DEV_OCM_1
+#undef PM_DEV_OCM_2
+#undef PM_DEV_OCM_3
+#undef PM_DEV_TCM_0_A
+#undef PM_DEV_TCM_1_A
+#undef PM_DEV_TCM_0_B
+#undef PM_DEV_TCM_1_B
+#undef PM_DEV_SWDT_FPD
+#undef PM_DEV_AI
+
+#endif
arch/arm64/boot/dts/xilinx/xlnx-versal-net-resets.h new file +53 -0

53 lines not on this page · raw message

arch/arm64/boot/dts/xilinx/xlnx-versal-power.h new file +55 -0

55 lines not on this page · raw message

arch/arm64/boot/dts/xilinx/xlnx-versal-resets.h new file +106 -0

106 lines not on this page · raw message

Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH v4 1/5] dt-bindings: firmware: xilinx: Add missing example for ZynqMP

In reply to Michal Simek
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] The commit message incorrectly references `xlnx,zynqmp-clk.yaml` instead of `xlnx,versal-clk.yaml`.…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The commit message incorrectly references xlnx,zynqmp-clk.yaml instead of xlnx,versal-clk.yaml. --

--- Patch [1]: [PATCH v4 1/5] dt-bindings: firmware: xilinx: Add missing example for ZynqMP --- commit f76bb0fabd5ddf2fd379360e863c083c04812eff
Author: Michal Simek <[email protected]>

dt-bindings: firmware: xilinx: Add missing example for ZynqMP

This commit adds the clock-controller to the zynqmp-firmware example in the device tree binding. This allows ZynqMP device trees to properly validate against the clock schema.

Quoted 2 lines

Document clock-controller under zynqmp-firmware in the binding example so ZynqMP DTs validate against xlnx,zynqmp-clk.yaml (Versal example already did).

[Severity: Low]
This isn't a bug, but the commit message references xlnx,zynqmp-clk.yaml, which does not appear to exist in the repository. Should the message specify xlnx,versal-clk.yaml instead, since that is what the hardware actually validates against?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
AI review Acked-by Conor Dooley on v4 2/5
#4 lore raw

Re: [PATCH v4 2/5] dt-bindings: clock: versal-clk: Fix mio_clk index range in clock-names pattern

In reply to Michal Simek
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The xlnx,versal-net-clk compatible string matches multiple contradictory if blocks, making valid device tree nodes mathematically impossible to validate. --

--- Patch [2]: [PATCH v4 2/5] dt-bindings: clock: versal-clk: Fix mio_clk index range in clock-names pattern --- commit bbeb0fbfb689e023d79c16fd79850f4f854a36ee
Author: Michal Simek <[email protected]>

dt-bindings: clock: versal-clk: Fix mio_clk index range in clock-names pattern

The clock-names pattern "^mio_clk[00-77]+.*$" was intended to constrain the MIO index to the valid range 00..77 (ZynqMP has 78 MIO pins), but a regex character class cannot express a multi-digit decimal range. Replace the bogus character class with an explicit alternation that enumerates the two-digit decimal values 00..77.

Fixes 03d4a1004053 ("dt-bindings: clock: versal: Convert the xlnx,zynqmp-clk.txt to yaml")

Documentation/devicetree/bindings/clock/xlnx,versal-clk.yaml allOf: · line 121

Quoted 12 lines
Documentation/devicetree/bindings/clock/xlnx,versal-clk.yaml +1 -1
index bef109d163a82..b1623c2ab0f69 100644
@@ -116,7 +116,7 @@ allOf:
             - const: pss_alt_ref_clk
             - const: aux_ref_clk
             - const: gt_crx_ref_clk
-            - pattern: "^mio_clk[00-77]+.*$"
+            - pattern: "^mio_clk([0-6][0-9]|7[0-7])+.*$"
             - pattern: "gem[0-3]+_emio_clk.*$"
             - pattern: "swdt[0-1]+_ext_clk.*$"

[Severity: High]
This is a pre-existing issue and was not introduced by the patch under review, but does the current allOf schema make it impossible to validate xlnx,versal-net-clk nodes?

Since xlnx,versal-net-clk uses xlnx,versal-clk as a fallback string, this first conditional in Documentation/devicetree/bindings/clock/xlnx,versal-clk.yaml will match:

allOf:
- if:
properties:
compatible:
contains:
enum:
- xlnx,versal-clk
then:
properties:
clocks:
items:
- description: reference clock
- description: alternate reference clock for programmable logic

This restricts the node to exactly 2 clocks. However, because both conditions are processed, the following conditional for xlnx,versal-net-clk also matches:

- if:
properties:
compatible:
contains:
enum:
- xlnx,versal-net-clk
then:
properties:
clocks:
items:
- description: reference clock
- description: alternate reference clock for programmable logic
- description: alternate reference clock

This applies a 3-item length constraint. Could this cause the schema to unconditionally reject valid xlnx,versal-net-clk nodes since it forces the node to have exactly 2 and exactly 3 clocks simultaneously?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
#7 lore raw

Re: [PATCH v4 3/5] dt-bindings: clock: Move xlnx,zynqmp-clk to its own schema

In reply to Michal Simek
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Medium] The regex pattern for `mio_clk` in `clock-names` contains a logic error that fails to correctly…

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The regex pattern for mio_clk in clock-names contains a logic error that fails to correctly constrain the index to 00-77.
- [Low] The example in xlnx,versal-clk.yaml fails schema validation because it wraps a versal-clk clock controller in a zynqmp-firmware node. --

--- Patch [3]: [PATCH v4 3/5] dt-bindings: clock: Move xlnx,zynqmp-clk to its own schema --- commit 718990212b2e54a25ccb16a23d741b1b1a896e2d
Author: Michal Simek <[email protected]>

dt-bindings: clock: Move xlnx,zynqmp-clk to its own schema

The ZynqMP clock controller binding shares only #clock-cells with the Versal bindings. Move it to a dedicated xlnx,zynqmp-clk.yaml schema. Also remove "(Optional clock)" from clock description because it is visible from schema itself.

Quoted 4 lines
Documentation/devicetree/bindings/clock/xlnx,versal-clk.yaml +0 -0
index b1623c2ab0f69..12d060c39bfc4 100644

[ ... ]

Quoted 9 lines

examples:

   - |
     firmware {
       zynqmp_firmware: zynqmp-firmware {
         compatible = "xlnx,zynqmp-firmware";
         method = "smc";
         versal_clk: clock-controller {
           #clock-cells = <1>;
           compatible = "xlnx,versal-clk";

[Severity: Low]
Will this example now fail make dt_binding_check validation?

Because xlnx,zynqmp-firmware.yaml is modified in this patch to add an allOf rule requiring the clock-controller child of zynqmp-firmware to use compatible = "xlnx,zynqmp-clk", this xlnx,versal-clk node inside a zynqmp-firmware example seems like it will trigger a schema validation error.

Quoted 5 lines
           clocks = <&pss_ref_clk>, <&video_clk>, <&pss_alt_ref_clk>;
           clock-names = "pss_ref_clk", "video_clk", "pss_alt_ref_clk";
         };
       };
     };

[ ... ]

Quoted 5 lines
Documentation/devicetree/bindings/clock/xlnx,zynqmp-clk.yaml new file +0 -0
new file mode 100644
index 0000000000000..c64550471581c

[ ... ]

Documentation/devicetree/bindings/clock/xlnx,zynqmp-clk.yaml line 46

Quoted 9 lines
Documentation/devicetree/bindings/clock/xlnx,zynqmp-clk.yaml new file +9 -0
+  clock-names:
+    minItems: 5
+    items:
+      - const: pss_ref_clk
+      - const: video_clk
+      - const: pss_alt_ref_clk
+      - const: aux_ref_clk
+      - const: gt_crx_ref_clk
+      - pattern: "^mio_clk([0-6][0-9]|7[0-7])+.*$"

[Severity: Medium]
Does this pattern correctly constrain the clock index to 00-77?

By combining the + quantifier with .*, this regex allows strings like "mio_clk100" to validate, since the "10" matches the capturing group and the remaining "0" matches ".*". Could this be corrected to avoid permitting out of bounds values?

Quoted 2 lines
Documentation/devicetree/bindings/clock/xlnx,zynqmp-clk.yaml new file +2 -0
+      - pattern: "gem[0-3]+_emio_clk.*$"
+      - pattern: "swdt[0-1]+_ext_clk.*$"
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
#12 lore raw

Re: [PATCH v4 5/5] arm64: versal-net: Switch Versal NET to firmware clock interface

In reply to Michal Simek
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Medium] Device tree binding headers are incorrectly placed in arch/arm64/boot/dts/xilinx/ and duplicate…

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Device tree binding headers are incorrectly placed in arch/arm64/boot/dts/xilinx/ and duplicate existing bindings.
- [Medium] Use of #undef directives in device tree binding headers to remove inherited definitions.
--

--- Patch [5]: [PATCH v4 5/5] arm64: versal-net: Switch Versal NET to firmware clock interface --- commit 768ce0b0d6c0eff83d929d6530cf30c0e1e4baaa
Author: Michal Simek <[email protected]>

arm64: versal-net: Switch Versal NET to firmware clock interface

Switch Versal NET from using fixed clocks to the firmware-based clock interface. Add DT macro headers for Versal NET and base Versal clocks, power domains, and mandatory resets required by the clock dtsi.

Quoted 6 lines
arch/arm64/boot/dts/xilinx/xlnx-versal-clk.h new file +0 -0
new file mode 100644
index 0000000000000..d0c4abf78f307

arch/arm64/boot/dts/xilinx/xlnx-versal-clk.h line 10

Quoted 10 lines
arch/arm64/boot/dts/xilinx/xlnx-versal-clk.h new file +10 -0
@@ -0,0 +1,123 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2019 - 2022, Xilinx, Inc.
+ * Copyright (C) 2022 - 2026, Advanced Micro Devices, Inc.
+ */
+
+#ifndef _XLNX_VERSAL_CLK_H
+#define _XLNX_VERSAL_CLK_H
+
+#define PMC_PLL					1

[Severity: Medium]
Should these device tree binding headers be placed in include/dt-bindings/ instead of arch/arm64/boot/dts/xilinx/?

Placing them in the architecture directory bypasses the convention of having binding definitions act as a shared contract between the device tree and kernel drivers. This applies to xlnx-versal-clk.h, xlnx-versal-power.h, and others introduced here.

[ ... ]

Quoted 5 lines
arch/arm64/boot/dts/xilinx/xlnx-versal-net-clk.h new file +0 -0
new file mode 100644
index 0000000000000..4a6add03c173e

[ ... ]

arch/arm64/boot/dts/xilinx/xlnx-versal-net-clk.h line 32

Quoted 4 lines
arch/arm64/boot/dts/xilinx/xlnx-versal-net-clk.h new file +4 -0
+/* Remove Versal specific node IDs */
+#undef APU_PLL
+#undef RPU_PLL
+#undef CPM_PLL

[Severity: Medium]
Will these undef directives work correctly with the device tree schema tools?

Since schema validation tools typically use simple regex-based parsers rather than a full C preprocessor, they generally ignore undef statements. Could this cause the validation schemas to incorrectly accept the removed IDs?

[ ... ]

Quoted 6 lines
arch/arm64/boot/dts/xilinx/xlnx-versal-resets.h new file +0 -0
new file mode 100644
index 0000000000000..fe00f4a0ba65b

arch/arm64/boot/dts/xilinx/xlnx-versal-resets.h line 10

Quoted 10 lines
arch/arm64/boot/dts/xilinx/xlnx-versal-resets.h new file +10 -0
@@ -0,0 +1,106 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2020 - 2022, Xilinx, Inc.
+ * Copyright (C) 2022 - 2026, Advanced Micro Devices, Inc.
+ */
+
+#ifndef _XLNX_VERSAL_RESETS_H
+#define _XLNX_VERSAL_RESETS_H
+
+#define VERSAL_RST_PMC_POR			(0xc30c001U)

[Severity: Medium]
Does this new file unnecessarily duplicate the already existing reset IDs binding in include/dt-bindings/reset/xlnx-versal-resets.h?

Maintaining duplicate copies of these bindings introduces a risk of the two files drifting out of sync.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
#9 lore raw

Re: [PATCH v4 3/5] dt-bindings: clock: Move xlnx,zynqmp-clk to its own schema

In reply to Michal Simek
Quoted 23 lines · Michal Simek

The ZynqMP clock controller binding shares only #clock-cells with the Versal bindings. Move it to a dedicated xlnx,zynqmp-clk.yaml schema. Also remove "(Optional clock)" from clock description because it is visible from schema itself.

---

Changes in v4:
- Update regex from previous patch

Changes in v3:
- Cover change in zynqmp-firmware.yaml
- Move clock-cells to be the last in the example
- Remove comment around (Optional clock) which is obvious from schema itself

Changes in v2:
- New patch in series
- Split zynqmp-clk from versal-clk

Quoted 6 lines
 .../bindings/clock/xlnx,versal-clk.yaml       | 50 +-------------
 .../bindings/clock/xlnx,zynqmp-clk.yaml       | 68 +++++++++++++++++++
 .../firmware/xilinx/xlnx,zynqmp-firmware.yaml |  7 +-
 3 files changed, 76 insertions(+), 49 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/xlnx,zynqmp-clk.yaml

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/clock/xlnx,versal-clk.example.dtb: zynqmp-firmware (xlnx,zynqmp-firmware): clock-controller:clock-names:0: 'pss_ref_clk' was expected
from schema $id: http://devicetree.org/schemas/firmware/xilinx/xlnx,zynqmp-firmware.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/clock/xlnx,versal-clk.example.dtb: zynqmp-firmware (xlnx,zynqmp-firmware): clock-controller:clock-names:1: 'video_clk' was expected
from schema $id: http://devicetree.org/schemas/firmware/xilinx/xlnx,zynqmp-firmware.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/clock/xlnx,versal-clk.example.dtb: zynqmp-firmware (xlnx,zynqmp-firmware): clock-controller:clock-names: ['ref', 'pl_alt_ref'] is too short
from schema $id: http://devicetree.org/schemas/firmware/xilinx/xlnx,zynqmp-firmware.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/clock/xlnx,versal-clk.example.dtb: zynqmp-firmware (xlnx,zynqmp-firmware): clock-controller:clocks: [[4294967295], [4294967295]] is too short
from schema $id: http://devicetree.org/schemas/firmware/xilinx/xlnx,zynqmp-firmware.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/clock/xlnx,versal-clk.example.dtb: zynqmp-firmware (xlnx,zynqmp-firmware): clock-controller:compatible:0: 'xlnx,zynqmp-clk' was expected
from schema $id: http://devicetree.org/schemas/firmware/xilinx/xlnx,zynqmp-firmware.yaml

doc reference errors (make refcheckdocs):

See https://patchwork.kernel.org/project/devicetree/patch/f6fc3f65475888cd5726e3f2795a110e9f7a79c3.1783495122.git.michal.simek@amd.com

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

author maintainer
#5 lore raw

Re: [PATCH v4 2/5] dt-bindings: clock: versal-clk: Fix mio_clk index range in clock-names pattern

In reply to [email protected]
Quoted 75 lines · On 7/8/26 09:32, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The xlnx,versal-net-clk compatible string matches multiple contradictory if blocks, making valid device tree nodes mathematically impossible to validate. --

--- Patch [2]: [PATCH v4 2/5] dt-bindings: clock: versal-clk: Fix mio_clk index range in clock-names pattern --- commit bbeb0fbfb689e023d79c16fd79850f4f854a36ee
Author: Michal Simek <[email protected]>

dt-bindings: clock: versal-clk: Fix mio_clk index range in clock-names pattern

The clock-names pattern "^mio_clk[00-77]+.*$" was intended to constrain the MIO index to the valid range 00..77 (ZynqMP has 78 MIO pins), but a regex character class cannot express a multi-digit decimal range. Replace the bogus character class with an explicit alternation that enumerates the two-digit decimal values 00..77.

Fixes 03d4a1004053 ("dt-bindings: clock: versal: Convert the xlnx,zynqmp-clk.txt to yaml")

Documentation/devicetree/bindings/clock/xlnx,versal-clk.yaml allOf: · line 121

Quoted 12 lines
Documentation/devicetree/bindings/clock/xlnx,versal-clk.yaml +1 -1
index bef109d163a82..b1623c2ab0f69 100644
@@ -116,7 +116,7 @@ allOf:
              - const: pss_alt_ref_clk
              - const: aux_ref_clk
              - const: gt_crx_ref_clk
-            - pattern: "^mio_clk[00-77]+.*$"
+            - pattern: "^mio_clk([0-6][0-9]|7[0-7])+.*$"
              - pattern: "gem[0-3]+_emio_clk.*$"
              - pattern: "swdt[0-1]+_ext_clk.*$"

[Severity: High]
This is a pre-existing issue and was not introduced by the patch under review, but does the current allOf schema make it impossible to validate xlnx,versal-net-clk nodes?

Since xlnx,versal-net-clk uses xlnx,versal-clk as a fallback string, this first conditional in Documentation/devicetree/bindings/clock/xlnx,versal-clk.yaml will match:

allOf:
- if:
properties:
compatible:
contains:
enum:
- xlnx,versal-clk
then:
properties:
clocks:
items:
- description: reference clock
- description: alternate reference clock for programmable logic

This restricts the node to exactly 2 clocks. However, because both conditions are processed, the following conditional for xlnx,versal-net-clk also matches:

- if:
properties:
compatible:
contains:
enum:
- xlnx,versal-net-clk
then:
properties:
clocks:
items:
- description: reference clock
- description: alternate reference clock for programmable logic
- description: alternate reference clock

Quoted 4 lines

This applies a 3-item length constraint. Could this cause the schema to unconditionally reject valid xlnx,versal-net-clk nodes since it forces the node to have exactly 2 and exactly 3 clocks simultaneously?

This is fixed in 4/5 patch.

M

author maintainer
#8 lore raw

Re: [PATCH v4 3/5] dt-bindings: clock: Move xlnx,zynqmp-clk to its own schema

In reply to [email protected]
Quoted 31 lines · On 7/8/26 09:37, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The regex pattern for mio_clk in clock-names contains a logic error that fails to correctly constrain the index to 00-77.
- [Low] The example in xlnx,versal-clk.yaml fails schema validation because it wraps a versal-clk clock controller in a zynqmp-firmware node. --

--- Patch [3]: [PATCH v4 3/5] dt-bindings: clock: Move xlnx,zynqmp-clk to its own schema --- commit 718990212b2e54a25ccb16a23d741b1b1a896e2d
Author: Michal Simek <[email protected]>

dt-bindings: clock: Move xlnx,zynqmp-clk to its own schema

The ZynqMP clock controller binding shares only #clock-cells with the Versal bindings. Move it to a dedicated xlnx,zynqmp-clk.yaml schema. Also remove "(Optional clock)" from clock description because it is visible from schema itself.

Quoted 4 lines
Documentation/devicetree/bindings/clock/xlnx,versal-clk.yaml +0 -0
index b1623c2ab0f69..12d060c39bfc4 100644

[ ... ]

Quoted 9 lines
  examples:
    - |
      firmware {
        zynqmp_firmware: zynqmp-firmware {
          compatible = "xlnx,zynqmp-firmware";
          method = "smc";
          versal_clk: clock-controller {
            #clock-cells = <1>;
            compatible = "xlnx,versal-clk";
Quoted 8 lines

[Severity: Low]
Will this example now fail make dt_binding_check validation?

Because xlnx,zynqmp-firmware.yaml is modified in this patch to add an allOf rule requiring the clock-controller child of zynqmp-firmware to use compatible = "xlnx,zynqmp-clk", this xlnx,versal-clk node inside a zynqmp-firmware example seems like it will trigger a schema validation error.

that fix is in 4/5. I will move it to 3/5.

Quoted 22 lines
Quoted 5 lines
            clocks = <&pss_ref_clk>, <&video_clk>, <&pss_alt_ref_clk>;
            clock-names = "pss_ref_clk", "video_clk", "pss_alt_ref_clk";
          };
        };
      };

[ ... ]

Quoted 5 lines
Documentation/devicetree/bindings/clock/xlnx,zynqmp-clk.yaml new file +0 -0
new file mode 100644
index 0000000000000..c64550471581c

[ ... ]

Documentation/devicetree/bindings/clock/xlnx,zynqmp-clk.yaml line 46

Quoted 9 lines
Documentation/devicetree/bindings/clock/xlnx,zynqmp-clk.yaml new file +9 -0
+  clock-names:
+    minItems: 5
+    items:
+      - const: pss_ref_clk
+      - const: video_clk
+      - const: pss_alt_ref_clk
+      - const: aux_ref_clk
+      - const: gt_crx_ref_clk
+      - pattern: "^mio_clk([0-6][0-9]|7[0-7])+.*$"
Quoted 7 lines

[Severity: Medium]
Does this pattern correctly constrain the clock index to 00-77?

By combining the + quantifier with .*, this regex allows strings like "mio_clk100" to validate, since the "10" matches the capturing group and the remaining "0" matches ".*". Could this be corrected to avoid permitting out of bounds values?

That's correct but that's just fix in 2/5 where +.* was there before too.
It means yes it is possible that user will pass mio_clk100 and it won't be noticed. But I don't have any reference that anybody is really using it and I don't want to break them.

Thanks,
Michal

author maintainer
#13 lore raw

Re: [PATCH v4 5/5] arm64: versal-net: Switch Versal NET to firmware clock interface

In reply to [email protected]
Quoted 36 lines · On 7/8/26 09:42, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Device tree binding headers are incorrectly placed in arch/arm64/boot/dts/xilinx/ and duplicate existing bindings.
- [Medium] Use of #undef directives in device tree binding headers to remove inherited definitions.
--

--- Patch [5]: [PATCH v4 5/5] arm64: versal-net: Switch Versal NET to firmware clock interface --- commit 768ce0b0d6c0eff83d929d6530cf30c0e1e4baaa
Author: Michal Simek <[email protected]>

arm64: versal-net: Switch Versal NET to firmware clock interface

Switch Versal NET from using fixed clocks to the firmware-based clock interface. Add DT macro headers for Versal NET and base Versal clocks, power domains, and mandatory resets required by the clock dtsi.

Quoted 6 lines
arch/arm64/boot/dts/xilinx/xlnx-versal-clk.h new file +0 -0
new file mode 100644
index 0000000000000..d0c4abf78f307

arch/arm64/boot/dts/xilinx/xlnx-versal-clk.h line 10

Quoted 10 lines
arch/arm64/boot/dts/xilinx/xlnx-versal-clk.h new file +10 -0
@@ -0,0 +1,123 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2019 - 2022, Xilinx, Inc.
+ * Copyright (C) 2022 - 2026, Advanced Micro Devices, Inc.
+ */
+
+#ifndef _XLNX_VERSAL_CLK_H
+#define _XLNX_VERSAL_CLK_H
+
+#define PMC_PLL					1

[Severity: Medium]
Should these device tree binding headers be placed in include/dt-bindings/ instead of arch/arm64/boot/dts/xilinx/?

Quoted 4 lines

Placing them in the architecture directory bypasses the convention of having binding definitions act as a shared contract between the device tree and kernel drivers. This applies to xlnx-versal-clk.h, xlnx-versal-power.h, and others introduced here.

These are just holding constants and current file sin dt-bindings should be deprecated as is done by

commit f0ceedd52a69a8bf63778b1fe9e1c10e02ecd3fd
dt-bindings: xilinx: Deprecate header with firmware constants

Quoted 17 lines

[ ... ]

Quoted 5 lines
arch/arm64/boot/dts/xilinx/xlnx-versal-net-clk.h new file +0 -0
new file mode 100644
index 0000000000000..4a6add03c173e

[ ... ]

arch/arm64/boot/dts/xilinx/xlnx-versal-net-clk.h line 32

Quoted 4 lines
arch/arm64/boot/dts/xilinx/xlnx-versal-net-clk.h new file +4 -0
+/* Remove Versal specific node IDs */
+#undef APU_PLL
+#undef RPU_PLL
+#undef CPM_PLL

[Severity: Medium]
Will these undef directives work correctly with the device tree schema tools?

Quoted 3 lines

Since schema validation tools typically use simple regex-based parsers rather than a full C preprocessor, they generally ignore undef statements. Could this cause the validation schemas to incorrectly accept the removed IDs?

validation is not affected.

Quoted 15 lines

[ ... ]

Quoted 12 lines
arch/arm64/boot/dts/xilinx/xlnx-versal-resets.h new file +6 -0
new file mode 100644
index 0000000000000..fe00f4a0ba65b
@@ -0,0 +1,106 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2020 - 2022, Xilinx, Inc.
+ * Copyright (C) 2022 - 2026, Advanced Micro Devices, Inc.
+ */
+
Quoted 8 lines

arch/arm64/boot/dts/xilinx/xlnx-versal-resets.h line 10

Quoted 4 lines
arch/arm64/boot/dts/xilinx/xlnx-versal-resets.h new file +4 -0
+#ifndef _XLNX_VERSAL_RESETS_H
+#define _XLNX_VERSAL_RESETS_H
+
+#define VERSAL_RST_PMC_POR			(0xc30c001U)

[Severity: Medium]
Does this new file unnecessarily duplicate the already existing reset IDs binding in include/dt-bindings/reset/xlnx-versal-resets.h?

as above.

Thanks,
Michal