mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v4 0/2] Add FD-Only mode support for R-Car CANFD
@ 2025-11-26 15:59 Biju
  2025-11-26 15:59 ` [PATCH v4 1/2] dt-bindings: can: renesas,rcar-canfd: Document renesas,fd-only property Biju
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Biju @ 2025-11-26 15:59 UTC (permalink / raw)
  To: Marc Kleine-Budde, Vincent Mailhol, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
	Magnus Damm
  Cc: Biju Das, Fabrizio Castro, linux-can, devicetree,
	linux-renesas-soc, linux-kernel, Prabhakar Mahadev Lad, Biju Das

From: Biju Das <biju.das.jz@bp.renesas.com>

The RZ/{G2L,G3E} and R-Car Gen4 SoCs support additional CAN FD mode called
FD-only mode. In this mode, communication in Classical CAN frame format is
disabled. Update binding/driver to support this mode.

v3->v4:
 * Dropped the node added in example for just testing.
 * Dropped the dependencies from covering letter.
v2->v3:
 * Added check to disallow the usage of both fd-only and no-can-fd.
v1->v2:
 * Added conditional check to disallow fd-only mode for R-Car Gen3 in
   bindings.
 * Dropped has_fd_only_mode variable from the struct rcar_canfd_hw_info
   as it is checked by the dt schema validation.

Logs:
root@smarc-rzg3e:~# /cip-test-scripts/canfd_validation.sh FD-ONLY
[   13.914196] rcar_canfd 12440000.can: global operational state (canfd clk, fd-only mode)
FD-ONLY
 [INFO] Testing can0<->can1 with bitrate 1000000 and dbitrate 4000000
 [INFO] Bringing down can0 can1
 [INFO] Bringing up can0 can1
 [INFO] Testing can1 as producer and can0 as consumer
 [INFO] Testing can0 as producer and can1 as consumer
FD-ONLY
 [INFO] Testing can0<->can1 with bitrate 500000 and dbitrate 2000000
 [INFO] Bringing down can0 can1
 [INFO] Bringing up can0 can1
 [INFO] Testing can1 as producer and can0 as consumer
 [INFO] Testing can0 as producer and can1 as consumer
FD-ONLY
 [INFO] Testing can0<->can1 with bitrate 250000 and dbitrate 1000000
 [INFO] Bringing down can0 can1
 [INFO] Bringing up can0 can1
 [INFO] Testing can1 as producer and can0 as consumer
 [INFO] Testing can0 as producer and can1 as consumer

EXIT|PASS|canfd_validation.sh|[00:00:19] ||

root@smarc-rzg3e:~# /cip-test-scripts/canfd_validation.sh CANFD
[   13.914196] rcar_canfd 12440000.can: global operational state (canfd clk, fd-only mode)
CANFD
 [INFO] Testing can0<->can1 with bitrate 1000000 and dbitrate 4000000
 [INFO] Bringing down can0 can1
 [INFO] Bringing up can0 can1
 [INFO] Testing can1 as producer and can0 as consumer
[   37.246104] can: controller area network core
[   37.250607] NET: Registered PF_CAN protocol family
[   37.291606] can: raw protocol

EXIT|FAIL|canfd_validation.sh|[00:00:04] Problems while producing data from can1 and consuming from can0||

root@smarc-rzg3e:~# /cip-test-scripts/canfd_validation.sh CAN
[   13.914196] rcar_canfd 12440000.can: global operational state (canfd clk, fd-only mode)
CAN
 [INFO] Testing can0<->can1 with bitrate 1000000
 [INFO] Bringing down can0 can1
 [INFO] Bringing up can0 can1
 [INFO] Testing can1 as producer and can0 as consumer

EXIT|FAIL|canfd_validation.sh|[00:00:03] Problems sending data from can1 to can0||

root@smarc-rzg3e:~#

Biju Das (2):
  dt-bindings: can: renesas,rcar-canfd: Document renesas,fd-only
    property
  can: rcar_canfd: Add support for FD-Only mode

 .../bindings/net/can/renesas,rcar-canfd.yaml  | 38 +++++++++++++++++--
 drivers/net/can/rcar/rcar_canfd.c             | 14 ++++++-
 2 files changed, 48 insertions(+), 4 deletions(-)

-- 
2.43.0


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

* [PATCH v4 1/2] dt-bindings: can: renesas,rcar-canfd: Document renesas,fd-only property
  2025-11-26 15:59 [PATCH v4 0/2] Add FD-Only mode support for R-Car CANFD Biju
@ 2025-11-26 15:59 ` Biju
  2025-11-27  7:34   ` Krzysztof Kozlowski
  2025-11-26 15:59 ` [PATCH v4 2/2] can: rcar_canfd: Add support for FD-Only mode Biju
  2026-01-12 15:51 ` [PATCH v4 0/2] Add FD-Only mode support for R-Car CANFD Biju Das
  2 siblings, 1 reply; 5+ messages in thread
From: Biju @ 2025-11-26 15:59 UTC (permalink / raw)
  To: Marc Kleine-Budde, Vincent Mailhol, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
	Magnus Damm
  Cc: Biju Das, Fabrizio Castro, linux-can, devicetree,
	linux-renesas-soc, linux-kernel, Prabhakar Mahadev Lad, Biju Das

From: Biju Das <biju.das.jz@bp.renesas.com>

The CANFD on RZ/{G2L,G3E} and R-Car Gen4 support 3 modes FD-Only mode,
Classical CAN mode and CAN-FD mode. In FD-Only mode, communication in
Classical CAN frame format is disabled. Document renesas,fd-only to handle
this mode. As these SoCs support 3 modes, update the description of
renesas,no-can-fd property and disallow it for R-Car Gen3.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v3->v4:
 * Dropped the node added in example for just testing.
v2->v3:
 * Added check to disallow the usage of both fd-only and no-can-fd.
v1->v2:
 * Added conditional check to disallow fd-only mode for R-Car Gen3.
---
 .../bindings/net/can/renesas,rcar-canfd.yaml  | 38 +++++++++++++++++--
 1 file changed, 35 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
index f4ac21c68427..e129bdceef84 100644
--- a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
+++ b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
@@ -125,9 +125,17 @@ properties:
   renesas,no-can-fd:
     $ref: /schemas/types.yaml#/definitions/flag
     description:
-      The controller can operate in either CAN FD only mode (default) or
-      Classical CAN only mode.  The mode is global to all channels.
-      Specify this property to put the controller in Classical CAN only mode.
+      The controller can operate in either CAN-FD mode (default) or FD-Only
+      mode (RZ/{G2L,G3E} and R-Car Gen4) or Classical CAN mode. Specify this
+      property to put the controller in Classical CAN mode.
+
+  renesas,fd-only:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      The CANFD on RZ/{G2L,G3E} and R-Car Gen4 SoCs support 3 modes FD-Only
+      mode, Classical CAN mode and CAN-FD mode (default). In FD-Only mode,
+      communication in Classical CAN frame format is disabled. Specify this
+      property to put the controller in FD-Only mode.
 
   assigned-clocks:
     description:
@@ -267,6 +275,30 @@ allOf:
       patternProperties:
         "^channel[6-7]$": false
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - renesas,rcar-gen3-canfd
+    then:
+      properties:
+        renesas,fd-only: false
+
+  - if:
+      required:
+        - renesas,no-can-fd
+    then:
+      properties:
+        renesas,fd-only: false
+
+  - if:
+      required:
+        - renesas,fd-only
+    then:
+      properties:
+        renesas,no-can-fd: false
+
 unevaluatedProperties: false
 
 examples:
-- 
2.43.0


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

* [PATCH v4 2/2] can: rcar_canfd: Add support for FD-Only mode
  2025-11-26 15:59 [PATCH v4 0/2] Add FD-Only mode support for R-Car CANFD Biju
  2025-11-26 15:59 ` [PATCH v4 1/2] dt-bindings: can: renesas,rcar-canfd: Document renesas,fd-only property Biju
@ 2025-11-26 15:59 ` Biju
  2026-01-12 15:51 ` [PATCH v4 0/2] Add FD-Only mode support for R-Car CANFD Biju Das
  2 siblings, 0 replies; 5+ messages in thread
From: Biju @ 2025-11-26 15:59 UTC (permalink / raw)
  To: Marc Kleine-Budde, Vincent Mailhol, Geert Uytterhoeven, Magnus Damm
  Cc: Biju Das, linux-can, linux-renesas-soc, linux-kernel,
	Prabhakar Mahadev Lad, Biju Das

From: Biju Das <biju.das.jz@bp.renesas.com>

The RZ/{G2L,G3E} and R-Car Gen4 SoCs support additional CAN FD mode called
FD-only mode. In this mode, communication in Classical CAN frame format is
disabled.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v3->v4:
 * No change.
v2->v3:
 * No change.
v1->v2:
 * Dropped has_fd_only_mode variable from the struct rcar_canfd_hw_info
   as it is checked by the dt schema validation.
---
 drivers/net/can/rcar/rcar_canfd.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
index 7895e1fdea1c..4a653d8978ba 100644
--- a/drivers/net/can/rcar/rcar_canfd.c
+++ b/drivers/net/can/rcar/rcar_canfd.c
@@ -472,6 +472,7 @@ struct rcar_canfd_global {
 	unsigned long channels_mask;	/* Enabled channels mask */
 	bool extclk;			/* CANFD or Ext clock */
 	bool fdmode;			/* CAN FD or Classical CAN only mode */
+	bool fd_only_mode;		/* FD-Only mode for CAN-FD */
 	struct reset_control *rstc1;
 	struct reset_control *rstc2;
 	const struct rcar_canfd_hw_info *info;
@@ -829,12 +830,20 @@ static int rcar_canfd_reset_controller(struct rcar_canfd_global *gpriv)
 							 RCANFD_GEN4_FDCFG_FDOE);
 				rcar_canfd_set_bit_reg(&gpriv->fcbase[ch].cfdcfg,
 						       RCANFD_GEN4_FDCFG_CLOE);
+			} else if (gpriv->fd_only_mode) {
+				rcar_canfd_clear_bit_reg(&gpriv->fcbase[ch].cfdcfg,
+							 RCANFD_GEN4_FDCFG_CLOE);
+				rcar_canfd_set_bit_reg(&gpriv->fcbase[ch].cfdcfg,
+						       RCANFD_GEN4_FDCFG_FDOE);
 			} else {
 				rcar_canfd_clear_bit_reg(&gpriv->fcbase[ch].cfdcfg,
 							 RCANFD_GEN4_FDCFG_FDOE);
 				rcar_canfd_clear_bit_reg(&gpriv->fcbase[ch].cfdcfg,
 							 RCANFD_GEN4_FDCFG_CLOE);
 			}
+		} else if (gpriv->fd_only_mode) {
+			rcar_canfd_set_bit_reg(&gpriv->fcbase[ch].cfdcfg,
+					       RCANFD_GEN4_FDCFG_FDOE);
 		}
 	}
 
@@ -2140,6 +2149,9 @@ static int rcar_canfd_probe(struct platform_device *pdev)
 	gpriv->fdmode = fdmode;
 	gpriv->info = info;
 
+	if (of_property_read_bool(dev->of_node, "renesas,fd-only"))
+		gpriv->fd_only_mode = true; /* FD-Only mode for CAN-FD */
+
 	gpriv->rstc1 = devm_reset_control_get_optional_exclusive(dev, "rstp_n");
 	if (IS_ERR(gpriv->rstc1))
 		return dev_err_probe(dev, PTR_ERR(gpriv->rstc1),
@@ -2239,7 +2251,7 @@ static int rcar_canfd_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, gpriv);
 	dev_info(dev, "global operational state (%s clk, %s mode)\n",
 		 gpriv->extclk ? "ext" : "canfd",
-		 gpriv->fdmode ? "fd" : "classical");
+		 gpriv->fdmode ? (gpriv->fd_only_mode ? "fd-only" : "fd") : "classical");
 	return 0;
 
 fail_channel:
-- 
2.43.0


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

* Re: [PATCH v4 1/2] dt-bindings: can: renesas,rcar-canfd: Document renesas,fd-only property
  2025-11-26 15:59 ` [PATCH v4 1/2] dt-bindings: can: renesas,rcar-canfd: Document renesas,fd-only property Biju
@ 2025-11-27  7:34   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2025-11-27  7:34 UTC (permalink / raw)
  To: Biju
  Cc: Marc Kleine-Budde, Vincent Mailhol, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
	Magnus Damm, Biju Das, Fabrizio Castro, linux-can, devicetree,
	linux-renesas-soc, linux-kernel, Prabhakar Mahadev Lad

On Wed, Nov 26, 2025 at 03:59:06PM +0000, Biju wrote:
> From: Biju Das <biju.das.jz@bp.renesas.com>
> 
> The CANFD on RZ/{G2L,G3E} and R-Car Gen4 support 3 modes FD-Only mode,
> Classical CAN mode and CAN-FD mode. In FD-Only mode, communication in
> Classical CAN frame format is disabled. Document renesas,fd-only to handle
> this mode. As these SoCs support 3 modes, update the description of
> renesas,no-can-fd property and disallow it for R-Car Gen3.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

Best regards,
Krzysztof


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

* RE: [PATCH v4 0/2] Add FD-Only mode support for R-Car CANFD
  2025-11-26 15:59 [PATCH v4 0/2] Add FD-Only mode support for R-Car CANFD Biju
  2025-11-26 15:59 ` [PATCH v4 1/2] dt-bindings: can: renesas,rcar-canfd: Document renesas,fd-only property Biju
  2025-11-26 15:59 ` [PATCH v4 2/2] can: rcar_canfd: Add support for FD-Only mode Biju
@ 2026-01-12 15:51 ` Biju Das
  2 siblings, 0 replies; 5+ messages in thread
From: Biju Das @ 2026-01-12 15:51 UTC (permalink / raw)
  To: biju.das.au, Marc Kleine-Budde, Vincent Mailhol, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
	magnus.damm
  Cc: Fabrizio Castro, linux-can, devicetree, linux-renesas-soc,
	linux-kernel, Prabhakar Mahadev Lad, biju.das.au

Hi All,

> -----Original Message-----
> From: Biju <biju.das.au@gmail.com>
> Sent: 26 November 2025 15:59
> Subject: [PATCH v4 0/2] Add FD-Only mode support for R-Car CANFD
> 
> From: Biju Das <biju.das.jz@bp.renesas.com>
> 
> The RZ/{G2L,G3E} and R-Car Gen4 SoCs support additional CAN FD mode called FD-only mode. In this mode,
> communication in Classical CAN frame format is disabled. Update binding/driver to support this mode.
> 
> v3->v4:
>  * Dropped the node added in example for just testing.
>  * Dropped the dependencies from covering letter.
> v2->v3:
>  * Added check to disallow the usage of both fd-only and no-can-fd.
> v1->v2:
>  * Added conditional check to disallow fd-only mode for R-Car Gen3 in
>    bindings.
>  * Dropped has_fd_only_mode variable from the struct rcar_canfd_hw_info
>    as it is checked by the dt schema validation.
> 
> Logs:
> root@smarc-rzg3e:~# /cip-test-scripts/canfd_validation.sh FD-ONLY
> [   13.914196] rcar_canfd 12440000.can: global operational state (canfd clk, fd-only mode)
> FD-ONLY
>  [INFO] Testing can0<->can1 with bitrate 1000000 and dbitrate 4000000  [INFO] Bringing down can0 can1
> [INFO] Bringing up can0 can1  [INFO] Testing can1 as producer and can0 as consumer  [INFO] Testing
> can0 as producer and can1 as consumer FD-ONLY  [INFO] Testing can0<->can1 with bitrate 500000 and
> dbitrate 2000000  [INFO] Bringing down can0 can1  [INFO] Bringing up can0 can1  [INFO] Testing can1 as
> producer and can0 as consumer  [INFO] Testing can0 as producer and can1 as consumer FD-ONLY  [INFO]
> Testing can0<->can1 with bitrate 250000 and dbitrate 1000000  [INFO] Bringing down can0 can1  [INFO]
> Bringing up can0 can1  [INFO] Testing can1 as producer and can0 as consumer  [INFO] Testing can0 as
> producer and can1 as consumer
> 
> EXIT|PASS|canfd_validation.sh|[00:00:19] ||
> 
> root@smarc-rzg3e:~# /cip-test-scripts/canfd_validation.sh CANFD
> [   13.914196] rcar_canfd 12440000.can: global operational state (canfd clk, fd-only mode)
> CANFD
>  [INFO] Testing can0<->can1 with bitrate 1000000 and dbitrate 4000000  [INFO] Bringing down can0 can1
> [INFO] Bringing up can0 can1  [INFO] Testing can1 as producer and can0 as consumer
> [   37.246104] can: controller area network core
> [   37.250607] NET: Registered PF_CAN protocol family
> [   37.291606] can: raw protocol
> 
> EXIT|FAIL|canfd_validation.sh|[00:00:04] Problems while producing data
> EXIT|FAIL|from can1 and consuming from can0||
> 
> root@smarc-rzg3e:~# /cip-test-scripts/canfd_validation.sh CAN
> [   13.914196] rcar_canfd 12440000.can: global operational state (canfd clk, fd-only mode)
> CAN
>  [INFO] Testing can0<->can1 with bitrate 1000000  [INFO] Bringing down can0 can1  [INFO] Bringing up
> can0 can1  [INFO] Testing can1 as producer and can0 as consumer
> 
> EXIT|FAIL|canfd_validation.sh|[00:00:03] Problems sending data from can1
> EXIT|FAIL|to can0||
> 
> root@smarc-rzg3e:~#
> 
> Biju Das (2):
>   dt-bindings: can: renesas,rcar-canfd: Document renesas,fd-only
>     property
>   can: rcar_canfd: Add support for FD-Only mode
> 
>  .../bindings/net/can/renesas,rcar-canfd.yaml  | 38 +++++++++++++++++--
>  drivers/net/can/rcar/rcar_canfd.c             | 14 ++++++-
>  2 files changed, 48 insertions(+), 4 deletions(-)
> 
> --
> 2.43.0

Gentle ping.

Cheers,
Biju


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

end of thread, other threads:[~2026-01-12 15:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-26 15:59 [PATCH v4 0/2] Add FD-Only mode support for R-Car CANFD Biju
2025-11-26 15:59 ` [PATCH v4 1/2] dt-bindings: can: renesas,rcar-canfd: Document renesas,fd-only property Biju
2025-11-27  7:34   ` Krzysztof Kozlowski
2025-11-26 15:59 ` [PATCH v4 2/2] can: rcar_canfd: Add support for FD-Only mode Biju
2026-01-12 15:51 ` [PATCH v4 0/2] Add FD-Only mode support for R-Car CANFD Biju Das

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®