Skip to contentSkip to conversation

dt-bindings: dma: mv-xor-v2: Convert to dtschema

PATCH Superseded Shresth Prasad 2 participants 2 messages Jul 7, 2024

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 dt-bindings: dma: mv-xor-v2: Convert to dtschema

Convert txt bindings of Marvell XOR v2 engines to dtschema to allow for validation.

Also add missing property dma-coherent as drivers/dma/mv_xor_v2.c calls various dma-coherent memory functions.

---
Changes in v2:
- Update commit message to indicate addition of dma-coherent
- Change maintainer
- Change compatible section
- Add minItems to clock-names
- Remove "location and length" from reg description
- List out clock-names items in if:
- Create two variants of if:

Tested against marvell/armada-7040-db.dtb, marvell/armada-7040-mochabin.dtb and marvell/armada-8080-db.dtb

 .../bindings/dma/marvell,xor-v2.yaml          | 86 +++++++++++++++++++
 .../devicetree/bindings/dma/mv-xor-v2.txt     | 28 ------
 2 files changed, 86 insertions(+), 28 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/marvell,xor-v2.yaml
 delete mode 100644 Documentation/devicetree/bindings/dma/mv-xor-v2.txt
Documentation/devicetree/bindings/dma/marvell,xor-v2.yaml new file +86 -0
new file mode 100644
index 000000000000..da58f6e0feab
@@ -0,0 +1,86 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/dma/marvell,xor-v2.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Marvell XOR v2 engines
+
+maintainers:
+  - Hans de Goede <[email protected]>
+
+properties:
+  compatible:
+    oneOf:
+      - const: marvell,xor-v2
+      - items:
+          - enum:
+              - marvell,armada-7k-xor
+          - const: marvell,xor-v2
+
+  reg:
+    items:
+      - description: DMA registers
+      - description: global registers
+
+  clocks:
+    minItems: 1
+    maxItems: 2
+
+  clock-names:
+    minItems: 1
+    items:
+      - const: core
+      - const: reg
+
+  msi-parent:
+    description:
+      Phandle to the MSI-capable interrupt controller used for
+      interrupts.
+    maxItems: 1
+
+  dma-coherent: true
+
+required:
+  - compatible
+  - reg
+  - msi-parent
+  - dma-coherent
+
+allOf:
+  - if:
+      properties:
+        clocks:
+          maxItems: 1
+    then:
+      properties:
+        clock-names:
+          items:
+            - const: core
+  - if:
+      properties:
+        clocks:
+          minItems: 2
+      required:
+        - clocks
+    then:
+      properties:
+        clock-names:
+          items:
+            - const: core
+            - const: reg
+      required:
+        - clock-names
+
+additionalProperties: false
+
+examples:
+  - |
+    xor0@6a0000 {
+        compatible = "marvell,armada-7k-xor", "marvell,xor-v2";
+        reg = <0x6a0000 0x1000>, <0x6b0000 0x1000>;
+        clocks = <&ap_clk 0>, <&ap_clk 1>;
+        clock-names = "core", "reg";
+        msi-parent = <&gic_v2m0>;
+        dma-coherent;
+    };
Documentation/devicetree/bindings/dma/mv-xor-v2.txt deleted +0 -28
deleted file mode 100644
index 9c38bbe7e6d7..000000000000
@@ -1,28 +0,0 @@
-* Marvell XOR v2 engines
-
-Required properties:
-- compatible: one of the following values:
-    "marvell,armada-7k-xor"
-    "marvell,xor-v2"
-- reg: Should contain registers location and length (two sets)
-    the first set is the DMA registers
-    the second set is the global registers
-- msi-parent: Phandle to the MSI-capable interrupt controller used for
-  interrupts.
-
-Optional properties:
-- clocks: Optional reference to the clocks used by the XOR engine.
-- clock-names: mandatory if there is a second clock, in this case the
-   name must be "core" for the first clock and "reg" for the second
-   one
-
-
-Example:
-
-	xor0@400000 {
-		compatible = "marvell,xor-v2";
-		reg = <0x400000 0x1000>,
-		      <0x410000 0x1000>;
-		msi-parent = <&gic_v2m0>;
-		dma-coherent;
-	};
Signature · 1 line
2.45.2
#1 lore raw
Quoted 32 lines · Shresth Prasad

Convert txt bindings of Marvell XOR v2 engines to dtschema to allow for validation.

Also add missing property dma-coherent as drivers/dma/mv_xor_v2.c calls various dma-coherent memory functions.

---
Changes in v2:
- Update commit message to indicate addition of dma-coherent
- Change maintainer
- Change compatible section
- Add minItems to clock-names
- Remove "location and length" from reg description
- List out clock-names items in if:
- Create two variants of if:

Tested against marvell/armada-7040-db.dtb, marvell/armada-7040-mochabin.dtb and marvell/armada-8080-db.dtb

 .../bindings/dma/marvell,xor-v2.yaml          | 86 +++++++++++++++++++
 .../devicetree/bindings/dma/mv-xor-v2.txt     | 28 ------
 2 files changed, 86 insertions(+), 28 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/marvell,xor-v2.yaml
 delete mode 100644 Documentation/devicetree/bindings/dma/mv-xor-v2.txt
Documentation/devicetree/bindings/dma/marvell,xor-v2.yaml new file +0 -0
new file mode 100644
index 000000000000..da58f6e0feab

Documentation/devicetree/bindings/dma/marvell,xor-v2.yaml line 10

Quoted 10 lines
Documentation/devicetree/bindings/dma/marvell,xor-v2.yaml new file +10 -0
@@ -0,0 +1,86 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/dma/marvell,xor-v2.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Marvell XOR v2 engines
+
+maintainers:
+  - Hans de Goede <[email protected]>

I don't think Hans maintains this platform - Marvell SoCs. Didn't we talk already what is "platform"?

Quoted 7 lines
Documentation/devicetree/bindings/dma/marvell,xor-v2.yaml new file +7 -0
+
+properties:
+  compatible:
+    oneOf:
+      - const: marvell,xor-v2
+      - items:
+          - enum:

Documentation/devicetree/bindings/dma/marvell,xor-v2.yaml line 54

Quoted 10 lines
Documentation/devicetree/bindings/dma/marvell,xor-v2.yaml new file +9 -0
+              - marvell,armada-7k-xor
+          - const: marvell,xor-v2
+
 
+
+allOf:
+  - if:
+      properties:
+        clocks:
+          maxItems: 1

Still not much improved. There are plenty of examples how this is done, so please do not invent one, entirely new style. Think for a sec, why doing things differently? Why this code is the first example of such syntax?

I asked to limit it pear each variant.

https://elixir.bootlin.com/linux/v6.8/source/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml#L132

Quoted 15 lines
Documentation/devicetree/bindings/dma/marvell,xor-v2.yaml new file +15 -0
+    then:
+      properties:
+        clock-names:
+          items:
+            - const: core
+  - if:
+      properties:
+        clocks:
+          minItems: 2
+      required:
+        - clocks
+    then:
+      properties:
+        clock-names:
+          items:

Documentation/devicetree/bindings/dma/marvell,xor-v2.yaml line 79

Quoted 10 lines
Documentation/devicetree/bindings/dma/marvell,xor-v2.yaml new file +10 -0
+            - const: core
+            - const: reg
+      required:
+        - clock-names
+
+additionalProperties: false
+
+examples:
+  - |
+    xor0@6a0000 {

xor@6a0000

Best regards,
Krzysztof