aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2014-07-25 14:16:40 -0400
committerMarc Kleine-Budde <mkl@pengutronix.de>2014-08-21 04:50:00 -0400
commit8ce261d0bb491da957278cdcba207791f329d1da (patch)
tree6e03a19648f7b073d73d7dae621136631414923c
parentbc03a54139baafcd8fe89ad115411c2c9c8a4905 (diff)
can: flexcan: handle state passive -> warning transition
Once the CAN-bus is open and a packet is sent, the controller switches into the PASSIVE state. Once the BUS is closed again it goes the back err-warning. The TX error counter goes 0 -> 0x80 -> 0x7f. This patch makes sure that the user learns about this state chang (CAN_STATE_ERROR_WARNING => CAN_STATE_ERROR_PASSIVE) Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Matthias Klein <matthias.klein@optimeas.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
-rw-r--r--drivers/net/can/flexcan.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index a691651f9ad9..944aa5d3af6e 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -549,6 +549,13 @@ static void do_state(struct net_device *dev,
549 549
550 /* process state changes depending on the new state */ 550 /* process state changes depending on the new state */
551 switch (new_state) { 551 switch (new_state) {
552 case CAN_STATE_ERROR_WARNING:
553 netdev_dbg(dev, "Error Warning\n");
554 cf->can_id |= CAN_ERR_CRTL;
555 cf->data[1] = (bec.txerr > bec.rxerr) ?
556 CAN_ERR_CRTL_TX_WARNING :
557 CAN_ERR_CRTL_RX_WARNING;
558 break;
552 case CAN_STATE_ERROR_ACTIVE: 559 case CAN_STATE_ERROR_ACTIVE:
553 netdev_dbg(dev, "Error Active\n"); 560 netdev_dbg(dev, "Error Active\n");
554 cf->can_id |= CAN_ERR_PROT; 561 cf->can_id |= CAN_ERR_PROT;