From: Marc Kleine-Budde <mkl@pengutronix.de>
To: "qiang.zhao@freescale.com" <qiang.zhao@freescale.com>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>,
"wg@grandegger.com" <wg@grandegger.com>,
Scott Wood <scottwood@freescale.com>
Subject: Re: [PATCH v3 1/2] flexcan: add err_irq handler for flexcan
Date: Mon, 23 Jun 2014 10:31:17 +0200 [thread overview]
Message-ID: <53A7E5D5.4070003@pengutronix.de> (raw)
In-Reply-To: <c0ae03364c7946bb8278bf20b03bab90@BLUPR03MB341.namprd03.prod.outlook.com>
[-- Attachment #1: Type: text/plain, Size: 2452 bytes --]
On 06/23/2014 10:15 AM, qiang.zhao@freescale.com wrote:
[...]
>>>>> + reg_esr = flexcan_read(®s->esr);
>>>>> + reg_ctrl = flexcan_read(®s->ctrl);
>>>>> + if (reg_esr & FLEXCAN_ESR_TX_WRN) {
>>>>
>>>> When does the hardware trigger the interrupt?
>>>
>>> When there is no wire link between tx and rx, tx start transfer and
>> doesn’t get the ack.
>>
>> You are testing for the warning interrupt, not for the
>> FLEXCAN_ESR_ACK_ERR (which is triggered there isn't any ACK).
>>
>>>>> + flexcan_write(reg_esr & ~FLEXCAN_ESR_TX_WRN, ®s->esr);
>>>>> + flexcan_write(reg_ctrl & ~FLEXCAN_CTRL_ERR_MSK, ®s->ctrl);
>>>>> + netif_stop_queue(dev);
>>>>
>>>> Why are you stopping the txqueue?
>>>
>>> There is no wire link, tx can't transfer successfully.
>>
>> You are testing for the warning interrupt, which is triggered if the
>> error counter increases from 95 to 96. And the error counter can increase
>> due to several reasons. No link is only one of them. If the CAN core
>> cannot transmit new packages any more the flow control in the driver will
>> take care.
>
> When Tx error counter increases from 95 to 96, there must be issue for tx,
> So why can't I stop the txqueue?
Why do you want to stop the queue? It's compliant with the CAN spec to
keep sending CAN frames if the error counter increases to 96. If there
isn't any problem with the CAN bus anymore, the TX error counters will
decrease with every successfully transmitted CAN frame.
> You said that there are several reasons, would you like to take some examples?
See CAN Error Confinement Rules in
http://www.can-wiki.info/doku.php?id=can_faq_erors
>> What about calling the normal interrupt if er err_irq occurs, as this
>> function will take care of both normal and error interrupts anyway?
>
> Calling the normal interrupt doesn't work.
Why?
flexcan_irq() if FLEXCAN_CTRL_TWRN_MSK is set and will schedule the NAPI
routine:
> if ((reg_iflag1 & FLEXCAN_IFLAG_RX_FIFO_AVAILABLE) ||
> (reg_esr & FLEXCAN_ESR_ERR_STATE) ||
> flexcan_has_and_handle_berr(priv, reg_esr)) {
[...]
> napi_schedule(&priv->napi);
> }
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-06-23 8:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-23 7:11 [PATCH v3 1/2] flexcan: add err_irq handler for flexcan Zhao Qiang
2014-06-23 7:11 ` [PATCH v3 2/2] flexcan: add err interrupt for p1010rdb Zhao Qiang
2014-06-23 7:17 ` [PATCH v3 1/2] flexcan: add err_irq handler for flexcan Marc Kleine-Budde
2014-06-23 7:26 ` qiang.zhao
2014-06-23 7:37 ` Marc Kleine-Budde
2014-06-23 8:15 ` qiang.zhao
2014-06-23 8: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=53A7E5D5.4070003@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=linux-can@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=qiang.zhao@freescale.com \
--cc=scottwood@freescale.com \
--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).