diff mbox series

dt-bindings: dma: sprd,sc9860-dma: convert to YAML

Message ID Zoa9MfYsAuqgh2Vb@standask-GA-A55M-S2HP (mailing list archive)
State Superseded
Headers show
Series dt-bindings: dma: sprd,sc9860-dma: convert to YAML | expand

Commit Message

Stanislav Jakubek July 4, 2024, 3:18 p.m. UTC
Convert the Spreadtrum SC9860 DMA bindings to DT schema.

Changes during conversion:
  - rename file to match compatible
  - make interrupts optional, the AGCP DMA controller doesn't need it
  - describe the optional ashb_eb clock for the AGCP DMA controller

Signed-off-by: Stanislav Jakubek <stano.jakubek@gmail.com>
---
 .../bindings/dma/sprd,sc9860-dma.yaml         | 92 +++++++++++++++++++
 .../devicetree/bindings/dma/sprd-dma.txt      | 44 ---------
 2 files changed, 92 insertions(+), 44 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/sprd,sc9860-dma.yaml
 delete mode 100644 Documentation/devicetree/bindings/dma/sprd-dma.txt

Comments

Conor Dooley July 4, 2024, 4:42 p.m. UTC | #1
On Thu, Jul 04, 2024 at 05:18:09PM +0200, Stanislav Jakubek wrote:
> Convert the Spreadtrum SC9860 DMA bindings to DT schema.
> 
> Changes during conversion:
>   - rename file to match compatible
>   - make interrupts optional, the AGCP DMA controller doesn't need it
>   - describe the optional ashb_eb clock for the AGCP DMA controller
> 
> Signed-off-by: Stanislav Jakubek <stano.jakubek@gmail.com>
> ---
>  .../bindings/dma/sprd,sc9860-dma.yaml         | 92 +++++++++++++++++++
>  .../devicetree/bindings/dma/sprd-dma.txt      | 44 ---------
>  2 files changed, 92 insertions(+), 44 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/dma/sprd,sc9860-dma.yaml
>  delete mode 100644 Documentation/devicetree/bindings/dma/sprd-dma.txt
> 
> diff --git a/Documentation/devicetree/bindings/dma/sprd,sc9860-dma.yaml b/Documentation/devicetree/bindings/dma/sprd,sc9860-dma.yaml
> new file mode 100644
> index 000000000000..e1639593d26d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/dma/sprd,sc9860-dma.yaml
> @@ -0,0 +1,92 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/dma/sprd,sc9860-dma.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Spreadtrum SC9860 DMA controller
> +
> +description: |
> +  There are three DMA controllers: AP DMA, AON DMA and AGCP DMA. For AGCP
> +  DMA controller, it can or do not request the IRQ, which will save
> +  system power without resuming system by DMA interrupts if AGCP DMA
> +  does not request the IRQ.
> +
> +maintainers:
> +  - Orson Zhai <orsonzhai@gmail.com>
> +  - Baolin Wang <baolin.wang7@gmail.com>
> +  - Chunyan Zhang <zhang.lyra@gmail.com>
> +
> +properties:
> +  compatible:
> +    const: sprd,sc9860-dma
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  clocks:
> +    minItems: 1
> +    maxItems: 2
> +
> +  clock-names:
> +    oneOf:
> +      - const: enable
> +      # The ashb_eb clock is optional and only for AGCP DMA controller
> +      - items:
> +          - const: enable
> +          - const: ashb_eb

This is better written as:
  clock-names:
    minItems: 1
    items:
      - const: enable
      - const: ashb_eb

> +
> +  '#dma-cells':
> +    const: 1
> +
> +  dma-channels:
> +    const: 32
> +
> +  '#dma-channels':
> +    const: 32
> +    deprecated: true

If there are no users of this, I'd be inclined to just drop it from the
binding.

Cheers,
Conor.
Stanislav Jakubek July 4, 2024, 5:09 p.m. UTC | #2
Hi Conor,
see below.

On Thu, Jul 04, 2024 at 05:42:39PM +0100, Conor Dooley wrote:
> On Thu, Jul 04, 2024 at 05:18:09PM +0200, Stanislav Jakubek wrote:
> > Convert the Spreadtrum SC9860 DMA bindings to DT schema.
> > 
> > Changes during conversion:
> >   - rename file to match compatible
> >   - make interrupts optional, the AGCP DMA controller doesn't need it
> >   - describe the optional ashb_eb clock for the AGCP DMA controller
> > 
> > Signed-off-by: Stanislav Jakubek <stano.jakubek@gmail.com>
> > ---
> >  .../bindings/dma/sprd,sc9860-dma.yaml         | 92 +++++++++++++++++++
> >  .../devicetree/bindings/dma/sprd-dma.txt      | 44 ---------
> >  2 files changed, 92 insertions(+), 44 deletions(-)
> >  create mode 100644 Documentation/devicetree/bindings/dma/sprd,sc9860-dma.yaml
> >  delete mode 100644 Documentation/devicetree/bindings/dma/sprd-dma.txt
> > 
> > diff --git a/Documentation/devicetree/bindings/dma/sprd,sc9860-dma.yaml b/Documentation/devicetree/bindings/dma/sprd,sc9860-dma.yaml
> > new file mode 100644
> > index 000000000000..e1639593d26d
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/dma/sprd,sc9860-dma.yaml
> > @@ -0,0 +1,92 @@
> > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/dma/sprd,sc9860-dma.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Spreadtrum SC9860 DMA controller
> > +
> > +description: |
> > +  There are three DMA controllers: AP DMA, AON DMA and AGCP DMA. For AGCP
> > +  DMA controller, it can or do not request the IRQ, which will save
> > +  system power without resuming system by DMA interrupts if AGCP DMA
> > +  does not request the IRQ.
> > +
> > +maintainers:
> > +  - Orson Zhai <orsonzhai@gmail.com>
> > +  - Baolin Wang <baolin.wang7@gmail.com>
> > +  - Chunyan Zhang <zhang.lyra@gmail.com>
> > +
> > +properties:
> > +  compatible:
> > +    const: sprd,sc9860-dma
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  interrupts:
> > +    maxItems: 1
> > +
> > +  clocks:
> > +    minItems: 1
> > +    maxItems: 2
> > +
> > +  clock-names:
> > +    oneOf:
> > +      - const: enable
> > +      # The ashb_eb clock is optional and only for AGCP DMA controller
> > +      - items:
> > +          - const: enable
> > +          - const: ashb_eb
> 
> This is better written as:
>   clock-names:
>     minItems: 1
>     items:
>       - const: enable
>       - const: ashb_eb

Ok, should I keep the comment?

> 
> > +
> > +  '#dma-cells':
> > +    const: 1
> > +
> > +  dma-channels:
> > +    const: 32
> > +
> > +  '#dma-channels':
> > +    const: 32
> > +    deprecated: true
> 
> If there are no users of this, I'd be inclined to just drop it from the
> binding.
> 
> Cheers,
> Conor.

It is specified in DT "For backwards compatibility", see e.g. [1]
I'm not sure if it's still required, I'm not very familiar with this platform.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/sprd/whale2.dtsi?h=v6.10-rc6#n124

Regards,
Stanislav
Conor Dooley July 4, 2024, 5:24 p.m. UTC | #3
On Thu, Jul 04, 2024 at 07:09:12PM +0200, Stanislav Jakubek wrote:
> Hi Conor,
> see below.
> 
> On Thu, Jul 04, 2024 at 05:42:39PM +0100, Conor Dooley wrote:
> > On Thu, Jul 04, 2024 at 05:18:09PM +0200, Stanislav Jakubek wrote:
> > > Convert the Spreadtrum SC9860 DMA bindings to DT schema.
> > > 
> > > Changes during conversion:
> > >   - rename file to match compatible
> > >   - make interrupts optional, the AGCP DMA controller doesn't need it
> > >   - describe the optional ashb_eb clock for the AGCP DMA controller
> > > 
> > > Signed-off-by: Stanislav Jakubek <stano.jakubek@gmail.com>
> > > ---
> > >  .../bindings/dma/sprd,sc9860-dma.yaml         | 92 +++++++++++++++++++
> > >  .../devicetree/bindings/dma/sprd-dma.txt      | 44 ---------
> > >  2 files changed, 92 insertions(+), 44 deletions(-)
> > >  create mode 100644 Documentation/devicetree/bindings/dma/sprd,sc9860-dma.yaml
> > >  delete mode 100644 Documentation/devicetree/bindings/dma/sprd-dma.txt
> > > 
> > > diff --git a/Documentation/devicetree/bindings/dma/sprd,sc9860-dma.yaml b/Documentation/devicetree/bindings/dma/sprd,sc9860-dma.yaml
> > > new file mode 100644
> > > index 000000000000..e1639593d26d
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/dma/sprd,sc9860-dma.yaml
> > > @@ -0,0 +1,92 @@
> > > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/dma/sprd,sc9860-dma.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: Spreadtrum SC9860 DMA controller
> > > +
> > > +description: |
> > > +  There are three DMA controllers: AP DMA, AON DMA and AGCP DMA. For AGCP
> > > +  DMA controller, it can or do not request the IRQ, which will save
> > > +  system power without resuming system by DMA interrupts if AGCP DMA
> > > +  does not request the IRQ.
> > > +
> > > +maintainers:
> > > +  - Orson Zhai <orsonzhai@gmail.com>
> > > +  - Baolin Wang <baolin.wang7@gmail.com>
> > > +  - Chunyan Zhang <zhang.lyra@gmail.com>
> > > +
> > > +properties:
> > > +  compatible:
> > > +    const: sprd,sc9860-dma
> > > +
> > > +  reg:
> > > +    maxItems: 1
> > > +
> > > +  interrupts:
> > > +    maxItems: 1
> > > +
> > > +  clocks:
> > > +    minItems: 1
> > > +    maxItems: 2
> > > +
> > > +  clock-names:
> > > +    oneOf:
> > > +      - const: enable
> > > +      # The ashb_eb clock is optional and only for AGCP DMA controller
> > > +      - items:
> > > +          - const: enable
> > > +          - const: ashb_eb
> > 
> > This is better written as:
> >   clock-names:
> >     minItems: 1
> >     items:
> >       - const: enable
> >       - const: ashb_eb
> 
> Ok, should I keep the comment?

If you like. Another option would be to define the items for clocks
also, instead of this comment, like:

clocks:
  minItems: 1
  items:
    - main DMA controller clock
    - optional clock for the ashb_eb, only for the AGCP DMA controller


> 
> > 
> > > +
> > > +  '#dma-cells':
> > > +    const: 1
> > > +
> > > +  dma-channels:
> > > +    const: 32
> > > +
> > > +  '#dma-channels':
> > > +    const: 32
> > > +    deprecated: true
> > 
> > If there are no users of this, I'd be inclined to just drop it from the
> > binding.
> > 
> > Cheers,
> > Conor.
> 
> It is specified in DT "For backwards compatibility", see e.g. [1]
> I'm not sure if it's still required, I'm not very familiar with this platform.
> 
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/sprd/whale2.dtsi?h=v6.10-rc6#n124

Then keep it, that's a user ;)

Cheers,
Conor.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/dma/sprd,sc9860-dma.yaml b/Documentation/devicetree/bindings/dma/sprd,sc9860-dma.yaml
new file mode 100644
index 000000000000..e1639593d26d
--- /dev/null
+++ b/Documentation/devicetree/bindings/dma/sprd,sc9860-dma.yaml
@@ -0,0 +1,92 @@ 
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/dma/sprd,sc9860-dma.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Spreadtrum SC9860 DMA controller
+
+description: |
+  There are three DMA controllers: AP DMA, AON DMA and AGCP DMA. For AGCP
+  DMA controller, it can or do not request the IRQ, which will save
+  system power without resuming system by DMA interrupts if AGCP DMA
+  does not request the IRQ.
+
+maintainers:
+  - Orson Zhai <orsonzhai@gmail.com>
+  - Baolin Wang <baolin.wang7@gmail.com>
+  - Chunyan Zhang <zhang.lyra@gmail.com>
+
+properties:
+  compatible:
+    const: sprd,sc9860-dma
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    minItems: 1
+    maxItems: 2
+
+  clock-names:
+    oneOf:
+      - const: enable
+      # The ashb_eb clock is optional and only for AGCP DMA controller
+      - items:
+          - const: enable
+          - const: ashb_eb
+
+  '#dma-cells':
+    const: 1
+
+  dma-channels:
+    const: 32
+
+  '#dma-channels':
+    const: 32
+    deprecated: true
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - '#dma-cells'
+  - dma-channels
+
+allOf:
+  - $ref: dma-controller.yaml#
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/sprd,sc9860-clk.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    /* AP DMA controller */
+    dma-controller@20100000 {
+      compatible = "sprd,sc9860-dma";
+      reg = <0x20100000 0x4000>;
+      interrupts = <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>;
+      clocks = <&apahb_gate CLK_DMA_EB>;
+      clock-names = "enable";
+      #dma-cells = <1>;
+      dma-channels = <32>;
+    };
+
+    /* AGCP DMA controller */
+    dma-controller@41580000 {
+      compatible = "sprd,sc9860-dma";
+      reg = <0x41580000 0x4000>;
+      clocks = <&agcp_gate CLK_AGCP_DMAAP_EB>,
+               <&agcp_gate CLK_AGCP_AP_ASHB_EB>;
+      clock-names = "enable", "ashb_eb";
+      #dma-cells = <1>;
+      dma-channels = <32>;
+    };
+...
diff --git a/Documentation/devicetree/bindings/dma/sprd-dma.txt b/Documentation/devicetree/bindings/dma/sprd-dma.txt
deleted file mode 100644
index c7e9b5fd50e7..000000000000
--- a/Documentation/devicetree/bindings/dma/sprd-dma.txt
+++ /dev/null
@@ -1,44 +0,0 @@ 
-* Spreadtrum DMA controller
-
-This binding follows the generic DMA bindings defined in dma.txt.
-
-Required properties:
-- compatible: Should be "sprd,sc9860-dma".
-- reg: Should contain DMA registers location and length.
-- interrupts: Should contain one interrupt shared by all channel.
-- #dma-cells: must be <1>. Used to represent the number of integer
-	cells in the dmas property of client device.
-- dma-channels : Number of DMA channels supported. Should be 32.
-- clock-names: Should contain the clock of the DMA controller.
-- clocks: Should contain a clock specifier for each entry in clock-names.
-
-Deprecated properties:
-- #dma-channels : Number of DMA channels supported. Should be 32.
-
-Example:
-
-Controller:
-apdma: dma-controller@20100000 {
-	compatible = "sprd,sc9860-dma";
-	reg = <0x20100000 0x4000>;
-	interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH>;
-	#dma-cells = <1>;
-	dma-channels = <32>;
-	clock-names = "enable";
-	clocks = <&clk_ap_ahb_gates 5>;
-};
-
-
-Client:
-DMA clients connected to the Spreadtrum DMA controller must use the format
-described in the dma.txt file, using a two-cell specifier for each channel.
-The two cells in order are:
-1. A phandle pointing to the DMA controller.
-2. The slave id.
-
-spi0: spi@70a00000{
-	...
-	dma-names = "rx_chn", "tx_chn";
-	dmas = <&apdma 11>, <&apdma 12>;
-	...
-};