Skip to content

Commit 59f3010

Browse files
Carolyn WybornyJeff Kirsher
authored andcommitted
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 <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent f6fde11 commit 59f3010

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

drivers/net/ethernet/intel/igb/e1000_phy.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1710,6 +1710,26 @@ s32 igb_get_cable_length_m88_gen2(struct e1000_hw *hw)
17101710

17111711
switch (hw->phy.id) {
17121712
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;
17131733
case I347AT4_E_PHY_ID:
17141734
/* Remember the original page select and set it to 7 */
17151735
ret_val = phy->ops.read_reg(hw, I347AT4_PAGE_SELECT,

0 commit comments

Comments
 (0)