Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge patch series "Add FD-Only mode support for R-Car CANFD"

Biju <biju.das.au@gmail.com> says:

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

Link: https://patch.msgid.link/20251126155911.320563-1-biju.das.jz@bp.renesas.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

+48 -4
+35 -3
Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
··· 125 125 renesas,no-can-fd: 126 126 $ref: /schemas/types.yaml#/definitions/flag 127 127 description: 128 - The controller can operate in either CAN FD only mode (default) or 129 - Classical CAN only mode. The mode is global to all channels. 130 - Specify this property to put the controller in Classical CAN only mode. 128 + The controller can operate in either CAN-FD mode (default) or FD-Only 129 + mode (RZ/{G2L,G3E} and R-Car Gen4) or Classical CAN mode. Specify this 130 + property to put the controller in Classical CAN mode. 131 + 132 + renesas,fd-only: 133 + $ref: /schemas/types.yaml#/definitions/flag 134 + description: 135 + The CANFD on RZ/{G2L,G3E} and R-Car Gen4 SoCs support 3 modes FD-Only 136 + mode, Classical CAN mode and CAN-FD mode (default). In FD-Only mode, 137 + communication in Classical CAN frame format is disabled. Specify this 138 + property to put the controller in FD-Only mode. 131 139 132 140 assigned-clocks: 133 141 description: ··· 274 266 then: 275 267 patternProperties: 276 268 "^channel[6-7]$": false 269 + 270 + - if: 271 + properties: 272 + compatible: 273 + contains: 274 + enum: 275 + - renesas,rcar-gen3-canfd 276 + then: 277 + properties: 278 + renesas,fd-only: false 279 + 280 + - if: 281 + required: 282 + - renesas,no-can-fd 283 + then: 284 + properties: 285 + renesas,fd-only: false 286 + 287 + - if: 288 + required: 289 + - renesas,fd-only 290 + then: 291 + properties: 292 + renesas,no-can-fd: false 277 293 278 294 unevaluatedProperties: false 279 295
+13 -1
drivers/net/can/rcar/rcar_canfd.c
··· 472 472 unsigned long channels_mask; /* Enabled channels mask */ 473 473 bool extclk; /* CANFD or Ext clock */ 474 474 bool fdmode; /* CAN FD or Classical CAN only mode */ 475 + bool fd_only_mode; /* FD-Only mode for CAN-FD */ 475 476 struct reset_control *rstc1; 476 477 struct reset_control *rstc2; 477 478 const struct rcar_canfd_hw_info *info; ··· 830 829 RCANFD_GEN4_FDCFG_FDOE); 831 830 rcar_canfd_set_bit_reg(&gpriv->fcbase[ch].cfdcfg, 832 831 RCANFD_GEN4_FDCFG_CLOE); 832 + } else if (gpriv->fd_only_mode) { 833 + rcar_canfd_clear_bit_reg(&gpriv->fcbase[ch].cfdcfg, 834 + RCANFD_GEN4_FDCFG_CLOE); 835 + rcar_canfd_set_bit_reg(&gpriv->fcbase[ch].cfdcfg, 836 + RCANFD_GEN4_FDCFG_FDOE); 833 837 } else { 834 838 rcar_canfd_clear_bit_reg(&gpriv->fcbase[ch].cfdcfg, 835 839 RCANFD_GEN4_FDCFG_FDOE); 836 840 rcar_canfd_clear_bit_reg(&gpriv->fcbase[ch].cfdcfg, 837 841 RCANFD_GEN4_FDCFG_CLOE); 838 842 } 843 + } else if (gpriv->fd_only_mode) { 844 + rcar_canfd_set_bit_reg(&gpriv->fcbase[ch].cfdcfg, 845 + RCANFD_GEN4_FDCFG_FDOE); 839 846 } 840 847 } 841 848 ··· 2149 2140 gpriv->fdmode = fdmode; 2150 2141 gpriv->info = info; 2151 2142 2143 + if (of_property_read_bool(dev->of_node, "renesas,fd-only")) 2144 + gpriv->fd_only_mode = true; /* FD-Only mode for CAN-FD */ 2145 + 2152 2146 gpriv->rstc1 = devm_reset_control_get_optional_exclusive(dev, "rstp_n"); 2153 2147 if (IS_ERR(gpriv->rstc1)) 2154 2148 return dev_err_probe(dev, PTR_ERR(gpriv->rstc1), ··· 2251 2239 platform_set_drvdata(pdev, gpriv); 2252 2240 dev_info(dev, "global operational state (%s clk, %s mode)\n", 2253 2241 gpriv->extclk ? "ext" : "canfd", 2254 - gpriv->fdmode ? "fd" : "classical"); 2242 + gpriv->fdmode ? (gpriv->fd_only_mode ? "fd-only" : "fd") : "classical"); 2255 2243 return 0; 2256 2244 2257 2245 fail_channel: