e1000e: 82579 PHY incorrectly identified during init
authorBruce Allan <bruce.w.allan@intel.com>
Wed, 24 Nov 2010 06:01:46 +0000 (06:01 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 7 Mar 2011 23:05:21 +0000 (15:05 -0800)
commit 664dc878ed6f0476b875547547a49e06f7a4e73b upstream.

During init, reading the 2 PHY ID registers back-to-back in the default
fast mode could return invalid data (all F's) and in slow mode could
return data to the second read the data from the first read.  To resolve
the issue in fast mode, set to slow mode before any PHY accesses; to
resolve the issue in slow mode, put in a delay for every 82579 PHY access.
Since this PHY is currently only paired with the pch2lan MAC and the PHY
type is not known before the first PHY access which can fail this way,
check for this based on MAC-type.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Acked-by: Brandon Philips <bphilips@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/net/e1000e/ich8lan.c
drivers/net/e1000e/phy.c

index e3374d9a2472a2af316ca137305a53162f62e882..94754f208f36c97eaf5a0fe03bcd6a62727acddc 100644 (file)
@@ -338,12 +338,17 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
        }
 
        phy->id = e1000_phy_unknown;
-       ret_val = e1000e_get_phy_id(hw);
-       if (ret_val)
-               goto out;
-       if ((phy->id == 0) || (phy->id == PHY_REVISION_MASK)) {
+       switch (hw->mac.type) {
+       default:
+               ret_val = e1000e_get_phy_id(hw);
+               if (ret_val)
+                       goto out;
+               if ((phy->id != 0) && (phy->id != PHY_REVISION_MASK))
+                       break;
+               /* fall-through */
+       case e1000_pch2lan:
                /*
-                * In case the PHY needs to be in mdio slow mode (eg. 82577),
+                * In case the PHY needs to be in mdio slow mode,
                 * set slow mode and try to get the PHY id again.
                 */
                ret_val = e1000_set_mdio_slow_mode_hv(hw);
@@ -352,6 +357,7 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
                ret_val = e1000e_get_phy_id(hw);
                if (ret_val)
                        goto out;
+               break;
        }
        phy->type = e1000e_get_phy_type_from_id(phy->id);
 
index 3d3dc0c823554ab6da90d56ec2d5940338113bb7..5ce87a670ae949d2ca6ec219341cbf64139f3427 100644 (file)
@@ -226,6 +226,13 @@ s32 e1000e_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data)
        }
        *data = (u16) mdic;
 
+       /*
+        * Allow some time after each MDIC transaction to avoid
+        * reading duplicate data in the next MDIC transaction.
+        */
+       if (hw->mac.type == e1000_pch2lan)
+               udelay(100);
+
        return 0;
 }
 
@@ -279,6 +286,13 @@ s32 e1000e_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data)
                return -E1000_ERR_PHY;
        }
 
+       /*
+        * Allow some time after each MDIC transaction to avoid
+        * reading duplicate data in the next MDIC transaction.
+        */
+       if (hw->mac.type == e1000_pch2lan)
+               udelay(100);
+
        return 0;
 }