All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/7] Add support for RZ/G3E CANFD
@ 2025-02-20 13:04 Biju Das
  2025-02-20 13:04 ` [PATCH v2 1/7] dt-bindings: can: renesas,rcar-canfd: Simplify the conditional schema Biju Das
                   ` (6 more replies)
  0 siblings, 7 replies; 16+ messages in thread
From: Biju Das @ 2025-02-20 13:04 UTC (permalink / raw)
  To: Marc Kleine-Budde, Vincent Mailhol, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
	Michael Turquette, Stephen Boyd
  Cc: Biju Das, linux-can, linux-renesas-soc, linux-clk, devicetree,
	Wolfram Sang, Uwe Kleine-König, Prabhakar Mahadev Lad,
	Biju Das

The CAN-FD module on RZ/G3E is very similar to the one on both R-Car V4H
and RZ/G2L, but differs in some hardware parameters:
 * No external clock, but instead has ram clock.
 * Support up to 6 channels.
 * 20 interrupts.

This patch series depend upon [1]
[1] https://lore.kernel.org/all/20250220094516.126598-1-biju.das.jz@bp.renesas.com/

v1->v2:
 * Split the series with fixes patch separately.
 * Added patch for Simplify rcar_canfd_probe() using
   of_get_available_child_by_name() as dependency patch hit on can-next.
 * Added Rb tag from Vincent Mailhol.
 * Dropped redundant comment from commit description for patch#3.

Biju Das (7):
  dt-bindings: can: renesas,rcar-canfd: Simplify the conditional schema
  dt-bindings: can: renesas,rcar-canfd: Document RZ/G3E support
  can: rcar_canfd: Use of_get_available_child_by_name()
  can: rcar_canfd: Add gen4_type variable to struct rcar_canfd_hw_info
  can: rcar_canfd: Add only_internal_clks variable to struct
    rcar_canfd_hw_info
  can: rcar_canfd: Enhance multi_channel_irqs handling
  can: rcar_canfd: Add RZ/G3E support

 .../bindings/net/can/renesas,rcar-canfd.yaml  | 180 +++++++++++++-----
 drivers/net/can/rcar/rcar_canfd.c             |  35 +++-
 2 files changed, 165 insertions(+), 50 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 1/7] dt-bindings: can: renesas,rcar-canfd: Simplify the conditional schema
  2025-02-20 13:04 [PATCH v2 0/7] Add support for RZ/G3E CANFD Biju Das
@ 2025-02-20 13:04 ` Biju Das
  2025-02-21 17:51   ` Conor Dooley
  2025-02-20 13:04 ` [PATCH v2 2/7] dt-bindings: can: renesas,rcar-canfd: Document RZ/G3E support Biju Das
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Biju Das @ 2025-02-20 13:04 UTC (permalink / raw)
  To: Marc Kleine-Budde, Vincent Mailhol, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
	Magnus Damm
  Cc: Biju Das, Fabrizio Castro, Simon Horman, Duy Nguyen, linux-can,
	devicetree, linux-renesas-soc, Prabhakar Mahadev Lad, Biju Das

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.

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/
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


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 2/7] dt-bindings: can: renesas,rcar-canfd: Document RZ/G3E support
  2025-02-20 13:04 [PATCH v2 0/7] Add support for RZ/G3E CANFD Biju Das
  2025-02-20 13:04 ` [PATCH v2 1/7] dt-bindings: can: renesas,rcar-canfd: Simplify the conditional schema Biju Das
@ 2025-02-20 13:04 ` Biju Das
  2025-02-21 17:53   ` Conor Dooley
  2025-02-20 13:04 ` [PATCH v2 3/7] can: rcar_canfd: Use of_get_available_child_by_name() Biju Das
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Biju Das @ 2025-02-20 13:04 UTC (permalink / raw)
  To: Marc Kleine-Budde, Vincent Mailhol, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
	Magnus Damm
  Cc: Biju Das, Fabrizio Castro, Simon Horman, Duy Nguyen, linux-can,
	devicetree, linux-renesas-soc, Prabhakar Mahadev Lad, Biju Das

Document support for the CAN-FD Interface on the RZ/G3E (R9A09G047) SoC,
which supports up to six channels.

The CAN-FD module on RZ/G3E is very similar to the one on both R-Car V4H
and RZ/G2L, but differs in some hardware parameters:
 * No external clock, but instead has ram clock.
 * Support up to 6 channels.
 * 20 interrupts.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v1->v2:
 * No change.
---
 .../bindings/net/can/renesas,rcar-canfd.yaml  | 67 +++++++++++++++++--
 1 file changed, 62 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
index f87f90f431e5..189d5303ad75 100644
--- a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
+++ b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
@@ -42,6 +42,8 @@ properties:
               - renesas,r9a07g054-canfd    # RZ/V2L
           - const: renesas,rzg2l-canfd     # RZ/G2L family
 
+      - const: renesas,r9a09g047-canfd     # RZ/G3E
+
   reg:
     maxItems: 1
 
@@ -59,6 +61,19 @@ properties:
           - description: CAN1 error interrupt
           - description: CAN1 transmit interrupt
           - description: CAN1 transmit/receive FIFO receive completion interrupt
+          - description: CAN2 error interrupt
+          - description: CAN2 transmit interrupt
+          - description: CAN2 transmit/receive FIFO receive completion interrupt
+          - description: CAN3 error interrupt
+          - description: CAN3 transmit interrupt
+          - description: CAN3 transmit/receive FIFO receive completion interrupt
+          - description: CAN4 error interrupt
+          - description: CAN4 transmit interrupt
+          - description: CAN4 transmit/receive FIFO receive completion interrupt
+          - description: CAN5 error interrupt
+          - description: CAN5 transmit interrupt
+          - description: CAN5 transmit/receive FIFO receive completion interrupt
+        minItems: 8
 
   interrupt-names:
     oneOf:
@@ -74,15 +89,33 @@ properties:
           - const: ch1_err
           - const: ch1_rec
           - const: ch1_trx
+          - const: ch2_err
+          - const: ch2_rec
+          - const: ch2_trx
+          - const: ch3_err
+          - const: ch3_rec
+          - const: ch3_trx
+          - const: ch4_err
+          - const: ch4_rec
+          - const: ch4_trx
+          - const: ch5_err
+          - const: ch5_rec
+          - const: ch5_trx
+        minItems: 8
 
   clocks:
     maxItems: 3
 
   clock-names:
-    items:
-      - const: fck
-      - const: canfd
-      - const: can_clk
+    oneOf:
+      - items:
+          - const: fck
+          - const: canfd
+          - const: can_clk
+      - items:
+          - const: fck
+          - const: ram_clk
+          - const: can_clk
 
   power-domains:
     maxItems: 1
@@ -173,7 +206,9 @@ allOf:
       properties:
         compatible:
           contains:
-            const: renesas,rzg2l-canfd
+            enum:
+              - renesas,r9a09g047-canfd
+              - renesas,rzg2l-canfd
     then:
       properties:
         resets:
@@ -187,6 +222,19 @@ allOf:
       required:
         - reset-names
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: renesas,r9a09g047-canfd
+    then:
+      properties:
+        interrupts:
+          maxItems: 20
+
+        interrupt-names:
+          maxItems: 20
+
   - if:
       properties:
         compatible:
@@ -219,6 +267,15 @@ allOf:
       patternProperties:
         "^channel[4-7]$": false
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: renesas,r9a09g047-canfd
+    then:
+      patternProperties:
+        "^channel[6-7]$": false
+
 unevaluatedProperties: false
 
 examples:
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 3/7] can: rcar_canfd: Use of_get_available_child_by_name()
  2025-02-20 13:04 [PATCH v2 0/7] Add support for RZ/G3E CANFD Biju Das
  2025-02-20 13:04 ` [PATCH v2 1/7] dt-bindings: can: renesas,rcar-canfd: Simplify the conditional schema Biju Das
  2025-02-20 13:04 ` [PATCH v2 2/7] dt-bindings: can: renesas,rcar-canfd: Document RZ/G3E support Biju Das
@ 2025-02-20 13:04 ` Biju Das
  2025-02-20 13:17   ` Geert Uytterhoeven
  2025-02-20 13:04 ` [PATCH v2 4/7] can: rcar_canfd: Add gen4_type variable to struct rcar_canfd_hw_info Biju Das
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Biju Das @ 2025-02-20 13:04 UTC (permalink / raw)
  To: Marc Kleine-Budde, Vincent Mailhol
  Cc: Biju Das, Geert Uytterhoeven, Wolfram Sang, Uwe Kleine-König,
	Rob Herring, Ulrich Hecht, linux-can, Prabhakar Mahadev Lad,
	Biju Das, linux-renesas-soc

Simplify rcar_canfd_probe() using of_get_available_child_by_name().

While at it, move of_node_put(child) inside the if block to avoid
additional check if of_child is NULL.

Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v2:
 * Added to this series as dependency patch hit on can-next.
 * Added Rb tag from Vincent Mailhol
 * Dropped redundant comment from commit description.
---
 drivers/net/can/rcar/rcar_canfd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
index 270f50d836f5..8b326977ddf7 100644
--- a/drivers/net/can/rcar/rcar_canfd.c
+++ b/drivers/net/can/rcar/rcar_canfd.c
@@ -1864,13 +1864,13 @@ static int rcar_canfd_probe(struct platform_device *pdev)
 
 	for (i = 0; i < info->max_channels; ++i) {
 		name[7] = '0' + i;
-		of_child = of_get_child_by_name(dev->of_node, name);
-		if (of_child && of_device_is_available(of_child)) {
+		of_child = of_get_available_child_by_name(dev->of_node, name);
+		if (of_child) {
 			channels_mask |= BIT(i);
 			transceivers[i] = devm_of_phy_optional_get(dev,
 							of_child, NULL);
+			of_node_put(of_child);
 		}
-		of_node_put(of_child);
 		if (IS_ERR(transceivers[i]))
 			return PTR_ERR(transceivers[i]);
 	}
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 4/7] can: rcar_canfd: Add gen4_type variable to struct rcar_canfd_hw_info
  2025-02-20 13:04 [PATCH v2 0/7] Add support for RZ/G3E CANFD Biju Das
                   ` (2 preceding siblings ...)
  2025-02-20 13:04 ` [PATCH v2 3/7] can: rcar_canfd: Use of_get_available_child_by_name() Biju Das
@ 2025-02-20 13:04 ` Biju Das
  2025-02-24 10:11   ` Geert Uytterhoeven
  2025-02-20 13:04 ` [PATCH v2 5/7] can: rcar_canfd: Add only_internal_clks " Biju Das
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Biju Das @ 2025-02-20 13:04 UTC (permalink / raw)
  To: Marc Kleine-Budde, Vincent Mailhol
  Cc: Biju Das, Wolfram Sang, Geert Uytterhoeven, Uwe Kleine-König,
	linux-can, Prabhakar Mahadev Lad, Biju Das, linux-renesas-soc

Both R-Car Gen4 and RZ/G3E SoCs have similar register layout. Introduce
gen4_type variable to struct rcar_canfd_hw_info for the preparation of
adding RZ/G3E driver support.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v1->v2:
 * No change.
---
 drivers/net/can/rcar/rcar_canfd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
index 8b326977ddf7..13eb6aa6ae45 100644
--- a/drivers/net/can/rcar/rcar_canfd.c
+++ b/drivers/net/can/rcar/rcar_canfd.c
@@ -516,6 +516,7 @@ struct rcar_canfd_hw_info {
 	/* hardware features */
 	unsigned shared_global_irqs:1;	/* Has shared global irqs */
 	unsigned multi_channel_irqs:1;	/* Has multiple channel irqs */
+	unsigned gen4_type:1;		/* Has gen4 type reg layout */
 };
 
 /* Channel priv data */
@@ -596,6 +597,7 @@ static const struct rcar_canfd_hw_info rcar_gen4_hw_info = {
 	.max_channels = 8,
 	.postdiv = 2,
 	.shared_global_irqs = 1,
+	.gen4_type = 1,
 };
 
 static const struct rcar_canfd_hw_info rzg2l_hw_info = {
@@ -607,7 +609,7 @@ static const struct rcar_canfd_hw_info rzg2l_hw_info = {
 /* Helper functions */
 static inline bool is_gen4(struct rcar_canfd_global *gpriv)
 {
-	return gpriv->info == &rcar_gen4_hw_info;
+	return gpriv->info->gen4_type;
 }
 
 static inline u32 reg_gen4(struct rcar_canfd_global *gpriv,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 5/7] can: rcar_canfd: Add only_internal_clks variable to struct rcar_canfd_hw_info
  2025-02-20 13:04 [PATCH v2 0/7] Add support for RZ/G3E CANFD Biju Das
                   ` (3 preceding siblings ...)
  2025-02-20 13:04 ` [PATCH v2 4/7] can: rcar_canfd: Add gen4_type variable to struct rcar_canfd_hw_info Biju Das
@ 2025-02-20 13:04 ` Biju Das
  2025-02-20 13:04 ` [PATCH v2 6/7] can: rcar_canfd: Enhance multi_channel_irqs handling Biju Das
  2025-02-20 13:04 ` [PATCH v2 7/7] can: rcar_canfd: Add RZ/G3E support Biju Das
  6 siblings, 0 replies; 16+ messages in thread
From: Biju Das @ 2025-02-20 13:04 UTC (permalink / raw)
  To: Marc Kleine-Budde, Vincent Mailhol
  Cc: Biju Das, Wolfram Sang, Geert Uytterhoeven, Uwe Kleine-König,
	linux-can, Prabhakar Mahadev Lad, Biju Das, linux-renesas-soc

All SoCs supports extenal clock, but RZ/G3E has only internal clocks. Add
only_internal_clks to struct rcar_canfd_hw_info to handle this difference.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v1->v2:
 * No change.
---
 drivers/net/can/rcar/rcar_canfd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
index 13eb6aa6ae45..f353a9d560e8 100644
--- a/drivers/net/can/rcar/rcar_canfd.c
+++ b/drivers/net/can/rcar/rcar_canfd.c
@@ -517,6 +517,7 @@ struct rcar_canfd_hw_info {
 	unsigned shared_global_irqs:1;	/* Has shared global irqs */
 	unsigned multi_channel_irqs:1;	/* Has multiple channel irqs */
 	unsigned gen4_type:1;		/* Has gen4 type reg layout */
+	unsigned only_internal_clks:1;	/* Has only internal clocks */
 };
 
 /* Channel priv data */
@@ -1943,7 +1944,7 @@ static int rcar_canfd_probe(struct platform_device *pdev)
 		fcan_freq = clk_get_rate(gpriv->can_clk) / info->postdiv;
 	} else {
 		fcan_freq = clk_get_rate(gpriv->can_clk);
-		gpriv->extclk = true;
+		gpriv->extclk = !gpriv->info->only_internal_clks;
 	}
 
 	addr = devm_platform_ioremap_resource(pdev, 0);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 6/7] can: rcar_canfd: Enhance multi_channel_irqs handling
  2025-02-20 13:04 [PATCH v2 0/7] Add support for RZ/G3E CANFD Biju Das
                   ` (4 preceding siblings ...)
  2025-02-20 13:04 ` [PATCH v2 5/7] can: rcar_canfd: Add only_internal_clks " Biju Das
@ 2025-02-20 13:04 ` Biju Das
  2025-02-20 13:04 ` [PATCH v2 7/7] can: rcar_canfd: Add RZ/G3E support Biju Das
  6 siblings, 0 replies; 16+ messages in thread
From: Biju Das @ 2025-02-20 13:04 UTC (permalink / raw)
  To: Marc Kleine-Budde, Vincent Mailhol
  Cc: Biju Das, Wolfram Sang, Geert Uytterhoeven, Uwe Kleine-König,
	linux-can, Prabhakar Mahadev Lad, Biju Das, linux-renesas-soc

Currently multi_channel_irqs has only 2 channels. But RZ/G3E has six
channels. Enhance multi_channel_irqs handling to support more than two
channels.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v1->v2:
 * No change.
---
 drivers/net/can/rcar/rcar_canfd.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
index f353a9d560e8..bf2561168e98 100644
--- a/drivers/net/can/rcar/rcar_canfd.c
+++ b/drivers/net/can/rcar/rcar_canfd.c
@@ -1748,16 +1748,19 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch,
 
 	if (info->multi_channel_irqs) {
 		char *irq_name;
+		char name[10];
 		int err_irq;
 		int tx_irq;
 
-		err_irq = platform_get_irq_byname(pdev, ch == 0 ? "ch0_err" : "ch1_err");
+		scnprintf(name, 10, "ch%u_err", ch);
+		err_irq = platform_get_irq_byname(pdev, name);
 		if (err_irq < 0) {
 			err = err_irq;
 			goto fail;
 		}
 
-		tx_irq = platform_get_irq_byname(pdev, ch == 0 ? "ch0_trx" : "ch1_trx");
+		scnprintf(name, 10, "ch%u_trx", ch);
+		tx_irq = platform_get_irq_byname(pdev, name);
 		if (tx_irq < 0) {
 			err = tx_irq;
 			goto fail;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 7/7] can: rcar_canfd: Add RZ/G3E support
  2025-02-20 13:04 [PATCH v2 0/7] Add support for RZ/G3E CANFD Biju Das
                   ` (5 preceding siblings ...)
  2025-02-20 13:04 ` [PATCH v2 6/7] can: rcar_canfd: Enhance multi_channel_irqs handling Biju Das
@ 2025-02-20 13:04 ` Biju Das
  6 siblings, 0 replies; 16+ messages in thread
From: Biju Das @ 2025-02-20 13:04 UTC (permalink / raw)
  To: Marc Kleine-Budde, Vincent Mailhol
  Cc: Biju Das, Wolfram Sang, Geert Uytterhoeven, Uwe Kleine-König,
	linux-can, Prabhakar Mahadev Lad, Biju Das, linux-renesas-soc

The CAN-FD IP found on the RZ/G3E SoC is similar to R-Car Gen4, but
it has no external clock instead it has clk_ram, it has 6 channels
and supports 20 interrupts. Add support for RZ/G3E CAN-FD driver.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v1->v2:
 * No change.
---
 drivers/net/can/rcar/rcar_canfd.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
index bf2561168e98..667d091bbcc9 100644
--- a/drivers/net/can/rcar/rcar_canfd.c
+++ b/drivers/net/can/rcar/rcar_canfd.c
@@ -607,6 +607,14 @@ static const struct rcar_canfd_hw_info rzg2l_hw_info = {
 	.multi_channel_irqs = 1,
 };
 
+static const struct rcar_canfd_hw_info r9a09g047_hw_info = {
+	.max_channels = 6,
+	.postdiv = 1,
+	.multi_channel_irqs = 1,
+	.gen4_type = 1,
+	.only_internal_clks = 1,
+};
+
 /* Helper functions */
 static inline bool is_gen4(struct rcar_canfd_global *gpriv)
 {
@@ -1861,6 +1869,7 @@ static int rcar_canfd_probe(struct platform_device *pdev)
 	u32 rule_entry = 0;
 	bool fdmode = true;			/* CAN FD only mode - default */
 	char name[9] = "channelX";
+	struct clk *clk_ram;
 	int i;
 
 	info = of_device_get_match_data(dev);
@@ -1950,6 +1959,11 @@ static int rcar_canfd_probe(struct platform_device *pdev)
 		gpriv->extclk = !gpriv->info->only_internal_clks;
 	}
 
+	clk_ram = devm_clk_get_optional_enabled(dev, "ram_clk");
+	if (IS_ERR(clk_ram))
+		return dev_err_probe(dev, PTR_ERR(clk_ram),
+				     "cannot get ram clock\n");
+
 	addr = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(addr)) {
 		err = PTR_ERR(addr);
@@ -2112,6 +2126,7 @@ static SIMPLE_DEV_PM_OPS(rcar_canfd_pm_ops, rcar_canfd_suspend,
 
 static const __maybe_unused struct of_device_id rcar_canfd_of_table[] = {
 	{ .compatible = "renesas,r8a779a0-canfd", .data = &rcar_gen4_hw_info },
+	{ .compatible = "renesas,r9a09g047-canfd", .data = &r9a09g047_hw_info },
 	{ .compatible = "renesas,rcar-gen3-canfd", .data = &rcar_gen3_hw_info },
 	{ .compatible = "renesas,rcar-gen4-canfd", .data = &rcar_gen4_hw_info },
 	{ .compatible = "renesas,rzg2l-canfd", .data = &rzg2l_hw_info },
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 3/7] can: rcar_canfd: Use of_get_available_child_by_name()
  2025-02-20 13:04 ` [PATCH v2 3/7] can: rcar_canfd: Use of_get_available_child_by_name() Biju Das
@ 2025-02-20 13:17   ` Geert Uytterhoeven
  0 siblings, 0 replies; 16+ messages in thread
From: Geert Uytterhoeven @ 2025-02-20 13:17 UTC (permalink / raw)
  To: Biju Das
  Cc: Marc Kleine-Budde, Vincent Mailhol, Wolfram Sang,
	Uwe Kleine-König, Rob Herring, Ulrich Hecht, linux-can,
	Prabhakar Mahadev Lad, Biju Das, linux-renesas-soc

On Thu, 20 Feb 2025 at 14:04, Biju Das <biju.das.jz@bp.renesas.com> wrote:
> Simplify rcar_canfd_probe() using of_get_available_child_by_name().
>
> While at it, move of_node_put(child) inside the if block to avoid
> additional check if of_child is NULL.
>
> Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> v2:
>  * Added to this series as dependency patch hit on can-next.
>  * Added Rb tag from Vincent Mailhol
>  * Dropped redundant comment from commit description.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 1/7] dt-bindings: can: renesas,rcar-canfd: Simplify the conditional schema
  2025-02-20 13:04 ` [PATCH v2 1/7] dt-bindings: can: renesas,rcar-canfd: Simplify the conditional schema Biju Das
@ 2025-02-21 17:51   ` Conor Dooley
  0 siblings, 0 replies; 16+ messages in thread
From: Conor Dooley @ 2025-02-21 17:51 UTC (permalink / raw)
  To: Biju Das
  Cc: Marc Kleine-Budde, Vincent Mailhol, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
	Magnus Damm, Fabrizio Castro, Simon Horman, Duy Nguyen, linux-can,
	devicetree, linux-renesas-soc, Prabhakar Mahadev Lad, Biju Das

[-- Attachment #1: Type: text/plain, Size: 422 bytes --]

On Thu, Feb 20, 2025 at 01:04:17PM +0000, Biju Das wrote:
> 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.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>

Acked-by: Conor Dooley <conor.dooley@microchip.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 2/7] dt-bindings: can: renesas,rcar-canfd: Document RZ/G3E support
  2025-02-20 13:04 ` [PATCH v2 2/7] dt-bindings: can: renesas,rcar-canfd: Document RZ/G3E support Biju Das
@ 2025-02-21 17:53   ` Conor Dooley
  2025-02-21 18:03     ` Biju Das
  2025-02-21 23:18     ` Rob Herring
  0 siblings, 2 replies; 16+ messages in thread
From: Conor Dooley @ 2025-02-21 17:53 UTC (permalink / raw)
  To: Biju Das
  Cc: Marc Kleine-Budde, Vincent Mailhol, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
	Magnus Damm, Fabrizio Castro, Simon Horman, Duy Nguyen, linux-can,
	devicetree, linux-renesas-soc, Prabhakar Mahadev Lad, Biju Das

[-- Attachment #1: Type: text/plain, Size: 4495 bytes --]

On Thu, Feb 20, 2025 at 01:04:18PM +0000, Biju Das wrote:
> Document support for the CAN-FD Interface on the RZ/G3E (R9A09G047) SoC,
> which supports up to six channels.
> 
> The CAN-FD module on RZ/G3E is very similar to the one on both R-Car V4H
> and RZ/G2L, but differs in some hardware parameters:
>  * No external clock, but instead has ram clock.
>  * Support up to 6 channels.
>  * 20 interrupts.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> v1->v2:
>  * No change.
> ---
>  .../bindings/net/can/renesas,rcar-canfd.yaml  | 67 +++++++++++++++++--
>  1 file changed, 62 insertions(+), 5 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
> index f87f90f431e5..189d5303ad75 100644
> --- a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
> +++ b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
> @@ -42,6 +42,8 @@ properties:
>                - renesas,r9a07g054-canfd    # RZ/V2L
>            - const: renesas,rzg2l-canfd     # RZ/G2L family
>  
> +      - const: renesas,r9a09g047-canfd     # RZ/G3E
> +
>    reg:
>      maxItems: 1
>  
> @@ -59,6 +61,19 @@ properties:
>            - description: CAN1 error interrupt
>            - description: CAN1 transmit interrupt
>            - description: CAN1 transmit/receive FIFO receive completion interrupt
> +          - description: CAN2 error interrupt
> +          - description: CAN2 transmit interrupt
> +          - description: CAN2 transmit/receive FIFO receive completion interrupt
> +          - description: CAN3 error interrupt
> +          - description: CAN3 transmit interrupt
> +          - description: CAN3 transmit/receive FIFO receive completion interrupt
> +          - description: CAN4 error interrupt
> +          - description: CAN4 transmit interrupt
> +          - description: CAN4 transmit/receive FIFO receive completion interrupt
> +          - description: CAN5 error interrupt
> +          - description: CAN5 transmit interrupt
> +          - description: CAN5 transmit/receive FIFO receive completion interrupt
> +        minItems: 8
>  
>    interrupt-names:
>      oneOf:
> @@ -74,15 +89,33 @@ properties:
>            - const: ch1_err
>            - const: ch1_rec
>            - const: ch1_trx
> +          - const: ch2_err
> +          - const: ch2_rec
> +          - const: ch2_trx
> +          - const: ch3_err
> +          - const: ch3_rec
> +          - const: ch3_trx
> +          - const: ch4_err
> +          - const: ch4_rec
> +          - const: ch4_trx
> +          - const: ch5_err
> +          - const: ch5_rec
> +          - const: ch5_trx
> +        minItems: 8
>  
>    clocks:
>      maxItems: 3
>  
>    clock-names:
> -    items:
> -      - const: fck
> -      - const: canfd
> -      - const: can_clk
> +    oneOf:
> +      - items:
> +          - const: fck
> +          - const: canfd
> +          - const: can_clk
> +      - items:
> +          - const: fck
> +          - const: ram_clk
> +          - const: can_clk
>  
>    power-domains:
>      maxItems: 1
> @@ -173,7 +206,9 @@ allOf:
>        properties:
>          compatible:
>            contains:
> -            const: renesas,rzg2l-canfd
> +            enum:
> +              - renesas,r9a09g047-canfd
> +              - renesas,rzg2l-canfd
>      then:
>        properties:
>          resets:
> @@ -187,6 +222,19 @@ allOf:
>        required:
>          - reset-names
>  
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: renesas,r9a09g047-canfd
> +    then:
> +      properties:
> +        interrupts:
> +          maxItems: 20
> +
> +        interrupt-names:
> +          maxItems: 20

Should these be minItems instead of maxItems? The list has 20 elements
at the moment (right?) so you're not adding any restriction here.

> +
>    - if:
>        properties:
>          compatible:
> @@ -219,6 +267,15 @@ allOf:
>        patternProperties:
>          "^channel[4-7]$": false
>  
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: renesas,r9a09g047-canfd
> +    then:
> +      patternProperties:
> +        "^channel[6-7]$": false
> +
>  unevaluatedProperties: false
>  
>  examples:
> -- 
> 2.43.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [PATCH v2 2/7] dt-bindings: can: renesas,rcar-canfd: Document RZ/G3E support
  2025-02-21 17:53   ` Conor Dooley
@ 2025-02-21 18:03     ` Biju Das
  2025-02-21 23:18     ` Rob Herring
  1 sibling, 0 replies; 16+ messages in thread
From: Biju Das @ 2025-02-21 18:03 UTC (permalink / raw)
  To: Conor Dooley
  Cc: Marc Kleine-Budde, Vincent Mailhol, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
	Magnus Damm, Fabrizio Castro, Simon Horman, Duy Nguyen,
	linux-can@vger.kernel.org, devicetree@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org, Prabhakar Mahadev Lad,
	biju.das.au

Hi Conor Dooley,

Thanks for the feedback.

> -----Original Message-----
> From: Conor Dooley <conor@kernel.org>
> Sent: 21 February 2025 17:54
> Subject: Re: [PATCH v2 2/7] dt-bindings: can: renesas,rcar-canfd: Document RZ/G3E support
> 
> On Thu, Feb 20, 2025 at 01:04:18PM +0000, Biju Das wrote:
> > Document support for the CAN-FD Interface on the RZ/G3E (R9A09G047)
> > SoC, which supports up to six channels.
> >
> > The CAN-FD module on RZ/G3E is very similar to the one on both R-Car
> > V4H and RZ/G2L, but differs in some hardware parameters:
> >  * No external clock, but instead has ram clock.
> >  * Support up to 6 channels.
> >  * 20 interrupts.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > ---
> > v1->v2:
> >  * No change.
> > ---
> >  .../bindings/net/can/renesas,rcar-canfd.yaml  | 67
> > +++++++++++++++++--
> >  1 file changed, 62 insertions(+), 5 deletions(-)
> >
> > diff --git
> > a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
> > b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
> > index f87f90f431e5..189d5303ad75 100644
> > ---
> > a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
> > +++ b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yam
> > +++ l
> > @@ -42,6 +42,8 @@ properties:
> >                - renesas,r9a07g054-canfd    # RZ/V2L
> >            - const: renesas,rzg2l-canfd     # RZ/G2L family
> >
> > +      - const: renesas,r9a09g047-canfd     # RZ/G3E
> > +
> >    reg:
> >      maxItems: 1
> >
> > @@ -59,6 +61,19 @@ properties:
> >            - description: CAN1 error interrupt
> >            - description: CAN1 transmit interrupt
> >            - description: CAN1 transmit/receive FIFO receive
> > completion interrupt
> > +          - description: CAN2 error interrupt
> > +          - description: CAN2 transmit interrupt
> > +          - description: CAN2 transmit/receive FIFO receive completion interrupt
> > +          - description: CAN3 error interrupt
> > +          - description: CAN3 transmit interrupt
> > +          - description: CAN3 transmit/receive FIFO receive completion interrupt
> > +          - description: CAN4 error interrupt
> > +          - description: CAN4 transmit interrupt
> > +          - description: CAN4 transmit/receive FIFO receive completion interrupt
> > +          - description: CAN5 error interrupt
> > +          - description: CAN5 transmit interrupt
> > +          - description: CAN5 transmit/receive FIFO receive completion interrupt
> > +        minItems: 8
> >
> >    interrupt-names:
> >      oneOf:
> > @@ -74,15 +89,33 @@ properties:
> >            - const: ch1_err
> >            - const: ch1_rec
> >            - const: ch1_trx
> > +          - const: ch2_err
> > +          - const: ch2_rec
> > +          - const: ch2_trx
> > +          - const: ch3_err
> > +          - const: ch3_rec
> > +          - const: ch3_trx
> > +          - const: ch4_err
> > +          - const: ch4_rec
> > +          - const: ch4_trx
> > +          - const: ch5_err
> > +          - const: ch5_rec
> > +          - const: ch5_trx
> > +        minItems: 8
> >
> >    clocks:
> >      maxItems: 3
> >
> >    clock-names:
> > -    items:
> > -      - const: fck
> > -      - const: canfd
> > -      - const: can_clk
> > +    oneOf:
> > +      - items:
> > +          - const: fck
> > +          - const: canfd
> > +          - const: can_clk
> > +      - items:
> > +          - const: fck
> > +          - const: ram_clk
> > +          - const: can_clk
> >
> >    power-domains:
> >      maxItems: 1
> > @@ -173,7 +206,9 @@ allOf:
> >        properties:
> >          compatible:
> >            contains:
> > -            const: renesas,rzg2l-canfd
> > +            enum:
> > +              - renesas,r9a09g047-canfd
> > +              - renesas,rzg2l-canfd
> >      then:
> >        properties:
> >          resets:
> > @@ -187,6 +222,19 @@ allOf:
> >        required:
> >          - reset-names
> >
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          contains:
> > +            const: renesas,r9a09g047-canfd
> > +    then:
> > +      properties:
> > +        interrupts:
> > +          maxItems: 20
> > +
> > +        interrupt-names:
> > +          maxItems: 20
> 
> Should these be minItems instead of maxItems? The list has 20 elements at the moment (right?) so
> you're not adding any restriction here.

Yes, it should be minItems.

Cheers,
Biju

> 
> > +
> >    - if:
> >        properties:
> >          compatible:
> > @@ -219,6 +267,15 @@ allOf:
> >        patternProperties:
> >          "^channel[4-7]$": false
> >
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          contains:
> > +            const: renesas,r9a09g047-canfd
> > +    then:
> > +      patternProperties:
> > +        "^channel[6-7]$": false
> > +
> >  unevaluatedProperties: false
> >
> >  examples:
> > --
> > 2.43.0
> >

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 2/7] dt-bindings: can: renesas,rcar-canfd: Document RZ/G3E support
  2025-02-21 17:53   ` Conor Dooley
  2025-02-21 18:03     ` Biju Das
@ 2025-02-21 23:18     ` Rob Herring
  2025-02-22  8:20       ` Biju Das
  1 sibling, 1 reply; 16+ messages in thread
From: Rob Herring @ 2025-02-21 23:18 UTC (permalink / raw)
  To: Conor Dooley
  Cc: Biju Das, Marc Kleine-Budde, Vincent Mailhol, Krzysztof Kozlowski,
	Conor Dooley, Geert Uytterhoeven, Magnus Damm, Fabrizio Castro,
	Simon Horman, Duy Nguyen, linux-can, devicetree,
	linux-renesas-soc, Prabhakar Mahadev Lad, Biju Das

On Fri, Feb 21, 2025 at 05:53:43PM +0000, Conor Dooley wrote:
> On Thu, Feb 20, 2025 at 01:04:18PM +0000, Biju Das wrote:
> > Document support for the CAN-FD Interface on the RZ/G3E (R9A09G047) SoC,
> > which supports up to six channels.
> > 
> > The CAN-FD module on RZ/G3E is very similar to the one on both R-Car V4H
> > and RZ/G2L, but differs in some hardware parameters:
> >  * No external clock, but instead has ram clock.
> >  * Support up to 6 channels.
> >  * 20 interrupts.
> > 
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > ---
> > v1->v2:
> >  * No change.
> > ---
> >  .../bindings/net/can/renesas,rcar-canfd.yaml  | 67 +++++++++++++++++--
> >  1 file changed, 62 insertions(+), 5 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
> > index f87f90f431e5..189d5303ad75 100644
> > --- a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
> > +++ b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
> > @@ -42,6 +42,8 @@ properties:
> >                - renesas,r9a07g054-canfd    # RZ/V2L
> >            - const: renesas,rzg2l-canfd     # RZ/G2L family
> >  
> > +      - const: renesas,r9a09g047-canfd     # RZ/G3E
> > +
> >    reg:
> >      maxItems: 1
> >  
> > @@ -59,6 +61,19 @@ properties:
> >            - description: CAN1 error interrupt
> >            - description: CAN1 transmit interrupt
> >            - description: CAN1 transmit/receive FIFO receive completion interrupt
> > +          - description: CAN2 error interrupt
> > +          - description: CAN2 transmit interrupt
> > +          - description: CAN2 transmit/receive FIFO receive completion interrupt
> > +          - description: CAN3 error interrupt
> > +          - description: CAN3 transmit interrupt
> > +          - description: CAN3 transmit/receive FIFO receive completion interrupt
> > +          - description: CAN4 error interrupt
> > +          - description: CAN4 transmit interrupt
> > +          - description: CAN4 transmit/receive FIFO receive completion interrupt
> > +          - description: CAN5 error interrupt
> > +          - description: CAN5 transmit interrupt
> > +          - description: CAN5 transmit/receive FIFO receive completion interrupt
> > +        minItems: 8
> >  
> >    interrupt-names:
> >      oneOf:
> > @@ -74,15 +89,33 @@ properties:
> >            - const: ch1_err
> >            - const: ch1_rec
> >            - const: ch1_trx
> > +          - const: ch2_err
> > +          - const: ch2_rec
> > +          - const: ch2_trx
> > +          - const: ch3_err
> > +          - const: ch3_rec
> > +          - const: ch3_trx
> > +          - const: ch4_err
> > +          - const: ch4_rec
> > +          - const: ch4_trx
> > +          - const: ch5_err
> > +          - const: ch5_rec
> > +          - const: ch5_trx
> > +        minItems: 8
> >  
> >    clocks:
> >      maxItems: 3
> >  
> >    clock-names:
> > -    items:
> > -      - const: fck
> > -      - const: canfd
> > -      - const: can_clk
> > +    oneOf:
> > +      - items:
> > +          - const: fck
> > +          - const: canfd
> > +          - const: can_clk
> > +      - items:
> > +          - const: fck
> > +          - const: ram_clk
> > +          - const: can_clk
> >  
> >    power-domains:
> >      maxItems: 1
> > @@ -173,7 +206,9 @@ allOf:
> >        properties:
> >          compatible:
> >            contains:
> > -            const: renesas,rzg2l-canfd
> > +            enum:
> > +              - renesas,r9a09g047-canfd
> > +              - renesas,rzg2l-canfd
> >      then:
> >        properties:
> >          resets:
> > @@ -187,6 +222,19 @@ allOf:
> >        required:
> >          - reset-names
> >  
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          contains:
> > +            const: renesas,r9a09g047-canfd
> > +    then:
> > +      properties:
> > +        interrupts:
> > +          maxItems: 20
> > +
> > +        interrupt-names:
> > +          maxItems: 20
> 
> Should these be minItems instead of maxItems? The list has 20 elements
> at the moment (right?) so you're not adding any restriction here.

And the existing platforms need to have 'maxItems: 8'.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [PATCH v2 2/7] dt-bindings: can: renesas,rcar-canfd: Document RZ/G3E support
  2025-02-21 23:18     ` Rob Herring
@ 2025-02-22  8:20       ` Biju Das
  0 siblings, 0 replies; 16+ messages in thread
From: Biju Das @ 2025-02-22  8:20 UTC (permalink / raw)
  To: Rob Herring, Conor Dooley
  Cc: Marc Kleine-Budde, Vincent Mailhol, Krzysztof Kozlowski,
	Conor Dooley, Geert Uytterhoeven, Magnus Damm, Fabrizio Castro,
	Simon Horman, Duy Nguyen, linux-can@vger.kernel.org,
	devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	Prabhakar Mahadev Lad, biju.das.au

Hi Rob,

Thanks for the feedback.

> -----Original Message-----
> From: Rob Herring <robh@kernel.org>
> Sent: 21 February 2025 23:19
> Subject: Re: [PATCH v2 2/7] dt-bindings: can: renesas,rcar-canfd: Document RZ/G3E support
> 
> On Fri, Feb 21, 2025 at 05:53:43PM +0000, Conor Dooley wrote:
> > On Thu, Feb 20, 2025 at 01:04:18PM +0000, Biju Das wrote:
> > > Document support for the CAN-FD Interface on the RZ/G3E (R9A09G047)
> > > SoC, which supports up to six channels.
> > >
> > > The CAN-FD module on RZ/G3E is very similar to the one on both R-Car
> > > V4H and RZ/G2L, but differs in some hardware parameters:
> > >  * No external clock, but instead has ram clock.
> > >  * Support up to 6 channels.
> > >  * 20 interrupts.
> > >
> > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > ---
> > > v1->v2:
> > >  * No change.
> > > ---
> > >  .../bindings/net/can/renesas,rcar-canfd.yaml  | 67
> > > +++++++++++++++++--
> > >  1 file changed, 62 insertions(+), 5 deletions(-)
> > >
> > > diff --git
> > > a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
> > > b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
> > > index f87f90f431e5..189d5303ad75 100644
> > > ---
> > > a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
> > > +++ b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.y
> > > +++ aml
> > > @@ -42,6 +42,8 @@ properties:
> > >                - renesas,r9a07g054-canfd    # RZ/V2L
> > >            - const: renesas,rzg2l-canfd     # RZ/G2L family
> > >
> > > +      - const: renesas,r9a09g047-canfd     # RZ/G3E
> > > +
> > >    reg:
> > >      maxItems: 1
> > >
> > > @@ -59,6 +61,19 @@ properties:
> > >            - description: CAN1 error interrupt
> > >            - description: CAN1 transmit interrupt
> > >            - description: CAN1 transmit/receive FIFO receive
> > > completion interrupt
> > > +          - description: CAN2 error interrupt
> > > +          - description: CAN2 transmit interrupt
> > > +          - description: CAN2 transmit/receive FIFO receive completion interrupt
> > > +          - description: CAN3 error interrupt
> > > +          - description: CAN3 transmit interrupt
> > > +          - description: CAN3 transmit/receive FIFO receive completion interrupt
> > > +          - description: CAN4 error interrupt
> > > +          - description: CAN4 transmit interrupt
> > > +          - description: CAN4 transmit/receive FIFO receive completion interrupt
> > > +          - description: CAN5 error interrupt
> > > +          - description: CAN5 transmit interrupt
> > > +          - description: CAN5 transmit/receive FIFO receive completion interrupt
> > > +        minItems: 8
> > >
> > >    interrupt-names:
> > >      oneOf:
> > > @@ -74,15 +89,33 @@ properties:
> > >            - const: ch1_err
> > >            - const: ch1_rec
> > >            - const: ch1_trx
> > > +          - const: ch2_err
> > > +          - const: ch2_rec
> > > +          - const: ch2_trx
> > > +          - const: ch3_err
> > > +          - const: ch3_rec
> > > +          - const: ch3_trx
> > > +          - const: ch4_err
> > > +          - const: ch4_rec
> > > +          - const: ch4_trx
> > > +          - const: ch5_err
> > > +          - const: ch5_rec
> > > +          - const: ch5_trx
> > > +        minItems: 8
> > >
> > >    clocks:
> > >      maxItems: 3
> > >
> > >    clock-names:
> > > -    items:
> > > -      - const: fck
> > > -      - const: canfd
> > > -      - const: can_clk
> > > +    oneOf:
> > > +      - items:
> > > +          - const: fck
> > > +          - const: canfd
> > > +          - const: can_clk
> > > +      - items:
> > > +          - const: fck
> > > +          - const: ram_clk
> > > +          - const: can_clk
> > >
> > >    power-domains:
> > >      maxItems: 1
> > > @@ -173,7 +206,9 @@ allOf:
> > >        properties:
> > >          compatible:
> > >            contains:
> > > -            const: renesas,rzg2l-canfd
> > > +            enum:
> > > +              - renesas,r9a09g047-canfd
> > > +              - renesas,rzg2l-canfd
> > >      then:
> > >        properties:
> > >          resets:
> > > @@ -187,6 +222,19 @@ allOf:
> > >        required:
> > >          - reset-names
> > >
> > > +  - if:
> > > +      properties:
> > > +        compatible:
> > > +          contains:
> > > +            const: renesas,r9a09g047-canfd
> > > +    then:
> > > +      properties:
> > > +        interrupts:
> > > +          maxItems: 20
> > > +
> > > +        interrupt-names:
> > > +          maxItems: 20
> >
> > Should these be minItems instead of maxItems? The list has 20 elements
> > at the moment (right?) so you're not adding any restriction here.
> 
> And the existing platforms need to have 'maxItems: 8'.

OK got.

platform 1: Here one of has min/max 2 interrupts. Platform 1 has 2 interrupts
        interrupts:
          minItems: 2
          maxItems: 2

Platform 2: Here one of Has min/max 8/20 interrupts and platform 2 has 8 interrupts
        interrupts:
          maxItems: 8

Platform 3: Here one of Has min/max 8/20 interrupts and platform 3 has 20 interrupts
        interrupts:
          minItems: 20

Cheers,
Biju

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 4/7] can: rcar_canfd: Add gen4_type variable to struct rcar_canfd_hw_info
  2025-02-20 13:04 ` [PATCH v2 4/7] can: rcar_canfd: Add gen4_type variable to struct rcar_canfd_hw_info Biju Das
@ 2025-02-24 10:11   ` Geert Uytterhoeven
  2025-02-24 10:36     ` Biju Das
  0 siblings, 1 reply; 16+ messages in thread
From: Geert Uytterhoeven @ 2025-02-24 10:11 UTC (permalink / raw)
  To: Biju Das
  Cc: Marc Kleine-Budde, Vincent Mailhol, Wolfram Sang,
	Geert Uytterhoeven, Uwe Kleine-König, linux-can,
	Prabhakar Mahadev Lad, Biju Das, linux-renesas-soc

Hi Biju,

On Thu, 20 Feb 2025 at 14:04, Biju Das <biju.das.jz@bp.renesas.com> wrote:
> Both R-Car Gen4 and RZ/G3E SoCs have similar register layout. Introduce
> gen4_type variable to struct rcar_canfd_hw_info for the preparation of
> adding RZ/G3E driver support.
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>

Thanks for your patch!

> --- a/drivers/net/can/rcar/rcar_canfd.c
> +++ b/drivers/net/can/rcar/rcar_canfd.c
> @@ -516,6 +516,7 @@ struct rcar_canfd_hw_info {
>         /* hardware features */
>         unsigned shared_global_irqs:1;  /* Has shared global irqs */
>         unsigned multi_channel_irqs:1;  /* Has multiple channel irqs */
> +       unsigned gen4_type:1;           /* Has gen4 type reg layout */

Perhaps this can be replaced by a (or more) more descriptive feature
flags, like you did before when introducing rcar_canfd_hw_info?

>  };
>
>  /* Channel priv data */
> @@ -596,6 +597,7 @@ static const struct rcar_canfd_hw_info rcar_gen4_hw_info = {
>         .max_channels = 8,
>         .postdiv = 2,
>         .shared_global_irqs = 1,
> +       .gen4_type = 1,
>  };
>
>  static const struct rcar_canfd_hw_info rzg2l_hw_info = {
> @@ -607,7 +609,7 @@ static const struct rcar_canfd_hw_info rzg2l_hw_info = {
>  /* Helper functions */
>  static inline bool is_gen4(struct rcar_canfd_global *gpriv)
>  {
> -       return gpriv->info == &rcar_gen4_hw_info;
> +       return gpriv->info->gen4_type;
>  }

And hopefully we can get rid of is_gen4() in the process, too...

>
>  static inline u32 reg_gen4(struct rcar_canfd_global *gpriv,

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [PATCH v2 4/7] can: rcar_canfd: Add gen4_type variable to struct rcar_canfd_hw_info
  2025-02-24 10:11   ` Geert Uytterhoeven
@ 2025-02-24 10:36     ` Biju Das
  0 siblings, 0 replies; 16+ messages in thread
From: Biju Das @ 2025-02-24 10:36 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Marc Kleine-Budde, Vincent Mailhol, Wolfram Sang,
	Geert Uytterhoeven, Uwe Kleine-König,
	linux-can@vger.kernel.org, Prabhakar Mahadev Lad, biju.das.au,
	linux-renesas-soc@vger.kernel.org

Hi Geert,

Thanks for the feedback.

> -----Original Message-----
> From: Geert Uytterhoeven <geert@linux-m68k.org>
> Sent: 24 February 2025 10:12
> Subject: Re: [PATCH v2 4/7] can: rcar_canfd: Add gen4_type variable to struct rcar_canfd_hw_info
> 
> Hi Biju,
> 
> On Thu, 20 Feb 2025 at 14:04, Biju Das <biju.das.jz@bp.renesas.com> wrote:
> > Both R-Car Gen4 and RZ/G3E SoCs have similar register layout.
> > Introduce gen4_type variable to struct rcar_canfd_hw_info for the
> > preparation of adding RZ/G3E driver support.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> 
> Thanks for your patch!
> 
> > --- a/drivers/net/can/rcar/rcar_canfd.c
> > +++ b/drivers/net/can/rcar/rcar_canfd.c
> > @@ -516,6 +516,7 @@ struct rcar_canfd_hw_info {
> >         /* hardware features */
> >         unsigned shared_global_irqs:1;  /* Has shared global irqs */
> >         unsigned multi_channel_irqs:1;  /* Has multiple channel irqs
> > */
> > +       unsigned gen4_type:1;           /* Has gen4 type reg layout */
> 
> Perhaps this can be replaced by a (or more) more descriptive feature flags, like you did before when
> introducing rcar_canfd_hw_info?

OK, Looking at commit log and hardware manual will do this change to add more descriptive feature flags.


> 
> >  };
> >
> >  /* Channel priv data */
> > @@ -596,6 +597,7 @@ static const struct rcar_canfd_hw_info rcar_gen4_hw_info = {
> >         .max_channels = 8,
> >         .postdiv = 2,
> >         .shared_global_irqs = 1,
> > +       .gen4_type = 1,
> >  };
> >
> >  static const struct rcar_canfd_hw_info rzg2l_hw_info = { @@ -607,7
> > +609,7 @@ static const struct rcar_canfd_hw_info rzg2l_hw_info = {
> >  /* Helper functions */
> >  static inline bool is_gen4(struct rcar_canfd_global *gpriv)  {
> > -       return gpriv->info == &rcar_gen4_hw_info;
> > +       return gpriv->info->gen4_type;
> >  }
> 
> And hopefully we can get rid of is_gen4() in the process, too...

Agreed.

Cheers,
Biju

> 
> >
> >  static inline u32 reg_gen4(struct rcar_canfd_global *gpriv,
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But when I'm talking to
> journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2025-02-24 10:36 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-20 13:04 [PATCH v2 0/7] Add support for RZ/G3E CANFD Biju Das
2025-02-20 13:04 ` [PATCH v2 1/7] dt-bindings: can: renesas,rcar-canfd: Simplify the conditional schema Biju Das
2025-02-21 17:51   ` Conor Dooley
2025-02-20 13:04 ` [PATCH v2 2/7] dt-bindings: can: renesas,rcar-canfd: Document RZ/G3E support Biju Das
2025-02-21 17:53   ` Conor Dooley
2025-02-21 18:03     ` Biju Das
2025-02-21 23:18     ` Rob Herring
2025-02-22  8:20       ` Biju Das
2025-02-20 13:04 ` [PATCH v2 3/7] can: rcar_canfd: Use of_get_available_child_by_name() Biju Das
2025-02-20 13:17   ` Geert Uytterhoeven
2025-02-20 13:04 ` [PATCH v2 4/7] can: rcar_canfd: Add gen4_type variable to struct rcar_canfd_hw_info Biju Das
2025-02-24 10:11   ` Geert Uytterhoeven
2025-02-24 10:36     ` Biju Das
2025-02-20 13:04 ` [PATCH v2 5/7] can: rcar_canfd: Add only_internal_clks " Biju Das
2025-02-20 13:04 ` [PATCH v2 6/7] can: rcar_canfd: Enhance multi_channel_irqs handling Biju Das
2025-02-20 13:04 ` [PATCH v2 7/7] can: rcar_canfd: Add RZ/G3E support Biju Das

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.