Thread (16 messages) 16 messages, 4 authors, 2025-09-05

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

From: Peng Fan <hidden>
Date: 2025-09-05 12:00:37
Also in: imx, linux-can, linux-devicetree, linux-phy, lkml

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:
quoted
The TJA1048 is a dual high-speed CAN transceiver with sleep mode supported
and no EN pin.
[snip]
quoted
 
+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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help