/* Polls the EEPROM status bit for either read or write completion based upon the value of 'ee_reg'.  */
s32 e1000e_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg)
/* Polls the EEPROM status bit for either read or write completion based upon the value of 'ee_reg'.  */
s32 e1000e_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg)
{
	u32 attempts = 100000;
	u32 i, reg = 0;
	for (i = 0; i < attempts; i++) {
		if (ee_reg == E1000_NVM_POLL_READ)
			reg = er32(EERD);
		else
			reg = er32(EEWR);
		if (reg & E1000_NVM_RW_REG_DONE)
			return 0;
		udelay(5);
	}
	return -E1000_ERR_NVM;
}