src/dpdk/drivers/net/igc/base/igc_api.c
static s32 igc_get_i2c_ack(struct igc_hw *hw)
{
	s32 status = IGC_SUCCESS;
	u32 i = 0;
	u32 i2cctl = IGC_READ_REG(hw, IGC_I2CPARAMS);
	u32 timeout = 10;
	bool ack = true;

	DEBUGFUNC("igc_get_i2c_ack");

	igc_raise_i2c_clk(hw, &i2cctl);

	/* Minimum high period of clock is 4us */
	usec_delay(IGC_I2C_T_HIGH);

	/* Wait until SCL returns high */
	for (i = 0; i < timeout; i++) {
		usec_delay(1);
		i2cctl = IGC_READ_REG(hw, IGC_I2CPARAMS);
		if (i2cctl & IGC_I2C_CLK_IN)
			break;
	}
	if (!(i2cctl & IGC_I2C_CLK_IN))
		return IGC_ERR_I2C;

	ack = igc_get_i2c_data(&i2cctl);
	if (ack) {
		DEBUGOUT("I2C ack was not received.\n");
		status = IGC_ERR_I2C;
	}

	igc_lower_i2c_clk(hw, &i2cctl);

	/* Minimum low period of clock is 4.7 us */
	usec_delay(IGC_I2C_T_LOW);

	return status;
}
/**
 *  igc_get_i2c_ack - Polls for I2C ACK
 *  @hw: pointer to hardware structure
 *
 *  Clocks in/out one bit via I2C data/clock
 **/
Polls for I2C ACK
@hw: pointer to hardware structure

Clocks in/out one bit via I2C data/clock
Polls for I2C ACK @hw : pointer to hardware structure Clocks in / out one bit via I2C data / clock
static s32 igc_get_i2c_ack(struct igc_hw *hw)
{
	s32 status = IGC_SUCCESS;
	u32 i = 0;
	u32 i2cctl = IGC_READ_REG(hw, IGC_I2CPARAMS);
	u32 timeout = 10;
	bool ack = true;
	DEBUGFUNC("igc_get_i2c_ack");
	igc_raise_i2c_clk(hw, &i2cctl);
	usec_delay(IGC_I2C_T_HIGH);
	for (i = 0; i < timeout; i++) {
		usec_delay(1);
		i2cctl = IGC_READ_REG(hw, IGC_I2CPARAMS);
		if (i2cctl & IGC_I2C_CLK_IN)
			break;
	}
	if (!(i2cctl & IGC_I2C_CLK_IN))
		return IGC_ERR_I2C;
	ack = igc_get_i2c_data(&i2cctl);
	if (ack) {
		DEBUGOUT("I2C ack was not received.\n");
		status = IGC_ERR_I2C;
	}
	igc_lower_i2c_clk(hw, &i2cctl);
	usec_delay(IGC_I2C_T_LOW);
	return status;
}
static s32 igc_get_i2c_ack ( struct igc_hw * hw ) { s32 status = IGC_SUCCESS ; u32 i = 0 ; u32 i2cctl = IGC_READ_REG ( hw , IGC_I2CPARAMS ) ; u32 timeout = 10 ; bool ack = true ; DEBUGFUNC ( " " ) ; igc_raise_i2c_clk ( hw , & i2cctl ) ; usec_delay ( IGC_I2C_T_HIGH ) ; for ( i = 0 ; i < timeout ; i ++ ) { usec_delay ( 1 ) ; i2cctl = IGC_READ_REG ( hw , IGC_I2CPARAMS ) ; if ( i2cctl & IGC_I2C_CLK_IN ) break ; } if ( ! ( i2cctl & IGC_I2C_CLK_IN ) ) return IGC_ERR_I2C ; ack = igc_get_i2c_data ( & i2cctl ) ; if ( ack ) { DEBUGOUT ( " \n " ) ; status = IGC_ERR_I2C ; } igc_lower_i2c_clk ( hw , & i2cctl ) ; usec_delay ( IGC_I2C_T_LOW ) ; return status ; }
igc_get_i2c_ack - Polls for I2C ACK
  @hw: pointer to hardware structure
igc_get_i2c_ack - Polls for I2C ACK @hw : pointer to hardware structure
/* Minimum high period of clock is 4us */ /* Wait until SCL returns high */ /* Minimum low period of clock is 4.7 us */