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

can: m_can.c: fix setup of CCCR register: clear CCCR NISO bit before checking can.ctrlmode

Inside m_can_chip_config(), when setting up the new value of the CCCR,
the CCCR_NISO bit is not cleared like the others, CCCR_TEST, CCCR_MON,
CCCR_BRSE and CCCR_FDOE, before checking the can.ctrlmode bits for
CAN_CTRLMODE_FD_NON_ISO.

This way once the controller was configured for CAN_CTRLMODE_FD_NON_ISO,
this mode could never be cleared again.

This fix is only relevant for controllers with version 3.1.x or 3.2.x.
Older versions do not support NISO.

Signed-off-by: Roman Fietze <roman.fietze@telemotive.de>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

authored by

Roman Fietze and committed by
Marc Kleine-Budde
393753b2 5d4c94ed

+2 -1
+2 -1
drivers/net/can/m_can/m_can.c
··· 1109 1109 1110 1110 } else { 1111 1111 /* Version 3.1.x or 3.2.x */ 1112 - cccr &= ~(CCCR_TEST | CCCR_MON | CCCR_BRSE | CCCR_FDOE); 1112 + cccr &= ~(CCCR_TEST | CCCR_MON | CCCR_BRSE | CCCR_FDOE | 1113 + CCCR_NISO); 1113 1114 1114 1115 /* Only 3.2.x has NISO Bit implemented */ 1115 1116 if (priv->can.ctrlmode & CAN_CTRLMODE_FD_NON_ISO)