2024-01-22 17:44:09

by Chen-Yu Tsai

[permalink] [raw]
Subject: [PATCH 4/7] dt-bindings: dma: allwinner,sun50i-a64-dma: Add compatible for H616

From: Chen-Yu Tsai <[email protected]>

The DMA controllers found on the H616 and H618 are the same as the one
found on the H6. The only difference is the DMA endpoint (DRQ) layout.

Since the number of channels and endpoints are described with additional
generic properties, just add a new H616-specific compatible string and
fallback to the H6 one.

Signed-off-by: Chen-Yu Tsai <[email protected]>
---
.../bindings/dma/allwinner,sun50i-a64-dma.yaml | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml b/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml
index ec2d7a789ffe..e5693be378bd 100644
--- a/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml
+++ b/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml
@@ -28,6 +28,9 @@ properties:
- items:
- const: allwinner,sun8i-r40-dma
- const: allwinner,sun50i-a64-dma
+ - items:
+ - const: allwinner,sun50i-h616-dma
+ - const: allwinner,sun50i-h6-dma

reg:
maxItems: 1
@@ -59,10 +62,14 @@ required:
if:
properties:
compatible:
- enum:
- - allwinner,sun20i-d1-dma
- - allwinner,sun50i-a100-dma
- - allwinner,sun50i-h6-dma
+ oneOf:
+ - enum:
+ - allwinner,sun20i-d1-dma
+ - allwinner,sun50i-a100-dma
+ - allwinner,sun50i-h6-dma
+ - items:
+ - const: allwinner,sun50i-h616-dma
+ - const: allwinner,sun50i-h6-dma

then:
properties:
--
2.39.2



2024-01-22 19:00:45

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH 4/7] dt-bindings: dma: allwinner,sun50i-a64-dma: Add compatible for H616

On Tue, Jan 23, 2024 at 01:05:15AM +0800, Chen-Yu Tsai wrote:
> From: Chen-Yu Tsai <[email protected]>
>
> The DMA controllers found on the H616 and H618 are the same as the one
> found on the H6. The only difference is the DMA endpoint (DRQ) layout.
>
> Since the number of channels and endpoints are described with additional
> generic properties, just add a new H616-specific compatible string and
> fallback to the H6 one.
>
> Signed-off-by: Chen-Yu Tsai <[email protected]>
> ---
> .../bindings/dma/allwinner,sun50i-a64-dma.yaml | 15 +++++++++++----
> 1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml b/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml
> index ec2d7a789ffe..e5693be378bd 100644
> --- a/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml
> +++ b/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml
> @@ -28,6 +28,9 @@ properties:
> - items:
> - const: allwinner,sun8i-r40-dma
> - const: allwinner,sun50i-a64-dma
> + - items:
> + - const: allwinner,sun50i-h616-dma
> + - const: allwinner,sun50i-h6-dma
>
> reg:
> maxItems: 1
> @@ -59,10 +62,14 @@ required:
> if:
> properties:
> compatible:
> - enum:
> - - allwinner,sun20i-d1-dma
> - - allwinner,sun50i-a100-dma
> - - allwinner,sun50i-h6-dma
> + oneOf:
> + - enum:
> + - allwinner,sun20i-d1-dma
> + - allwinner,sun50i-a100-dma
> + - allwinner,sun50i-h6-dma
> + - items:
> + - const: allwinner,sun50i-h616-dma
> + - const: allwinner,sun50i-h6-dma

Instead of introducing this complexity, could you instead use "contains"
here? Unless I am missing soemthing, you can achieve the same thing here
with:
|if:
| properties:
| compatible:
| constains:
| enum:
| - allwinner,sun20i-d1-dma
| - allwinner,sun50i-a100-dma
| - allwinner,sun50i-h6-dma


Attachments:
(No filename) (2.07 kB)
signature.asc (235.00 B)
Download all attachments

2024-01-23 01:37:00

by Andre Przywara

[permalink] [raw]
Subject: Re: [PATCH 4/7] dt-bindings: dma: allwinner,sun50i-a64-dma: Add compatible for H616

On Tue, 23 Jan 2024 01:05:15 +0800
Chen-Yu Tsai <[email protected]> wrote:

Hi,

> From: Chen-Yu Tsai <[email protected]>
>
> The DMA controllers found on the H616 and H618 are the same as the one
> found on the H6. The only difference is the DMA endpoint (DRQ) layout.

That does not seem to be entirely true: The H616 encodes the two lowest
bits in DMA_DESC_ADDR_REG differently: on the H6 they must be 0 (word
aligned), on the H616 these contain bits [33:32] of the address of the
DMA descriptor. The manual doesn't describe the descriptor format in
much detail, but ec31c5c59492 suggests that those two bits are put in
the "para" word of the descriptor.

The good thing it that this encoding is backwards compatible, so I
think the fallback string still holds: Any driver just implementing the
H6 encoding would be able to drive the H616.

I think the A100 was mis-described, as mentioned here:
https://lore.kernel.org/linux-arm-kernel/[email protected]/
I think we should:
- make the A100 use: "allwinner,sun50i-a100-dma", "sun50i-h6-dma"
- make the H616 use: "allwinner,sun50i-h616-dma", "allwinner,sun50i-a100-dma", "sun50i-h6-dma"

Does that make sense?

Cheers,
Andre

> Since the number of channels and endpoints are described with additional
> generic properties, just add a new H616-specific compatible string and
> fallback to the H6 one.
>
> Signed-off-by: Chen-Yu Tsai <[email protected]>
> ---
> .../bindings/dma/allwinner,sun50i-a64-dma.yaml | 15 +++++++++++----
> 1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml b/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml
> index ec2d7a789ffe..e5693be378bd 100644
> --- a/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml
> +++ b/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml
> @@ -28,6 +28,9 @@ properties:
> - items:
> - const: allwinner,sun8i-r40-dma
> - const: allwinner,sun50i-a64-dma
> + - items:
> + - const: allwinner,sun50i-h616-dma
> + - const: allwinner,sun50i-h6-dma
>
> reg:
> maxItems: 1
> @@ -59,10 +62,14 @@ required:
> if:
> properties:
> compatible:
> - enum:
> - - allwinner,sun20i-d1-dma
> - - allwinner,sun50i-a100-dma
> - - allwinner,sun50i-h6-dma
> + oneOf:
> + - enum:
> + - allwinner,sun20i-d1-dma
> + - allwinner,sun50i-a100-dma
> + - allwinner,sun50i-h6-dma
> + - items:
> + - const: allwinner,sun50i-h616-dma
> + - const: allwinner,sun50i-h6-dma
>
> then:
> properties:


2024-01-25 14:33:53

by Chen-Yu Tsai

[permalink] [raw]
Subject: Re: [PATCH 4/7] dt-bindings: dma: allwinner,sun50i-a64-dma: Add compatible for H616

On Tue, Jan 23, 2024 at 2:18 AM Conor Dooley <[email protected]> wrote:
>
> On Tue, Jan 23, 2024 at 01:05:15AM +0800, Chen-Yu Tsai wrote:
> > From: Chen-Yu Tsai <[email protected]>
> >
> > The DMA controllers found on the H616 and H618 are the same as the one
> > found on the H6. The only difference is the DMA endpoint (DRQ) layout.
> >
> > Since the number of channels and endpoints are described with additional
> > generic properties, just add a new H616-specific compatible string and
> > fallback to the H6 one.
> >
> > Signed-off-by: Chen-Yu Tsai <[email protected]>
> > ---
> > .../bindings/dma/allwinner,sun50i-a64-dma.yaml | 15 +++++++++++----
> > 1 file changed, 11 insertions(+), 4 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml b/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml
> > index ec2d7a789ffe..e5693be378bd 100644
> > --- a/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml
> > +++ b/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml
> > @@ -28,6 +28,9 @@ properties:
> > - items:
> > - const: allwinner,sun8i-r40-dma
> > - const: allwinner,sun50i-a64-dma
> > + - items:
> > + - const: allwinner,sun50i-h616-dma
> > + - const: allwinner,sun50i-h6-dma
> >
> > reg:
> > maxItems: 1
> > @@ -59,10 +62,14 @@ required:
> > if:
> > properties:
> > compatible:
> > - enum:
> > - - allwinner,sun20i-d1-dma
> > - - allwinner,sun50i-a100-dma
> > - - allwinner,sun50i-h6-dma
> > + oneOf:
> > + - enum:
> > + - allwinner,sun20i-d1-dma
> > + - allwinner,sun50i-a100-dma
> > + - allwinner,sun50i-h6-dma
> > + - items:
> > + - const: allwinner,sun50i-h616-dma
> > + - const: allwinner,sun50i-h6-dma
>
> Instead of introducing this complexity, could you instead use "contains"
> here? Unless I am missing soemthing, you can achieve the same thing here
> with:
> |if:
> | properties:
> | compatible:
> | constains:
> | enum:
> | - allwinner,sun20i-d1-dma
> | - allwinner,sun50i-a100-dma
> | - allwinner,sun50i-h6-dma

Thank you for the reminder. I had a vague impression that something
simpler worked, but couldn't remember what exactly.

ChenYu

2024-01-25 14:38:05

by Chen-Yu Tsai

[permalink] [raw]
Subject: Re: [PATCH 4/7] dt-bindings: dma: allwinner,sun50i-a64-dma: Add compatible for H616

On Tue, Jan 23, 2024 at 8:41 AM Andre Przywara <[email protected]> wrote:
>
> On Tue, 23 Jan 2024 01:05:15 +0800
> Chen-Yu Tsai <[email protected]> wrote:
>
> Hi,
>
> > From: Chen-Yu Tsai <[email protected]>
> >
> > The DMA controllers found on the H616 and H618 are the same as the one
> > found on the H6. The only difference is the DMA endpoint (DRQ) layout.
>
> That does not seem to be entirely true: The H616 encodes the two lowest
> bits in DMA_DESC_ADDR_REG differently: on the H6 they must be 0 (word
> aligned), on the H616 these contain bits [33:32] of the address of the
> DMA descriptor. The manual doesn't describe the descriptor format in
> much detail, but ec31c5c59492 suggests that those two bits are put in
> the "para" word of the descriptor.

Good catch. So, same as the A100 I believe?

> The good thing it that this encoding is backwards compatible, so I
> think the fallback string still holds: Any driver just implementing the
> H6 encoding would be able to drive the H616.
>
> I think the A100 was mis-described, as mentioned here:
> https://lore.kernel.org/linux-arm-kernel/[email protected]/
> I think we should:
> - make the A100 use: "allwinner,sun50i-a100-dma", "sun50i-h6-dma"
> - make the H616 use: "allwinner,sun50i-h616-dma", "allwinner,sun50i-a100-dma", "sun50i-h6-dma"
>
> Does that make sense?

I wouldn't call that exactly backward compatible. Say the driver forgot to
clear the two bits. It would work fine on the H6, but the accessed address
could be way off on the A100 and H616.


ChenYu

> Cheers,
> Andre
>
> > Since the number of channels and endpoints are described with additional
> > generic properties, just add a new H616-specific compatible string and
> > fallback to the H6 one.
> >
> > Signed-off-by: Chen-Yu Tsai <[email protected]>
> > ---
> > .../bindings/dma/allwinner,sun50i-a64-dma.yaml | 15 +++++++++++----
> > 1 file changed, 11 insertions(+), 4 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml b/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml
> > index ec2d7a789ffe..e5693be378bd 100644
> > --- a/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml
> > +++ b/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml
> > @@ -28,6 +28,9 @@ properties:
> > - items:
> > - const: allwinner,sun8i-r40-dma
> > - const: allwinner,sun50i-a64-dma
> > + - items:
> > + - const: allwinner,sun50i-h616-dma
> > + - const: allwinner,sun50i-h6-dma
> >
> > reg:
> > maxItems: 1
> > @@ -59,10 +62,14 @@ required:
> > if:
> > properties:
> > compatible:
> > - enum:
> > - - allwinner,sun20i-d1-dma
> > - - allwinner,sun50i-a100-dma
> > - - allwinner,sun50i-h6-dma
> > + oneOf:
> > + - enum:
> > + - allwinner,sun20i-d1-dma
> > + - allwinner,sun50i-a100-dma
> > + - allwinner,sun50i-h6-dma
> > + - items:
> > + - const: allwinner,sun50i-h616-dma
> > + - const: allwinner,sun50i-h6-dma
> >
> > then:
> > properties:
>

2024-01-25 15:10:39

by Andre Przywara

[permalink] [raw]
Subject: Re: [PATCH 4/7] dt-bindings: dma: allwinner,sun50i-a64-dma: Add compatible for H616

On Thu, 25 Jan 2024 22:37:34 +0800
Chen-Yu Tsai <[email protected]> wrote:

Hi,

> On Tue, Jan 23, 2024 at 8:41 AM Andre Przywara <[email protected]> wrote:
> >
> > On Tue, 23 Jan 2024 01:05:15 +0800
> > Chen-Yu Tsai <[email protected]> wrote:
> >
> > Hi,
> >
> > > From: Chen-Yu Tsai <[email protected]>
> > >
> > > The DMA controllers found on the H616 and H618 are the same as the one
> > > found on the H6. The only difference is the DMA endpoint (DRQ) layout
> >
> > That does not seem to be entirely true: The H616 encodes the two lowest
> > bits in DMA_DESC_ADDR_REG differently: on the H6 they must be 0 (word
> > aligned), on the H616 these contain bits [33:32] of the address of the
> > DMA descriptor. The manual doesn't describe the descriptor format in
> > much detail, but ec31c5c59492 suggests that those two bits are put in
> > the "para" word of the descriptor.
>
> Good catch. So, same as the A100 I believe?

Yes, that's what I got as well.

> > The good thing it that this encoding is backwards compatible, so I
> > think the fallback string still holds: Any driver just implementing the
> > H6 encoding would be able to drive the H616.
> >
> > I think the A100 was mis-described, as mentioned here:
> > https://lore.kernel.org/linux-arm-kernel/[email protected]/
> > I think we should:
> > - make the A100 use: "allwinner,sun50i-a100-dma", "sun50i-h6-dma"
> > - make the H616 use: "allwinner,sun50i-h616-dma", "allwinner,sun50i-a100-dma", "sun50i-h6-dma"
> >
> > Does that make sense?
>
> I wouldn't call that exactly backward compatible. Say the driver forgot to
> clear the two bits. It would work fine on the H6, but the accessed address
> could be way off on the A100 and H616.

I don't know the exact boundaries of "compatible" here, but the H6 manual
pretty clearly states "The descriptor address must be word-aligned."
But since the A100 compatible is known and supported for a while, that
doesn't really matter, practically speaking, I guess.

One could check how the H6 DMA controller reacts to those bits not being
0, not sure if I find the time, though.

Cheers,
Andre.

> > Cheers,
> > Andre
> >
> > > Since the number of channels and endpoints are described with additional
> > > generic properties, just add a new H616-specific compatible string and
> > > fallback to the H6 one.
> > >
> > > Signed-off-by: Chen-Yu Tsai <[email protected]>
> > > ---
> > > .../bindings/dma/allwinner,sun50i-a64-dma.yaml | 15 +++++++++++----
> > > 1 file changed, 11 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml b/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml
> > > index ec2d7a789ffe..e5693be378bd 100644
> > > --- a/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml
> > > +++ b/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml
> > > @@ -28,6 +28,9 @@ properties:
> > > - items:
> > > - const: allwinner,sun8i-r40-dma
> > > - const: allwinner,sun50i-a64-dma
> > > + - items:
> > > + - const: allwinner,sun50i-h616-dma
> > > + - const: allwinner,sun50i-h6-dma
> > >
> > > reg:
> > > maxItems: 1
> > > @@ -59,10 +62,14 @@ required:
> > > if:
> > > properties:
> > > compatible:
> > > - enum:
> > > - - allwinner,sun20i-d1-dma
> > > - - allwinner,sun50i-a100-dma
> > > - - allwinner,sun50i-h6-dma
> > > + oneOf:
> > > + - enum:
> > > + - allwinner,sun20i-d1-dma
> > > + - allwinner,sun50i-a100-dma
> > > + - allwinner,sun50i-h6-dma
> > > + - items:
> > > + - const: allwinner,sun50i-h616-dma
> > > + - const: allwinner,sun50i-h6-dma
> > >
> > > then:
> > > properties:
> >
>


2024-01-25 15:46:08

by Chen-Yu Tsai

[permalink] [raw]
Subject: Re: [PATCH 4/7] dt-bindings: dma: allwinner,sun50i-a64-dma: Add compatible for H616

On Thu, Jan 25, 2024 at 11:09 PM Andre Przywara <andre.przywara@armcom> wrote:
>
> On Thu, 25 Jan 2024 22:37:34 +0800
> Chen-Yu Tsai <[email protected]> wrote:
>
> Hi,
>
> > On Tue, Jan 23, 2024 at 8:41 AM Andre Przywara <[email protected]> wrote:
> > >
> > > On Tue, 23 Jan 2024 01:05:15 +0800
> > > Chen-Yu Tsai <[email protected]> wrote:
> > >
> > > Hi,
> > >
> > > > From: Chen-Yu Tsai <[email protected]>
> > > >
> > > > The DMA controllers found on the H616 and H618 are the same as the one
> > > > found on the H6. The only difference is the DMA endpoint (DRQ) layout.
> > >
> > > That does not seem to be entirely true: The H616 encodes the two lowest
> > > bits in DMA_DESC_ADDR_REG differently: on the H6 they must be 0 (word
> > > aligned), on the H616 these contain bits [33:32] of the address of the
> > > DMA descriptor. The manual doesn't describe the descriptor format in
> > > much detail, but ec31c5c59492 suggests that those two bits are put in
> > > the "para" word of the descriptor.
> >
> > Good catch. So, same as the A100 I believe?
>
> Yes, that's what I got as well.
>
> > > The good thing it that this encoding is backwards compatible, so I
> > > think the fallback string still holds: Any driver just implementing the
> > > H6 encoding would be able to drive the H616.
> > >
> > > I think the A100 was mis-described, as mentioned here:
> > > https://lore.kernel.org/linux-arm-kernel/[email protected]/
> > > I think we should:
> > > - make the A100 use: "allwinner,sun50i-a100-dma", "sun50i-h6-dma"
> > > - make the H616 use: "allwinner,sun50i-h616-dma", "allwinner,sun50i-a100-dma", "sun50i-h6-dma"
> > >
> > > Does that make sense?
> >
> > I wouldn't call that exactly backward compatible. Say the driver forgot to
> > clear the two bits. It would work fine on the H6, but the accessed address
> > could be way off on the A100 and H616.
>
> I don't know the exact boundaries of "compatible" here, but the H6 manual
> pretty clearly states "The descriptor address must be word-aligned."
> But since the A100 compatible is known and supported for a while, that
> doesn't really matter, practically speaking, I guess.

I'd say that makes the descriptor address register backward compatible,

> One could check how the H6 DMA controller reacts to those bits not being
> 0, not sure if I find the time, though.

but no idea about the parameter field in the descriptor. So for now I
think we should just be cautious. Since as you mentioned the A100 is already
supported and listed separately, lets just keep that for now.

ChenYu

[...]