aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorGary Zambrano <zambrano@broadcom.com>2006-06-20 18:34:15 -0400
committerJeff Garzik <jeff@garzik.org>2006-06-22 23:16:13 -0400
commit47b9c3b1e6afa3c40e3ac1822cd13946567b5955 (patch)
tree21316fb2f44240c9eb123367097b2e41a43a1ecc /drivers
parent00e5edcbfdb7030f6cbb8d5d89fdc2848133a182 (diff)
[PATCH] b44: fix manual speed/duplex/autoneg settings
Fixes for speed/duplex/autoneg settings and driver settings info. This is a redo of a previous patch thanks to feedback from Jeff Garzik. Signed-off-by: Gary Zambrano <zambrano@broadcom.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/b44.c44
1 files changed, 28 insertions, 16 deletions
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index d8233e0b7899..41b1618573c7 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -1620,8 +1620,6 @@ static int b44_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
1620{ 1620{
1621 struct b44 *bp = netdev_priv(dev); 1621 struct b44 *bp = netdev_priv(dev);
1622 1622
1623 if (!netif_running(dev))
1624 return -EAGAIN;
1625 cmd->supported = (SUPPORTED_Autoneg); 1623 cmd->supported = (SUPPORTED_Autoneg);
1626 cmd->supported |= (SUPPORTED_100baseT_Half | 1624 cmd->supported |= (SUPPORTED_100baseT_Half |
1627 SUPPORTED_100baseT_Full | 1625 SUPPORTED_100baseT_Full |
@@ -1649,6 +1647,12 @@ static int b44_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
1649 XCVR_INTERNAL : XCVR_EXTERNAL; 1647 XCVR_INTERNAL : XCVR_EXTERNAL;
1650 cmd->autoneg = (bp->flags & B44_FLAG_FORCE_LINK) ? 1648 cmd->autoneg = (bp->flags & B44_FLAG_FORCE_LINK) ?
1651 AUTONEG_DISABLE : AUTONEG_ENABLE; 1649 AUTONEG_DISABLE : AUTONEG_ENABLE;
1650 if (cmd->autoneg == AUTONEG_ENABLE)
1651 cmd->advertising |= ADVERTISED_Autoneg;
1652 if (!netif_running(dev)){
1653 cmd->speed = 0;
1654 cmd->duplex = 0xff;
1655 }
1652 cmd->maxtxpkt = 0; 1656 cmd->maxtxpkt = 0;
1653 cmd->maxrxpkt = 0; 1657 cmd->maxrxpkt = 0;
1654 return 0; 1658 return 0;
@@ -1658,9 +1662,6 @@ static int b44_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
1658{ 1662{
1659 struct b44 *bp = netdev_priv(dev); 1663 struct b44 *bp = netdev_priv(dev);
1660 1664
1661 if (!netif_running(dev))
1662 return -EAGAIN;
1663
1664 /* We do not support gigabit. */ 1665 /* We do not support gigabit. */
1665 if (cmd->autoneg == AUTONEG_ENABLE) { 1666 if (cmd->autoneg == AUTONEG_ENABLE) {
1666 if (cmd->advertising & 1667 if (cmd->advertising &
@@ -1677,28 +1678,39 @@ static int b44_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
1677 spin_lock_irq(&bp->lock); 1678 spin_lock_irq(&bp->lock);
1678 1679
1679 if (cmd->autoneg == AUTONEG_ENABLE) { 1680 if (cmd->autoneg == AUTONEG_ENABLE) {
1680 bp->flags &= ~B44_FLAG_FORCE_LINK; 1681 bp->flags &= ~(B44_FLAG_FORCE_LINK |
1681 bp->flags &= ~(B44_FLAG_ADV_10HALF | 1682 B44_FLAG_100_BASE_T |
1683 B44_FLAG_FULL_DUPLEX |
1684 B44_FLAG_ADV_10HALF |
1682 B44_FLAG_ADV_10FULL | 1685 B44_FLAG_ADV_10FULL |
1683 B44_FLAG_ADV_100HALF | 1686 B44_FLAG_ADV_100HALF |
1684 B44_FLAG_ADV_100FULL); 1687 B44_FLAG_ADV_100FULL);
1685 if (cmd->advertising & ADVERTISE_10HALF) 1688 if (cmd->advertising == 0) {
1686 bp->flags |= B44_FLAG_ADV_10HALF; 1689 bp->flags |= (B44_FLAG_ADV_10HALF |
1687 if (cmd->advertising & ADVERTISE_10FULL) 1690 B44_FLAG_ADV_10FULL |
1688 bp->flags |= B44_FLAG_ADV_10FULL; 1691 B44_FLAG_ADV_100HALF |
1689 if (cmd->advertising & ADVERTISE_100HALF) 1692 B44_FLAG_ADV_100FULL);
1690 bp->flags |= B44_FLAG_ADV_100HALF; 1693 } else {
1691 if (cmd->advertising & ADVERTISE_100FULL) 1694 if (cmd->advertising & ADVERTISED_10baseT_Half)
1692 bp->flags |= B44_FLAG_ADV_100FULL; 1695 bp->flags |= B44_FLAG_ADV_10HALF;
1696 if (cmd->advertising & ADVERTISED_10baseT_Full)
1697 bp->flags |= B44_FLAG_ADV_10FULL;
1698 if (cmd->advertising & ADVERTISED_100baseT_Half)
1699 bp->flags |= B44_FLAG_ADV_100HALF;
1700 if (cmd->advertising & ADVERTISED_100baseT_Full)
1701 bp->flags |= B44_FLAG_ADV_100FULL;
1702 }
1693 } else { 1703 } else {
1694 bp->flags |= B44_FLAG_FORCE_LINK; 1704 bp->flags |= B44_FLAG_FORCE_LINK;
1705 bp->flags &= ~(B44_FLAG_100_BASE_T | B44_FLAG_FULL_DUPLEX);
1695 if (cmd->speed == SPEED_100) 1706 if (cmd->speed == SPEED_100)
1696 bp->flags |= B44_FLAG_100_BASE_T; 1707 bp->flags |= B44_FLAG_100_BASE_T;
1697 if (cmd->duplex == DUPLEX_FULL) 1708 if (cmd->duplex == DUPLEX_FULL)
1698 bp->flags |= B44_FLAG_FULL_DUPLEX; 1709 bp->flags |= B44_FLAG_FULL_DUPLEX;
1699 } 1710 }
1700 1711
1701 b44_setup_phy(bp); 1712 if (netif_running(dev))
1713 b44_setup_phy(bp);
1702 1714
1703 spin_unlock_irq(&bp->lock); 1715 spin_unlock_irq(&bp->lock);
1704 1716