Skip to content

Commit

Permalink
[PATCH] sky2: gigabit full duplex negotiation
Browse files Browse the repository at this point in the history
Look at the registers correctly, when doing gigabit full duplex.
Need to look for link partner result.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
  • Loading branch information
Stephen Hemminger authored and Jeff Garzik committed Sep 27, 2006
1 parent 0ba8821 commit e0ed545
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions drivers/net/sky2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1624,22 +1624,33 @@ static int sky2_autoneg_done(struct sky2_port *sky2, u16 aux)
return -1;
}

if (hw->chip_id != CHIP_ID_YUKON_FE &&
gm_phy_read(hw, port, PHY_MARV_1000T_STAT) & PHY_B_1000S_MSF) {
printk(KERN_ERR PFX "%s: master/slave fault",
sky2->netdev->name);
return -1;
}

if (!(aux & PHY_M_PS_SPDUP_RES)) {
printk(KERN_ERR PFX "%s: speed/duplex mismatch",
sky2->netdev->name);
return -1;
}

sky2->duplex = (aux & PHY_M_PS_FULL_DUP) ? DUPLEX_FULL : DUPLEX_HALF;

sky2->speed = sky2_phy_speed(hw, aux);
if (sky2->speed == SPEED_1000) {
u16 ctl2 = gm_phy_read(hw, port, PHY_MARV_1000T_CTRL);
u16 lpa2 = gm_phy_read(hw, port, PHY_MARV_1000T_STAT);
if (lpa2 & PHY_B_1000S_MSF) {
printk(KERN_ERR PFX "%s: master/slave fault",
sky2->netdev->name);
return -1;
}

if ((ctl2 & PHY_M_1000C_AFD) && (lpa2 & PHY_B_1000S_LP_FD))
sky2->duplex = DUPLEX_FULL;
else
sky2->duplex = DUPLEX_HALF;
} else {
u16 adv = gm_phy_read(hw, port, PHY_MARV_AUNE_ADV);
if ((aux & adv) & PHY_AN_FULL)
sky2->duplex = DUPLEX_FULL;
else
sky2->duplex = DUPLEX_HALF;
}

/* Pause bits are offset (9..8) */
if (hw->chip_id == CHIP_ID_YUKON_XL || hw->chip_id == CHIP_ID_YUKON_EC_U)
Expand Down

0 comments on commit e0ed545

Please sign in to comment.