diff mbox series

[v6,1/2] dt-bindings: dma: Add Loongson-1 DMA

Message ID 20240316-loongson1-dma-v6-1-90de2c3cc928@gmail.com (mailing list archive)
State Superseded
Headers show
Series Add support for Loongson1 DMA | expand

Commit Message

Keguang Zhang via B4 Relay March 16, 2024, 11:33 a.m. UTC
From: Keguang Zhang <keguang.zhang@gmail.com>

Add devicetree binding document for Loongson-1 DMA.

Signed-off-by: Keguang Zhang <keguang.zhang@gmail.com>
---
V5 -> V6:
   Change the compatible to the fallback
   Some minor fixes
V4 -> V5:
   A newly added patch
---
 .../devicetree/bindings/dma/loongson,ls1x-dma.yaml | 66 ++++++++++++++++++++++
 1 file changed, 66 insertions(+)

Comments

Conor Dooley March 17, 2024, 2:40 p.m. UTC | #1
On Sat, Mar 16, 2024 at 07:33:53PM +0800, Keguang Zhang via B4 Relay wrote:
> From: Keguang Zhang <keguang.zhang@gmail.com>
> 
> Add devicetree binding document for Loongson-1 DMA.
> 
> Signed-off-by: Keguang Zhang <keguang.zhang@gmail.com>
> ---
> V5 -> V6:
>    Change the compatible to the fallback
>    Some minor fixes
> V4 -> V5:
>    A newly added patch
> ---
>  .../devicetree/bindings/dma/loongson,ls1x-dma.yaml | 66 ++++++++++++++++++++++
>  1 file changed, 66 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/dma/loongson,ls1x-dma.yaml b/Documentation/devicetree/bindings/dma/loongson,ls1x-dma.yaml
> new file mode 100644
> index 000000000000..06358df725c6
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/dma/loongson,ls1x-dma.yaml
> @@ -0,0 +1,66 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/dma/loongson,ls1x-dma.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Loongson-1 DMA Controller
> +
> +maintainers:
> +  - Keguang Zhang <keguang.zhang@gmail.com>
> +
> +description:
> +  Loongson-1 DMA controller provides 3 independent channels for
> +  peripherals such as NAND and AC97.
> +
> +properties:
> +  compatible:
> +    oneOf:
> +      - const: loongson,ls1b-dma
> +      - items:
> +          - enum:
> +              - loongson,ls1c-dma
> +          - const: loongson,ls1b-dma

Aren't there several more devices in this family? Do they not have DMA
controllers?

> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    description: Each channel has a dedicated interrupt line.
> +    minItems: 1
> +    maxItems: 3

Is this number not fixed for each SoC?

> +  interrupt-names:
> +    minItems: 1
> +    items:
> +      - pattern: ch0
> +      - pattern: ch1
> +      - pattern: ch2

Why have you made these a pattern? There's no regex being used here at
all.

Cheers,
Cono4.
Keguang Zhang March 18, 2024, 6:18 a.m. UTC | #2
On Sun, Mar 17, 2024 at 10:40 PM Conor Dooley <conor@kernel.org> wrote:
>
> On Sat, Mar 16, 2024 at 07:33:53PM +0800, Keguang Zhang via B4 Relay wrote:
> > From: Keguang Zhang <keguang.zhang@gmail.com>
> >
> > Add devicetree binding document for Loongson-1 DMA.
> >
> > Signed-off-by: Keguang Zhang <keguang.zhang@gmail.com>
> > ---
> > V5 -> V6:
> >    Change the compatible to the fallback
> >    Some minor fixes
> > V4 -> V5:
> >    A newly added patch
> > ---
> >  .../devicetree/bindings/dma/loongson,ls1x-dma.yaml | 66 ++++++++++++++++++++++
> >  1 file changed, 66 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/dma/loongson,ls1x-dma.yaml b/Documentation/devicetree/bindings/dma/loongson,ls1x-dma.yaml
> > new file mode 100644
> > index 000000000000..06358df725c6
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/dma/loongson,ls1x-dma.yaml
> > @@ -0,0 +1,66 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/dma/loongson,ls1x-dma.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Loongson-1 DMA Controller
> > +
> > +maintainers:
> > +  - Keguang Zhang <keguang.zhang@gmail.com>
> > +
> > +description:
> > +  Loongson-1 DMA controller provides 3 independent channels for
> > +  peripherals such as NAND and AC97.
> > +
> > +properties:
> > +  compatible:
> > +    oneOf:
> > +      - const: loongson,ls1b-dma
> > +      - items:
> > +          - enum:
> > +              - loongson,ls1c-dma
> > +          - const: loongson,ls1b-dma
>
> Aren't there several more devices in this family? Do they not have DMA
> controllers?
>
You are right. Loongson1 is a SoC family.
However, only 1A/1B/1C have DMA controller.

> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  interrupts:
> > +    description: Each channel has a dedicated interrupt line.
> > +    minItems: 1
> > +    maxItems: 3
>
> Is this number not fixed for each SoC?
>
Yes. Actually, it's fixed for the whole family.

> > +  interrupt-names:
> > +    minItems: 1
> > +    items:
> > +      - pattern: ch0
> > +      - pattern: ch1
> > +      - pattern: ch2
>
> Why have you made these a pattern? There's no regex being used here at
> all.
>
Will change items to the following regex.
  interrupt-names:
    minItems: 1
    items:
      - pattern: "^ch[0-2]$"

Thanks!

> Cheers,
> Cono4.
Conor Dooley March 18, 2024, 11:29 a.m. UTC | #3
On Mon, Mar 18, 2024 at 02:18:27PM +0800, Keguang Zhang wrote:
> On Sun, Mar 17, 2024 at 10:40 PM Conor Dooley <conor@kernel.org> wrote:
> >
> > On Sat, Mar 16, 2024 at 07:33:53PM +0800, Keguang Zhang via B4 Relay wrote:
> > > From: Keguang Zhang <keguang.zhang@gmail.com>
> > >
> > > Add devicetree binding document for Loongson-1 DMA.
> > >
> > > Signed-off-by: Keguang Zhang <keguang.zhang@gmail.com>
> > > ---
> > > V5 -> V6:
> > >    Change the compatible to the fallback
> > >    Some minor fixes
> > > V4 -> V5:
> > >    A newly added patch
> > > ---
> > >  .../devicetree/bindings/dma/loongson,ls1x-dma.yaml | 66 ++++++++++++++++++++++
> > >  1 file changed, 66 insertions(+)
> > >
> > > diff --git a/Documentation/devicetree/bindings/dma/loongson,ls1x-dma.yaml b/Documentation/devicetree/bindings/dma/loongson,ls1x-dma.yaml
> > > new file mode 100644
> > > index 000000000000..06358df725c6
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/dma/loongson,ls1x-dma.yaml
> > > @@ -0,0 +1,66 @@
> > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/dma/loongson,ls1x-dma.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: Loongson-1 DMA Controller
> > > +
> > > +maintainers:
> > > +  - Keguang Zhang <keguang.zhang@gmail.com>
> > > +
> > > +description:
> > > +  Loongson-1 DMA controller provides 3 independent channels for
> > > +  peripherals such as NAND and AC97.
> > > +
> > > +properties:
> > > +  compatible:
> > > +    oneOf:
> > > +      - const: loongson,ls1b-dma
> > > +      - items:
> > > +          - enum:
> > > +              - loongson,ls1c-dma
> > > +          - const: loongson,ls1b-dma
> >
> > Aren't there several more devices in this family? Do they not have DMA
> > controllers?
> >
> You are right. Loongson1 is a SoC family.
> However, only 1A/1B/1C have DMA controller.

You're missing the 1A then.

> 
> > > +
> > > +  reg:
> > > +    maxItems: 1
> > > +
> > > +  interrupts:
> > > +    description: Each channel has a dedicated interrupt line.
> > > +    minItems: 1
> > > +    maxItems: 3
> >
> > Is this number not fixed for each SoC?
> >
> Yes. Actually, it's fixed for the whole family.

Then why do you have minItems: 1? Are there multiple DMA controllers
on each SoC that only make use of a subset of the possible channels?

> > > +  interrupt-names:
> > > +    minItems: 1
> > > +    items:
> > > +      - pattern: ch0
> > > +      - pattern: ch1
> > > +      - pattern: ch2
> >
> > Why have you made these a pattern? There's no regex being used here at
> > all.
> >
> Will change items to the following regex.
>   interrupt-names:
>     minItems: 1
>     items:
>       - pattern: "^ch[0-2]$"
Keguang Zhang March 19, 2024, 2:16 a.m. UTC | #4
On Mon, Mar 18, 2024 at 7:29 PM Conor Dooley <conor@kernel.org> wrote:
>
> On Mon, Mar 18, 2024 at 02:18:27PM +0800, Keguang Zhang wrote:
> > On Sun, Mar 17, 2024 at 10:40 PM Conor Dooley <conor@kernel.org> wrote:
> > >
> > > On Sat, Mar 16, 2024 at 07:33:53PM +0800, Keguang Zhang via B4 Relay wrote:
> > > > From: Keguang Zhang <keguang.zhang@gmail.com>
> > > >
> > > > Add devicetree binding document for Loongson-1 DMA.
> > > >
> > > > Signed-off-by: Keguang Zhang <keguang.zhang@gmail.com>
> > > > ---
> > > > V5 -> V6:
> > > >    Change the compatible to the fallback
> > > >    Some minor fixes
> > > > V4 -> V5:
> > > >    A newly added patch
> > > > ---
> > > >  .../devicetree/bindings/dma/loongson,ls1x-dma.yaml | 66 ++++++++++++++++++++++
> > > >  1 file changed, 66 insertions(+)
> > > >
> > > > diff --git a/Documentation/devicetree/bindings/dma/loongson,ls1x-dma.yaml b/Documentation/devicetree/bindings/dma/loongson,ls1x-dma.yaml
> > > > new file mode 100644
> > > > index 000000000000..06358df725c6
> > > > --- /dev/null
> > > > +++ b/Documentation/devicetree/bindings/dma/loongson,ls1x-dma.yaml
> > > > @@ -0,0 +1,66 @@
> > > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > > > +%YAML 1.2
> > > > +---
> > > > +$id: http://devicetree.org/schemas/dma/loongson,ls1x-dma.yaml#
> > > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > > +
> > > > +title: Loongson-1 DMA Controller
> > > > +
> > > > +maintainers:
> > > > +  - Keguang Zhang <keguang.zhang@gmail.com>
> > > > +
> > > > +description:
> > > > +  Loongson-1 DMA controller provides 3 independent channels for
> > > > +  peripherals such as NAND and AC97.
> > > > +
> > > > +properties:
> > > > +  compatible:
> > > > +    oneOf:
> > > > +      - const: loongson,ls1b-dma
> > > > +      - items:
> > > > +          - enum:
> > > > +              - loongson,ls1c-dma
> > > > +          - const: loongson,ls1b-dma
> > >
> > > Aren't there several more devices in this family? Do they not have DMA
> > > controllers?
> > >
> > You are right. Loongson1 is a SoC family.
> > However, only 1A/1B/1C have DMA controller.
>
> You're missing the 1A then.
>
Will add 1A.

> >
> > > > +
> > > > +  reg:
> > > > +    maxItems: 1
> > > > +
> > > > +  interrupts:
> > > > +    description: Each channel has a dedicated interrupt line.
> > > > +    minItems: 1
> > > > +    maxItems: 3
> > >
> > > Is this number not fixed for each SoC?
> > >
> > Yes. Actually, it's fixed for the whole family.
>
> Then why do you have minItems: 1? Are there multiple DMA controllers
> on each SoC that only make use of a subset of the possible channels?
>
All channels are available on each SoC.
Sorry, I will remove the minItems.

Thanks for your review!

> > > > +  interrupt-names:
> > > > +    minItems: 1
> > > > +    items:
> > > > +      - pattern: ch0
> > > > +      - pattern: ch1
> > > > +      - pattern: ch2
> > >
> > > Why have you made these a pattern? There's no regex being used here at
> > > all.
> > >
> > Will change items to the following regex.
> >   interrupt-names:
> >     minItems: 1
> >     items:
> >       - pattern: "^ch[0-2]$"
>
Keguang Zhang March 19, 2024, 8:28 a.m. UTC | #5
On Mon, Mar 18, 2024 at 2:18 PM Keguang Zhang <keguang.zhang@gmail.com> wrote:
>
> On Sun, Mar 17, 2024 at 10:40 PM Conor Dooley <conor@kernel.org> wrote:
> >
> > On Sat, Mar 16, 2024 at 07:33:53PM +0800, Keguang Zhang via B4 Relay wrote:
> > > From: Keguang Zhang <keguang.zhang@gmail.com>
> > >
> > > Add devicetree binding document for Loongson-1 DMA.
> > >
> > > Signed-off-by: Keguang Zhang <keguang.zhang@gmail.com>
> > > ---
> > > V5 -> V6:
> > >    Change the compatible to the fallback
> > >    Some minor fixes
> > > V4 -> V5:
> > >    A newly added patch
> > > ---
> > >  .../devicetree/bindings/dma/loongson,ls1x-dma.yaml | 66 ++++++++++++++++++++++
> > >  1 file changed, 66 insertions(+)
> > >
> > > diff --git a/Documentation/devicetree/bindings/dma/loongson,ls1x-dma.yaml b/Documentation/devicetree/bindings/dma/loongson,ls1x-dma.yaml
> > > new file mode 100644
> > > index 000000000000..06358df725c6
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/dma/loongson,ls1x-dma.yaml
> > > @@ -0,0 +1,66 @@
> > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/dma/loongson,ls1x-dma.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: Loongson-1 DMA Controller
> > > +
> > > +maintainers:
> > > +  - Keguang Zhang <keguang.zhang@gmail.com>
> > > +
> > > +description:
> > > +  Loongson-1 DMA controller provides 3 independent channels for
> > > +  peripherals such as NAND and AC97.
> > > +
> > > +properties:
> > > +  compatible:
> > > +    oneOf:
> > > +      - const: loongson,ls1b-dma
> > > +      - items:
> > > +          - enum:
> > > +              - loongson,ls1c-dma
> > > +          - const: loongson,ls1b-dma
> >
> > Aren't there several more devices in this family? Do they not have DMA
> > controllers?
> >
> You are right. Loongson1 is a SoC family.
> However, only 1A/1B/1C have DMA controller.
>
> > > +
> > > +  reg:
> > > +    maxItems: 1
> > > +
> > > +  interrupts:
> > > +    description: Each channel has a dedicated interrupt line.
> > > +    minItems: 1
> > > +    maxItems: 3
> >
> > Is this number not fixed for each SoC?
> >
> Yes. Actually, it's fixed for the whole family.
>
> > > +  interrupt-names:
> > > +    minItems: 1
> > > +    items:
> > > +      - pattern: ch0
> > > +      - pattern: ch1
> > > +      - pattern: ch2
> >
> > Why have you made these a pattern? There's no regex being used here at
> > all.
> >
> Will change items to the following regex.
>   interrupt-names:
>     minItems: 1
>     items:
>       - pattern: "^ch[0-2]$"
>
Sorry. This pattern fails in dt_binding_check.
Will use const instead of pattern.
  interrupt-names:
   items:
     - const: ch0
     - const: ch1
     - const: ch2


> Thanks!
>
> > Cheers,
> > Cono4.
>
>
>
> --
> Best regards,
>
> Keguang Zhang



--
Best regards,

Keguang Zhang
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/dma/loongson,ls1x-dma.yaml b/Documentation/devicetree/bindings/dma/loongson,ls1x-dma.yaml
new file mode 100644
index 000000000000..06358df725c6
--- /dev/null
+++ b/Documentation/devicetree/bindings/dma/loongson,ls1x-dma.yaml
@@ -0,0 +1,66 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/dma/loongson,ls1x-dma.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Loongson-1 DMA Controller
+
+maintainers:
+  - Keguang Zhang <keguang.zhang@gmail.com>
+
+description:
+  Loongson-1 DMA controller provides 3 independent channels for
+  peripherals such as NAND and AC97.
+
+properties:
+  compatible:
+    oneOf:
+      - const: loongson,ls1b-dma
+      - items:
+          - enum:
+              - loongson,ls1c-dma
+          - const: loongson,ls1b-dma
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    description: Each channel has a dedicated interrupt line.
+    minItems: 1
+    maxItems: 3
+
+  interrupt-names:
+    minItems: 1
+    items:
+      - pattern: ch0
+      - pattern: ch1
+      - pattern: ch2
+
+  '#dma-cells':
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - interrupt-names
+  - '#dma-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    dma-controller@1fd01160 {
+        compatible = "loongson,ls1b-dma";
+        reg = <0x1fd01160 0x4>;
+
+        interrupt-parent = <&intc0>;
+        interrupts = <13 IRQ_TYPE_EDGE_RISING>,
+                     <14 IRQ_TYPE_EDGE_RISING>,
+                     <15 IRQ_TYPE_EDGE_RISING>;
+        interrupt-names = "ch0", "ch1", "ch2";
+
+        #dma-cells = <1>;
+    };