diff mbox series

[v2,2/6] dt-bindings: gpio: vf610: correct i.MX8ULP and i.MX93

Message ID 20230916-vf610-gpio-v2-2-40823da788d7@nxp.com
State Superseded
Headers show
Series gpio: update i.MX93/8ULP and support i.MX95 | expand

Checks

Context Check Description
robh/checkpatch success
robh/patch-applied success
robh/dtbs-check warning build log
robh/dt-meta-schema success

Commit Message

Peng Fan (OSS) Sept. 16, 2023, 2:03 a.m. UTC
From: Peng Fan <peng.fan@nxp.com>

i.MX8ULP and i.MX93 actually has two interrupts for each gpio
controller, one for Trustzone non-secure world, one for secure world.

And they has one register based, not two as i.MX7ULP or VF610.

Although the Linux Kernel driver gpio-vf610.c could work with
fsl,imx7ulp-gpio compatible, it is based on some tricks did in
device tree with some offset added to base address.

So actually i.MX8ULP/i.MX93 is not compatible with i.MX7ULP.

Last, i.MX93 is directly derived from i.MX8ULP, so make i.MX93 GPIO
compatible with i.MX8ULP

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 .../devicetree/bindings/gpio/gpio-vf610.yaml       | 41 +++++++++++++++++++---
 1 file changed, 37 insertions(+), 4 deletions(-)

Comments

Krzysztof Kozlowski Sept. 17, 2023, 7:52 a.m. UTC | #1
On 16/09/2023 04:03, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
> 
> i.MX8ULP and i.MX93 actually has two interrupts for each gpio
> controller, one for Trustzone non-secure world, one for secure world.
> 
> And they has one register based, not two as i.MX7ULP or VF610.
> 
> Although the Linux Kernel driver gpio-vf610.c could work with
> fsl,imx7ulp-gpio compatible, it is based on some tricks did in
> device tree with some offset added to base address.
> 
> So actually i.MX8ULP/i.MX93 is not compatible with i.MX7ULP.
> 
> Last, i.MX93 is directly derived from i.MX8ULP, so make i.MX93 GPIO
> compatible with i.MX8ULP
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  .../devicetree/bindings/gpio/gpio-vf610.yaml       | 41 +++++++++++++++++++---
>  1 file changed, 37 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/gpio/gpio-vf610.yaml b/Documentation/devicetree/bindings/gpio/gpio-vf610.yaml
> index 59427d97adf5..8c1f87a1a393 100644
> --- a/Documentation/devicetree/bindings/gpio/gpio-vf610.yaml
> +++ b/Documentation/devicetree/bindings/gpio/gpio-vf610.yaml
> @@ -20,6 +20,7 @@ description: |
>  properties:
>    compatible:
>      oneOf:
> +      - const: fsl,imx8ulp-gpio
>        - const: fsl,vf610-gpio
>        - items:
>            - const: fsl,imx7ulp-gpio
> @@ -27,16 +28,21 @@ properties:
>        - items:
>            - enum:
>                - fsl,imx93-gpio
> -              - fsl,imx8ulp-gpio
> -          - const: fsl,imx7ulp-gpio
> +          - const: fsl,imx8ulp-gpio
>  
>    reg:
>      description: The first reg tuple represents the PORT module, the second tuple
>        represents the GPIO module.
> -    maxItems: 2
> +    items:
> +      - description: PORT register base address
> +      - description: GPIO register base address
> +    minItems: 1
>  
>    interrupts:
> -    maxItems: 1
> +    items:
> +      - description: GPIO Trustzone non-secure interrupt number
> +      - description: GPIO Trustzone secure interrupt number
> +    minItems: 1
>  
>    interrupt-controller: true
>  
> @@ -78,6 +84,33 @@ required:
>    - "#gpio-cells"
>    - gpio-controller
>  
> +allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - fsl,vf610-gpio
> +              - fsl,imx7ulp-gpio
> +    then:
> +      properties:
> +        interrupts:
> +          items:
> +            - description: GPIO interrupt number

So this is different than first interrupt mentioned in top-level?


> +        reg:
> +          items:
> +            - description: PORT register base address
> +            - description: GPIO register base address

You have the description in top-level, no need to repeat it. Just
minItems: 2... although it depends whether top-level property will stay.


> +    else:
> +      properties:
> +        interrupts:
> +          items:
> +            - description: GPIO Trustzone non-secure interrupt number
> +            - description: GPIO Trustzone secure interrupt number
> +        reg:
> +          items:
> +            - description: GPIO register base address

So the first entry is different between variants? Then top-level should
be just min/maxItems.

> +
>  additionalProperties: false
>  
>  examples:
> 

Best regards,
Krzysztof
Peng Fan Sept. 17, 2023, 12:46 p.m. UTC | #2
> Subject: Re: [PATCH v2 2/6] dt-bindings: gpio: vf610: correct i.MX8ULP and
> i.MX93
> 
> On 16/09/2023 04:03, Peng Fan (OSS) wrote:
> > From: Peng Fan <peng.fan@nxp.com>
> >
> > i.MX8ULP and i.MX93 actually has two interrupts for each gpio
> > controller, one for Trustzone non-secure world, one for secure world.
> >
> > And they has one register based, not two as i.MX7ULP or VF610.
> >
> > Although the Linux Kernel driver gpio-vf610.c could work with
> > fsl,imx7ulp-gpio compatible, it is based on some tricks did in device
> > tree with some offset added to base address.
> >
> > So actually i.MX8ULP/i.MX93 is not compatible with i.MX7ULP.
> >
> > Last, i.MX93 is directly derived from i.MX8ULP, so make i.MX93 GPIO
> > compatible with i.MX8ULP
> >
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > ---
> >  .../devicetree/bindings/gpio/gpio-vf610.yaml       | 41
> +++++++++++++++++++---
> >  1 file changed, 37 insertions(+), 4 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/gpio/gpio-vf610.yaml
> > b/Documentation/devicetree/bindings/gpio/gpio-vf610.yaml
> > index 59427d97adf5..8c1f87a1a393 100644
> > --- a/Documentation/devicetree/bindings/gpio/gpio-vf610.yaml
> > +++ b/Documentation/devicetree/bindings/gpio/gpio-vf610.yaml
> > @@ -20,6 +20,7 @@ description: |
> >  properties:
> >    compatible:
> >      oneOf:
> > +      - const: fsl,imx8ulp-gpio
> >        - const: fsl,vf610-gpio
> >        - items:
> >            - const: fsl,imx7ulp-gpio
> > @@ -27,16 +28,21 @@ properties:
> >        - items:
> >            - enum:
> >                - fsl,imx93-gpio
> > -              - fsl,imx8ulp-gpio
> > -          - const: fsl,imx7ulp-gpio
> > +          - const: fsl,imx8ulp-gpio
> >
> >    reg:
> >      description: The first reg tuple represents the PORT module, the second
> tuple
> >        represents the GPIO module.
> > -    maxItems: 2
> > +    items:
> > +      - description: PORT register base address
> > +      - description: GPIO register base address
> > +    minItems: 1
> >
> >    interrupts:
> > -    maxItems: 1
> > +    items:
> > +      - description: GPIO Trustzone non-secure interrupt number
> > +      - description: GPIO Trustzone secure interrupt number
> > +    minItems: 1
> >
> >    interrupt-controller: true
> >
> > @@ -78,6 +84,33 @@ required:
> >    - "#gpio-cells"
> >    - gpio-controller
> >
> > +allOf:
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          contains:
> > +            enum:
> > +              - fsl,vf610-gpio
> > +              - fsl,imx7ulp-gpio
> > +    then:
> > +      properties:
> > +        interrupts:
> > +          items:
> > +            - description: GPIO interrupt number
> 
> So this is different than first interrupt mentioned in top-level?

Should be same, I will use maxItems: 1 here.
> 
> 
> > +        reg:
> > +          items:
> > +            - description: PORT register base address
> > +            - description: GPIO register base address
> 
> You have the description in top-level, no need to repeat it. Just
> minItems: 2... although it depends whether top-level property will stay.

Ok, got it.
> 
> 
> > +    else:
> > +      properties:
> > +        interrupts:
> > +          items:
> > +            - description: GPIO Trustzone non-secure interrupt number
> > +            - description: GPIO Trustzone secure interrupt number
> > +        reg:
> > +          items:
> > +            - description: GPIO register base address
> 
> So the first entry is different between variants? Then top-level should be just
> min/maxItems.

Yes, I think so. Rob commented to list items in top level, so ..

Thanks,
Peng.


> 
> > +
> >  additionalProperties: false
> >
> >  examples:
> >
> 
> Best regards,
> Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/gpio/gpio-vf610.yaml b/Documentation/devicetree/bindings/gpio/gpio-vf610.yaml
index 59427d97adf5..8c1f87a1a393 100644
--- a/Documentation/devicetree/bindings/gpio/gpio-vf610.yaml
+++ b/Documentation/devicetree/bindings/gpio/gpio-vf610.yaml
@@ -20,6 +20,7 @@  description: |
 properties:
   compatible:
     oneOf:
+      - const: fsl,imx8ulp-gpio
       - const: fsl,vf610-gpio
       - items:
           - const: fsl,imx7ulp-gpio
@@ -27,16 +28,21 @@  properties:
       - items:
           - enum:
               - fsl,imx93-gpio
-              - fsl,imx8ulp-gpio
-          - const: fsl,imx7ulp-gpio
+          - const: fsl,imx8ulp-gpio
 
   reg:
     description: The first reg tuple represents the PORT module, the second tuple
       represents the GPIO module.
-    maxItems: 2
+    items:
+      - description: PORT register base address
+      - description: GPIO register base address
+    minItems: 1
 
   interrupts:
-    maxItems: 1
+    items:
+      - description: GPIO Trustzone non-secure interrupt number
+      - description: GPIO Trustzone secure interrupt number
+    minItems: 1
 
   interrupt-controller: true
 
@@ -78,6 +84,33 @@  required:
   - "#gpio-cells"
   - gpio-controller
 
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - fsl,vf610-gpio
+              - fsl,imx7ulp-gpio
+    then:
+      properties:
+        interrupts:
+          items:
+            - description: GPIO interrupt number
+        reg:
+          items:
+            - description: PORT register base address
+            - description: GPIO register base address
+    else:
+      properties:
+        interrupts:
+          items:
+            - description: GPIO Trustzone non-secure interrupt number
+            - description: GPIO Trustzone secure interrupt number
+        reg:
+          items:
+            - description: GPIO register base address
+
 additionalProperties: false
 
 examples: