aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarolyn Wyborny <carolyn.wyborny@intel.com>2012-10-10 00:42:59 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2012-10-23 04:05:14 -0400
commit59f301046b276f87483b3afa3201a4273def06a9 (patch)
treeb56a2e436d7c26d0c99fd05618031f973ed41c02
parentf6fde11a9dbcf27a2766a1ea0fb5d6267c45af02 (diff)
igb: Update get cable length function for i210/i211
There was a problem in the initial implementation of the get cable length function for i210 and it did not work properly. This patch fixes that problem for i210/i211 devices. Signed-off-by: Carolyn Wyborny <carolyn.wyborny@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r--drivers/net/ethernet/intel/igb/e1000_phy.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/igb/e1000_phy.c b/drivers/net/ethernet/intel/igb/e1000_phy.c
index 3404bc79f4ca..c62a4c388194 100644
--- a/drivers/net/ethernet/intel/igb/e1000_phy.c
+++ b/drivers/net/ethernet/intel/igb/e1000_phy.c
@@ -1710,6 +1710,26 @@ s32 igb_get_cable_length_m88_gen2(struct e1000_hw *hw)
1710 1710
1711 switch (hw->phy.id) { 1711 switch (hw->phy.id) {
1712 case I210_I_PHY_ID: 1712 case I210_I_PHY_ID:
1713 /* Get cable length from PHY Cable Diagnostics Control Reg */
1714 ret_val = phy->ops.read_reg(hw, (0x7 << GS40G_PAGE_SHIFT) +
1715 (I347AT4_PCDL + phy->addr),
1716 &phy_data);
1717 if (ret_val)
1718 return ret_val;
1719
1720 /* Check if the unit of cable length is meters or cm */
1721 ret_val = phy->ops.read_reg(hw, (0x7 << GS40G_PAGE_SHIFT) +
1722 I347AT4_PCDC, &phy_data2);
1723 if (ret_val)
1724 return ret_val;
1725
1726 is_cm = !(phy_data2 & I347AT4_PCDC_CABLE_LENGTH_UNIT);
1727
1728 /* Populate the phy structure with cable length in meters */
1729 phy->min_cable_length = phy_data / (is_cm ? 100 : 1);
1730 phy->max_cable_length = phy_data / (is_cm ? 100 : 1);
1731 phy->cable_length = phy_data / (is_cm ? 100 : 1);
1732 break;
1713 case I347AT4_E_PHY_ID: 1733 case I347AT4_E_PHY_ID:
1714 /* Remember the original page select and set it to 7 */ 1734 /* Remember the original page select and set it to 7 */
1715 ret_val = phy->ops.read_reg(hw, I347AT4_PAGE_SELECT, 1735 ret_val = phy->ops.read_reg(hw, I347AT4_PAGE_SELECT,