aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@osdl.org>2006-10-17 13:24:08 -0400
committerStephen Hemminger <shemminger@osdl.org>2006-10-17 13:24:08 -0400
commit7c74ac1c236457e454804774e832046c1a7cc0bf (patch)
tree10d9bc000ffbec9fc94604977eef69f84a134def
parent0edea0f54e1e28bdc1ce6b02d5ca3c4c878cf959 (diff)
sky2: use duplex result bits
The result of duplex negotiation is avaliable in the phy status register, so use that to simplify code and avoid rereading the PHY. Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
-rw-r--r--drivers/net/sky2.c21
1 files changed, 1 insertions, 20 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 88b12e856649..6a594b001f58 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -1714,26 +1714,7 @@ static int sky2_autoneg_done(struct sky2_port *sky2, u16 aux)
1714 } 1714 }
1715 1715
1716 sky2->speed = sky2_phy_speed(hw, aux); 1716 sky2->speed = sky2_phy_speed(hw, aux);
1717 if (sky2->speed == SPEED_1000) { 1717 sky2->duplex = (aux & PHY_M_PS_FULL_DUP) ? DUPLEX_FULL : DUPLEX_HALF;
1718 u16 ctl2 = gm_phy_read(hw, port, PHY_MARV_1000T_CTRL);
1719 u16 lpa2 = gm_phy_read(hw, port, PHY_MARV_1000T_STAT);
1720 if (lpa2 & PHY_B_1000S_MSF) {
1721 printk(KERN_ERR PFX "%s: master/slave fault",
1722 sky2->netdev->name);
1723 return -1;
1724 }
1725
1726 if ((ctl2 & PHY_M_1000C_AFD) && (lpa2 & PHY_B_1000S_LP_FD))
1727 sky2->duplex = DUPLEX_FULL;
1728 else
1729 sky2->duplex = DUPLEX_HALF;
1730 } else {
1731 u16 adv = gm_phy_read(hw, port, PHY_MARV_AUNE_ADV);
1732 if ((aux & adv) & PHY_AN_FULL)
1733 sky2->duplex = DUPLEX_FULL;
1734 else
1735 sky2->duplex = DUPLEX_HALF;
1736 }
1737 1718
1738 /* Pause bits are offset (9..8) */ 1719 /* Pause bits are offset (9..8) */
1739 if (hw->chip_id == CHIP_ID_YUKON_XL || hw->chip_id == CHIP_ID_YUKON_EC_U) 1720 if (hw->chip_id == CHIP_ID_YUKON_XL || hw->chip_id == CHIP_ID_YUKON_EC_U)