/* Reads the diagnostic status register and verifies result is valid before placing it in the phy_cable_length field.  */
s32 igb_get_cable_length_82580(struct e1000_hw *hw)
/* Reads the diagnostic status register and verifies result is valid before placing it in the phy_cable_length field.  */
s32 igb_get_cable_length_82580(struct e1000_hw *hw)
{
	struct e1000_phy_info *phy = &hw->phy;
	s32 ret_val;
	u16 phy_data, length;
	ret_val = phy->ops.read_reg(hw, I82580_PHY_DIAG_STATUS, &phy_data);
	if (ret_val)
		goto out;
	length = (phy_data & I82580_DSTATUS_CABLE_LENGTH) >>
	         I82580_DSTATUS_CABLE_LENGTH_SHIFT;
	if (length == E1000_CABLE_LENGTH_UNDEFINED)
		ret_val = -E1000_ERR_PHY;
	phy->cable_length = length;
out:
	return ret_val;
}