netdev.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, linux-can@vger.kernel.org,
	kernel@pengutronix.de, Marc Kleine-Budde <mkl@pengutronix.de>,
	linux-stable <stable@vger.kernel.org>
Subject: [PATCH 1/8] can: flexcan: fix shutdown: first disable chip, then all interrupts
Date: Mon,  3 Mar 2014 14:54:28 +0100	[thread overview]
Message-ID: <1393854875-8171-2-git-send-email-mkl@pengutronix.de> (raw)
In-Reply-To: <1393854875-8171-1-git-send-email-mkl@pengutronix.de>

When shutting down the CAN interface (ifconfig canX down) during high CAN bus
loads, the CAN core might hang and freeze the whole CPU.

This patch fixes the shutdown sequence by first disabling the CAN core then
disabling all interrupts.

Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/flexcan.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 320bef2..dcd69c9 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -827,14 +827,16 @@ static void flexcan_chip_stop(struct net_device *dev)
 	struct flexcan_regs __iomem *regs = priv->base;
 	u32 reg;
 
-	/* Disable all interrupts */
-	flexcan_write(0, &regs->imask1);
-
 	/* Disable + halt module */
 	reg = flexcan_read(&regs->mcr);
 	reg |= FLEXCAN_MCR_MDIS | FLEXCAN_MCR_HALT;
 	flexcan_write(reg, &regs->mcr);
 
+	/* Disable all interrupts */
+	flexcan_write(0, &regs->imask1);
+	flexcan_write(priv->reg_ctrl_default & ~FLEXCAN_CTRL_ERR_ALL,
+		      &regs->ctrl);
+
 	if (priv->reg_xceiver)
 		regulator_disable(priv->reg_xceiver);
 	priv->can.state = CAN_STATE_STOPPED;
-- 
1.9.0

  reply	other threads:[~2014-03-03 13:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-03 13:54 pull-request: can 2014-03-03 Marc Kleine-Budde
2014-03-03 13:54 ` Marc Kleine-Budde [this message]
2014-03-03 13:54 ` [PATCH 2/8] can: flexcan: flexcan_open(): fix error path if flexcan_chip_start() fails Marc Kleine-Budde
2014-03-03 13:54 ` [PATCH 3/8] can: flexcan: fix transition from and to low power mode in chip_{en,dis}able Marc Kleine-Budde
2014-03-03 13:54 ` [PATCH 4/8] can: flexcan: factor out transceiver {en,dis}able into seperate functions Marc Kleine-Budde
2014-03-03 13:54 ` [PATCH 5/8] can: flexcan: fix transition from and to freeze mode in chip_{,un}freeze Marc Kleine-Budde
2014-03-03 13:54 ` [PATCH 6/8] can: flexcan: flexcan_remove(): add missing netif_napi_del() Marc Kleine-Budde
2014-03-03 13:54 ` [PATCH 7/8] can: flexcan: factor out soft reset into seperate funtion Marc Kleine-Budde
2014-03-03 13:54 ` [PATCH 8/8] can: remove CAN FD compatibility for CAN 2.0 sockets Marc Kleine-Budde
2014-03-03 21:05 ` pull-request: can 2014-03-03 David Miller

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=1393854875-8171-2-git-send-email-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=davem@davemloft.net \
    --cc=kernel@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stable@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).