/* Polls the EEPROM status bit for either read or write completion based upon the value of 'ee_reg'.  */
static s32 igb_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'.  */
static s32 igb_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg)
{
	u32 attempts = 100000;
	u32 i, reg = 0;
	s32 ret_val = -E1000_ERR_NVM;
	for (i = 0; i < attempts; i++) {
		if (ee_reg == E1000_NVM_POLL_READ)
			reg = rd32(E1000_EERD);
		else
			reg = rd32(E1000_EEWR);
		if (reg & E1000_NVM_RW_REG_DONE) {
			ret_val = 0;
			break;
		}
		udelay(5);
	}
	return ret_val;
}