netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] can: m_can: Set device to software init mode before closing
@ 2020-08-25  5:54 Faiz Abbas
  2020-09-01 18:18 ` Dan Murphy
  2020-11-11 22:33 ` Marc Kleine-Budde
  0 siblings, 2 replies; 3+ messages in thread
From: Faiz Abbas @ 2020-08-25  5:54 UTC (permalink / raw)
  To: linux-kernel, netdev, linux-can
  Cc: kuba, davem, mkl, wg, sriram.dash, dmurphy, faiz_abbas

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;
 }
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] can: m_can: Set device to software init mode before closing
  2020-08-25  5:54 [PATCH v2] can: m_can: Set device to software init mode before closing Faiz Abbas
@ 2020-09-01 18:18 ` Dan Murphy
  2020-11-11 22:33 ` Marc Kleine-Budde
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Murphy @ 2020-09-01 18:18 UTC (permalink / raw)
  To: Faiz Abbas, linux-kernel, netdev, linux-can
  Cc: kuba, davem, mkl, wg, sriram.dash

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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] can: m_can: Set device to software init mode before closing
  2020-08-25  5:54 [PATCH v2] can: m_can: Set device to software init mode before closing Faiz Abbas
  2020-09-01 18:18 ` Dan Murphy
@ 2020-11-11 22:33 ` Marc Kleine-Budde
  1 sibling, 0 replies; 3+ messages in thread
From: Marc Kleine-Budde @ 2020-11-11 22:33 UTC (permalink / raw)
  To: Faiz Abbas, linux-kernel, netdev, linux-can
  Cc: kuba, davem, wg, sriram.dash, dmurphy


[-- Attachment #1.1: Type: text/plain, Size: 728 bytes --]

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

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-12  1:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-25  5:54 [PATCH v2] can: m_can: Set device to software init mode before closing Faiz Abbas
2020-09-01 18:18 ` Dan Murphy
2020-11-11 22:33 ` Marc Kleine-Budde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).