nuport-mac: disable MAC RX and TX during interface close
authorFlorian Fainelli <florian@openwrt.org>
Mon, 3 Sep 2012 10:26:01 +0000 (10:26 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Mon, 3 Sep 2012 10:26:01 +0000 (10:26 +0000)
Fixes sporadic crashes while reconfiguring the network interface.

SVN-Revision: 33312

target/linux/mcs814x/files-3.3/drivers/net/ethernet/mcs8140/nuport_mac.c

index b14019d578d341fbab51c48ac09ecdeb3072242a..4a4208604618fd71d409997f80f8d538189aac03 100644 (file)
@@ -829,9 +829,14 @@ out_emac_clk:
 
 static int nuport_mac_close(struct net_device *dev)
 {
+       u32 reg;
        struct nuport_mac_priv *priv = netdev_priv(dev);
 
        spin_lock_irq(&priv->lock);
+       reg = nuport_mac_readl(CTRL_REG);
+       reg &= ~(RX_ENABLE | TX_ENABLE);
+       nuport_mac_writel(reg, CTRL_REG);
+
        napi_disable(&priv->napi);
        netif_stop_queue(dev);