Skip to content

Commit 4942c42

Browse files
can: m_can: m_can_chip_config(): bring up interface in correct state
In some SoCs (observed on the STM32MP15) the M_CAN IP core keeps the CAN state and CAN error counters over an internal reset cycle. An external reset is not always possible, due to the shared reset with the other CAN core. This caused the core not always be in Error Active state when bringing up the controller. Instead of always setting the CAN state to Error Active in m_can_chip_config(), fix this by reading and decoding the Protocol Status Regitser (PSR) and set the CAN state accordingly. Fixes: e0d1f48 ("can: m_can: add Bosch M_CAN controller support") Reviewed-by: Markus Schneider-Pargmann <[email protected]> Link: https://patch.msgid.link/20250929-m_can-fix-state-handling-v4-3-682b49b49d9a@pengutronix.de Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent 3d9db29 commit 4942c42

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/can/m_can/m_can.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1617,7 +1617,7 @@ static int m_can_start(struct net_device *dev)
16171617
netdev_queue_set_dql_min_limit(netdev_get_tx_queue(cdev->net, 0),
16181618
cdev->tx_max_coalesced_frames);
16191619

1620-
cdev->can.state = CAN_STATE_ERROR_ACTIVE;
1620+
cdev->can.state = m_can_state_get_by_psr(cdev);
16211621

16221622
m_can_enable_all_interrupts(cdev);
16231623

0 commit comments

Comments
 (0)