Skip to contentSkip to conversation

dt-bindings: dma: Add YAML schemas for the generic DMA bindings

PATCH In review Maxime Ripard 1 participant 4 messages Jul 20, 2019

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

PATCH 1/3 dt-bindings: dma: Add YAML schemas for the generic DMA bindings

The DMA controllers and consumers have a bunch of generic properties that are needed in a device tree. Add a YAML schemas for those.

---

Changes from v1:
- Dropped the dma consumer schemas
- Fixed the node name of the examples
- Enhanced a bit the description for dma-requests in case of a router
- Split the bindings in two to handle the router and controller case separately
- Made #dma-cells required

---
 .../devicetree/bindings/dma/dma-common.yaml   |  43 +++++++
 .../bindings/dma/dma-controller.yaml          |  35 ++++++
 .../devicetree/bindings/dma/dma-router.yaml   |  50 ++++++++
 Documentation/devicetree/bindings/dma/dma.txt | 114 +-----------------
 4 files changed, 129 insertions(+), 113 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/dma-common.yaml
 create mode 100644 Documentation/devicetree/bindings/dma/dma-controller.yaml
 create mode 100644 Documentation/devicetree/bindings/dma/dma-router.yaml
Documentation/devicetree/bindings/dma/dma-common.yaml new file +43 -0
new file mode 100644
index 000000000000..422fd6c8b0ce
@@ -0,0 +1,43 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/dma/dma-common.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: DMA Engine Generic Binding
+
+maintainers:
+  - Vinod Koul <[email protected]>
+
+description:
+  Generic binding to provide a way for a driver using DMA Engine to
+  retrieve the DMA request or channel information that goes from a
+  hardware device to a DMA controller.
+
+properties:
+  "#dma-cells":
+    minimum: 1
+    # Should be enough
+    maximum: 255
+    description:
+      Used to provide DMA controller specific information.
+
+  dma-channel-masks:
+    $ref: /schemas/types.yaml#definitions/uint32
+    description:
+      Bitmask of available DMA channels in ascending order that are
+      not reserved by firmware and are available to the
+      kernel. i.e. first channel corresponds to LSB.
+
+  dma-channels:
+    $ref: /schemas/types.yaml#definitions/uint32
+    description:
+      Number of DMA channels supported by the controller.
+
+  dma-requests:
+    $ref: /schemas/types.yaml#definitions/uint32
+    description:
+      Number of DMA request signals supported by the controller.
+
+required:
+  - "#dma-cells"
Documentation/devicetree/bindings/dma/dma-controller.yaml new file +35 -0
new file mode 100644
index 000000000000..c39f6de76670
@@ -0,0 +1,35 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/dma/dma-controller.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: DMA Controller Generic Binding
+
+maintainers:
+  - Vinod Koul <[email protected]>
+
+allOf:
+  - $ref: "dma-common.yaml#"
+
+# Everything else is described in the common file
+properties:
+  $nodename:
+    pattern: "^dma-controller(@.*)?$"
+
+examples:
+  - |
+    dma: dma-controller@48000000 {
+        compatible = "ti,omap-sdma";
+        reg = <0x48000000 0x1000>;
+        interrupts = <0 12 0x4
+                      0 13 0x4
+                      0 14 0x4
+                      0 15 0x4>;
+        #dma-cells = <1>;
+        dma-channels = <32>;
+        dma-requests = <127>;
+        dma-channel-mask = <0xfffe>;
+    };
+
+...
Documentation/devicetree/bindings/dma/dma-router.yaml new file +50 -0

50 lines not on this page · raw message

Documentation/devicetree/bindings/dma/dma.txt +1 -113

114 lines not on this page · raw message

Signature · 1 line
2.21.0
#1 lore raw

PATCH 2/3 dt-bindings: dma: Convert Allwinner A10 DMA to a schema

The older Allwinner SoCs have a DMA controller supported in Linux, with a matching Device Tree binding.

Now that we have the DT validation in place, let's convert the device tree bindings for that controller over to a YAML schemas.

---
 .../bindings/dma/allwinner,sun4i-a10-dma.yaml | 55 +++++++++++++++++++
 .../devicetree/bindings/dma/sun4i-dma.txt     | 45 ---------------
 2 files changed, 55 insertions(+), 45 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/allwinner,sun4i-a10-dma.yaml
 delete mode 100644 Documentation/devicetree/bindings/dma/sun4i-dma.txt
Documentation/devicetree/bindings/dma/allwinner,sun4i-a10-dma.yaml new file +55 -0
new file mode 100644
index 000000000000..15abc0f9429f
@@ -0,0 +1,55 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/dma/allwinner,sun4i-a10-dma.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Allwinner A10 DMA Controller Device Tree Bindings
+
+maintainers:
+  - Chen-Yu Tsai <[email protected]>
+  - Maxime Ripard <[email protected]>
+
+allOf:
+  - $ref: "dma-controller.yaml#"
+
+properties:
+  "#dma-cells":
+    const: 2
+    description:
+      The first cell is either 0 or 1, the former to use the normal
+      DMA, 1 for dedicated DMA. The second cell is the request line
+      number.
+
+  compatible:
+    const: allwinner,sun4i-a10-dma
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+required:
+  - "#dma-cells"
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+
+additionalProperties: false
+
+examples:
+  - |
+    dma: dma-controller@1c02000 {
+        compatible = "allwinner,sun4i-a10-dma";
+        reg = <0x01c02000 0x1000>;
+        interrupts = <27>;
+        clocks = <&ahb_gates 6>;
+        #dma-cells = <2>;
+    };
+
+...
Documentation/devicetree/bindings/dma/sun4i-dma.txt deleted +0 -45

45 lines not on this page · raw message

Signature · 1 line
2.21.0
#2 lore raw

PATCH 3/3 dt-bindings: dma: Convert Allwinner A31 and A64 DMA to a schema

In reply to Maxime Ripard

The newer Allwinner SoCs have a DMA controller supported in Linux, with a matching Device Tree binding.

Now that we have the DT validation in place, let's convert the device tree bindings for that controller over to a YAML schemas.

---
 .../dma/allwinner,sun50i-a64-dma.yaml         | 88 +++++++++++++++++++
 .../bindings/dma/allwinner,sun6i-a31-dma.yaml | 62 +++++++++++++
 .../devicetree/bindings/dma/sun6i-dma.txt     | 81 -----------------
 3 files changed, 150 insertions(+), 81 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml
 create mode 100644 Documentation/devicetree/bindings/dma/allwinner,sun6i-a31-dma.yaml
 delete mode 100644 Documentation/devicetree/bindings/dma/sun6i-dma.txt
Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml new file +88 -0
new file mode 100644
index 000000000000..4cb9d6b93138
@@ -0,0 +1,88 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/dma/allwinner,sun50i-a64-dma.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Allwinner A64 DMA Controller Device Tree Bindings
+
+maintainers:
+  - Chen-Yu Tsai <[email protected]>
+  - Maxime Ripard <[email protected]>
+
+allOf:
+  - $ref: "dma-controller.yaml#"
+
+properties:
+  "#dma-cells":
+    const: 1
+    description: The cell is the request line number.
+
+  compatible:
+    enum:
+      - allwinner,sun50i-a64-dma
+      - allwinner,sun50i-h6-dma
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    minItems: 1
+    maxItems: 2
+
+  clock-names:
+    items:
+      - const: bus
+      - const: mbus
+
+  resets:
+    maxItems: 1
+
+required:
+  - "#dma-cells"
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - resets
+  - dma-channels
+
+if:
+  properties:
+    compatible:
+      const: allwinner,sun50i-h6-dma
+
+then:
+  properties:
+    clocks:
+      maxItems: 2
+
+  required:
+    - clock-names
+
+else:
+  properties:
+    clocks:
+      maxItems: 1
+
+# FIXME: We should set it, but it would report all the generic
+# properties as additional properties.
+# additionalProperties: false
+
+examples:
+  - |
+    dma: dma-controller@1c02000 {
+        compatible = "allwinner,sun50i-a64-dma";
+        reg = <0x01c02000 0x1000>;
+        interrupts = <0 50 4>;
+        clocks = <&ccu 30>;
+        dma-channels = <8>;
+        dma-requests = <27>;
+        resets = <&ccu 7>;
+        #dma-cells = <1>;
+    };
+
+...
Documentation/devicetree/bindings/dma/allwinner,sun6i-a31-dma.yaml new file +62 -0

62 lines not on this page · raw message

Documentation/devicetree/bindings/dma/sun6i-dma.txt deleted +0 -81

81 lines not on this page · raw message

Signature · 1 line
2.21.0
#3 lore raw
In reply to Maxime Ripard
Quoted 43 lines · Maxime Ripard

The DMA controllers and consumers have a bunch of generic properties that are needed in a device tree. Add a YAML schemas for those.

---

Changes from v1:
- Dropped the dma consumer schemas
- Fixed the node name of the examples
- Enhanced a bit the description for dma-requests in case of a router
- Split the bindings in two to handle the router and controller case separately
- Made #dma-cells required

---
 .../devicetree/bindings/dma/dma-common.yaml   |  43 +++++++
 .../bindings/dma/dma-controller.yaml          |  35 ++++++
 .../devicetree/bindings/dma/dma-router.yaml   |  50 ++++++++
 Documentation/devicetree/bindings/dma/dma.txt | 114 +-----------------
 4 files changed, 129 insertions(+), 113 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/dma-common.yaml
 create mode 100644 Documentation/devicetree/bindings/dma/dma-controller.yaml
 create mode 100644 Documentation/devicetree/bindings/dma/dma-router.yaml
Documentation/devicetree/bindings/dma/dma-common.yaml new file +13 -0
new file mode 100644
index 000000000000..422fd6c8b0ce
@@ -0,0 +1,43 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/dma/dma-common.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: DMA Engine Generic Binding
+
+maintainers:
+  - Vinod Koul <[email protected]>
+
+description:
+  Generic binding to provide a way for a driver using DMA Engine to

Documentation/devicetree/bindings/dma/dma-common.yaml line 23

Quoted 10 lines
Documentation/devicetree/bindings/dma/dma-common.yaml new file +10 -0
+  retrieve the DMA request or channel information that goes from a
+  hardware device to a DMA controller.
+
+properties:
+  "#dma-cells":
+    minimum: 1
+    # Should be enough
+    maximum: 255
+    description:
+      Used to provide DMA controller specific information.

We need a select statement here, otherwise it will try to validate every node and report dma-cells as missing. I'll send a v3.

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel