Part Number: TCAN4550
We encountered an issue with the TCAN device during dynamic switching of CAN modes and bitrates.
Initially, the CAN interface is configured in High-Speed (HS) mode with a bitrate of 500 kbps. After deinitializing the interface, we reconfigure it to CAN-FD mode with a nominal bitrate of 1 Mbps and a data bitrate of 3 Mbps. However, in this scenario:
*CAN-FD data (64 bytes) transmission does not work.
*Classic CAN communication at 1 Mbps also fails
*Classic CAN communication at 500 kbps is working, even though the interface is reinitialized with the updated configuration.
Upon investigation, we observed that dynamic switching is not functioning correctly with the tcan4x5x driver. Reviewing the driver and register behavior revealed that the initialization bits (INIT and CCE) in the MCAN_CCCR register are set only once during driver load. Since these bits are not re-enabled during runtime reconfiguration, dynamic switching of modes and bitrates is not supported by default.
To address this issue, we modified the m_can.c driver as shown below:
diff -aruN A/drivers/net/can/m_can/m_can.c B/drivers/net/can/m_can/m_can.c
--- A/drivers/net/can/m_can/m_can.c 2026-03-17 11:17:38.166965563 +0530
+++ B/drivers/net/can/m_can/m_can.c 2026-04-01 18:20:24.215708731 +0530
@@ -1253,6 +1253,7 @@
cccr &= ~(CCCR_TEST | CCCR_MON | CCCR_BRSE | CCCR_FDOE |
CCCR_NISO);
+ cccr = (CCCR_INIT | CCCR_CCE ) ;
/* Only 3.2.x has NISO Bit implemented */
if (cdev->can.ctrlmode & CAN_CTRLMODE_FD_NON_ISO)
cccr |= CCCR_NISO;
@@ -1265,6 +1266,8 @@
if (cdev->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)
cccr |= CCCR_MON;
+ m_can_write(cdev, M_CAN_CCCR, CCCR_INIT);
+ m_can_write(cdev, M_CAN_CCCR, (CCCR_INIT | CCCR_CCE ) );
/* Write config */
m_can_write(cdev, M_CAN_CCCR, cccr);
m_can_write(cdev, M_CAN_TEST, test);
With these changes, dynamic switching between CAN modes and bitrates is now working as expected.
We would appreciate your review of this modification and confirmation that it will not introduce any unintended side effects.
Additionally, we would like to understand why this functionality is not enabled by default in the driver. Is there a specific design constraint or hardware limitation that prevents dynamic reconfiguration without explicitly re-entering INIT/CCE mode?