[PATCH v3 1/3] dt-bindings: can: fsl,flexcan: add S32G2/S32G3 SoC support

Ciprian Costea posted 3 patches 1 year, 2 months ago
There is a newer version of this series
[PATCH v3 1/3] dt-bindings: can: fsl,flexcan: add S32G2/S32G3 SoC support
Posted by Ciprian Costea 1 year, 2 months ago
From: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com>

Add S32G2/S32G3 SoCs compatible strings.

A particularity for these SoCs is the presence of separate interrupts for
state change, bus errors, MBs 0-7 and MBs 8-127 respectively.

Increase maxItems of 'interrupts' to 4 for S32G based SoCs and keep the
same restriction for other SoCs.

Also, as part of this commit, move the 'allOf' after the required
properties to make the documentation easier to read.

Signed-off-by: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com>
---
 .../bindings/net/can/fsl,flexcan.yaml         | 46 +++++++++++++++++--
 1 file changed, 42 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
index 97dd1a7c5ed2..10b658e85ef2 100644
--- a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
+++ b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
@@ -10,9 +10,6 @@ title:
 maintainers:
   - Marc Kleine-Budde <mkl@pengutronix.de>
 
-allOf:
-  - $ref: can-controller.yaml#
-
 properties:
   compatible:
     oneOf:
@@ -28,6 +25,7 @@ properties:
           - fsl,vf610-flexcan
           - fsl,ls1021ar2-flexcan
           - fsl,lx2160ar1-flexcan
+          - nxp,s32g2-flexcan
       - items:
           - enum:
               - fsl,imx53-flexcan
@@ -43,12 +41,21 @@ properties:
           - enum:
               - fsl,ls1028ar1-flexcan
           - const: fsl,lx2160ar1-flexcan
+      - items:
+          - enum:
+              - nxp,s32g3-flexcan
+          - const: nxp,s32g2-flexcan
 
   reg:
     maxItems: 1
 
   interrupts:
-    maxItems: 1
+    minItems: 1
+    maxItems: 4
+
+  interrupt-names:
+    minItems: 1
+    maxItems: 4
 
   clocks:
     maxItems: 2
@@ -136,6 +143,37 @@ required:
   - reg
   - interrupts
 
+allOf:
+  - $ref: can-controller.yaml#
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: nxp,s32g2-flexcan
+    then:
+      properties:
+        interrupts:
+          items:
+            - description: Message Buffer interrupt for mailboxes 0-7 and Enhanced RX FIFO
+            - description: Device state change
+            - description: Error detection
+            - description: Message Buffer interrupt for mailboxes 8-127
+        interrupt-names:
+          items:
+            - const: mb-0
+            - const: state
+            - const: berr
+            - const: mb-1
+      required:
+        - compatible
+        - reg
+        - interrupts
+        - interrupt-names
+    else:
+      properties:
+        interrupts:
+          maxItems: 1
+
 additionalProperties: false
 
 examples:
-- 
2.45.2
Re: [PATCH v3 1/3] dt-bindings: can: fsl,flexcan: add S32G2/S32G3 SoC support
Posted by Krzysztof Kozlowski 1 year, 2 months ago
On 29/11/2024 15:25, Ciprian Costea wrote:
> +      properties:
> +        interrupts:
> +          items:
> +            - description: Message Buffer interrupt for mailboxes 0-7 and Enhanced RX FIFO
> +            - description: Device state change
> +            - description: Error detection
> +            - description: Message Buffer interrupt for mailboxes 8-127
> +        interrupt-names:
> +          items:
> +            - const: mb-0
> +            - const: state
> +            - const: berr
> +            - const: mb-1
> +      required:
> +        - compatible
> +        - reg


Drop, aren't they already required?

> +        - interrupts
> +        - interrupt-names
> +    else:
> +      properties:
> +        interrupts:
> +          maxItems: 1


Missing constraints for interrupt-names, e.g. :false.


> +
>  additionalProperties: false
>  
>  examples:


Best regards,
Krzysztof
Re: [PATCH v3 1/3] dt-bindings: can: fsl,flexcan: add S32G2/S32G3 SoC support
Posted by Ciprian Marian Costea 1 year, 2 months ago
On 11/29/2024 6:05 PM, Krzysztof Kozlowski wrote:
> On 29/11/2024 15:25, Ciprian Costea wrote:
>> +      properties:
>> +        interrupts:
>> +          items:
>> +            - description: Message Buffer interrupt for mailboxes 0-7 and Enhanced RX FIFO
>> +            - description: Device state change
>> +            - description: Error detection
>> +            - description: Message Buffer interrupt for mailboxes 8-127
>> +        interrupt-names:
>> +          items:
>> +            - const: mb-0
>> +            - const: state
>> +            - const: berr
>> +            - const: mb-1
>> +      required:
>> +        - compatible
>> +        - reg
> 
> 
> Drop, aren't they already required?
> 

Yes, I was not sure if 'required' here overrides or appends the items to 
the 'global' required declaration.
Now I know it appends them, so I will only keep 'interrupt-names'. Thanks.

>> +        - interrupts
>> +        - interrupt-names
>> +    else:
>> +      properties:
>> +        interrupts:
>> +          maxItems: 1
> 
> 
> Missing constraints for interrupt-names, e.g. :false.
> 

Correct, I will add 'interrupt-names' constraint in V4.

> 
>> +
>>   additionalProperties: false
>>   
>>   examples:
> 
> 
> Best regards,
> Krzysztof

Best Regards,
Ciprian
Re: [PATCH v3 1/3] dt-bindings: can: fsl,flexcan: add S32G2/S32G3 SoC support
Posted by Marc Kleine-Budde 1 year, 2 months ago
On 29.11.2024 16:25:33, Ciprian Costea wrote:
> From: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com>
> 
> Add S32G2/S32G3 SoCs compatible strings.
> 
> A particularity for these SoCs is the presence of separate interrupts for
> state change, bus errors, MBs 0-7 and MBs 8-127 respectively.
> 
> Increase maxItems of 'interrupts' to 4 for S32G based SoCs and keep the
> same restriction for other SoCs.
> 
> Also, as part of this commit, move the 'allOf' after the required
> properties to make the documentation easier to read.
> 
> Signed-off-by: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com>
> ---
>  .../bindings/net/can/fsl,flexcan.yaml         | 46 +++++++++++++++++--
>  1 file changed, 42 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
> index 97dd1a7c5ed2..10b658e85ef2 100644
> --- a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
> +++ b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
> @@ -10,9 +10,6 @@ title:
>  maintainers:
>    - Marc Kleine-Budde <mkl@pengutronix.de>
>  
> -allOf:
> -  - $ref: can-controller.yaml#
> -
>  properties:
>    compatible:
>      oneOf:
> @@ -28,6 +25,7 @@ properties:
>            - fsl,vf610-flexcan
>            - fsl,ls1021ar2-flexcan
>            - fsl,lx2160ar1-flexcan
> +          - nxp,s32g2-flexcan
>        - items:
>            - enum:
>                - fsl,imx53-flexcan
> @@ -43,12 +41,21 @@ properties:
>            - enum:
>                - fsl,ls1028ar1-flexcan
>            - const: fsl,lx2160ar1-flexcan
> +      - items:
> +          - enum:
> +              - nxp,s32g3-flexcan
> +          - const: nxp,s32g2-flexcan
>  
>    reg:
>      maxItems: 1
>  
>    interrupts:
> -    maxItems: 1
> +    minItems: 1
> +    maxItems: 4
> +
> +  interrupt-names:
> +    minItems: 1
> +    maxItems: 4
>  
>    clocks:
>      maxItems: 2
> @@ -136,6 +143,37 @@ required:
>    - reg
>    - interrupts
>  
> +allOf:
> +  - $ref: can-controller.yaml#
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: nxp,s32g2-flexcan
> +    then:
> +      properties:
> +        interrupts:
> +          items:
> +            - description: Message Buffer interrupt for mailboxes 0-7 and Enhanced RX FIFO
> +            - description: Device state change
> +            - description: Error detection
> +            - description: Message Buffer interrupt for mailboxes 8-127
> +        interrupt-names:
> +          items:
> +            - const: mb-0
> +            - const: state
> +            - const: berr

Nitpick:

- description: Error detection
and
- const: err

or

- description: Bus Error detection
and
- const: berr

regards,
Marc

> +            - const: mb-1
> +      required:
> +        - compatible
> +        - reg
> +        - interrupts
> +        - interrupt-names
> +    else:
> +      properties:
> +        interrupts:
> +          maxItems: 1
> +
>  additionalProperties: false
>  
>  examples:
> -- 
> 2.45.2
> 
> 

-- 
Pengutronix e.K.                 | Marc Kleine-Budde          |
Embedded Linux                   | https://www.pengutronix.de |
Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |
Re: [PATCH v3 1/3] dt-bindings: can: fsl,flexcan: add S32G2/S32G3 SoC support
Posted by Ciprian Marian Costea 1 year, 2 months ago
On 11/29/2024 4:37 PM, Marc Kleine-Budde wrote:
> On 29.11.2024 16:25:33, Ciprian Costea wrote:
>> From: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com>
>>
>> Add S32G2/S32G3 SoCs compatible strings.
>>
>> A particularity for these SoCs is the presence of separate interrupts for
>> state change, bus errors, MBs 0-7 and MBs 8-127 respectively.
>>
>> Increase maxItems of 'interrupts' to 4 for S32G based SoCs and keep the
>> same restriction for other SoCs.
>>
>> Also, as part of this commit, move the 'allOf' after the required
>> properties to make the documentation easier to read.
>>
>> Signed-off-by: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com>
>> ---
>>   .../bindings/net/can/fsl,flexcan.yaml         | 46 +++++++++++++++++--
>>   1 file changed, 42 insertions(+), 4 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
>> index 97dd1a7c5ed2..10b658e85ef2 100644
>> --- a/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
>> +++ b/Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml
>> @@ -10,9 +10,6 @@ title:
>>   maintainers:
>>     - Marc Kleine-Budde <mkl@pengutronix.de>
>>   
>> -allOf:
>> -  - $ref: can-controller.yaml#
>> -
>>   properties:
>>     compatible:
>>       oneOf:
>> @@ -28,6 +25,7 @@ properties:
>>             - fsl,vf610-flexcan
>>             - fsl,ls1021ar2-flexcan
>>             - fsl,lx2160ar1-flexcan
>> +          - nxp,s32g2-flexcan
>>         - items:
>>             - enum:
>>                 - fsl,imx53-flexcan
>> @@ -43,12 +41,21 @@ properties:
>>             - enum:
>>                 - fsl,ls1028ar1-flexcan
>>             - const: fsl,lx2160ar1-flexcan
>> +      - items:
>> +          - enum:
>> +              - nxp,s32g3-flexcan
>> +          - const: nxp,s32g2-flexcan
>>   
>>     reg:
>>       maxItems: 1
>>   
>>     interrupts:
>> -    maxItems: 1
>> +    minItems: 1
>> +    maxItems: 4
>> +
>> +  interrupt-names:
>> +    minItems: 1
>> +    maxItems: 4
>>   
>>     clocks:
>>       maxItems: 2
>> @@ -136,6 +143,37 @@ required:
>>     - reg
>>     - interrupts
>>   
>> +allOf:
>> +  - $ref: can-controller.yaml#
>> +  - if:
>> +      properties:
>> +        compatible:
>> +          contains:
>> +            const: nxp,s32g2-flexcan
>> +    then:
>> +      properties:
>> +        interrupts:
>> +          items:
>> +            - description: Message Buffer interrupt for mailboxes 0-7 and Enhanced RX FIFO
>> +            - description: Device state change
>> +            - description: Error detection
>> +            - description: Message Buffer interrupt for mailboxes 8-127
>> +        interrupt-names:
>> +          items:
>> +            - const: mb-0
>> +            - const: state
>> +            - const: berr
> 
> Nitpick:
> 
> - description: Error detection
> and
> - const: err
> 
> or
> 
> - description: Bus Error detection
> and
> - const: berr
> 
> regards,
> Marc
> 

Hello Marc,

Good point. I will change irq description to 'Bus Error detection' in V4.


Best Regards,
Ciprian

>> +            - const: mb-1
>> +      required:
>> +        - compatible
>> +        - reg
>> +        - interrupts
>> +        - interrupt-names
>> +    else:
>> +      properties:
>> +        interrupts:
>> +          maxItems: 1
>> +
>>   additionalProperties: false
>>   
>>   examples:
>> -- 
>> 2.45.2
>>
>>
>