From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Zhao Qiang <B45475@freescale.com>,
linuxppc-dev@lists.ozlabs.org, linux-can@vger.kernel.org,
wg@grandegger.com, B07421@freescale.com
Subject: Re: [PATCH v3 1/2] flexcan: add err_irq handler for flexcan
Date: Mon, 23 Jun 2014 09:17:43 +0200 [thread overview]
Message-ID: <53A7D497.7080806@pengutronix.de> (raw)
In-Reply-To: <1403507484-46547-1-git-send-email-B45475@freescale.com>
[-- Attachment #1: Type: text/plain, Size: 2034 bytes --]
On 06/23/2014 09:11 AM, Zhao Qiang wrote:
> when flexcan is not physically linked, command 'cantest' will
> trigger an err_irq, add err_irq handler for it.
>
> Signed-off-by: Zhao Qiang <B45475@freescale.com>
> ---
> Changes for v2:
> - use a space instead of tab
> - use flexcan_poll_state instead of print
> Changes for v3:
> - return IRQ_HANDLED if err is triggered
> - stop transmitted packets when there is an err_interrupt
>
> drivers/net/can/flexcan.c | 35 ++++++++++++++++++++++++++++++++++-
> 1 file changed, 34 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
> index f425ec2..6802a25 100644
> --- a/drivers/net/can/flexcan.c
> +++ b/drivers/net/can/flexcan.c
> @@ -208,6 +208,7 @@ struct flexcan_priv {
> void __iomem *base;
> u32 reg_esr;
> u32 reg_ctrl_default;
> + unsigned int err_irq;
>
> struct clk *clk_ipg;
> struct clk *clk_per;
> @@ -744,6 +745,24 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
> return IRQ_HANDLED;
> }
>
> +static irqreturn_t flexcan_err_irq(int irq, void *dev_id)
> +{
> + struct net_device *dev = dev_id;
> + struct flexcan_priv *priv = netdev_priv(dev);
> + struct flexcan_regs __iomem *regs = priv->base;
> + u32 reg_ctrl, reg_esr;
> +
> + 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?
> + 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?
> + return IRQ_HANDLED;
> + }
> + return IRQ_NONE;
> +}
> +
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 --]
next prev parent reply other threads:[~2014-06-23 7:18 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 ` Marc Kleine-Budde [this message]
2014-06-23 7:26 ` [PATCH v3 1/2] flexcan: add err_irq handler for flexcan 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
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=53A7D497.7080806@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=B07421@freescale.com \
--cc=B45475@freescale.com \
--cc=linux-can@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.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).