Linux CAN drivers development
 help / color / mirror / Atom feed
From: Biju Das <biju.das.jz@bp.renesas.com>
To: Marc Kleine-Budde <mkl@pengutronix.de>,
	Vincent Mailhol <mailhol.vincent@wanadoo.fr>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Magnus Damm <magnus.damm@gmail.com>
Cc: Biju Das <biju.das.jz@bp.renesas.com>,
	Fabrizio Castro <fabrizio.castro.jz@renesas.com>,
	Simon Horman <horms@kernel.org>,
	Duy Nguyen <duy.nguyen.rh@renesas.com>,
	linux-can@vger.kernel.org, devicetree@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org,
	Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	Biju Das <biju.das.au@gmail.com>,
	Conor Dooley <conor.dooley@microchip.com>
Subject: [PATCH v4 01/11] dt-bindings: can: renesas,rcar-canfd: Simplify the conditional schema
Date: Thu,  6 Mar 2025 12:42:40 +0000	[thread overview]
Message-ID: <20250306124256.93033-2-biju.das.jz@bp.renesas.com> (raw)
In-Reply-To: <20250306124256.93033-1-biju.das.jz@bp.renesas.com>

RZ/G3E SoC has 20 interrupts, 2 resets and 6 channels that need more
branching with conditional schema. Simplify the conditional schema with
if statements rather than the complex if-else statements to prepare for
supporting RZ/G3E SoC.

Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
This patch depend upon [1]
[1] https://lore.kernel.org/all/20250220094516.126598-2-biju.das.jz@bp.renesas.com/
v3->v4:
 * No change.
v2->v3:
 * Collected tags.
v1->v2:
 * No change
---
 .../bindings/net/can/renesas,rcar-canfd.yaml  | 123 ++++++++++++------
 1 file changed, 80 insertions(+), 43 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
index f6884f6e59e7..f87f90f431e5 100644
--- a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
+++ b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
@@ -45,7 +45,35 @@ properties:
   reg:
     maxItems: 1
 
-  interrupts: true
+  interrupts:
+    oneOf:
+      - items:
+          - description: Channel interrupt
+          - description: Global interrupt
+      - items:
+          - description: CAN global error interrupt
+          - description: CAN receive FIFO interrupt
+          - description: CAN0 error interrupt
+          - description: CAN0 transmit interrupt
+          - description: CAN0 transmit/receive FIFO receive completion interrupt
+          - description: CAN1 error interrupt
+          - description: CAN1 transmit interrupt
+          - description: CAN1 transmit/receive FIFO receive completion interrupt
+
+  interrupt-names:
+    oneOf:
+      - items:
+          - const: ch_int
+          - const: g_int
+      - items:
+          - const: g_err
+          - const: g_recc
+          - const: ch0_err
+          - const: ch0_rec
+          - const: ch0_trx
+          - const: ch1_err
+          - const: ch1_rec
+          - const: ch1_trx
 
   clocks:
     maxItems: 3
@@ -117,52 +145,71 @@ allOf:
     then:
       properties:
         interrupts:
-          items:
-            - description: CAN global error interrupt
-            - description: CAN receive FIFO interrupt
-            - description: CAN0 error interrupt
-            - description: CAN0 transmit interrupt
-            - description: CAN0 transmit/receive FIFO receive completion interrupt
-            - description: CAN1 error interrupt
-            - description: CAN1 transmit interrupt
-            - description: CAN1 transmit/receive FIFO receive completion interrupt
+          minItems: 8
+          maxItems: 8
 
         interrupt-names:
-          items:
-            - const: g_err
-            - const: g_recc
-            - const: ch0_err
-            - const: ch0_rec
-            - const: ch0_trx
-            - const: ch1_err
-            - const: ch1_rec
-            - const: ch1_trx
+          minItems: 8
+          maxItems: 8
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - renesas,rcar-gen3-canfd
+              - renesas,rcar-gen4-canfd
+    then:
+      properties:
+        interrupts:
+          minItems: 2
+          maxItems: 2
+
+        interrupt-names:
+          minItems: 2
+          maxItems: 2
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: renesas,rzg2l-canfd
+    then:
+      properties:
         resets:
+          minItems: 2
           maxItems: 2
 
         reset-names:
-          items:
-            - const: rstp_n
-            - const: rstc_n
+          minItems: 2
+          maxItems: 2
 
       required:
         - reset-names
-    else:
-      properties:
-        interrupts:
-          items:
-            - description: Channel interrupt
-            - description: Global interrupt
-
-        interrupt-names:
-          items:
-            - const: ch_int
-            - const: g_int
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - renesas,rcar-gen3-canfd
+              - renesas,rcar-gen4-canfd
+    then:
+      properties:
         resets:
           maxItems: 1
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - renesas,rcar-gen3-canfd
+              - renesas,rzg2l-canfd
+    then:
+      patternProperties:
+        "^channel[2-7]$": false
+
   - if:
       properties:
         compatible:
@@ -171,16 +218,6 @@ allOf:
     then:
       patternProperties:
         "^channel[4-7]$": false
-    else:
-      if:
-        not:
-          properties:
-            compatible:
-              contains:
-                const: renesas,rcar-gen4-canfd
-      then:
-        patternProperties:
-          "^channel[2-7]$": false
 
 unevaluatedProperties: false
 
-- 
2.43.0


  reply	other threads:[~2025-03-06 12:43 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-06 12:42 [PATCH v4 00/11] Add support for RZ/G3E CANFD Biju Das
2025-03-06 12:42 ` Biju Das [this message]
2025-03-14 13:31   ` [PATCH v4 01/11] dt-bindings: can: renesas,rcar-canfd: Simplify the conditional schema Geert Uytterhoeven
2025-03-14 13:53     ` Biju Das
2025-03-06 12:42 ` [PATCH v4 02/11] dt-bindings: can: renesas,rcar-canfd: Document RZ/G3E support Biju Das
2025-03-14 13:40   ` Geert Uytterhoeven
2025-03-14 13:59     ` Biju Das
2025-03-06 12:42 ` [PATCH v4 03/11] can: rcar_canfd: Use of_get_available_child_by_name() Biju Das
2025-03-06 12:42 ` [PATCH v4 04/11] can: rcar_canfd: Add ch_interface_mode variable to struct rcar_canfd_hw_info Biju Das
2025-03-14 14:45   ` Geert Uytterhoeven
2025-03-06 12:42 ` [PATCH v4 05/11] can: rcar_canfd: Add shared_can_regs " Biju Das
2025-03-14 14:46   ` Geert Uytterhoeven
2025-03-15 17:25     ` Biju Das
2025-03-06 12:42 ` [PATCH v4 06/11] can: rcar_canfd: Add register mapping table " Biju Das
2025-03-14 14:46   ` Geert Uytterhoeven
2025-03-15 17:26     ` Biju Das
2025-03-06 12:42 ` [PATCH v4 07/11] can: rcar_canfd: Add mask " Biju Das
2025-03-14 14:47   ` Geert Uytterhoeven
2025-03-15 17:29     ` Biju Das
2025-03-06 12:42 ` [PATCH v4 08/11] can: rcar_canfd: Add shift " Biju Das
2025-03-14 14:47   ` Geert Uytterhoeven
2025-03-14 18:39     ` Biju Das
2025-03-15 17:31     ` Biju Das
2025-03-16  9:53       ` Geert Uytterhoeven
2025-03-16 17:02         ` Biju Das
2025-03-17  9:53           ` Geert Uytterhoeven
2025-03-17  9:58             ` Biju Das
2025-03-06 12:42 ` [PATCH v4 09/11] can: rcar_canfd: Add only_internal_clks variable " Biju Das
2025-03-14 14:47   ` Geert Uytterhoeven
2025-03-15 17:33     ` Biju Das
2025-03-16  9:50       ` Geert Uytterhoeven
2025-03-06 12:42 ` [PATCH v4 10/11] can: rcar_canfd: Enhance multi_channel_irqs handling Biju Das
2025-03-14 14:47   ` Geert Uytterhoeven
2025-03-06 12:42 ` [PATCH v4 11/11] can: rcar_canfd: Add RZ/G3E support Biju Das
2025-03-14 14:48   ` Geert Uytterhoeven
2025-03-14 14:59     ` Biju Das
2025-03-14 15:12       ` Geert Uytterhoeven
2025-03-14 12:38 ` [PATCH v4 00/11] Add support for RZ/G3E CANFD Marc Kleine-Budde
2025-03-14 12:51   ` Biju Das

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250306124256.93033-2-biju.das.jz@bp.renesas.com \
    --to=biju.das.jz@bp.renesas.com \
    --cc=biju.das.au@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=conor.dooley@microchip.com \
    --cc=devicetree@vger.kernel.org \
    --cc=duy.nguyen.rh@renesas.com \
    --cc=fabrizio.castro.jz@renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=horms@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=mailhol.vincent@wanadoo.fr \
    --cc=mkl@pengutronix.de \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox