[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DCOZUOS67P02.1SZS876C49XTP@baylibre.com>
Date: Wed, 10 Sep 2025 10:57:13 +0200
From: "Markus Schneider-Pargmann" <msp@...libre.com>
To: "Marc Kleine-Budde" <mkl@...gutronix.de>, "Chandrasekar Ramakrishnan"
<rcsekar@...sung.com>, "Vincent Mailhol" <mailhol.vincent@...adoo.fr>,
"Patrik Flykt" <patrik.flykt@...ux.intel.com>, "Dong Aisheng"
<b29396@...escale.com>, "Varka Bhadram" <varkabhadram@...il.com>, "Wu Bo"
<wubo.oduw@...il.com>, "Philipp Zabel" <p.zabel@...gutronix.de>
Cc: <linux-can@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<kernel@...gutronix.de>
Subject: Re: [PATCH v2 4/7] can: m_can: m_can_chip_config(): bring up
interface in correct state
On Tue Sep 9, 2025 at 7:53 PM CEST, Marc Kleine-Budde wrote:
> 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: e0d1f4816f2a ("can: m_can: add Bosch M_CAN controller support")
> Signed-off-by: Marc Kleine-Budde <mkl@...gutronix.de>
Reviewed-by: Markus Schneider-Pargmann <msp@...libre.com>
> ---
> drivers/net/can/m_can/m_can.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
> index 3edf01b098a4..efd9c23edd4a 100644
> --- a/drivers/net/can/m_can/m_can.c
> +++ b/drivers/net/can/m_can/m_can.c
> @@ -1620,7 +1620,7 @@ static int m_can_start(struct net_device *dev)
> netdev_queue_set_dql_min_limit(netdev_get_tx_queue(cdev->net, 0),
> cdev->tx_max_coalesced_frames);
>
> - cdev->can.state = CAN_STATE_ERROR_ACTIVE;
> + cdev->can.state = m_can_state_get_by_psr(cdev);
>
> m_can_enable_all_interrupts(cdev);
>
Download attachment "signature.asc" of type "application/pgp-signature" (290 bytes)
Powered by blists - more mailing lists