From: Lukas Wunner <lukas@wunner.de>
To: Marc Kleine-Budde <mkl@pengutronix.de>,
Wolfgang Grandegger <wg@grandegger.com>,
linux-can@vger.kernel.org, netdev@vger.kernel.org
Cc: Mathias Duckeck <m.duckeck@kunbus.de>,
Akshay Bhat <akshay.bhat@timesys.com>,
Casey Fitzpatrick <casey.fitzpatrick@timesys.com>
Subject: Re: [PATCH] can: hi311x: Work around TX complete interrupt erratum
Date: Thu, 10 May 2018 06:38:43 +0200 [thread overview]
Message-ID: <20180510043843.GA14936@wunner.de> (raw)
In-Reply-To: <dc7901c96bed90724bb372f4d3eead82bd22ac37.1525869303.git.lukas@wunner.de>
On Wed, May 09, 2018 at 02:43:43PM +0200, Lukas Wunner wrote:
> When sending packets as fast as possible using "cangen -g 0 -i -x", the
> HI-3110 occasionally latches the interrupt pin high on completion of a
> packet, but doesn't set the TXCPLT bit in the INTF register. The INTF
> register contains 0x00 as if no interrupt has occurred. Even waiting
> for a few milliseconds after the interrupt doesn't help.
>
> Work around this apparent erratum by instead checking the TXMTY bit in
> the STATF register ("TX FIFO empty"). We know that we've queued up a
> packet for transmission if priv->tx_len is nonzero. If the TX FIFO is
> empty, transmission of that packet must have completed.
>
> Note that this is congruent with our handling of received packets, which
> likewise gleans from the STATF register whether a packet is waiting in
> the RX FIFO, instead of looking at the INTF register.
I should have mentioned, to verify the existence of the erratum and the
validity of the patch, you can apply the little debug patch below, then
run "cangen -g 0 -i -x". You should see error messages in dmesg within
a few minutes.
-- >8 --
diff --git a/drivers/net/can/spi/hi311x.c b/drivers/net/can/spi/hi311x.c
index 53e320c..48b5c63 100644
--- a/drivers/net/can/spi/hi311x.c
+++ b/drivers/net/can/spi/hi311x.c
@@ -739,6 +739,9 @@ static irqreturn_t hi3110_can_ist(int irq, void *dev_id)
}
if (priv->tx_len && statf & HI3110_STAT_TXMTY) {
+ if (!(intf & HI3110_INT_TXCPLT))
+ dev_err(&spi->dev, "TX FIFO empty and TX was queued but TXCPLT not set\n");
+
net->stats.tx_packets++;
net->stats.tx_bytes += priv->tx_len - 1;
can_led_event(net, CAN_LED_EVENT_TX);
next prev parent reply other threads:[~2018-05-10 4:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-09 12:43 [PATCH] can: hi311x: Work around TX complete interrupt erratum Lukas Wunner
2018-05-10 4:38 ` Lukas Wunner [this message]
2018-05-10 16:23 ` Akshay Bhat
2018-05-10 16:27 ` Marc Kleine-Budde
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=20180510043843.GA14936@wunner.de \
--to=lukas@wunner.de \
--cc=akshay.bhat@timesys.com \
--cc=casey.fitzpatrick@timesys.com \
--cc=linux-can@vger.kernel.org \
--cc=m.duckeck@kunbus.de \
--cc=mkl@pengutronix.de \
--cc=netdev@vger.kernel.org \
--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).