Skip to content

Commit

Permalink
r6040: save and restore MIER correctly in the interrupt routine
Browse files Browse the repository at this point in the history
This patch saves the MIER register contents before treating
interrupts, then restores them correcty at the end of the
interrupt routine.

Signed-off-by: Joe Chou <Joe.Chou@rdc.com.tw>
Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Joe Chou authored and David S. Miller committed Dec 23, 2008
1 parent 11e5e8f commit 3e7c469
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/net/r6040.c
Original file line number Diff line number Diff line change
Expand Up @@ -680,8 +680,10 @@ static irqreturn_t r6040_interrupt(int irq, void *dev_id)
struct net_device *dev = dev_id;
struct r6040_private *lp = netdev_priv(dev);
void __iomem *ioaddr = lp->base;
u16 status;
u16 misr, status;

/* Save MIER */
misr = ioread16(ioaddr + MIER);
/* Mask off RDC MAC interrupt */
iowrite16(MSK_INT, ioaddr + MIER);
/* Read MISR status and clear */
Expand All @@ -701,14 +703,17 @@ static irqreturn_t r6040_interrupt(int irq, void *dev_id)
dev->stats.rx_fifo_errors++;

/* Mask off RX interrupt */
iowrite16(ioread16(ioaddr + MIER) & ~RX_INTS, ioaddr + MIER);
misr &= ~RX_INTS;
netif_rx_schedule(dev, &lp->napi);
}

/* TX interrupt request */
if (status & TX_INTS)
r6040_tx(dev);

/* Restore RDC MAC interrupt */
iowrite16(misr, ioaddr + MIER);

return IRQ_HANDLED;
}

Expand Down

0 comments on commit 3e7c469

Please sign in to comment.