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 | -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: OpenPGP digital signature
