[PATCH v5 1/9] dt-bindings: phy: ti,tcan104x-can: Document NXP TJA105X/1048

Peng Fan posted 9 patches 4 weeks ago
There is a newer version of this series
[PATCH v5 1/9] dt-bindings: phy: ti,tcan104x-can: Document NXP TJA105X/1048
Posted by Peng Fan 4 weeks ago
The TJA1048 is a dual high-speed CAN transceiver with sleep mode supported
and no EN pin.

The TJA1051 is a high-speed CAN transceiver with slient mode supported,
but only TJA1051T/E has EN pin. To make it simple, make enable-gpios as
optional for TJA1051.

The TJA1057 is a high-speed CAN transceiver with slient mode supported
and no EN pin.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 .../devicetree/bindings/phy/ti,tcan104x-can.yaml   | 69 +++++++++++++++++++++-
 1 file changed, 66 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/phy/ti,tcan104x-can.yaml b/Documentation/devicetree/bindings/phy/ti,tcan104x-can.yaml
index 4a8c3829d85d3c4a4963750d03567c1c345beb91..124493f360516eb203e8711cb96789258dd01119 100644
--- a/Documentation/devicetree/bindings/phy/ti,tcan104x-can.yaml
+++ b/Documentation/devicetree/bindings/phy/ti,tcan104x-can.yaml
@@ -22,16 +22,26 @@ properties:
       - enum:
           - ti,tcan1042
           - ti,tcan1043
+          - nxp,tja1048
+          - nxp,tja1051
+          - nxp,tja1057
           - nxp,tjr1443
 
   '#phy-cells':
-    const: 0
+    enum: [0, 1]
 
-  standby-gpios:
+  silent-gpios:
     description:
-      gpio node to toggle standby signal on transceiver
+      gpio node to toggle silent signal on transceiver
     maxItems: 1
 
+  standby-gpios:
+    description:
+      gpio node to toggle standby signal on transceiver. For two Items, item 1
+      is for stbn1, item 2 is for stbn2.
+    minItems: 1
+    maxItems: 2
+
   enable-gpios:
     description:
       gpio node to toggle enable signal on transceiver
@@ -53,6 +63,59 @@ required:
   - compatible
   - '#phy-cells'
 
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: nxp,tja1048
+    then:
+      properties:
+        '#phy-cells':
+          const: 1
+        enable-gpios: false
+        silent-gpios: false
+        standby-gpios:
+          minItems: 2
+    else:
+      properties:
+        '#phy-cells':
+          const: 0
+        standby-gpios:
+          maxItems: 1
+
+  - if:
+      properties:
+        compatible:
+          enum:
+            - nxp,tja1051
+            - nxp,tja1057
+    then:
+      properties:
+        silent-gpios: true
+    else:
+      properties:
+        silent-gpios: false
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: nxp,tja1051
+    then:
+      properties:
+        standby-gpios: false
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: nxp,tja1057
+    then:
+      properties:
+        enable-gpios: false
+        standby-gpios: false
+
 additionalProperties: false
 
 examples:

-- 
2.37.1
Re: [PATCH v5 1/9] dt-bindings: phy: ti,tcan104x-can: Document NXP TJA105X/1048
Posted by Krzysztof Kozlowski 3 weeks, 6 days ago
On Thu, Sep 04, 2025 at 04:36:44PM +0800, Peng Fan wrote:
> The TJA1048 is a dual high-speed CAN transceiver with sleep mode supported
> and no EN pin.
> 
> The TJA1051 is a high-speed CAN transceiver with slient mode supported,
> but only TJA1051T/E has EN pin. To make it simple, make enable-gpios as
> optional for TJA1051.
> 
> The TJA1057 is a high-speed CAN transceiver with slient mode supported
> and no EN pin.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  .../devicetree/bindings/phy/ti,tcan104x-can.yaml   | 69 +++++++++++++++++++++-
>  1 file changed, 66 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/phy/ti,tcan104x-can.yaml b/Documentation/devicetree/bindings/phy/ti,tcan104x-can.yaml
> index 4a8c3829d85d3c4a4963750d03567c1c345beb91..124493f360516eb203e8711cb96789258dd01119 100644
> --- a/Documentation/devicetree/bindings/phy/ti,tcan104x-can.yaml
> +++ b/Documentation/devicetree/bindings/phy/ti,tcan104x-can.yaml
> @@ -22,16 +22,26 @@ properties:
>        - enum:
>            - ti,tcan1042
>            - ti,tcan1043
> +          - nxp,tja1048
> +          - nxp,tja1051
> +          - nxp,tja1057
>            - nxp,tjr1443
>  
>    '#phy-cells':
> -    const: 0
> +    enum: [0, 1]
>  
> -  standby-gpios:
> +  silent-gpios:
>      description:
> -      gpio node to toggle standby signal on transceiver
> +      gpio node to toggle silent signal on transceiver
>      maxItems: 1
>  
> +  standby-gpios:
> +    description:
> +      gpio node to toggle standby signal on transceiver. For two Items, item 1
> +      is for stbn1, item 2 is for stbn2.
> +    minItems: 1
> +    maxItems: 2
> +
>    enable-gpios:
>      description:
>        gpio node to toggle enable signal on transceiver
> @@ -53,6 +63,59 @@ required:
>    - compatible
>    - '#phy-cells'
>  
> +allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: nxp,tja1048
> +    then:
> +      properties:
> +        '#phy-cells':
> +          const: 1
> +        enable-gpios: false
> +        silent-gpios: false
> +        standby-gpios:
> +          minItems: 2
> +    else:
> +      properties:
> +        '#phy-cells':
> +          const: 0
> +        standby-gpios:
> +          maxItems: 1
> +
> +  - if:
> +      properties:
> +        compatible:
> +          enum:
> +            - nxp,tja1051
> +            - nxp,tja1057
> +    then:
> +      properties:
> +        silent-gpios: true
> +    else:
> +      properties:
> +        silent-gpios: false
> +
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: nxp,tja1051

This is here and in if earlier. Just keep in only one place. Also
earlier else also touches standby-gpios, so you basically have it in
multiple places.

Just define if:then:, without any else:, for each variant.

> +    then:
> +      properties:
> +        standby-gpios: false
> +
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: nxp,tja1057

This as well.

> +    then:
> +      properties:
> +        enable-gpios: false
> +        standby-gpios: false
> +
>  additionalProperties: false
>  
>  examples:
> 
> -- 
> 2.37.1
>
Re: [PATCH v5 1/9] dt-bindings: phy: ti,tcan104x-can: Document NXP TJA105X/1048
Posted by Peng Fan 3 weeks, 6 days ago
Hi Krzysztof,

On Fri, Sep 05, 2025 at 09:52:19AM +0200, Krzysztof Kozlowski wrote:
>On Thu, Sep 04, 2025 at 04:36:44PM +0800, Peng Fan wrote:
>> The TJA1048 is a dual high-speed CAN transceiver with sleep mode supported
>> and no EN pin.
>> 
[snip]
>>  
>> +allOf:
>> +  - if:
>> +      properties:
>> +        compatible:
>> +          contains:
>> +            const: nxp,tja1048
>> +    then:
>> +      properties:
>> +        '#phy-cells':
>> +          const: 1
>> +        enable-gpios: false
>> +        silent-gpios: false
>> +        standby-gpios:
>> +          minItems: 2
>> +    else:
>> +      properties:
>> +        '#phy-cells':
>> +          const: 0
>> +        standby-gpios:
>> +          maxItems: 1
>> +
>> +  - if:
>> +      properties:
>> +        compatible:
>> +          enum:
>> +            - nxp,tja1051
>> +            - nxp,tja1057
>> +    then:
>> +      properties:
>> +        silent-gpios: true
>> +    else:
>> +      properties:
>> +        silent-gpios: false
>> +
>> +  - if:
>> +      properties:
>> +        compatible:
>> +          contains:
>> +            const: nxp,tja1051
>
>This is here and in if earlier. Just keep in only one place. Also
>earlier else also touches standby-gpios, so you basically have it in
>multiple places.
>
>Just define if:then:, without any else:, for each variant.

Thanks for your suggestions. This is cleaner and easier to read.

Does something as below looks good to you?

allOf:
  - if:
      properties:
        compatible:
          enum:
            - nxp,tjr1443
            - ti,tcan1042
            - ti,tcan1043
    then:
      properties:
        '#phy-cells':
          const: 0
        silent-gpios: false
        standby-gpios:
          maxItems: 1

  - if:
      properties:
        compatible:
          contains:
            const: nxp,tja1048
    then:
      properties:
        '#phy-cells':
          const: 1
        enable-gpios: false
        silent-gpios: false
        standby-gpios:
          minItems: 2

  - if:
      properties:
        compatible:
          contains:
            const: nxp,tja1051
    then:
      properties:
        silent-gpios: true
        standby-gpios: false
        '#phy-cells':
          const: 0

  - if:
      properties:
        compatible:
          contains:
            const: nxp,tja1057
    then:
      properties:
        enable-gpios: false
        silent-gpios: true
        standby-gpios: false
        '#phy-cells':
          const: 0

Thanks,
Peng
Re: [PATCH v5 1/9] dt-bindings: phy: ti,tcan104x-can: Document NXP TJA105X/1048
Posted by Frank Li 4 weeks ago
On Thu, Sep 04, 2025 at 04:36:44PM +0800, Peng Fan wrote:
> The TJA1048 is a dual high-speed CAN transceiver with sleep mode supported
> and no EN pin.
>
> The TJA1051 is a high-speed CAN transceiver with slient mode supported,
> but only TJA1051T/E has EN pin. To make it simple, make enable-gpios as
> optional for TJA1051.
>
> The TJA1057 is a high-speed CAN transceiver with slient mode supported
> and no EN pin.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>

Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
>  .../devicetree/bindings/phy/ti,tcan104x-can.yaml   | 69 +++++++++++++++++++++-
>  1 file changed, 66 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/phy/ti,tcan104x-can.yaml b/Documentation/devicetree/bindings/phy/ti,tcan104x-can.yaml
> index 4a8c3829d85d3c4a4963750d03567c1c345beb91..124493f360516eb203e8711cb96789258dd01119 100644
> --- a/Documentation/devicetree/bindings/phy/ti,tcan104x-can.yaml
> +++ b/Documentation/devicetree/bindings/phy/ti,tcan104x-can.yaml
> @@ -22,16 +22,26 @@ properties:
>        - enum:
>            - ti,tcan1042
>            - ti,tcan1043
> +          - nxp,tja1048
> +          - nxp,tja1051
> +          - nxp,tja1057
>            - nxp,tjr1443
>
>    '#phy-cells':
> -    const: 0
> +    enum: [0, 1]
>
> -  standby-gpios:
> +  silent-gpios:
>      description:
> -      gpio node to toggle standby signal on transceiver
> +      gpio node to toggle silent signal on transceiver
>      maxItems: 1
>
> +  standby-gpios:
> +    description:
> +      gpio node to toggle standby signal on transceiver. For two Items, item 1
> +      is for stbn1, item 2 is for stbn2.
> +    minItems: 1
> +    maxItems: 2
> +
>    enable-gpios:
>      description:
>        gpio node to toggle enable signal on transceiver
> @@ -53,6 +63,59 @@ required:
>    - compatible
>    - '#phy-cells'
>
> +allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: nxp,tja1048
> +    then:
> +      properties:
> +        '#phy-cells':
> +          const: 1
> +        enable-gpios: false
> +        silent-gpios: false
> +        standby-gpios:
> +          minItems: 2
> +    else:
> +      properties:
> +        '#phy-cells':
> +          const: 0
> +        standby-gpios:
> +          maxItems: 1
> +
> +  - if:
> +      properties:
> +        compatible:
> +          enum:
> +            - nxp,tja1051
> +            - nxp,tja1057
> +    then:
> +      properties:
> +        silent-gpios: true
> +    else:
> +      properties:
> +        silent-gpios: false
> +
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: nxp,tja1051
> +    then:
> +      properties:
> +        standby-gpios: false
> +
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: nxp,tja1057
> +    then:
> +      properties:
> +        enable-gpios: false
> +        standby-gpios: false
> +
>  additionalProperties: false
>
>  examples:
>
> --
> 2.37.1
>