The first patch fixes a pm_runtime imbalance in the m_can_platform
driver.
The rest of this series fixes the CAN state handling in the m_can
driver:
- add the missing state transition from from Error Warning back to
Error Active (Patches 2+3)
- address the fact that 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. Set the correct CAN state during ifup and
system resume (Patches 4+5)
- add support for optional shared external reset, to properly reset
the IP core (Patches 6+7)
The update of the DT binding for the reset property is upstream:
https://git.kernel.org/pub/scm/linux/kernel/git/atorgue/stm32.git/commit/?h=stm32-next&id=cfd856da6cf561f7e1dc6b16f3453814cde1058e
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
Changes in v2:
- cover: added link to DT bindings update (thanks Philipp)
- 1: add Markus's R-b
- 2: always mask active interrupts (thanks Markus)
- 3: remove not needed comments (thanks Markus)
- 3: rename m_can_can_state_get_by_psr() -> m_can_state_get_by_psr() (thanks Markus)
- 3: read PSR inside m_can_state_get_by_psr() (thanks Markus)
- 5: add Markus's R-b
- 7: fix typo (thanks Philipp)
- 7: rename struct m_can_classdev::rsts -> rst (thanks Philipp)
- Link to v1: https://patch.msgid.link/20250812-m_can-fix-state-handling-v1-0-b739e06c0a3b@pengutronix.de
---
Marc Kleine-Budde (7):
can: m_can: m_can_plat_remove(): add missing pm_runtime_disable()
can: m_can: only handle active interrupts
can: m_can: m_can_handle_state_errors(): fix CAN state transition to Error Active
can: m_can: m_can_chip_config(): bring up interface in correct state
can: m_can: fix CAN state in system PM
can: m_can: m_can_get_berr_counter(): don't wake up controller if interface is down
can: m_can: add optional support for reset
drivers/net/can/m_can/m_can.c | 97 +++++++++++++++++++++++-----------
drivers/net/can/m_can/m_can.h | 1 +
drivers/net/can/m_can/m_can_platform.c | 2 +-
3 files changed, 69 insertions(+), 31 deletions(-)
---
base-commit: d3b28612bc5500133260aaf36794a0a0c287d61b
change-id: 20250811-m_can-fix-state-handling-0ba4bda6cb8e
Best regards,
--
Marc Kleine-Budde <mkl@pengutronix.de>