On Thu, May 30, 2024 at 12:57:58PM +0200, Martin Hundebøll wrote: > The m_can driver sets and clears the CCCR.INIT bit during probe (both > when testing the NON-ISO bit, and when configuring the chip). After > clearing the CCCR.INIT bit, the transceiver enters normal mode, where it > affects the CAN bus (i.e. it ACKs frames). This can cause troubles when > the m_can node is only used for monitoring the bus, as one cannot setup > listen-only mode before the device is probed. > > Rework the probe flow, so that the CCCR.INIT bit is only cleared when > upping the device. First, the tcan4x5x driver is changed to stay in > standby mode during/after probe. This in turn requires changes when > setting bits in the CCCR register, as its CSR and CSA bits are always > high in standby mode. > > Signed-off-by: Martin Hundebøll <martin@xxxxxxxxxx> > --- > drivers/net/can/m_can/m_can.c | 169 ++++++++++++++++---------- > drivers/net/can/m_can/tcan4x5x-core.c | 13 +- > 2 files changed, 116 insertions(+), 66 deletions(-) > > diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c ... > @@ -1694,21 +1732,26 @@ static int m_can_dev_setup(struct m_can_classdev *cdev) > return -EINVAL; > } > > - if (cdev->ops->init) > - cdev->ops->init(cdev); > - > - return 0; > + /* Forcing standby mode should be redunant, as the chip should be in Hi Martin, A minor nit from my side as it looks like there will be another revision anyway. redunant -> redundant > + * standby after a reset. Write the INIT bit anyways, should the chip > + * be configured by previous stage. > + */ > + return m_can_cccr_update_bits(cdev, CCCR_INIT, CCCR_INIT); > } ...