|
@@ -1710,6 +1710,26 @@ s32 igb_get_cable_length_m88_gen2(struct e1000_hw *hw)
|
|
|
|
|
|
switch (hw->phy.id) {
|
|
|
case I210_I_PHY_ID:
|
|
|
+ /* Get cable length from PHY Cable Diagnostics Control Reg */
|
|
|
+ ret_val = phy->ops.read_reg(hw, (0x7 << GS40G_PAGE_SHIFT) +
|
|
|
+ (I347AT4_PCDL + phy->addr),
|
|
|
+ &phy_data);
|
|
|
+ if (ret_val)
|
|
|
+ return ret_val;
|
|
|
+
|
|
|
+ /* Check if the unit of cable length is meters or cm */
|
|
|
+ ret_val = phy->ops.read_reg(hw, (0x7 << GS40G_PAGE_SHIFT) +
|
|
|
+ I347AT4_PCDC, &phy_data2);
|
|
|
+ if (ret_val)
|
|
|
+ return ret_val;
|
|
|
+
|
|
|
+ is_cm = !(phy_data2 & I347AT4_PCDC_CABLE_LENGTH_UNIT);
|
|
|
+
|
|
|
+ /* Populate the phy structure with cable length in meters */
|
|
|
+ phy->min_cable_length = phy_data / (is_cm ? 100 : 1);
|
|
|
+ phy->max_cable_length = phy_data / (is_cm ? 100 : 1);
|
|
|
+ phy->cable_length = phy_data / (is_cm ? 100 : 1);
|
|
|
+ break;
|
|
|
case I347AT4_E_PHY_ID:
|
|
|
/* Remember the original page select and set it to 7 */
|
|
|
ret_val = phy->ops.read_reg(hw, I347AT4_PAGE_SELECT,
|