src/dpdk/drivers/net/igc/base/igc_nvm.c
s32 igc_acquire_nvm_generic(struct igc_hw *hw)
{
	u32 eecd = IGC_READ_REG(hw, IGC_EECD);
	s32 timeout = IGC_NVM_GRANT_ATTEMPTS;

	DEBUGFUNC("igc_acquire_nvm_generic");

	IGC_WRITE_REG(hw, IGC_EECD, eecd | IGC_EECD_REQ);
	eecd = IGC_READ_REG(hw, IGC_EECD);

	while (timeout) {
		if (eecd & IGC_EECD_GNT)
			break;
		usec_delay(5);
		eecd = IGC_READ_REG(hw, IGC_EECD);
		timeout--;
	}

	if (!timeout) {
		eecd &= ~IGC_EECD_REQ;
		IGC_WRITE_REG(hw, IGC_EECD, eecd);
		DEBUGOUT("Could not acquire NVM grant\n");
		return -IGC_ERR_NVM;
	}

	return IGC_SUCCESS;
}
/**
 *  igc_acquire_nvm_generic - Generic request for access to EEPROM
 *  @hw: pointer to the HW structure
 *
 *  Set the EEPROM access request bit and wait for EEPROM access grant bit.
 *  Return successful if access grant bit set, else clear the request for
 *  EEPROM access and return -IGC_ERR_NVM (-1).
 **/
Generic request for access to EEPROM
@hw: pointer to the HW structure

Set the EEPROM access request bit and wait for EEPROM access grant bit.
Return successful if access grant bit set, else clear the request for
EEPROM access and return -IGC_ERR_NVM (-1).
Generic request for access to EEPROM @hw : pointer to the HW structure Set the EEPROM access request bit and wait for EEPROM access grant bit . Return successful if access grant bit set else clear the request for EEPROM access and return - IGC_ERR_NVM ( - 1 ) .
s32 igc_acquire_nvm_generic(struct igc_hw *hw)
{
	u32 eecd = IGC_READ_REG(hw, IGC_EECD);
	s32 timeout = IGC_NVM_GRANT_ATTEMPTS;
	DEBUGFUNC("igc_acquire_nvm_generic");
	IGC_WRITE_REG(hw, IGC_EECD, eecd | IGC_EECD_REQ);
	eecd = IGC_READ_REG(hw, IGC_EECD);
	while (timeout) {
		if (eecd & IGC_EECD_GNT)
			break;
		usec_delay(5);
		eecd = IGC_READ_REG(hw, IGC_EECD);
		timeout--;
	}
	if (!timeout) {
		eecd &= ~IGC_EECD_REQ;
		IGC_WRITE_REG(hw, IGC_EECD, eecd);
		DEBUGOUT("Could not acquire NVM grant\n");
		return -IGC_ERR_NVM;
	}
	return IGC_SUCCESS;
}
s32 igc_acquire_nvm_generic ( struct igc_hw * hw ) { u32 eecd = IGC_READ_REG ( hw , IGC_EECD ) ; s32 timeout = IGC_NVM_GRANT_ATTEMPTS ; DEBUGFUNC ( " " ) ; IGC_WRITE_REG ( hw , IGC_EECD , eecd | IGC_EECD_REQ ) ; eecd = IGC_READ_REG ( hw , IGC_EECD ) ; while ( timeout ) { if ( eecd & IGC_EECD_GNT ) break ; usec_delay ( 5 ) ; eecd = IGC_READ_REG ( hw , IGC_EECD ) ; timeout -- ; } if ( ! timeout ) { eecd &= ~ IGC_EECD_REQ ; IGC_WRITE_REG ( hw , IGC_EECD , eecd ) ; DEBUGOUT ( " \n " ) ; return - IGC_ERR_NVM ; } return IGC_SUCCESS ; }
igc_acquire_nvm_generic - Generic request for access to EEPROM
  @hw: pointer to the HW structure
igc_acquire_nvm_generic - Generic request for access to EEPROM @hw : pointer to the HW structure