]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
tg3: Remove SPEED_UNKNOWN checks
authorMatt Carlson <mcarlson@broadcom.com>
Wed, 22 Feb 2012 12:35:19 +0000 (12:35 +0000)
committerJoe Jin <joe.jin@oracle.com>
Tue, 28 Aug 2012 07:23:04 +0000 (15:23 +0800)
tg3_phy_copper_begin() has code that configures the link
advertisements through the use of the link_config.speed and
link_config.duplex members.  The driver does not internally use these
members in this way, nor is it (currently) permitted via the ethtool
interface.  This patch removes the dead code.

(cherry picked from commit d13ba512cbba7de5d55d7a3b2aae7d83c8921457)
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
drivers/net/tg3.c

index 3db31e3ad0533c2ced906785ca98644fa1386138..5670e37296cc6af3ddc0597436964696ba4e6666 100644 (file)
@@ -3899,51 +3899,33 @@ done:
 
 static void tg3_phy_copper_begin(struct tg3 *tp)
 {
-       u32 new_adv;
-       int i;
-
-       if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER) {
-               new_adv = ADVERTISED_10baseT_Half |
-                         ADVERTISED_10baseT_Full;
-               if (tg3_flag(tp, WOL_SPEED_100MB))
-                       new_adv |= ADVERTISED_100baseT_Half |
-                                  ADVERTISED_100baseT_Full;
-
-               tg3_phy_autoneg_cfg(tp, new_adv,
-                                   FLOW_CTRL_TX | FLOW_CTRL_RX);
-       } else if (tp->link_config.speed == SPEED_UNKNOWN) {
-               if (tp->phy_flags & TG3_PHYFLG_10_100_ONLY)
-                       tp->link_config.advertising &=
-                               ~(ADVERTISED_1000baseT_Half |
-                                 ADVERTISED_1000baseT_Full);
-
-               tg3_phy_autoneg_cfg(tp, tp->link_config.advertising,
-                                   tp->link_config.flowctrl);
-       } else {
-               /* Asking for a specific link mode. */
-               if (tp->link_config.speed == SPEED_1000) {
-                       if (tp->link_config.duplex == DUPLEX_FULL)
-                               new_adv = ADVERTISED_1000baseT_Full;
-                       else
-                               new_adv = ADVERTISED_1000baseT_Half;
-               } else if (tp->link_config.speed == SPEED_100) {
-                       if (tp->link_config.duplex == DUPLEX_FULL)
-                               new_adv = ADVERTISED_100baseT_Full;
-                       else
-                               new_adv = ADVERTISED_100baseT_Half;
+       if (tp->link_config.autoneg == AUTONEG_ENABLE ||
+           (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER)) {
+               u32 adv, fc;
+
+               if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER) {
+                       adv = ADVERTISED_10baseT_Half |
+                             ADVERTISED_10baseT_Full;
+                       if (tg3_flag(tp, WOL_SPEED_100MB))
+                               adv |= ADVERTISED_100baseT_Half |
+                                      ADVERTISED_100baseT_Full;
+
+                       fc = FLOW_CTRL_TX | FLOW_CTRL_RX;
                } else {
-                       if (tp->link_config.duplex == DUPLEX_FULL)
-                               new_adv = ADVERTISED_10baseT_Full;
-                       else
-                               new_adv = ADVERTISED_10baseT_Half;
+                       adv = tp->link_config.advertising;
+                       if (tp->phy_flags & TG3_PHYFLG_10_100_ONLY)
+                               adv &= ~(ADVERTISED_1000baseT_Half |
+                                        ADVERTISED_1000baseT_Full);
+
+                       fc = tp->link_config.flowctrl;
                }
 
-               tg3_phy_autoneg_cfg(tp, new_adv,
-                                   tp->link_config.flowctrl);
-       }
+               tg3_phy_autoneg_cfg(tp, adv, fc);
 
-       if (tp->link_config.autoneg == AUTONEG_DISABLE &&
-           tp->link_config.speed != SPEED_UNKNOWN) {
+               tg3_writephy(tp, MII_BMCR,
+                            BMCR_ANENABLE | BMCR_ANRESTART);
+       } else {
+               int i;
                u32 bmcr, orig_bmcr;
 
                tp->link_config.active_speed = tp->link_config.speed;
@@ -3985,9 +3967,6 @@ static void tg3_phy_copper_begin(struct tg3 *tp)
                        tg3_writephy(tp, MII_BMCR, bmcr);
                        udelay(40);
                }
-       } else {
-               tg3_writephy(tp, MII_BMCR,
-                            BMCR_ANENABLE | BMCR_ANRESTART);
        }
 }