Skip to content

can: rcar_canfd: Add support for Transceiver Delay Compensation

Geert Uytterhoeven linux-can linux-renesas-soc 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest10 patches 7 repliesIn review
  2. v19 patches 10 repliesSuperseded

Changes in v2 from the cover letter

- Dropped patch "can: rcar_canfd: Use ndev parameter in rcar_canfd_set_bittiming()",
- New patch "[PATCH v2 02/10] can: rcar_canfd: Remove bittiming debug prints",
- New patch "[PATCH v2 07/10] can: rcar_canfd: Rename rcar_canfd_setrnc() to rcar_canfd_set_rnc()",
- Add Reviewed-by,
- Replace function-like RCANFD_F_*() macros by rcar_canfd_f_*() inline functions,
- Replace function-like macro RCANFD_FDSTS_TDCR() by bitmask RCANFD_FDSTS_TDCR and helper function rcar_canfd_get_tdcr(),
- Replace function-like macro RCANFD_FDSTS_TDCVF() by two bit definitions,
- Drop debug print of tdc mode and tdco value.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10can: rcar_canfd: Consistently use ndev for net_device pointersdrivers/net/can/rcar/rcar_canfd.c+4 -40 replies
2/10can: rcar_canfd: Remove bittiming debug printsdrivers/net/can/rcar/rcar_canfd.c+0 -71 reply
3/10can: rcar_canfd: Add helper variable ndev to rcar_canfd_rx_pkt()drivers/net/can/rcar/rcar_canfd.c+6 -60 replies
4/10can: rcar_canfd: Add helper variable dev to rcar_canfd_reset_controller()drivers/net/can/rcar/rcar_canfd.c+4 -40 replies
5/10can: rcar_canfd: Simplify data access in rcar_canfd_{ge,pu}t_data()drivers/net/can/rcar/rcar_canfd.c+4 -40 replies
6/10can: rcar_canfd: Repurpose f_dcfg base for other registersdrivers/net/can/rcar/rcar_canfd.c+37 -153 replies
7/10can: rcar_canfd: Rename rcar_canfd_setrnc() to rcar_canfd_set_rnc()drivers/net/can/rcar/rcar_canfd.c+3 -31 reply
8/10can: rcar_canfd: Share config code in rcar_canfd_set_bittiming()drivers/net/can/rcar/rcar_canfd.c+7 -180 replies
9/10can: rcar_canfd: Return early in rcar_canfd_set_bittiming() when not FDdrivers/net/can/rcar/rcar_canfd.c+11 -100 replies
10/10can: rcar_canfd: Add support for Transceiver Delay Compensationdrivers/net/can/rcar/rcar_canfd.c+82 -30 replies

Reviews trailers per patch

All 10 patches have a Reviewed-by or Acked-by.

PatchVincent Mailhol
1/10R-b
2/10R-b
3/10R-b
4/10R-b
5/10R-b
6/10R-b
7/10R-b
8/10R-b
9/10R-b
10/10R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 00/10] can: rcar_canfd: Add support for Transceiver Delay Compensation

Hi all,

This patch series adds CAN-FD Transceiver Delay Compensation support to the R-Car CAN-FD driver, after the customary cleanups and refactorings.

Changes compared to v1:
- Dropped patch "can: rcar_canfd: Use ndev parameter in rcar_canfd_set_bittiming()",
- New patch "[PATCH v2 02/10] can: rcar_canfd: Remove bittiming debug prints",
- New patch "[PATCH v2 07/10] can: rcar_canfd: Rename rcar_canfd_setrnc() to rcar_canfd_set_rnc()",
- Add Reviewed-by,
- Replace function-like RCANFD_F_*() macros by rcar_canfd_f_*() inline functions,
- Replace function-like macro RCANFD_FDSTS_TDCR() by bitmask RCANFD_FDSTS_TDCR and helper function rcar_canfd_get_tdcr(),
- Replace function-like macro RCANFD_FDSTS_TDCVF() by two bit definitions,
- Drop debug print of tdc mode and tdco value.

This has been tested on R-Car V4H (White Hawk), V4M (Gray Hawk Single), and E3 (Ebisu-4D[2]), using various data bit rates. Without proper TDC configuration, transmitting at 8 Mbps makes the CAN-FD controller enter BUS-OFF state. The TDCV value as measured by the CAN-FD controller is 4 on all boards tested (base clock 40 MHz, i.e. 25 ns period), and ca. 90 ns as measured by a logic analyzer on Gray Hawk Single.

Note that the BSP (predating upstream TDC support), uses a much simpler
method: for transfer rates >= 5 Mbps on R-Car Gen4, it enables TDC with a hardcoded (hardware) TDCO value of 2 (i.e. actual 3), which matches the behavior of this series at 8 Mbps.

Thanks for your comments!

[1] "[PATCH 0/9] can: rcar_canfd: Add support for Transceiver Delay Compensation"

    https://lore.kernel.org/[email protected]

[2] r8a77990.dtsi configures the CANFD core clock to 40 MHz, limiting transfer rates to 4 Mbps. Enable support for 8 Mbps by adding to ebisu.dtsi:

&canfd {
assigned-clock-rates = <80000000>;
}

I plan to send patches to update this on all R-Car Gen3 and RZ/G2 SoCs once this series has reached upstream.

Geert Uytterhoeven (10):
can: rcar_canfd: Consistently use ndev for net_device pointers
can: rcar_canfd: Remove bittiming debug prints
can: rcar_canfd: Add helper variable ndev to rcar_canfd_rx_pkt()
can: rcar_canfd: Add helper variable dev to
rcar_canfd_reset_controller()
can: rcar_canfd: Simplify data access in rcar_canfd_{ge,pu}t_data()
can: rcar_canfd: Repurpose f_dcfg base for other registers
can: rcar_canfd: Rename rcar_canfd_setrnc() to rcar_canfd_set_rnc()
can: rcar_canfd: Share config code in rcar_canfd_set_bittiming()
can: rcar_canfd: Return early in rcar_canfd_set_bittiming() when not
FD
can: rcar_canfd: Add support for Transceiver Delay Compensation

 drivers/net/can/rcar/rcar_canfd.c | 228 ++++++++++++++++++++----------
 1 file changed, 156 insertions(+), 72 deletions(-)
Signature · 12 lines
2.43.0

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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