All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Maxime Ripard <maxime.ripard@free-electrons.com>,
	Gerhard Bertelsmann <info@gerhard-bertelsmann.de>
Cc: linux-can@vger.kernel.org, linux-sunxi@googlegroups.com
Subject: Re: [linux-sunxi] [PATCH v5 2/2] can: Allwinner A10/A20 CAN Controller support - controller code
Date: Sun, 13 Sep 2015 14:50:34 +0200	[thread overview]
Message-ID: <55F5711A.6030002@pengutronix.de> (raw)
In-Reply-To: <20150913124501.GS9885@lukather>

[-- Attachment #1: Type: text/plain, Size: 2169 bytes --]

On 09/13/2015 02:45 PM, Maxime Ripard wrote:
>> > +static irqreturn_t sunxi_can_interrupt(int irq, void *dev_id)
>> > +{
>> > +	struct net_device *dev = (struct net_device *)dev_id;
>> > +	struct sunxican_priv *priv = netdev_priv(dev);
>> > +	struct net_device_stats *stats = &dev->stats;
>> > +	u8 isrc, status;
>> > +	int n = 0;
>> > +
>> > +	while ((isrc = readl(priv->base + SUNXI_REG_INT_ADDR)) &&
>> > +	       (n < SUNXI_CAN_MAX_IRQ)) {
>> > +		n++;
>> > +		status = readl(priv->base + SUNXI_REG_STA_ADDR);
>> > +
>> > +		if (isrc & SUNXI_INT_WAKEUP)
>> > +			netdev_warn(dev, "wakeup interrupt\n");
>> > +
>> > +		if (isrc & SUNXI_INT_TBUF_VLD) {
>> > +			/* transmission complete interrupt */
>> > +			stats->tx_bytes +=
>> > +			    readl(priv->base +
>> > +				  SUNXI_REG_RBUF_RBACK_START_ADDR) & 0xf;
>> > +			stats->tx_packets++;
>> > +			can_get_echo_skb(dev, 0);
>> > +			netif_wake_queue(dev);
>> > +			can_led_event(dev, CAN_LED_EVENT_TX);
>> > +		}
>> > +		if (isrc & SUNXI_INT_RBUF_VLD) {
>> > +			/* receive interrupt */
>> > +			while (status & SUNXI_STA_RBUF_RDY) {
>> > +				/* RX buffer is not empty */
>> > +				sunxi_can_rx(dev);
>> > +				status = readl(priv->base + SUNXI_REG_STA_ADDR);
>> > +			}
>> > +		}
>> > +		if (isrc &
>> > +		    (SUNXI_INT_DATA_OR | SUNXI_INT_ERR_WRN | SUNXI_INT_BUS_ERR |
>> > +		     SUNXI_INT_ERR_PASSIVE | SUNXI_INT_ARB_LOST)) {
>> > +			/* error interrupt */
>> > +			if (sunxi_can_err(dev, isrc, status))
>> > +				break;
>> > +		}
>> > +		/* clear interrupts */
>> > +		writel(isrc, priv->base + SUNXI_REG_INT_ADDR);
>> > +		readl(priv->base + SUNXI_REG_INT_ADDR);
>> > +	}
> Why not simply handle whatever you have in the status register, and
> let the interrupt retrigger if there's something new?

Latency. On CAN Networks you can have an interrupt rate of sevel KHz.

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: 455 bytes --]

  reply	other threads:[~2015-09-13 12:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-13 11:43 [PATCH v5 0/2] can: Allwinner A10/A20 CAN Controller support - summary Gerhard Bertelsmann
2015-09-13 11:43 ` [PATCH v5 1/2] can: Allwinner A10/A20 CAN Controller support - Devicetree bindings Gerhard Bertelsmann
     [not found]   ` <1442144632-4541-2-git-send-email-info-La43T0Mi4bH5xCKuJOYmCvaTkwRoYoCU@public.gmane.org>
2015-09-13 12:25     ` Maxime Ripard
2015-09-13 11:43 ` [PATCH v5 2/2] can: Allwinner A10/A20 CAN Controller support - controller code Gerhard Bertelsmann
     [not found]   ` <1442144632-4541-3-git-send-email-info-La43T0Mi4bH5xCKuJOYmCvaTkwRoYoCU@public.gmane.org>
2015-09-13 12:45     ` Maxime Ripard
2015-09-13 12:50       ` Marc Kleine-Budde [this message]
2015-09-13 13:42       ` Gerhard Bertelsmann
2015-09-13 13:49         ` [linux-sunxi] " Marc Kleine-Budde
     [not found]         ` <f8eea0f544eb6367142bbc1c2ab35964-6XUBc1GShDsOIzVOb1FTxg@public.gmane.org>
2015-09-13 23:51           ` Julian Calaby
2015-09-14  8:17           ` Maxime Ripard
2015-09-14 12:41             ` Gerhard Bertelsmann
2015-09-14 12:45               ` [linux-sunxi] " Marc Kleine-Budde
     [not found] ` <1442144632-4541-1-git-send-email-info-La43T0Mi4bH5xCKuJOYmCvaTkwRoYoCU@public.gmane.org>
2015-09-13 12:22   ` [PATCH v5 0/2] can: Allwinner A10/A20 CAN Controller support - summary Maxime Ripard
2015-09-13 12:57     ` [linux-sunxi] " Marc Kleine-Budde
2015-09-13 13:42       ` Maxime Ripard

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=55F5711A.6030002@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=info@gerhard-bertelsmann.de \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-sunxi@googlegroups.com \
    --cc=maxime.ripard@free-electrons.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.