diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2014-02-19 12:00:51 +0100 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2014-04-02 00:58:57 +0100 |
commit | 5fdcc8da46cec9fc4f240dbd7ec1e70713d464cc (patch) | |
tree | 202bbc2cb6b5787fd887fcd336e1aaeb88592696 | |
parent | 955f8acb2df06b1e28c88dc653293f51b42eb8f0 (diff) |
can: flexcan: fix shutdown: first disable chip, then all interrupts
commit 5be93bdda64e85450598c6e97f79fb8f6acf30e0 upstream.
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.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | drivers/net/can/flexcan.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index bb828c24ce6..6bd45eef69c 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -777,14 +777,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, ®s->imask1); - /* Disable + halt module */ reg = flexcan_read(®s->mcr); reg |= FLEXCAN_MCR_MDIS | FLEXCAN_MCR_HALT; flexcan_write(reg, ®s->mcr); + /* Disable all interrupts */ + flexcan_write(0, ®s->imask1); + flexcan_write(priv->reg_ctrl_default & ~FLEXCAN_CTRL_ERR_ALL, + ®s->ctrl); + flexcan_transceiver_switch(priv, 0); priv->can.state = CAN_STATE_STOPPED; |