linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, linux-can@vger.kernel.org,
	kernel@pengutronix.de, Faiz Abbas <faiz_abbas@ti.com>,
	Dan Murphy <dmurphy@ti.com>,
	Marc Kleine-Budde <mkl@pengutronix.de>
Subject: [net 15/15] can: m_can: m_can_stop(): set device to software init mode before closing
Date: Sun, 15 Nov 2020 18:41:31 +0100	[thread overview]
Message-ID: <20201115174131.2089251-16-mkl@pengutronix.de> (raw)
In-Reply-To: <20201115174131.2089251-1-mkl@pengutronix.de>

From: Faiz Abbas <faiz_abbas@ti.com>

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


  parent reply	other threads:[~2020-11-15 17:42 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-15 17:41 pull-request: can 2020-11-15 Marc Kleine-Budde
2020-11-15 17:41 ` [net 01/15] can: af_can: prevent potential access of uninitialized member in can_rcv() Marc Kleine-Budde
2020-11-15 17:41 ` [net 02/15] can: af_can: prevent potential access of uninitialized member in canfd_rcv() Marc Kleine-Budde
2020-11-15 17:41 ` [net 03/15] can: dev: can_restart(): post buffer from the right context Marc Kleine-Budde
2020-11-15 17:41 ` [net 04/15] can: ti_hecc: Fix memleak in ti_hecc_probe Marc Kleine-Budde
2020-11-15 17:41 ` [net 05/15] can: mcba_usb: mcba_usb_start_xmit(): first fill skb, then pass to can_put_echo_skb() Marc Kleine-Budde
2020-11-15 17:41 ` [net 06/15] can: peak_usb: fix potential integer overflow on shift of a int Marc Kleine-Budde
2020-11-15 17:41 ` [net 07/15] can: flexcan: flexcan_setup_stop_mode(): add missing "req_bit" to stop mode property comment Marc Kleine-Budde
2020-11-15 17:41 ` [net 08/15] can: flexcan: fix failure handling of pm_runtime_get_sync() Marc Kleine-Budde
2020-11-15 17:41 ` [net 09/15] can: tcan4x5x: replace depends on REGMAP_SPI with depends on SPI Marc Kleine-Budde
2020-11-15 17:41 ` [net 10/15] can: tcan4x5x: tcan4x5x_can_probe(): add missing error checking for devm_regmap_init() Marc Kleine-Budde
2020-11-17 14:01   ` Dan Murphy
2020-11-15 17:41 ` [net 11/15] can: tcan4x5x: tcan4x5x_can_remove(): fix order of deregistration Marc Kleine-Budde
2020-11-17 14:00   ` Dan Murphy
2020-11-17 14:02     ` Marc Kleine-Budde
2020-11-15 17:41 ` [net 12/15] can: m_can: m_can_handle_state_change(): fix state change Marc Kleine-Budde
2020-11-17 14:01   ` Dan Murphy
2020-11-15 17:41 ` [net 13/15] can: m_can: m_can_class_free_dev(): introduce new function Marc Kleine-Budde
2020-11-15 17:41 ` [net 14/15] can: m_can: Fix freeing of can device from peripherials Marc Kleine-Budde
2020-11-15 17:41 ` Marc Kleine-Budde [this message]
2020-11-16 15:37 ` pull-request: can 2020-11-15 Jakub Kicinski
  -- strict thread matches above, loose matches on Subject: below --
2020-11-14 17:33 pull-request: can 2020-11-14 Marc Kleine-Budde
2020-11-14 17:33 ` [net 15/15] can: m_can: m_can_stop(): set device to software init mode before closing Marc Kleine-Budde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201115174131.2089251-16-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=davem@davemloft.net \
    --cc=dmurphy@ti.com \
    --cc=faiz_abbas@ti.com \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).