sky2: use duplex result bits
authorStephen Hemminger <shemminger@osdl.org>
Tue, 17 Oct 2006 17:24:08 +0000 (10:24 -0700)
committerStephen Hemminger <shemminger@osdl.org>
Tue, 17 Oct 2006 17:24:08 +0000 (10:24 -0700)
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>
drivers/net/sky2.c

index 88b12e856649ebf4e4dc0ba46d9de25550d2ecbd..6a594b001f58630bc2fe73e5322149c252bf6b83 100644 (file)
@@ -1714,26 +1714,7 @@ static int sky2_autoneg_done(struct sky2_port *sky2, u16 aux)
        }
 
        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;
-       }
+       sky2->duplex = (aux & PHY_M_PS_FULL_DUP) ? DUPLEX_FULL : DUPLEX_HALF;
 
        /* Pause bits are offset (9..8) */
        if (hw->chip_id == CHIP_ID_YUKON_XL || hw->chip_id == CHIP_ID_YUKON_EC_U)