diff mbox series

[v2] can: m_can: Set device to software init mode before closing

Message ID 20200825055442.16994-1-faiz_abbas@ti.com
State Awaiting Upstream
Delegated to: David Miller
Headers show
Series [v2] can: m_can: Set device to software init mode before closing | expand

Commit Message

Faiz Abbas Aug. 25, 2020, 5:54 a.m. UTC
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.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
---

changes since v1: Rebased to latest mainline

 drivers/net/can/m_can/m_can.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Dan Murphy Sept. 1, 2020, 6:18 p.m. UTC | #1
Faiz

On 8/25/20 12:54 AM, Faiz Abbas wrote:
> 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.
>
> Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
> ---
>
> changes since v1: Rebased to latest mainline
>
>   drivers/net/can/m_can/m_can.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
> index 02c5795b7393..d0c458f7f6e1 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;
>   }
Acked-by: Dan Murphy <dmurphy@ti.com>
Marc Kleine-Budde Nov. 11, 2020, 10:33 p.m. UTC | #2
On 8/25/20 7:54 AM, Faiz Abbas wrote:
> 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.
> 
> Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

Added to linux-can/testing.

Tnx,
Marc
diff mbox series

Patch

diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index 02c5795b7393..d0c458f7f6e1 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;
 }