aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2007-07-09 18:33:34 -0400
committerJeff Garzik <jeff@garzik.org>2007-07-10 12:22:28 -0400
commit55d7b4e6ed6ad3ec5e5e30b3b4515a0a6a53e344 (patch)
tree20e47d88a2bc0e580cb56f59dd7ecbc36d768190 /drivers
parentc59697e06058fc2361da8cefcfa3de85ac107582 (diff)
sky2: carrier management
Make sky2 handle carrier similar to other drivers, eliminate some possible races in carrier state transistions. Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/sky2.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 77abf892e4f3..f6fe2861cc4c 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -1265,6 +1265,8 @@ static int sky2_up(struct net_device *dev)
1265 if (netif_msg_ifup(sky2)) 1265 if (netif_msg_ifup(sky2))
1266 printk(KERN_INFO PFX "%s: enabling interface\n", dev->name); 1266 printk(KERN_INFO PFX "%s: enabling interface\n", dev->name);
1267 1267
1268 netif_carrier_off(dev);
1269
1268 /* must be power of 2 */ 1270 /* must be power of 2 */
1269 sky2->tx_le = pci_alloc_consistent(hw->pdev, 1271 sky2->tx_le = pci_alloc_consistent(hw->pdev,
1270 TX_RING_SIZE * 1272 TX_RING_SIZE *
@@ -1616,7 +1618,6 @@ static int sky2_down(struct net_device *dev)
1616 1618
1617 /* Stop more packets from being queued */ 1619 /* Stop more packets from being queued */
1618 netif_stop_queue(dev); 1620 netif_stop_queue(dev);
1619 netif_carrier_off(dev);
1620 1621
1621 /* Disable port IRQ */ 1622 /* Disable port IRQ */
1622 imask = sky2_read32(hw, B0_IMSK); 1623 imask = sky2_read32(hw, B0_IMSK);
@@ -1668,6 +1669,8 @@ static int sky2_down(struct net_device *dev)
1668 1669
1669 sky2_phy_power(hw, port, 0); 1670 sky2_phy_power(hw, port, 0);
1670 1671
1672 netif_carrier_off(dev);
1673
1671 /* turn off LED's */ 1674 /* turn off LED's */
1672 sky2_write16(hw, B0_Y2LED, LED_STAT_OFF); 1675 sky2_write16(hw, B0_Y2LED, LED_STAT_OFF);
1673 1676
@@ -1732,7 +1735,6 @@ static void sky2_link_up(struct sky2_port *sky2)
1732 gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_DEF_MSK); 1735 gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_DEF_MSK);
1733 1736
1734 netif_carrier_on(sky2->netdev); 1737 netif_carrier_on(sky2->netdev);
1735 netif_wake_queue(sky2->netdev);
1736 1738
1737 /* Turn on link LED */ 1739 /* Turn on link LED */
1738 sky2_write8(hw, SK_REG(port, LNK_LED_REG), 1740 sky2_write8(hw, SK_REG(port, LNK_LED_REG),
@@ -1784,7 +1786,6 @@ static void sky2_link_down(struct sky2_port *sky2)
1784 gma_write16(hw, port, GM_GP_CTRL, reg); 1786 gma_write16(hw, port, GM_GP_CTRL, reg);
1785 1787
1786 netif_carrier_off(sky2->netdev); 1788 netif_carrier_off(sky2->netdev);
1787 netif_stop_queue(sky2->netdev);
1788 1789
1789 /* Turn on link LED */ 1790 /* Turn on link LED */
1790 sky2_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_OFF); 1791 sky2_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_OFF);
@@ -3543,10 +3544,6 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,
3543 memcpy_fromio(dev->dev_addr, hw->regs + B2_MAC_1 + port * 8, ETH_ALEN); 3544 memcpy_fromio(dev->dev_addr, hw->regs + B2_MAC_1 + port * 8, ETH_ALEN);
3544 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); 3545 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
3545 3546
3546 /* device is off until link detection */
3547 netif_carrier_off(dev);
3548 netif_stop_queue(dev);
3549
3550 return dev; 3547 return dev;
3551} 3548}
3552 3549