summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFaiz Abbas <faiz_abbas@ti.com>2020-08-25 11:24:42 +0530
committerMarc Kleine-Budde <mkl@pengutronix.de>2020-11-15 18:33:45 +0100
commita584e9bc1b7e88f24f8504886eafbe6c73d8a97c (patch)
treeff41ec60be84689af4f6623e815f73385c83bc44
parent85816aba460ceebed0047381395615891df68c8f (diff)
downloadlinux-a584e9bc1b7e88f24f8504886eafbe6c73d8a97c.tar.bz2
can: m_can: m_can_stop(): set device to software init mode before closing
There might be some requests pending in the buffer when the interface close sequence occurs. In some devices, these pending requests might lead to the module not shutting down properly when m_can_clk_stop() is called. Therefore, move the device to init state before potentially powering it down. Fixes: e0d1f4816f2a ("can: m_can: add Bosch M_CAN controller support") Signed-off-by: Faiz Abbas <faiz_abbas@ti.com> Acked-by: Dan Murphy <dmurphy@ti.com> Link: https://lore.kernel.org/r/20200825055442.16994-1-faiz_abbas@ti.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
-rw-r--r--drivers/net/can/m_can/m_can.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index 645101d19989..e7264043f79a 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -1414,6 +1414,9 @@ static void m_can_stop(struct net_device *dev)
/* disable all interrupts */
m_can_disable_all_interrupts(cdev);
+ /* Set init mode to disengage from the network */
+ m_can_config_endisable(cdev, true);
+
/* set the state as STOPPED */
cdev->can.state = CAN_STATE_STOPPED;
}