From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Matthias Klein <matthias.klein@optimeas.de>,
wg@grandegger.com, linux-can@vger.kernel.org,
support@karo-electronics.de
Cc: bigeasy@linutronix.de
Subject: Re: [PATCH 1/5] net: can: flexcan: provide propper return code in ISR
Date: Sat, 26 Jul 2014 00:31:11 +0200 [thread overview]
Message-ID: <53D2DAAF.1080406@pengutronix.de> (raw)
In-Reply-To: <1406312202-2542-1-git-send-email-matthias.klein@optimeas.de>
[-- Attachment #1: Type: text/plain, Size: 2904 bytes --]
On 07/25/2014 08:16 PM, Matthias Klein wrote:
> 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.
Yes....although the interrupt is ack'ed.
> This patch ensures that in such a case the core has a chance to detect
> such (or similar) misbehavior and disable the interrupt line.
The problem is, without the enabled bus errors, you have no chance to
detect the warning interrupt, as it is not connected on some SoCs.
However, the series berr_limit addresses the problem, too.
> 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(®s->iflag1);
> reg_esr = flexcan_read(®s->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,
> ®s->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, ®s->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), ®s->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)
>
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 242 bytes --]
prev parent reply other threads:[~2014-07-25 22:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-25 18:16 [PATCH 1/5] net: can: flexcan: provide propper return code in ISR Matthias Klein
2014-07-25 18:16 ` [PATCH 2/5] net: can: flexcan: disable error interrupts in non ERR-Active state Matthias Klein
2014-07-25 22:17 ` Marc Kleine-Budde
2014-07-25 18:16 ` [PATCH 3/5] net: can: flexcan: handle state passive -> warning transition Matthias Klein
2014-07-25 22:21 ` Marc Kleine-Budde
2014-07-25 18:16 ` [PATCH 4/5] net: can: flexcan: wait for completion when entering freeze mode Matthias Klein
2014-07-25 18:50 ` Sebastian Andrzej Siewior
2014-07-25 18:51 ` [PATCH] net: can: flexcan: reset the error counter after leaving passive state Sebastian Andrzej Siewior
2014-07-25 20:46 ` Marc Kleine-Budde
2014-07-25 18:16 ` [PATCH 5/5] net: can: flexcan: fix for wrong TX error count behaviour on i.MX53 Matthias Klein
2014-07-25 22:31 ` Marc Kleine-Budde [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53D2DAAF.1080406@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=bigeasy@linutronix.de \
--cc=linux-can@vger.kernel.org \
--cc=matthias.klein@optimeas.de \
--cc=support@karo-electronics.de \
--cc=wg@grandegger.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).