diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2014-07-25 18:16:40 (GMT) |
---|---|---|
committer | Matthew Weigel <Matthew.Weigel@freescale.com> | 2014-12-11 18:38:30 (GMT) |
commit | 55e35235db469a6fb949a4574146d1ed20c5e2ae (patch) | |
tree | cab23bd8ed3ad278efe9a2882fe4de42e5fdb668 /drivers/net | |
parent | 501b81d0dc746b9f323c5b597c94b492012e7495 (diff) | |
download | linux-fsl-qoriq-55e35235db469a6fb949a4574146d1ed20c5e2ae.tar.xz |
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>
---
Cherry-picked from linux-next: 8ce261d0bb491da957278cdcba207791f329d1da
Change-Id: I311a7075033b493ef06818fb1e15f0eb69e96fa2
Reviewed-on: http://git.am.freescale.net:8181/21845
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Zhengxiong Jin <Jason.Jin@freescale.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/can/flexcan.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index 826b424..bac72c6 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -605,6 +605,13 @@ static void do_state(struct net_device *dev, /* process state changes depending on the new state */ switch (new_state) { + case CAN_STATE_ERROR_WARNING: + netdev_dbg(dev, "Error Warning\n"); + cf->can_id |= CAN_ERR_CRTL; + cf->data[1] = (bec.txerr > bec.rxerr) ? + CAN_ERR_CRTL_TX_WARNING : + CAN_ERR_CRTL_RX_WARNING; + break; case CAN_STATE_ERROR_ACTIVE: netdev_dbg(dev, "Error Active\n"); cf->can_id |= CAN_ERR_PROT; |