diff options
author | Mirza Krak <mirza.krak@hostmobility.com> | 2015-11-10 16:59:34 +0300 |
---|---|---|
committer | Zefan Li <lizefan@huawei.com> | 2016-10-26 18:15:32 +0300 |
commit | cf030cb1542d200fc258f2efb1f118874a023d09 (patch) | |
tree | d805e3a24dc7cc10c47ae9185330fd03df9e2778 | |
parent | 34a906cd9f6445d9510841667eff0d980279ebf3 (diff) | |
download | linux-cf030cb1542d200fc258f2efb1f118874a023d09.tar.xz |
can: sja1000: clear interrupts on start
commit 7cecd9ab80f43972c056dc068338f7bcc407b71c upstream.
According to SJA1000 data sheet error-warning (EI) interrupt is not
cleared by setting the controller in to reset-mode.
Then if we have the following case:
- system is suspended (echo mem > /sys/power/state) and SJA1000 is left
in operating state
- A bus error condition occurs which activates EI interrupt, system is
still suspended which means EI interrupt will be not be handled nor
cleared.
If the above two events occur, on resume there is no way to return the
SJA1000 to operating state, except to cycle power to it.
By simply reading the IR register on start we will clear any previous
conditions that could be present.
Signed-off-by: Mirza Krak <mirza.krak@hostmobility.com>
Reported-by: Christian Magnusson <Christian.Magnusson@semcon.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
[lizf: Backported to 3.4: s/SJA1000_IR/REG_IR/]
Signed-off-by: Zefan Li <lizefan@huawei.com>
-rw-r--r-- | drivers/net/can/sja1000/sja1000.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c index 2d3ad72958ff..18244862dfbf 100644 --- a/drivers/net/can/sja1000/sja1000.c +++ b/drivers/net/can/sja1000/sja1000.c @@ -177,6 +177,9 @@ static void sja1000_start(struct net_device *dev) priv->write_reg(priv, REG_RXERR, 0x0); priv->read_reg(priv, REG_ECC); + /* clear interrupt flags */ + priv->read_reg(priv, REG_IR); + /* leave reset mode */ set_normal_mode(dev); } |