aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2014-02-19 06:00:51 -0500
committerMarc Kleine-Budde <mkl@pengutronix.de>2014-03-03 06:40:52 -0500
commit5be93bdda64e85450598c6e97f79fb8f6acf30e0 (patch)
treeec4522c10a34495e6cc8f13e1ef1f62de89d1ce9
parent635d61a3735e05c8da72740006670f819e5b6a5f (diff)
can: flexcan: fix shutdown: first disable chip, then all interrupts
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>
-rw-r--r--drivers/net/can/flexcan.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 320bef2dba42..dcd69c9374ae 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)
827 struct flexcan_regs __iomem *regs = priv->base; 827 struct flexcan_regs __iomem *regs = priv->base;
828 u32 reg; 828 u32 reg;
829 829
830 /* Disable all interrupts */
831 flexcan_write(0, &regs->imask1);
832
833 /* Disable + halt module */ 830 /* Disable + halt module */
834 reg = flexcan_read(&regs->mcr); 831 reg = flexcan_read(&regs->mcr);
835 reg |= FLEXCAN_MCR_MDIS | FLEXCAN_MCR_HALT; 832 reg |= FLEXCAN_MCR_MDIS | FLEXCAN_MCR_HALT;
836 flexcan_write(reg, &regs->mcr); 833 flexcan_write(reg, &regs->mcr);
837 834
835 /* Disable all interrupts */
836 flexcan_write(0, &regs->imask1);
837 flexcan_write(priv->reg_ctrl_default & ~FLEXCAN_CTRL_ERR_ALL,
838 &regs->ctrl);
839
838 if (priv->reg_xceiver) 840 if (priv->reg_xceiver)
839 regulator_disable(priv->reg_xceiver); 841 regulator_disable(priv->reg_xceiver);
840 priv->can.state = CAN_STATE_STOPPED; 842 priv->can.state = CAN_STATE_STOPPED;