diff mbox series

dt-bindings: dma: fsl,imx-dma: Convert to dtschema

Message ID 20240530072113.30410-1-animeshagarwal28@gmail.com (mailing list archive)
State Superseded
Headers show
Series dt-bindings: dma: fsl,imx-dma: Convert to dtschema | expand

Commit Message

Animesh Agarwal May 30, 2024, 7:21 a.m. UTC
Convert the fsl i.MX DMA controller bindings to DT schema

Signed-off-by: Animesh Agarwal <animeshagarwal28@gmail.com>
---
 .../devicetree/bindings/dma/fsl,imx-dma.yaml  | 58 +++++++++++++++++++
 .../devicetree/bindings/dma/fsl-imx-dma.txt   | 50 ----------------
 2 files changed, 58 insertions(+), 50 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/fsl,imx-dma.yaml
 delete mode 100644 Documentation/devicetree/bindings/dma/fsl-imx-dma.txt

Comments

Frank Li May 30, 2024, 4:06 p.m. UTC | #1
On Thu, May 30, 2024 at 12:51:07PM +0530, Animesh Agarwal wrote:
> Convert the fsl i.MX DMA controller bindings to DT schema

nit: need "." after sentence.

> 
> Signed-off-by: Animesh Agarwal <animeshagarwal28@gmail.com>
> ---
>  .../devicetree/bindings/dma/fsl,imx-dma.yaml  | 58 +++++++++++++++++++
>  .../devicetree/bindings/dma/fsl-imx-dma.txt   | 50 ----------------
>  2 files changed, 58 insertions(+), 50 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/dma/fsl,imx-dma.yaml
>  delete mode 100644 Documentation/devicetree/bindings/dma/fsl-imx-dma.txt
> 
> diff --git a/Documentation/devicetree/bindings/dma/fsl,imx-dma.yaml b/Documentation/devicetree/bindings/dma/fsl,imx-dma.yaml
> new file mode 100644
> index 000000000000..f36ab5425bdb
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/dma/fsl,imx-dma.yaml
> @@ -0,0 +1,58 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/dma/fsl,imx-dma.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Freescale Direct Memory Access (DMA) Controller for i.MX
> +
> +maintainers:
> +  - Animesh Agarwal <animeshagarwal28@gmail.com>
> +
> +allOf:
> +  - $ref: dma-controller.yaml#
> +
> +properties:
> +  compatible:
> +    enum:
> +      - fsl,imx1-dma
> +      - fsl,imx21-dma
> +      - fsl,imx27-dma
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    description: |
> +      First item should be DMA interrupt, second one is optional and
> +      should contain DMA Error interrupt.

items:
  - description: DMA complete interrupt
  - description: DMA Error interrupt

> +    minItems: 1
> +    maxItems: 2
> +
> +  "#dma-cells":
> +    const: 1
> +
> +  dma-channels:
> +    const: 16

I think it should be maximum: 16

> +
> +  dma-requests:
> +    description: |
> +      Number of DMA requests supported.

No "|" need here.

> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +  - "#dma-cells"
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    dma: dma-controller@10001000 {

needn't label "dma".

> +      compatible = "fsl,imx27-dma";
> +      reg = <0x10001000 0x1000>;
> +      interrupts = <32 33>;
> +      #dma-cells = <1>;
> +      dma-channels = <16>;
> +    };
> diff --git a/Documentation/devicetree/bindings/dma/fsl-imx-dma.txt b/Documentation/devicetree/bindings/dma/fsl-imx-dma.txt
> deleted file mode 100644
> index 1c9929d53727..000000000000
> --- a/Documentation/devicetree/bindings/dma/fsl-imx-dma.txt
> +++ /dev/null
> @@ -1,50 +0,0 @@
> -* Freescale Direct Memory Access (DMA) Controller for i.MX
> -
> -This document will only describe differences to the generic DMA Controller and
> -DMA request bindings as described in dma/dma.txt .
> -
> -* DMA controller
> -
> -Required properties:
> -- compatible : Should be "fsl,<chip>-dma". chip can be imx1, imx21 or imx27
> -- reg : Should contain DMA registers location and length
> -- interrupts : First item should be DMA interrupt, second one is optional and
> -    should contain DMA Error interrupt
> -- #dma-cells : Has to be 1. imx-dma does not support anything else.
> -
> -Optional properties:
> -- dma-channels : Number of DMA channels supported. Should be 16.
> -- #dma-channels : deprecated
> -- dma-requests : Number of DMA requests supported.
> -- #dma-requests : deprecated
> -
> -Example:
> -
> -	dma: dma@10001000 {
> -		compatible = "fsl,imx27-dma";
> -		reg = <0x10001000 0x1000>;
> -		interrupts = <32 33>;
> -		#dma-cells = <1>;
> -		dma-channels = <16>;
> -	};
> -
> -
> -* DMA client
> -
> -Clients have to specify the DMA requests with phandles in a list.
> -
> -Required properties:
> -- dmas: List of one or more DMA request specifiers. One DMA request specifier
> -    consists of a phandle to the DMA controller followed by the integer
> -    specifying the request line.
> -- dma-names: List of string identifiers for the DMA requests. For the correct
> -    names, have a look at the specific client driver.
> -
> -Example:
> -
> -	sdhci1: sdhci@10013000 {
> -		...
> -		dmas = <&dma 7>;
> -		dma-names = "rx-tx";
> -		...
> -	};
> -- 
> 2.45.1
>
Animesh Agarwal May 31, 2024, 8:35 a.m. UTC | #2
On Thu, May 30, 2024 at 9:36 PM Frank Li <Frank.li@nxp.com> wrote:
>
> On Thu, May 30, 2024 at 12:51:07PM +0530, Animesh Agarwal wrote:
> > Convert the fsl i.MX DMA controller bindings to DT schema
>
> nit: need "." after sentence.

Sorry for the typo here.

> >
> > Signed-off-by: Animesh Agarwal <animeshagarwal28@gmail.com>
> > ---
> >  .../devicetree/bindings/dma/fsl,imx-dma.yaml  | 58 +++++++++++++++++++
> >  .../devicetree/bindings/dma/fsl-imx-dma.txt   | 50 ----------------
> >  2 files changed, 58 insertions(+), 50 deletions(-)
> >  create mode 100644 Documentation/devicetree/bindings/dma/fsl,imx-dma.yaml
> >  delete mode 100644 Documentation/devicetree/bindings/dma/fsl-imx-dma.txt
> >
> > diff --git a/Documentation/devicetree/bindings/dma/fsl,imx-dma.yaml b/Documentation/devicetree/bindings/dma/fsl,imx-dma.yaml
> > new file mode 100644
> > index 000000000000..f36ab5425bdb
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/dma/fsl,imx-dma.yaml
> > @@ -0,0 +1,58 @@
> > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/dma/fsl,imx-dma.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Freescale Direct Memory Access (DMA) Controller for i.MX
> > +
> > +maintainers:
> > +  - Animesh Agarwal <animeshagarwal28@gmail.com>
> > +
> > +allOf:
> > +  - $ref: dma-controller.yaml#
> > +
> > +properties:
> > +  compatible:
> > +    enum:
> > +      - fsl,imx1-dma
> > +      - fsl,imx21-dma
> > +      - fsl,imx27-dma
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  interrupts:
> > +    description: |
> > +      First item should be DMA interrupt, second one is optional and
> > +      should contain DMA Error interrupt.
>
> items:
>   - description: DMA complete interrupt
>   - description: DMA Error interrupt

I'll add this in v2.
>
> > +    minItems: 1
> > +    maxItems: 2
> > +
> > +  "#dma-cells":
> > +    const: 1
> > +
> > +  dma-channels:
> > +    const: 16
>
> I think it should be maximum: 16

Agreed! Changing it for v2.

>
> > +
> > +  dma-requests:
> > +    description: |
> > +      Number of DMA requests supported.
>
> No "|" need here.

Removing this.

>
> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +  - interrupts
> > +  - "#dma-cells"
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > +  - |
> > +    dma: dma-controller@10001000 {
>
> needn't label "dma".

Removing this.

>
> > +      compatible = "fsl,imx27-dma";
> > +      reg = <0x10001000 0x1000>;
> > +      interrupts = <32 33>;
> > +      #dma-cells = <1>;
> > +      dma-channels = <16>;
> > +    };
> > diff --git a/Documentation/devicetree/bindings/dma/fsl-imx-dma.txt b/Documentation/devicetree/bindings/dma/fsl-imx-dma.txt
> > deleted file mode 100644
> > index 1c9929d53727..000000000000
> > --- a/Documentation/devicetree/bindings/dma/fsl-imx-dma.txt
> > +++ /dev/null
> > @@ -1,50 +0,0 @@
> > -* Freescale Direct Memory Access (DMA) Controller for i.MX
> > -
> > -This document will only describe differences to the generic DMA Controller and
> > -DMA request bindings as described in dma/dma.txt .
> > -
> > -* DMA controller
> > -
> > -Required properties:
> > -- compatible : Should be "fsl,<chip>-dma". chip can be imx1, imx21 or imx27
> > -- reg : Should contain DMA registers location and length
> > -- interrupts : First item should be DMA interrupt, second one is optional and
> > -    should contain DMA Error interrupt
> > -- #dma-cells : Has to be 1. imx-dma does not support anything else.
> > -
> > -Optional properties:
> > -- dma-channels : Number of DMA channels supported. Should be 16.
> > -- #dma-channels : deprecated
> > -- dma-requests : Number of DMA requests supported.
> > -- #dma-requests : deprecated
> > -
> > -Example:
> > -
> > -     dma: dma@10001000 {
> > -             compatible = "fsl,imx27-dma";
> > -             reg = <0x10001000 0x1000>;
> > -             interrupts = <32 33>;
> > -             #dma-cells = <1>;
> > -             dma-channels = <16>;
> > -     };
> > -
> > -
> > -* DMA client
> > -
> > -Clients have to specify the DMA requests with phandles in a list.
> > -
> > -Required properties:
> > -- dmas: List of one or more DMA request specifiers. One DMA request specifier
> > -    consists of a phandle to the DMA controller followed by the integer
> > -    specifying the request line.
> > -- dma-names: List of string identifiers for the DMA requests. For the correct
> > -    names, have a look at the specific client driver.
> > -
> > -Example:
> > -
> > -     sdhci1: sdhci@10013000 {
> > -             ...
> > -             dmas = <&dma 7>;
> > -             dma-names = "rx-tx";
> > -             ...
> > -     };
> > --
> > 2.45.1
> >
Daniel Baluta June 4, 2024, 12:50 p.m. UTC | #3
On Thu, May 30, 2024 at 7:06 PM Frank Li <Frank.li@nxp.com> wrote:
>
> On Thu, May 30, 2024 at 12:51:07PM +0530, Animesh Agarwal wrote:
> > Convert the fsl i.MX DMA controller bindings to DT schema
>
> nit: need "." after sentence.
>
> >
> > Signed-off-by: Animesh Agarwal <animeshagarwal28@gmail.com>
> > ---
> >  .../devicetree/bindings/dma/fsl,imx-dma.yaml  | 58 +++++++++++++++++++
> >  .../devicetree/bindings/dma/fsl-imx-dma.txt   | 50 ----------------
> >  2 files changed, 58 insertions(+), 50 deletions(-)
> >  create mode 100644 Documentation/devicetree/bindings/dma/fsl,imx-dma.yaml
> >  delete mode 100644 Documentation/devicetree/bindings/dma/fsl-imx-dma.txt
> >
> > diff --git a/Documentation/devicetree/bindings/dma/fsl,imx-dma.yaml b/Documentation/devicetree/bindings/dma/fsl,imx-dma.yaml
> > new file mode 100644
> > index 000000000000..f36ab5425bdb
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/dma/fsl,imx-dma.yaml
> > @@ -0,0 +1,58 @@
> > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/dma/fsl,imx-dma.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Freescale Direct Memory Access (DMA) Controller for i.MX
> > +
> > +maintainers:
> > +  - Animesh Agarwal <animeshagarwal28@gmail.com>
> > +
> > +allOf:
> > +  - $ref: dma-controller.yaml#
> > +
> > +properties:
> > +  compatible:
> > +    enum:
> > +      - fsl,imx1-dma
> > +      - fsl,imx21-dma
> > +      - fsl,imx27-dma
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  interrupts:
> > +    description: |
> > +      First item should be DMA interrupt, second one is optional and
> > +      should contain DMA Error interrupt.
>
> items:
>   - description: DMA complete interrupt
>   - description: DMA Error interrupt
>
> > +    minItems: 1
> > +    maxItems: 2
> > +
> > +  "#dma-cells":
> > +    const: 1
> > +
> > +  dma-channels:
> > +    const: 16
>
> I think it should be maximum: 16

As Krzysztof pointed out and looking at datasheet and driver implementation, we
always use 16 channels. Nothing less or variable.

So const: 16 I think it is correct!

Another, thing. Should we keep both

dma-channels
and
#dma-channels?

I wonder what is the correct way to put #dma-channels

Like this:

#dma-channels:
     deprecated

or

'#dma-channels':
    deprecated


The rest looks good to me.

Thanks for doing this Animesh!
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/dma/fsl,imx-dma.yaml b/Documentation/devicetree/bindings/dma/fsl,imx-dma.yaml
new file mode 100644
index 000000000000..f36ab5425bdb
--- /dev/null
+++ b/Documentation/devicetree/bindings/dma/fsl,imx-dma.yaml
@@ -0,0 +1,58 @@ 
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/dma/fsl,imx-dma.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Freescale Direct Memory Access (DMA) Controller for i.MX
+
+maintainers:
+  - Animesh Agarwal <animeshagarwal28@gmail.com>
+
+allOf:
+  - $ref: dma-controller.yaml#
+
+properties:
+  compatible:
+    enum:
+      - fsl,imx1-dma
+      - fsl,imx21-dma
+      - fsl,imx27-dma
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    description: |
+      First item should be DMA interrupt, second one is optional and
+      should contain DMA Error interrupt.
+    minItems: 1
+    maxItems: 2
+
+  "#dma-cells":
+    const: 1
+
+  dma-channels:
+    const: 16
+
+  dma-requests:
+    description: |
+      Number of DMA requests supported.
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - "#dma-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    dma: dma-controller@10001000 {
+      compatible = "fsl,imx27-dma";
+      reg = <0x10001000 0x1000>;
+      interrupts = <32 33>;
+      #dma-cells = <1>;
+      dma-channels = <16>;
+    };
diff --git a/Documentation/devicetree/bindings/dma/fsl-imx-dma.txt b/Documentation/devicetree/bindings/dma/fsl-imx-dma.txt
deleted file mode 100644
index 1c9929d53727..000000000000
--- a/Documentation/devicetree/bindings/dma/fsl-imx-dma.txt
+++ /dev/null
@@ -1,50 +0,0 @@ 
-* Freescale Direct Memory Access (DMA) Controller for i.MX
-
-This document will only describe differences to the generic DMA Controller and
-DMA request bindings as described in dma/dma.txt .
-
-* DMA controller
-
-Required properties:
-- compatible : Should be "fsl,<chip>-dma". chip can be imx1, imx21 or imx27
-- reg : Should contain DMA registers location and length
-- interrupts : First item should be DMA interrupt, second one is optional and
-    should contain DMA Error interrupt
-- #dma-cells : Has to be 1. imx-dma does not support anything else.
-
-Optional properties:
-- dma-channels : Number of DMA channels supported. Should be 16.
-- #dma-channels : deprecated
-- dma-requests : Number of DMA requests supported.
-- #dma-requests : deprecated
-
-Example:
-
-	dma: dma@10001000 {
-		compatible = "fsl,imx27-dma";
-		reg = <0x10001000 0x1000>;
-		interrupts = <32 33>;
-		#dma-cells = <1>;
-		dma-channels = <16>;
-	};
-
-
-* DMA client
-
-Clients have to specify the DMA requests with phandles in a list.
-
-Required properties:
-- dmas: List of one or more DMA request specifiers. One DMA request specifier
-    consists of a phandle to the DMA controller followed by the integer
-    specifying the request line.
-- dma-names: List of string identifiers for the DMA requests. For the correct
-    names, have a look at the specific client driver.
-
-Example:
-
-	sdhci1: sdhci@10013000 {
-		...
-		dmas = <&dma 7>;
-		dma-names = "rx-tx";
-		...
-	};