/* Waits for auto-negotiation to complete or for the auto-negotiation time limit to expire, which ever happens first.  */
static s32 e1000_wait_autoneg(struct e1000_hw *hw)
/* Waits for auto-negotiation to complete or for the auto-negotiation time limit to expire, which ever happens first.  */
static s32 e1000_wait_autoneg(struct e1000_hw *hw)
{
	s32 ret_val = 0;
	u16 i, phy_status;
	for (i = PHY_AUTO_NEG_LIMIT; i > 0; i--) {
		ret_val = e1e_rphy(hw, PHY_STATUS, &phy_status);
		if (ret_val)
			break;
		ret_val = e1e_rphy(hw, PHY_STATUS, &phy_status);
		if (ret_val)
			break;
		if (phy_status & MII_SR_AUTONEG_COMPLETE)
			break;
		msleep(100);
	}
	return ret_val;
}