]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
r6040: save and restore MIER correctly in the interrupt routine
authorJoe Chou <Joe.Chou@rdc.com.tw>
Tue, 23 Dec 2008 03:40:02 +0000 (19:40 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sun, 25 Jan 2009 00:36:19 +0000 (16:36 -0800)
[ Upstream commit: 3e7c469f07ff14cbf9a814739e1fc99a863e0943 ]

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/net/r6040.c

index da43d9e0f17ecbdf73afa0905a100c721044d314..9e3bdb477dc26ad076a2df57e3a19c2b3432d5e8 100644 (file)
@@ -681,8 +681,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 */
@@ -702,7 +704,7 @@ 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);
        }
 
@@ -710,6 +712,9 @@ static irqreturn_t r6040_interrupt(int irq, void *dev_id)
        if (status & TX_INTS)
                r6040_tx(dev);
 
+       /* Restore RDC MAC interrupt */
+       iowrite16(misr, ioaddr + MIER);
+
        return IRQ_HANDLED;
 }