linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 1/5] net: can: flexcan: provide propper return code in ISR
@ 2014-07-28  6:34 Matthias Klein
  2014-07-28  6:34 ` [PATCH V2 2/5] net: can: flexcan: disable error interrupts in non ERR-Active state Matthias Klein
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Matthias Klein @ 2014-07-28  6:34 UTC (permalink / raw)
  To: wg, mkl, linux-can, support; +Cc: bigeasy

From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

flexcan_irq() always returns IRQ_HANDLED no matter if it actually did
something or not. If the CAN interface is brought up without BERR
reporting on a SoC which has the FLEXCAN_HAS_BROKEN_ERR_STATE feature
then ERR reporting is activated but not really handled. That means on an
open bus one receives a lot of STF_ERR and the only thing that happens
is that the number of interrupts is incremented.
This patch ensures that in such a case the core has a chance to detect
such (or similar) misbehavior and disable the interrupt line.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Matthias Klein <matthias.klein@optimeas.de>
---
 drivers/net/can/flexcan.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index e381142..f677b49 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -641,6 +641,7 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
 	struct flexcan_priv *priv = netdev_priv(dev);
 	struct flexcan_regs __iomem *regs = priv->base;
 	u32 reg_iflag1, reg_esr;
+	int worked = 0;
 
 	reg_iflag1 = flexcan_read(&regs->iflag1);
 	reg_esr = flexcan_read(&regs->esr);
@@ -667,6 +668,7 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
 		flexcan_write(priv->reg_ctrl_default & ~FLEXCAN_CTRL_ERR_ALL,
 		       &regs->ctrl);
 		napi_schedule(&priv->napi);
+		worked = 1;
 	}
 
 	/* FIFO overflow */
@@ -674,6 +676,7 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
 		flexcan_write(FLEXCAN_IFLAG_RX_FIFO_OVERFLOW, &regs->iflag1);
 		dev->stats.rx_over_errors++;
 		dev->stats.rx_errors++;
+		worked = 1;
 	}
 
 	/* transmission complete interrupt */
@@ -683,9 +686,12 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
 		can_led_event(dev, CAN_LED_EVENT_TX);
 		flexcan_write((1 << FLEXCAN_TX_BUF_ID), &regs->iflag1);
 		netif_wake_queue(dev);
+		worked = 1;
 	}
-
-	return IRQ_HANDLED;
+	if (worked)
+		return IRQ_HANDLED;
+	else
+		return IRQ_NONE;
 }
 
 static void flexcan_set_bittiming(struct net_device *dev)
-- 
2.0.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-07-28  7:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-28  6:34 [PATCH V2 1/5] net: can: flexcan: provide propper return code in ISR Matthias Klein
2014-07-28  6:34 ` [PATCH V2 2/5] net: can: flexcan: disable error interrupts in non ERR-Active state Matthias Klein
2014-07-28  6:40   ` Varka Bhadram
2014-07-28  6:34 ` [PATCH V2 3/5] net: can: flexcan: handle state passive -> warning transition Matthias Klein
2014-07-28  6:34 ` [PATCH V2 4/5] can: flexcan: fix transition from and to freeze mode in chip_{,un}freeze Matthias Klein
2014-07-28  6:38   ` Marc Kleine-Budde
2014-07-28  6:34 ` [PATCH V2 5/5] net: can: flexcan: fix for wrong TX error count behaviour on i.MX53 Matthias Klein
2014-07-28  6:39   ` Varka Bhadram
2014-07-28  7:05   ` Marc Kleine-Budde
2014-07-28  7:08     ` Sebastian Andrzej Siewior
2014-07-28  6:36 ` [PATCH V2 1/5] net: can: flexcan: provide propper return code in ISR Varka Bhadram

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).