diff mbox series

[2/2] dt-bindings: dma: renesas,usb-dmac: convert bindings to json-schema

Message ID 1586512923-21739-3-git-send-email-yoshihiro.shimoda.uh@renesas.com (mailing list archive)
State Changes Requested
Headers show
Series dt-bindings: dma: renesas,{rcar,usb}-dmac: convert to json-schema | expand

Commit Message

Yoshihiro Shimoda April 10, 2020, 10:02 a.m. UTC
Convert Renesas R-Car USB-DMA Controller bindings documentation
to json-schema.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 .../devicetree/bindings/dma/renesas,usb-dmac.txt   | 55 ------------
 .../devicetree/bindings/dma/renesas,usb-dmac.yaml  | 99 ++++++++++++++++++++++
 2 files changed, 99 insertions(+), 55 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/dma/renesas,usb-dmac.txt
 create mode 100644 Documentation/devicetree/bindings/dma/renesas,usb-dmac.yaml

Comments

Geert Uytterhoeven April 15, 2020, 1:55 p.m. UTC | #1
Hi Shimoda-san,

On Fri, Apr 10, 2020 at 12:02 PM Yoshihiro Shimoda
<yoshihiro.shimoda.uh@renesas.com> wrote:
> Convert Renesas R-Car USB-DMA Controller bindings documentation
> to json-schema.
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Thanks for your patch!

> --- /dev/null
> +++ b/Documentation/devicetree/bindings/dma/renesas,usb-dmac.yaml
> @@ -0,0 +1,99 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/dma/renesas,usb-dmac.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Renesas USB DMA Controller
> +
> +maintainers:
> +  - Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> +
> +allOf:
> +  - $ref: "dma-controller.yaml#"
> +
> +properties:
> +  compatible:
> +    items:
> +      - enum:
> +          - renesas,r8a7743-usb-dmac  # RZ/G1M
> +          - renesas,r8a7744-usb-dmac  # RZ/G1N
> +          - renesas,r8a7745-usb-dmac  # RZ/G1E
> +          - renesas,r8a77470-usb-dmac # RZ/G1C
> +          - renesas,r8a774a1-usb-dmac # RZ/G2M
> +          - renesas,r8a774b1-usb-dmac # RZ/G2N
> +          - renesas,r8a774c0-usb-dmac # RZ/G2E
> +          - renesas,r8a7790-usb-dmac  # R-Car H2
> +          - renesas,r8a7791-usb-dmac  # R-Car M2-W
> +          - renesas,r8a7793-usb-dmac  # R-Car M2-N
> +          - renesas,r8a7794-usb-dmac  # R-Car E2
> +          - renesas,r8a7795-usb-dmac  # R-Car H3
> +          - renesas,r8a7796-usb-dmac  # R-Car M3-W
> +          - renesas,r8a77961-usb-dmac # R-Car M3-W+
> +          - renesas,r8a77965-usb-dmac # R-Car M3-N
> +          - renesas,r8a77990-usb-dmac # R-Car E3
> +          - renesas,r8a77995-usb-dmac # R-Car D3
> +      - const: renesas,usb-dmac
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 2

Is there a use case for specifying a single interrupt?

> +
> +  interrupt-names:
> +    maxItems: 2
> +    items:
> +      - pattern: "^ch[0-1]$"
> +      - pattern: "^ch[0-1]$"

Would it make sense to list the (two) actual channel names instead?

> +
> +  clocks:
> +    maxItems: 1
> +
> +  '#dma-cells':
> +    const: 1
> +    description:
> +      The cell specifies the channel number of the DMAC port connected to
> +      the DMA client.
> +
> +  dma-channels:
> +    maximum: 2

Is there a use case for specifying a single channel?

> +
> +  iommus:
> +    maxItems: 2

Likewise?

> +
> +  power-domains:
> +    maxItems: 1
> +
> +  resets:
> +    maxItems: 1
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +  - interrupt-names
> +  - clocks
> +  - '#dma-cells'
> +  - dma-channels

Shouldn't "power-domains" and "resets" be mandatory, too?
All covered SoCS have them.

Gr{oetje,eeting}s,

                        Geert
Yoshihiro Shimoda April 16, 2020, 2:04 a.m. UTC | #2
Hi Geert-san,

Thank you for your review!

> From: Geert Uytterhoeven, Sent: Wednesday, April 15, 2020 10:56 PM
<snip>
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/dma/renesas,usb-dmac.yaml
> > @@ -0,0 +1,99 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/dma/renesas,usb-dmac.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Renesas USB DMA Controller
> > +
> > +maintainers:
> > +  - Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> > +
> > +allOf:
> > +  - $ref: "dma-controller.yaml#"
> > +
> > +properties:
> > +  compatible:
> > +    items:
> > +      - enum:
> > +          - renesas,r8a7743-usb-dmac  # RZ/G1M
> > +          - renesas,r8a7744-usb-dmac  # RZ/G1N
> > +          - renesas,r8a7745-usb-dmac  # RZ/G1E
> > +          - renesas,r8a77470-usb-dmac # RZ/G1C
> > +          - renesas,r8a774a1-usb-dmac # RZ/G2M
> > +          - renesas,r8a774b1-usb-dmac # RZ/G2N
> > +          - renesas,r8a774c0-usb-dmac # RZ/G2E
> > +          - renesas,r8a7790-usb-dmac  # R-Car H2
> > +          - renesas,r8a7791-usb-dmac  # R-Car M2-W
> > +          - renesas,r8a7793-usb-dmac  # R-Car M2-N
> > +          - renesas,r8a7794-usb-dmac  # R-Car E2
> > +          - renesas,r8a7795-usb-dmac  # R-Car H3
> > +          - renesas,r8a7796-usb-dmac  # R-Car M3-W
> > +          - renesas,r8a77961-usb-dmac # R-Car M3-W+
> > +          - renesas,r8a77965-usb-dmac # R-Car M3-N
> > +          - renesas,r8a77990-usb-dmac # R-Car E3
> > +          - renesas,r8a77995-usb-dmac # R-Car D3
> > +      - const: renesas,usb-dmac
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  interrupts:
> > +    maxItems: 2
> 
> Is there a use case for specifying a single interrupt?

No. All USB-DMAC of R-Car Gen2/3 and RZ/Gn has 2 channels.
In case of R-Car Gen3, please refer to the Figure 75.1 USB-DMAC Block Diagram.
These USB-DMACn have CH0 and CH1

> > +
> > +  interrupt-names:
> > +    maxItems: 2
> > +    items:
> > +      - pattern: "^ch[0-1]$"
> > +      - pattern: "^ch[0-1]$"
> 
> Would it make sense to list the (two) actual channel names instead?

I agree. Just using ch0 and ch1 is simpler.

> > +
> > +  clocks:
> > +    maxItems: 1
> > +
> > +  '#dma-cells':
> > +    const: 1
> > +    description:
> > +      The cell specifies the channel number of the DMAC port connected to
> > +      the DMA client.
> > +
> > +  dma-channels:
> > +    maximum: 2
> 
> Is there a use case for specifying a single channel?
> 
> > +
> > +  iommus:
> > +    maxItems: 2
> 
> Likewise?

As I mentioned above, there is not a use case for specifying a single channel.

> > +
> > +  power-domains:
> > +    maxItems: 1
> > +
> > +  resets:
> > +    maxItems: 1
> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +  - interrupts
> > +  - interrupt-names
> > +  - clocks
> > +  - '#dma-cells'
> > +  - dma-channels
> 
> Shouldn't "power-domains" and "resets" be mandatory, too?
> All covered SoCS have them.

Oops. I'll add these properties as required.

Best regards,
Yoshihiro Shimoda

> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
Geert Uytterhoeven April 16, 2020, 7:49 a.m. UTC | #3
Hi Shimoda-san,

On Thu, Apr 16, 2020 at 4:04 AM Yoshihiro Shimoda
<yoshihiro.shimoda.uh@renesas.com> wrote:
> > From: Geert Uytterhoeven, Sent: Wednesday, April 15, 2020 10:56 PM
> <snip>
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/dma/renesas,usb-dmac.yaml
> > > +  interrupts:
> > > +    maxItems: 2
> >
> > Is there a use case for specifying a single interrupt?
>
> No. All USB-DMAC of R-Car Gen2/3 and RZ/Gn has 2 channels.
> In case of R-Car Gen3, please refer to the Figure 75.1 USB-DMAC Block Diagram.
> These USB-DMACn have CH0 and CH1

Thanks for confirming!

> > > +  dma-channels:
> > > +    maximum: 2
> >
> > Is there a use case for specifying a single channel?
> >
> > > +
> > > +  iommus:
> > > +    maxItems: 2
> >
> > Likewise?
>
> As I mentioned above, there is not a use case for specifying a single channel.

Hence I think all of these should have "const: 2" or "minItems: 2".

Gr{oetje,eeting}s,

                        Geert
Yoshihiro Shimoda April 16, 2020, 8:13 a.m. UTC | #4
Hi Geert-san,

> From: Geert Uytterhoeven, Sent: Thursday, April 16, 2020 4:50 PM
> 
> Hi Shimoda-san,
> 
> On Thu, Apr 16, 2020 at 4:04 AM Yoshihiro Shimoda
> <yoshihiro.shimoda.uh@renesas.com> wrote:
> > > From: Geert Uytterhoeven, Sent: Wednesday, April 15, 2020 10:56 PM
> > <snip>
> > > > --- /dev/null
> > > > +++ b/Documentation/devicetree/bindings/dma/renesas,usb-dmac.yaml
> > > > +  interrupts:
> > > > +    maxItems: 2
> > >
> > > Is there a use case for specifying a single interrupt?
> >
> > No. All USB-DMAC of R-Car Gen2/3 and RZ/Gn has 2 channels.
> > In case of R-Car Gen3, please refer to the Figure 75.1 USB-DMAC Block Diagram.
> > These USB-DMACn have CH0 and CH1
> 
> Thanks for confirming!
> 
> > > > +  dma-channels:
> > > > +    maximum: 2
> > >
> > > Is there a use case for specifying a single channel?
> > >
> > > > +
> > > > +  iommus:
> > > > +    maxItems: 2
> > >
> > > Likewise?
> >
> > As I mentioned above, there is not a use case for specifying a single channel.
> 
> Hence I think all of these should have "const: 2" or "minItems: 2".

Thank you for the proposal. I got it. I'll fix it.

Best regards,
Yoshihiro Shimoda
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/dma/renesas,usb-dmac.txt b/Documentation/devicetree/bindings/dma/renesas,usb-dmac.txt
deleted file mode 100644
index e8f6c42..00000000
--- a/Documentation/devicetree/bindings/dma/renesas,usb-dmac.txt
+++ /dev/null
@@ -1,55 +0,0 @@ 
-* Renesas USB DMA Controller Device Tree bindings
-
-Required Properties:
--compatible: "renesas,<soctype>-usb-dmac", "renesas,usb-dmac" as fallback.
-	Examples with soctypes are:
-	  - "renesas,r8a7743-usb-dmac" (RZ/G1M)
-	  - "renesas,r8a7744-usb-dmac" (RZ/G1N)
-	  - "renesas,r8a7745-usb-dmac" (RZ/G1E)
-	  - "renesas,r8a77470-usb-dmac" (RZ/G1C)
-	  - "renesas,r8a774a1-usb-dmac" (RZ/G2M)
-	  - "renesas,r8a774b1-usb-dmac" (RZ/G2N)
-	  - "renesas,r8a774c0-usb-dmac" (RZ/G2E)
-	  - "renesas,r8a7790-usb-dmac" (R-Car H2)
-	  - "renesas,r8a7791-usb-dmac" (R-Car M2-W)
-	  - "renesas,r8a7793-usb-dmac" (R-Car M2-N)
-	  - "renesas,r8a7794-usb-dmac" (R-Car E2)
-	  - "renesas,r8a7795-usb-dmac" (R-Car H3)
-	  - "renesas,r8a7796-usb-dmac" (R-Car M3-W)
-	  - "renesas,r8a77961-usb-dmac" (R-Car M3-W+)
-	  - "renesas,r8a77965-usb-dmac" (R-Car M3-N)
-	  - "renesas,r8a77990-usb-dmac" (R-Car E3)
-	  - "renesas,r8a77995-usb-dmac" (R-Car D3)
-- reg: base address and length of the registers block for the DMAC
-- interrupts: interrupt specifiers for the DMAC, one for each entry in
-  interrupt-names.
-- interrupt-names: one entry per channel, named "ch%u", where %u is the
-  channel number ranging from zero to the number of channels minus one.
-- clocks: a list of phandle + clock-specifier pairs.
-- #dma-cells: must be <1>, the cell specifies the channel number of the DMAC
-  port connected to the DMA client.
-- dma-channels: number of DMA channels
-
-Example: R8A7790 (R-Car H2) USB-DMACs
-
-	usb_dmac0: dma-controller@e65a0000 {
-		compatible = "renesas,r8a7790-usb-dmac", "renesas,usb-dmac";
-		reg = <0 0xe65a0000 0 0x100>;
-		interrupts = <0 109 IRQ_TYPE_LEVEL_HIGH
-			      0 109 IRQ_TYPE_LEVEL_HIGH>;
-		interrupt-names = "ch0", "ch1";
-		clocks = <&mstp3_clks R8A7790_CLK_USBDMAC0>;
-		#dma-cells = <1>;
-		dma-channels = <2>;
-	};
-
-	usb_dmac1: dma-controller@e65b0000 {
-		compatible = "renesas,usb-dmac";
-		reg = <0 0xe65b0000 0 0x100>;
-		interrupts = <0 110 IRQ_TYPE_LEVEL_HIGH
-			      0 110 IRQ_TYPE_LEVEL_HIGH>;
-		interrupt-names = "ch0", "ch1";
-		clocks = <&mstp3_clks R8A7790_CLK_USBDMAC1>;
-		#dma-cells = <1>;
-		dma-channels = <2>;
-	};
diff --git a/Documentation/devicetree/bindings/dma/renesas,usb-dmac.yaml b/Documentation/devicetree/bindings/dma/renesas,usb-dmac.yaml
new file mode 100644
index 00000000..9c81081
--- /dev/null
+++ b/Documentation/devicetree/bindings/dma/renesas,usb-dmac.yaml
@@ -0,0 +1,99 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/dma/renesas,usb-dmac.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas USB DMA Controller
+
+maintainers:
+  - Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+
+allOf:
+  - $ref: "dma-controller.yaml#"
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - renesas,r8a7743-usb-dmac  # RZ/G1M
+          - renesas,r8a7744-usb-dmac  # RZ/G1N
+          - renesas,r8a7745-usb-dmac  # RZ/G1E
+          - renesas,r8a77470-usb-dmac # RZ/G1C
+          - renesas,r8a774a1-usb-dmac # RZ/G2M
+          - renesas,r8a774b1-usb-dmac # RZ/G2N
+          - renesas,r8a774c0-usb-dmac # RZ/G2E
+          - renesas,r8a7790-usb-dmac  # R-Car H2
+          - renesas,r8a7791-usb-dmac  # R-Car M2-W
+          - renesas,r8a7793-usb-dmac  # R-Car M2-N
+          - renesas,r8a7794-usb-dmac  # R-Car E2
+          - renesas,r8a7795-usb-dmac  # R-Car H3
+          - renesas,r8a7796-usb-dmac  # R-Car M3-W
+          - renesas,r8a77961-usb-dmac # R-Car M3-W+
+          - renesas,r8a77965-usb-dmac # R-Car M3-N
+          - renesas,r8a77990-usb-dmac # R-Car E3
+          - renesas,r8a77995-usb-dmac # R-Car D3
+      - const: renesas,usb-dmac
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 2
+
+  interrupt-names:
+    maxItems: 2
+    items:
+      - pattern: "^ch[0-1]$"
+      - pattern: "^ch[0-1]$"
+
+  clocks:
+    maxItems: 1
+
+  '#dma-cells':
+    const: 1
+    description:
+      The cell specifies the channel number of the DMAC port connected to
+      the DMA client.
+
+  dma-channels:
+    maximum: 2
+
+  iommus:
+    maxItems: 2
+
+  power-domains:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - interrupt-names
+  - clocks
+  - '#dma-cells'
+  - dma-channels
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/r8a7790-cpg-mssr.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/power/r8a7790-sysc.h>
+
+    usb_dmac0: dma-controller@e65a0000 {
+        compatible = "renesas,r8a7790-usb-dmac", "renesas,usb-dmac";
+        reg = <0xe65a0000 0x100>;
+        interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>;
+        interrupt-names = "ch0", "ch1";
+        clocks = <&cpg CPG_MOD 330>;
+        power-domains = <&sysc R8A7790_PD_ALWAYS_ON>;
+        resets = <&cpg 330>;
+        #dma-cells = <1>;
+        dma-channels = <2>;
+    };