diff mbox series

[v2,4/5] dt-bindings: dma: fsl-edma: add fsl,imx8ulp-edma compatible string

Message ID 20240229-8ulp_edma-v2-4-9d12f883c8f7@nxp.com (mailing list archive)
State Superseded
Headers show
Series dmaengine: fsl-edma: add 8ulp support | expand

Commit Message

Frank Li Feb. 29, 2024, 8:58 p.m. UTC
From: Joy Zou <joy.zou@nxp.com>

Introduce the compatible string 'fsl,imx8ulp-edma' to enable support for
the i.MX8ULP's eDMA, alongside adjusting the clock numbering. The i.MX8ULP
eDMA architecture features one clock for each DMA channel and an additional
clock for the core controller. Given a maximum of 32 DMA channels, the
maximum clock number consequently increases to 33.

Signed-off-by: Joy Zou <joy.zou@nxp.com>
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
 .../devicetree/bindings/dma/fsl,edma.yaml          | 26 ++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

Comments

Rob Herring (Arm) March 4, 2024, 4:44 p.m. UTC | #1
On Thu, Feb 29, 2024 at 03:58:10PM -0500, Frank Li wrote:
> From: Joy Zou <joy.zou@nxp.com>
> 
> Introduce the compatible string 'fsl,imx8ulp-edma' to enable support for
> the i.MX8ULP's eDMA, alongside adjusting the clock numbering. The i.MX8ULP
> eDMA architecture features one clock for each DMA channel and an additional
> clock for the core controller. Given a maximum of 32 DMA channels, the
> maximum clock number consequently increases to 33.
> 
> Signed-off-by: Joy Zou <joy.zou@nxp.com>
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
> ---
>  .../devicetree/bindings/dma/fsl,edma.yaml          | 26 ++++++++++++++++++++--
>  1 file changed, 24 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/dma/fsl,edma.yaml b/Documentation/devicetree/bindings/dma/fsl,edma.yaml
> index aa51d278cb67b..55cce79c759f8 100644
> --- a/Documentation/devicetree/bindings/dma/fsl,edma.yaml
> +++ b/Documentation/devicetree/bindings/dma/fsl,edma.yaml
> @@ -23,6 +23,7 @@ properties:
>            - fsl,imx7ulp-edma
>            - fsl,imx8qm-adma
>            - fsl,imx8qm-edma
> +          - fsl,imx8ulp-edma
>            - fsl,imx93-edma3
>            - fsl,imx93-edma4
>            - fsl,imx95-edma5
> @@ -53,11 +54,11 @@ properties:
>  
>    clocks:
>      minItems: 1
> -    maxItems: 2
> +    maxItems: 33
>  
>    clock-names:
>      minItems: 1
> -    maxItems: 2
> +    maxItems: 33
>  
>    big-endian:
>      description: |
> @@ -108,6 +109,7 @@ allOf:
>        properties:
>          clocks:
>            minItems: 2
> +          maxItems: 2
>          clock-names:
>            items:
>              - const: dmamux0
> @@ -136,6 +138,7 @@ allOf:
>        properties:
>          clock:
>            minItems: 2
> +          maxItems: 2
>          clock-names:
>            items:
>              - const: dma
> @@ -151,6 +154,25 @@ allOf:
>          dma-channels:
>            const: 32
>  
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: fsl,imx8ulp-edma
> +    then:
> +      properties:
> +        clock:

clocks

> +          maxItems: 33

That is already the max. I think you want 'minItems: 33' here.

> +        clock-names:
> +          items:
> +            - const: dma
> +            - pattern: "^CH[0-31]-clk$"

'-clk' is redundant. [0-31] is not how you do a range of numbers with 
regex. 

This doesn't cover clocks 3-33. Not a great way to express in 
json-schema, but this should do it:

allOf:
  - items:
      - const: dma
  - items:
      oneOf:
        - const: dma
        - pattern: "^ch([0-9]|[1-2][0-9]|[3[01])$"

That doesn't enforce the order of 'chN' entries though. Probably good 
enough.


> +        interrupt-names: false
> +        interrupts:
> +          maxItems: 32

minItems

> +        "#dma-cells":
> +          const: 3

Is what is in each cell defined somewhere? If not, you need a 
description with those details.

Rob
Frank Li March 4, 2024, 11:31 p.m. UTC | #2
On Mon, Mar 04, 2024 at 10:44:23AM -0600, Rob Herring wrote:
> On Thu, Feb 29, 2024 at 03:58:10PM -0500, Frank Li wrote:
> > From: Joy Zou <joy.zou@nxp.com>
> > 
> > Introduce the compatible string 'fsl,imx8ulp-edma' to enable support for
> > the i.MX8ULP's eDMA, alongside adjusting the clock numbering. The i.MX8ULP
> > eDMA architecture features one clock for each DMA channel and an additional
> > clock for the core controller. Given a maximum of 32 DMA channels, the
> > maximum clock number consequently increases to 33.
> > 
> > Signed-off-by: Joy Zou <joy.zou@nxp.com>
> > Signed-off-by: Frank Li <Frank.Li@nxp.com>
> > ---
> >  .../devicetree/bindings/dma/fsl,edma.yaml          | 26 ++++++++++++++++++++--
> >  1 file changed, 24 insertions(+), 2 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/dma/fsl,edma.yaml b/Documentation/devicetree/bindings/dma/fsl,edma.yaml
> > index aa51d278cb67b..55cce79c759f8 100644
> > --- a/Documentation/devicetree/bindings/dma/fsl,edma.yaml
> > +++ b/Documentation/devicetree/bindings/dma/fsl,edma.yaml
> > @@ -23,6 +23,7 @@ properties:
> >            - fsl,imx7ulp-edma
> >            - fsl,imx8qm-adma
> >            - fsl,imx8qm-edma
> > +          - fsl,imx8ulp-edma
> >            - fsl,imx93-edma3
> >            - fsl,imx93-edma4
> >            - fsl,imx95-edma5
> > @@ -53,11 +54,11 @@ properties:
> >  
> >    clocks:
> >      minItems: 1
> > -    maxItems: 2
> > +    maxItems: 33
> >  
> >    clock-names:
> >      minItems: 1
> > -    maxItems: 2
> > +    maxItems: 33
> >  
> >    big-endian:
> >      description: |
> > @@ -108,6 +109,7 @@ allOf:
> >        properties:
> >          clocks:
> >            minItems: 2
> > +          maxItems: 2
> >          clock-names:
> >            items:
> >              - const: dmamux0
> > @@ -136,6 +138,7 @@ allOf:
> >        properties:
> >          clock:
> >            minItems: 2
> > +          maxItems: 2
> >          clock-names:
> >            items:
> >              - const: dma
> > @@ -151,6 +154,25 @@ allOf:
> >          dma-channels:
> >            const: 32
> >  
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          contains:
> > +            const: fsl,imx8ulp-edma
> > +    then:
> > +      properties:
> > +        clock:
> 
> clocks
> 
> > +          maxItems: 33
> 
> That is already the max. I think you want 'minItems: 33' here.
> 
> > +        clock-names:
> > +          items:
> > +            - const: dma
> > +            - pattern: "^CH[0-31]-clk$"
> 
> '-clk' is redundant. [0-31] is not how you do a range of numbers with 
> regex. 
> 
> This doesn't cover clocks 3-33. Not a great way to express in 
> json-schema, but this should do it:
> 
> allOf:
>   - items:
>       - const: dma
>   - items:
>       oneOf:
>         - const: dma
>         - pattern: "^ch([0-9]|[1-2][0-9]|[3[01])$"

I understand pattern is wrong. But I don't understand why need 'allOf'.
8ulp need clock 'dma" and "ch*". I think 

items:
    - const: dma 
    - pattern: "^CH[0-31]-clk$"

should be enough.

If you means put on top allOf, other platform use clock name such as
'dmamux0'.

Frank

> 
> That doesn't enforce the order of 'chN' entries though. Probably good 
> enough.
> 
> 
> > +        interrupt-names: false
> > +        interrupts:
> > +          maxItems: 32
> 
> minItems
> 
> > +        "#dma-cells":
> > +          const: 3
> 
> Is what is in each cell defined somewhere? If not, you need a 
> description with those details.
> 
> Rob
Rob Herring (Arm) March 6, 2024, 8:40 p.m. UTC | #3
On Mon, Mar 4, 2024 at 5:31 PM Frank Li <Frank.li@nxp.com> wrote:
>
> On Mon, Mar 04, 2024 at 10:44:23AM -0600, Rob Herring wrote:
> > On Thu, Feb 29, 2024 at 03:58:10PM -0500, Frank Li wrote:
> > > From: Joy Zou <joy.zou@nxp.com>
> > >
> > > Introduce the compatible string 'fsl,imx8ulp-edma' to enable support for
> > > the i.MX8ULP's eDMA, alongside adjusting the clock numbering. The i.MX8ULP
> > > eDMA architecture features one clock for each DMA channel and an additional
> > > clock for the core controller. Given a maximum of 32 DMA channels, the
> > > maximum clock number consequently increases to 33.
> > >
> > > Signed-off-by: Joy Zou <joy.zou@nxp.com>
> > > Signed-off-by: Frank Li <Frank.Li@nxp.com>
> > > ---
> > >  .../devicetree/bindings/dma/fsl,edma.yaml          | 26 ++++++++++++++++++++--
> > >  1 file changed, 24 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/Documentation/devicetree/bindings/dma/fsl,edma.yaml b/Documentation/devicetree/bindings/dma/fsl,edma.yaml
> > > index aa51d278cb67b..55cce79c759f8 100644
> > > --- a/Documentation/devicetree/bindings/dma/fsl,edma.yaml
> > > +++ b/Documentation/devicetree/bindings/dma/fsl,edma.yaml
> > > @@ -23,6 +23,7 @@ properties:
> > >            - fsl,imx7ulp-edma
> > >            - fsl,imx8qm-adma
> > >            - fsl,imx8qm-edma
> > > +          - fsl,imx8ulp-edma
> > >            - fsl,imx93-edma3
> > >            - fsl,imx93-edma4
> > >            - fsl,imx95-edma5
> > > @@ -53,11 +54,11 @@ properties:
> > >
> > >    clocks:
> > >      minItems: 1
> > > -    maxItems: 2
> > > +    maxItems: 33
> > >
> > >    clock-names:
> > >      minItems: 1
> > > -    maxItems: 2
> > > +    maxItems: 33
> > >
> > >    big-endian:
> > >      description: |
> > > @@ -108,6 +109,7 @@ allOf:
> > >        properties:
> > >          clocks:
> > >            minItems: 2
> > > +          maxItems: 2
> > >          clock-names:
> > >            items:
> > >              - const: dmamux0
> > > @@ -136,6 +138,7 @@ allOf:
> > >        properties:
> > >          clock:
> > >            minItems: 2
> > > +          maxItems: 2
> > >          clock-names:
> > >            items:
> > >              - const: dma
> > > @@ -151,6 +154,25 @@ allOf:
> > >          dma-channels:
> > >            const: 32
> > >
> > > +  - if:
> > > +      properties:
> > > +        compatible:
> > > +          contains:
> > > +            const: fsl,imx8ulp-edma
> > > +    then:
> > > +      properties:
> > > +        clock:
> >
> > clocks
> >
> > > +          maxItems: 33
> >
> > That is already the max. I think you want 'minItems: 33' here.
> >
> > > +        clock-names:
> > > +          items:
> > > +            - const: dma
> > > +            - pattern: "^CH[0-31]-clk$"
> >
> > '-clk' is redundant. [0-31] is not how you do a range of numbers with
> > regex.
> >
> > This doesn't cover clocks 3-33. Not a great way to express in
> > json-schema, but this should do it:
> >
> > allOf:
> >   - items:
> >       - const: dma
> >   - items:
> >       oneOf:
> >         - const: dma
> >         - pattern: "^ch([0-9]|[1-2][0-9]|[3[01])$"
>
> I understand pattern is wrong. But I don't understand why need 'allOf'.

The first 'items' says the 1st entry must be 'dma'. (It might need a
'maxItems: 33' too now that I look at it.) The 2nd 'items' says all
entries must be either 'dma' or the CHn pattern.

> 8ulp need clock 'dma" and "ch*". I think
>
> items:
>     - const: dma
>     - pattern: "^CH[0-31]-clk$"
>
> should be enough.

If it was, then I would not have said anything. If you don't believe
me see if this passes validation:

clock-names = "dma", "CH0", "foobar";

> If you means put on top allOf, other platform use clock name such as
> 'dmamux0'.

What? It's under an if/then schema.

Rob
Frank Li March 7, 2024, 9:41 p.m. UTC | #4
On Wed, Mar 06, 2024 at 02:40:23PM -0600, Rob Herring wrote:
> On Mon, Mar 4, 2024 at 5:31 PM Frank Li <Frank.li@nxp.com> wrote:
> >
> > On Mon, Mar 04, 2024 at 10:44:23AM -0600, Rob Herring wrote:
> > > On Thu, Feb 29, 2024 at 03:58:10PM -0500, Frank Li wrote:
> > > > From: Joy Zou <joy.zou@nxp.com>
> > > >
> > > > Introduce the compatible string 'fsl,imx8ulp-edma' to enable support for
> > > > the i.MX8ULP's eDMA, alongside adjusting the clock numbering. The i.MX8ULP
> > > > eDMA architecture features one clock for each DMA channel and an additional
> > > > clock for the core controller. Given a maximum of 32 DMA channels, the
> > > > maximum clock number consequently increases to 33.
> > > >
> > > > Signed-off-by: Joy Zou <joy.zou@nxp.com>
> > > > Signed-off-by: Frank Li <Frank.Li@nxp.com>
> > > > ---
> > > >  .../devicetree/bindings/dma/fsl,edma.yaml          | 26 ++++++++++++++++++++--
> > > >  1 file changed, 24 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/Documentation/devicetree/bindings/dma/fsl,edma.yaml b/Documentation/devicetree/bindings/dma/fsl,edma.yaml
> > > > index aa51d278cb67b..55cce79c759f8 100644
> > > > --- a/Documentation/devicetree/bindings/dma/fsl,edma.yaml
> > > > +++ b/Documentation/devicetree/bindings/dma/fsl,edma.yaml
> > > > @@ -23,6 +23,7 @@ properties:
> > > >            - fsl,imx7ulp-edma
> > > >            - fsl,imx8qm-adma
> > > >            - fsl,imx8qm-edma
> > > > +          - fsl,imx8ulp-edma
> > > >            - fsl,imx93-edma3
> > > >            - fsl,imx93-edma4
> > > >            - fsl,imx95-edma5
> > > > @@ -53,11 +54,11 @@ properties:
> > > >
> > > >    clocks:
> > > >      minItems: 1
> > > > -    maxItems: 2
> > > > +    maxItems: 33
> > > >
> > > >    clock-names:
> > > >      minItems: 1
> > > > -    maxItems: 2
> > > > +    maxItems: 33
> > > >
> > > >    big-endian:
> > > >      description: |
> > > > @@ -108,6 +109,7 @@ allOf:
> > > >        properties:
> > > >          clocks:
> > > >            minItems: 2
> > > > +          maxItems: 2
> > > >          clock-names:
> > > >            items:
> > > >              - const: dmamux0
> > > > @@ -136,6 +138,7 @@ allOf:
> > > >        properties:
> > > >          clock:
> > > >            minItems: 2
> > > > +          maxItems: 2
> > > >          clock-names:
> > > >            items:
> > > >              - const: dma
> > > > @@ -151,6 +154,25 @@ allOf:
> > > >          dma-channels:
> > > >            const: 32
> > > >
> > > > +  - if:
> > > > +      properties:
> > > > +        compatible:
> > > > +          contains:
> > > > +            const: fsl,imx8ulp-edma
> > > > +    then:
> > > > +      properties:
> > > > +        clock:
> > >
> > > clocks
> > >
> > > > +          maxItems: 33
> > >
> > > That is already the max. I think you want 'minItems: 33' here.
> > >
> > > > +        clock-names:
> > > > +          items:
> > > > +            - const: dma
> > > > +            - pattern: "^CH[0-31]-clk$"
> > >
> > > '-clk' is redundant. [0-31] is not how you do a range of numbers with
> > > regex.
> > >
> > > This doesn't cover clocks 3-33. Not a great way to express in
> > > json-schema, but this should do it:
> > >
> > > allOf:
> > >   - items:
> > >       - const: dma
> > >   - items:
> > >       oneOf:
> > >         - const: dma
> > >         - pattern: "^ch([0-9]|[1-2][0-9]|[3[01])$"
> >
> > I understand pattern is wrong. But I don't understand why need 'allOf'.
> 
> The first 'items' says the 1st entry must be 'dma'. (It might need a
> 'maxItems: 33' too now that I look at it.) The 2nd 'items' says all
> entries must be either 'dma' or the CHn pattern.
> 
> > 8ulp need clock 'dma" and "ch*". I think
> >
> > items:
> >     - const: dma
> >     - pattern: "^CH[0-31]-clk$"
> >
> > should be enough.
> 
> If it was, then I would not have said anything. If you don't believe
> me see if this passes validation:
> 
> clock-names = "dma", "CH0", "foobar";

        clock-names:                                                       
          minItems: 33                                                     
          items:                                                           
            oneOf:                                                         
              - const: dma                                                 
              - pattern: "^ch(0[0-9]|[1-2][0-9]|3[01])$"   

Above code can pass check and detect error of "foobar", it should miss
restriction about first item must be 'dma'.


Your previous allOf block, 
 allOf:                                                               
   - items:                                                           
       - const: dma                                                   
   - items:                                                           
       oneOf:                                                         
         - const: dma                                                 
         - pattern: "^ch([0-9]|[1-2][0-9]|[3[01])$" 

It reported clock-names too long.

Frank


> 
> > If you means put on top allOf, other platform use clock name such as
> > 'dmamux0'.
> 
> What? It's under an if/then schema.
> 
> Rob
Frank Li March 11, 2024, 2:38 a.m. UTC | #5
On Wed, Mar 06, 2024 at 02:40:23PM -0600, Rob Herring wrote:
> On Mon, Mar 4, 2024 at 5:31 PM Frank Li <Frank.li@nxp.com> wrote:
> >
> > On Mon, Mar 04, 2024 at 10:44:23AM -0600, Rob Herring wrote:
> > > On Thu, Feb 29, 2024 at 03:58:10PM -0500, Frank Li wrote:
> > > > From: Joy Zou <joy.zou@nxp.com>
> > > >
> > > > Introduce the compatible string 'fsl,imx8ulp-edma' to enable support for
> > > > the i.MX8ULP's eDMA, alongside adjusting the clock numbering. The i.MX8ULP
> > > > eDMA architecture features one clock for each DMA channel and an additional
> > > > clock for the core controller. Given a maximum of 32 DMA channels, the
> > > > maximum clock number consequently increases to 33.
> > > >
> > > > Signed-off-by: Joy Zou <joy.zou@nxp.com>
> > > > Signed-off-by: Frank Li <Frank.Li@nxp.com>
> > > > ---
> > > >  .../devicetree/bindings/dma/fsl,edma.yaml          | 26 ++++++++++++++++++++--
> > > >  1 file changed, 24 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/Documentation/devicetree/bindings/dma/fsl,edma.yaml b/Documentation/devicetree/bindings/dma/fsl,edma.yaml
> > > > index aa51d278cb67b..55cce79c759f8 100644
> > > > --- a/Documentation/devicetree/bindings/dma/fsl,edma.yaml
> > > > +++ b/Documentation/devicetree/bindings/dma/fsl,edma.yaml
> > > > @@ -23,6 +23,7 @@ properties:
> > > >            - fsl,imx7ulp-edma
> > > >            - fsl,imx8qm-adma
> > > >            - fsl,imx8qm-edma
> > > > +          - fsl,imx8ulp-edma
> > > >            - fsl,imx93-edma3
> > > >            - fsl,imx93-edma4
> > > >            - fsl,imx95-edma5
> > > > @@ -53,11 +54,11 @@ properties:
> > > >
> > > >    clocks:
> > > >      minItems: 1
> > > > -    maxItems: 2
> > > > +    maxItems: 33
> > > >
> > > >    clock-names:
> > > >      minItems: 1
> > > > -    maxItems: 2
> > > > +    maxItems: 33
> > > >
> > > >    big-endian:
> > > >      description: |
> > > > @@ -108,6 +109,7 @@ allOf:
> > > >        properties:
> > > >          clocks:
> > > >            minItems: 2
> > > > +          maxItems: 2
> > > >          clock-names:
> > > >            items:
> > > >              - const: dmamux0
> > > > @@ -136,6 +138,7 @@ allOf:
> > > >        properties:
> > > >          clock:
> > > >            minItems: 2
> > > > +          maxItems: 2
> > > >          clock-names:
> > > >            items:
> > > >              - const: dma
> > > > @@ -151,6 +154,25 @@ allOf:
> > > >          dma-channels:
> > > >            const: 32
> > > >
> > > > +  - if:
> > > > +      properties:
> > > > +        compatible:
> > > > +          contains:
> > > > +            const: fsl,imx8ulp-edma
> > > > +    then:
> > > > +      properties:
> > > > +        clock:
> > >
> > > clocks
> > >
> > > > +          maxItems: 33
> > >
> > > That is already the max. I think you want 'minItems: 33' here.
> > >
> > > > +        clock-names:
> > > > +          items:
> > > > +            - const: dma
> > > > +            - pattern: "^CH[0-31]-clk$"
> > >
> > > '-clk' is redundant. [0-31] is not how you do a range of numbers with
> > > regex.
> > >
> > > This doesn't cover clocks 3-33. Not a great way to express in
> > > json-schema, but this should do it:
> > >
> > > allOf:
> > >   - items:
> > >       - const: dma
> > >   - items:
> > >       oneOf:
> > >         - const: dma
> > >         - pattern: "^ch([0-9]|[1-2][0-9]|[3[01])$"
> >
> > I understand pattern is wrong. But I don't understand why need 'allOf'.
> 
> The first 'items' says the 1st entry must be 'dma'. (It might need a
> 'maxItems: 33' too now that I look at it.) The 2nd 'items' says all
> entries must be either 'dma' or the CHn pattern.

After dig into dt_scheme and json scheme, I start understand what your
means.

"clock-names": {                                   
    "minItems": 33,                                
    "allOf": [                                     
         {                                          
            "items": [                             
                 {                                  
                     "const": "dma"                 
                 }                                  
            ],                                     
            "maxItems": 33, 
            ^^^^^^^^
      Here need a maxItem 33 and make sure first item is "dma" and total
array is 33.                       

            "type": "array",                       
            "minItems": 1                          
         },                                         
         {                                          
            "items": {                             
            "oneOf": [                         
                 {                              
                      "const": "dma"             
                 },                             
                 {                              
                       "pattern": "^ch(0[0-9]|[1-2][0-9]|3[01])$"
                 }                              
                 ]                                  
            },                                     
            "type": "array"                        
         }                                          
    ]                                              
}

The yaml source is

          allOf:                                                           
            - items:                                                       
                - const: dma                                               
              maxItems: 33                                                 
            - items:                                                       
                oneOf:                                                     
                  - const: dma                                             
                  - pattern: "^ch(0[0-9]|[1-2][0-9]|3[01])$"


But unfortunately, 

dtschema/meta-schemas/items.yaml

    type: object                                                         
      properties:                                                          
        items:                                                             
          type: array                                                      
        additionalItems: false                                             
      required:                                                            
        - items                                                            
        - maxItems                                                         
    then:                                                                  
      description: '"maxItems" is not needed with an "items" list'         
      not:                                                                 
        required:                                                          
          - maxItem


dt_binding check will complain
	'"maxItems" is not needed with an "items" list'


I am not sure how to go futher. Maybe below 'stupid' method is less impact.

items
  - const: dma
  - const: ch00
  ...
  - const: ch31
	  

Frank

> 
> > 8ulp need clock 'dma" and "ch*". I think
> >
> > items:
> >     - const: dma
> >     - pattern: "^CH[0-31]-clk$"
> >
> > should be enough.
> 
> If it was, then I would not have said anything. If you don't believe
> me see if this passes validation:
> 
> clock-names = "dma", "CH0", "foobar";
> 
> > If you means put on top allOf, other platform use clock name such as
> > 'dmamux0'.
> 
> What? It's under an if/then schema.
> 
> Rob
Frank Li March 19, 2024, 8:12 p.m. UTC | #6
On Sun, Mar 10, 2024 at 10:38:42PM -0400, Frank Li wrote:
> On Wed, Mar 06, 2024 at 02:40:23PM -0600, Rob Herring wrote:
> > On Mon, Mar 4, 2024 at 5:31 PM Frank Li <Frank.li@nxp.com> wrote:
> > >
> > > On Mon, Mar 04, 2024 at 10:44:23AM -0600, Rob Herring wrote:
> > > > On Thu, Feb 29, 2024 at 03:58:10PM -0500, Frank Li wrote:
> > > > > From: Joy Zou <joy.zou@nxp.com>
> > > > >
> > > > > Introduce the compatible string 'fsl,imx8ulp-edma' to enable support for
> > > > > the i.MX8ULP's eDMA, alongside adjusting the clock numbering. The i.MX8ULP
> > > > > eDMA architecture features one clock for each DMA channel and an additional
> > > > > clock for the core controller. Given a maximum of 32 DMA channels, the
> > > > > maximum clock number consequently increases to 33.
> > > > >
> > > > > Signed-off-by: Joy Zou <joy.zou@nxp.com>
> > > > > Signed-off-by: Frank Li <Frank.Li@nxp.com>
> > > > > ---
> > > > >  .../devicetree/bindings/dma/fsl,edma.yaml          | 26 ++++++++++++++++++++--
> > > > >  1 file changed, 24 insertions(+), 2 deletions(-)
> > > > >
> > > > > diff --git a/Documentation/devicetree/bindings/dma/fsl,edma.yaml b/Documentation/devicetree/bindings/dma/fsl,edma.yaml
> > > > > index aa51d278cb67b..55cce79c759f8 100644
> > > > > --- a/Documentation/devicetree/bindings/dma/fsl,edma.yaml
> > > > > +++ b/Documentation/devicetree/bindings/dma/fsl,edma.yaml
> > > > > @@ -23,6 +23,7 @@ properties:
> > > > >            - fsl,imx7ulp-edma
> > > > >            - fsl,imx8qm-adma
> > > > >            - fsl,imx8qm-edma
> > > > > +          - fsl,imx8ulp-edma
> > > > >            - fsl,imx93-edma3
> > > > >            - fsl,imx93-edma4
> > > > >            - fsl,imx95-edma5
> > > > > @@ -53,11 +54,11 @@ properties:
> > > > >
> > > > >    clocks:
> > > > >      minItems: 1
> > > > > -    maxItems: 2
> > > > > +    maxItems: 33
> > > > >
> > > > >    clock-names:
> > > > >      minItems: 1
> > > > > -    maxItems: 2
> > > > > +    maxItems: 33
> > > > >
> > > > >    big-endian:
> > > > >      description: |
> > > > > @@ -108,6 +109,7 @@ allOf:
> > > > >        properties:
> > > > >          clocks:
> > > > >            minItems: 2
> > > > > +          maxItems: 2
> > > > >          clock-names:
> > > > >            items:
> > > > >              - const: dmamux0
> > > > > @@ -136,6 +138,7 @@ allOf:
> > > > >        properties:
> > > > >          clock:
> > > > >            minItems: 2
> > > > > +          maxItems: 2
> > > > >          clock-names:
> > > > >            items:
> > > > >              - const: dma
> > > > > @@ -151,6 +154,25 @@ allOf:
> > > > >          dma-channels:
> > > > >            const: 32
> > > > >
> > > > > +  - if:
> > > > > +      properties:
> > > > > +        compatible:
> > > > > +          contains:
> > > > > +            const: fsl,imx8ulp-edma
> > > > > +    then:
> > > > > +      properties:
> > > > > +        clock:
> > > >
> > > > clocks
> > > >
> > > > > +          maxItems: 33
> > > >
> > > > That is already the max. I think you want 'minItems: 33' here.
> > > >
> > > > > +        clock-names:
> > > > > +          items:
> > > > > +            - const: dma
> > > > > +            - pattern: "^CH[0-31]-clk$"
> > > >
> > > > '-clk' is redundant. [0-31] is not how you do a range of numbers with
> > > > regex.
> > > >
> > > > This doesn't cover clocks 3-33. Not a great way to express in
> > > > json-schema, but this should do it:
> > > >
> > > > allOf:
> > > >   - items:
> > > >       - const: dma
> > > >   - items:
> > > >       oneOf:
> > > >         - const: dma
> > > >         - pattern: "^ch([0-9]|[1-2][0-9]|[3[01])$"
> > >
> > > I understand pattern is wrong. But I don't understand why need 'allOf'.
> > 
> > The first 'items' says the 1st entry must be 'dma'. (It might need a
> > 'maxItems: 33' too now that I look at it.) The 2nd 'items' says all
> > entries must be either 'dma' or the CHn pattern.
> 
> After dig into dt_scheme and json scheme, I start understand what your
> means.
> 
> "clock-names": {                                   
>     "minItems": 33,                                
>     "allOf": [                                     
>          {                                          
>             "items": [                             
>                  {                                  
>                      "const": "dma"                 
>                  }                                  
>             ],                                     
>             "maxItems": 33, 
>             ^^^^^^^^
>       Here need a maxItem 33 and make sure first item is "dma" and total
> array is 33.                       
> 
>             "type": "array",                       
>             "minItems": 1                          
>          },                                         
>          {                                          
>             "items": {                             
>             "oneOf": [                         
>                  {                              
>                       "const": "dma"             
>                  },                             
>                  {                              
>                        "pattern": "^ch(0[0-9]|[1-2][0-9]|3[01])$"
>                  }                              
>                  ]                                  
>             },                                     
>             "type": "array"                        
>          }                                          
>     ]                                              
> }
> 
> The yaml source is
> 
>           allOf:                                                           
>             - items:                                                       
>                 - const: dma                                               
>               maxItems: 33                                                 
>             - items:                                                       
>                 oneOf:                                                     
>                   - const: dma                                             
>                   - pattern: "^ch(0[0-9]|[1-2][0-9]|3[01])$"
> 
> 
> But unfortunately, 
> 
> dtschema/meta-schemas/items.yaml
> 
>     type: object                                                         
>       properties:                                                          
>         items:                                                             
>           type: array                                                      
>         additionalItems: false                                             
>       required:                                                            
>         - items                                                            
>         - maxItems                                                         
>     then:                                                                  
>       description: '"maxItems" is not needed with an "items" list'         
>       not:                                                                 
>         required:                                                          
>           - maxItem
> 
> 
> dt_binding check will complain
> 	'"maxItems" is not needed with an "items" list'
> 
> 
> I am not sure how to go futher. Maybe below 'stupid' method is less impact.
> 
> items
>   - const: dma
>   - const: ch00
>   ...
>   - const: ch31
> 	  
> 
> Frank

@rob:

       I can't found out a way to to handle this case. 
dtschema/meta-schemas/items.yaml not allow 'maxItems' for 'items'.

       Any suggestion?

Frank

> 
> > 
> > > 8ulp need clock 'dma" and "ch*". I think
> > >
> > > items:
> > >     - const: dma
> > >     - pattern: "^CH[0-31]-clk$"
> > >
> > > should be enough.
> > 
> > If it was, then I would not have said anything. If you don't believe
> > me see if this passes validation:
> > 
> > clock-names = "dma", "CH0", "foobar";
> > 
> > > If you means put on top allOf, other platform use clock name such as
> > > 'dmamux0'.
> > 
> > What? It's under an if/then schema.
> > 
> > Rob
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/dma/fsl,edma.yaml b/Documentation/devicetree/bindings/dma/fsl,edma.yaml
index aa51d278cb67b..55cce79c759f8 100644
--- a/Documentation/devicetree/bindings/dma/fsl,edma.yaml
+++ b/Documentation/devicetree/bindings/dma/fsl,edma.yaml
@@ -23,6 +23,7 @@  properties:
           - fsl,imx7ulp-edma
           - fsl,imx8qm-adma
           - fsl,imx8qm-edma
+          - fsl,imx8ulp-edma
           - fsl,imx93-edma3
           - fsl,imx93-edma4
           - fsl,imx95-edma5
@@ -53,11 +54,11 @@  properties:
 
   clocks:
     minItems: 1
-    maxItems: 2
+    maxItems: 33
 
   clock-names:
     minItems: 1
-    maxItems: 2
+    maxItems: 33
 
   big-endian:
     description: |
@@ -108,6 +109,7 @@  allOf:
       properties:
         clocks:
           minItems: 2
+          maxItems: 2
         clock-names:
           items:
             - const: dmamux0
@@ -136,6 +138,7 @@  allOf:
       properties:
         clock:
           minItems: 2
+          maxItems: 2
         clock-names:
           items:
             - const: dma
@@ -151,6 +154,25 @@  allOf:
         dma-channels:
           const: 32
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: fsl,imx8ulp-edma
+    then:
+      properties:
+        clock:
+          maxItems: 33
+        clock-names:
+          items:
+            - const: dma
+            - pattern: "^CH[0-31]-clk$"
+        interrupt-names: false
+        interrupts:
+          maxItems: 32
+        "#dma-cells":
+          const: 3
+
 unevaluatedProperties: false
 
 examples: