aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sky2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/sky2.c')
-rw-r--r--drivers/net/sky2.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index daf961ab68bc..0a551d8f5d95 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -1151,14 +1151,7 @@ stopped:
1151 1151
1152 /* reset the Rx prefetch unit */ 1152 /* reset the Rx prefetch unit */
1153 sky2_write32(hw, Y2_QADDR(rxq, PREF_UNIT_CTRL), PREF_UNIT_RST_SET); 1153 sky2_write32(hw, Y2_QADDR(rxq, PREF_UNIT_CTRL), PREF_UNIT_RST_SET);
1154 1154 mmiowb();
1155 /* Reset the RAM Buffer receive queue */
1156 sky2_write8(hw, RB_ADDR(rxq, RB_CTRL), RB_RST_SET);
1157
1158 /* Reset Rx MAC FIFO */
1159 sky2_write8(hw, SK_REG(sky2->port, RX_GMF_CTRL_T), GMF_RST_SET);
1160
1161 sky2_read8(hw, B0_CTST);
1162} 1155}
1163 1156
1164/* Clean out receive buffer area, assumes receiver hardware stopped */ 1157/* Clean out receive buffer area, assumes receiver hardware stopped */
@@ -1495,6 +1488,8 @@ static int sky2_up(struct net_device *dev)
1495 sky2_set_vlan_mode(hw, port, sky2->vlgrp != NULL); 1488 sky2_set_vlan_mode(hw, port, sky2->vlgrp != NULL);
1496#endif 1489#endif
1497 1490
1491 sky2->restarting = 0;
1492
1498 err = sky2_rx_start(sky2); 1493 err = sky2_rx_start(sky2);
1499 if (err) 1494 if (err)
1500 goto err_out; 1495 goto err_out;
@@ -1507,6 +1502,9 @@ static int sky2_up(struct net_device *dev)
1507 1502
1508 sky2_set_multicast(dev); 1503 sky2_set_multicast(dev);
1509 1504
1505 /* wake queue incase we are restarting */
1506 netif_wake_queue(dev);
1507
1510 if (netif_msg_ifup(sky2)) 1508 if (netif_msg_ifup(sky2))
1511 printk(KERN_INFO PFX "%s: enabling interface\n", dev->name); 1509 printk(KERN_INFO PFX "%s: enabling interface\n", dev->name);
1512 return 0; 1510 return 0;
@@ -1540,6 +1538,8 @@ static inline int tx_dist(unsigned tail, unsigned head)
1540/* Number of list elements available for next tx */ 1538/* Number of list elements available for next tx */
1541static inline int tx_avail(const struct sky2_port *sky2) 1539static inline int tx_avail(const struct sky2_port *sky2)
1542{ 1540{
1541 if (unlikely(sky2->restarting))
1542 return 0;
1543 return sky2->tx_pending - tx_dist(sky2->tx_cons, sky2->tx_prod); 1543 return sky2->tx_pending - tx_dist(sky2->tx_cons, sky2->tx_prod);
1544} 1544}
1545 1545
@@ -1825,11 +1825,9 @@ static int sky2_down(struct net_device *dev)
1825 if (netif_msg_ifdown(sky2)) 1825 if (netif_msg_ifdown(sky2))
1826 printk(KERN_INFO PFX "%s: disabling interface\n", dev->name); 1826 printk(KERN_INFO PFX "%s: disabling interface\n", dev->name);
1827 1827
1828 /* Disable port IRQ */ 1828 /* explicitly shut off tx incase we're restarting */
1829 imask = sky2_read32(hw, B0_IMSK); 1829 sky2->restarting = 1;
1830 imask &= ~portirq_msk[port]; 1830 netif_tx_disable(dev);
1831 sky2_write32(hw, B0_IMSK, imask);
1832 sky2_read32(hw, B0_IMSK);
1833 1831
1834 /* Force flow control off */ 1832 /* Force flow control off */
1835 sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_OFF); 1833 sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_OFF);
@@ -1870,8 +1868,6 @@ static int sky2_down(struct net_device *dev)
1870 1868
1871 sky2_write32(hw, RB_ADDR(txqaddr[port], RB_CTRL), RB_RST_SET); 1869 sky2_write32(hw, RB_ADDR(txqaddr[port], RB_CTRL), RB_RST_SET);
1872 1870
1873 sky2_rx_stop(sky2);
1874
1875 sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET); 1871 sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET);
1876 sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_SET); 1872 sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_SET);
1877 1873
@@ -1881,6 +1877,14 @@ static int sky2_down(struct net_device *dev)
1881 sky2_write32(hw, STAT_ISR_TIMER_CNT, 0); 1877 sky2_write32(hw, STAT_ISR_TIMER_CNT, 0);
1882 sky2_read8(hw, STAT_ISR_TIMER_CTRL); 1878 sky2_read8(hw, STAT_ISR_TIMER_CTRL);
1883 1879
1880 sky2_rx_stop(sky2);
1881
1882 /* Disable port IRQ */
1883 imask = sky2_read32(hw, B0_IMSK);
1884 imask &= ~portirq_msk[port];
1885 sky2_write32(hw, B0_IMSK, imask);
1886 sky2_read32(hw, B0_IMSK);
1887
1884 synchronize_irq(hw->pdev->irq); 1888 synchronize_irq(hw->pdev->irq);
1885 napi_synchronize(&hw->napi); 1889 napi_synchronize(&hw->napi);
1886 1890
@@ -2366,7 +2370,7 @@ static inline void sky2_tx_done(struct net_device *dev, u16 last)
2366{ 2370{
2367 struct sky2_port *sky2 = netdev_priv(dev); 2371 struct sky2_port *sky2 = netdev_priv(dev);
2368 2372
2369 if (netif_running(dev)) { 2373 if (likely(netif_running(dev) && !sky2->restarting)) {
2370 netif_tx_lock(dev); 2374 netif_tx_lock(dev);
2371 sky2_tx_complete(sky2, last); 2375 sky2_tx_complete(sky2, last);
2372 netif_tx_unlock(dev); 2376 netif_tx_unlock(dev);
@@ -4290,6 +4294,7 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,
4290 spin_lock_init(&sky2->phy_lock); 4294 spin_lock_init(&sky2->phy_lock);
4291 sky2->tx_pending = TX_DEF_PENDING; 4295 sky2->tx_pending = TX_DEF_PENDING;
4292 sky2->rx_pending = RX_DEF_PENDING; 4296 sky2->rx_pending = RX_DEF_PENDING;
4297 sky2->restarting = 0;
4293 4298
4294 hw->dev[port] = dev; 4299 hw->dev[port] = dev;
4295 4300