src/dpdk/drivers/net/txgbe/base/txgbe_phy.c
s32 txgbe_read_i2c_byte_unlocked(struct txgbe_hw *hw, u8 byte_offset,
					   u8 dev_addr, u8 *data)
{
	UNREFERENCED_PARAMETER(dev_addr);

	DEBUGFUNC("txgbe_read_i2c_byte");

	txgbe_i2c_start(hw);

	/* wait tx empty */
	if (!po32m(hw, TXGBE_I2CICR, TXGBE_I2CICR_TXEMPTY,
		TXGBE_I2CICR_TXEMPTY, NULL, 100, 100)) {
		return -TERR_TIMEOUT;
	}

	/* read data */
	wr32(hw, TXGBE_I2CDATA,
			byte_offset | TXGBE_I2CDATA_STOP);
	wr32(hw, TXGBE_I2CDATA, TXGBE_I2CDATA_READ);

	/* wait for read complete */
	if (!po32m(hw, TXGBE_I2CICR, TXGBE_I2CICR_RXFULL,
		TXGBE_I2CICR_RXFULL, NULL, 100, 100)) {
		return -TERR_TIMEOUT;
	}

	txgbe_i2c_stop(hw);

	*data = 0xFF & rd32(hw, TXGBE_I2CDATA);

	return 0;
}
/**
 *  txgbe_read_i2c_byte_unlocked - Reads 8 bit word over I2C
 *  @hw: pointer to hardware structure
 *  @byte_offset: byte offset to read
 *  @dev_addr: address to read from
 *  @data: value read
 *
 *  Performs byte read operation to SFP module's EEPROM over I2C interface at
 *  a specified device address.
 **/
Reads 8 bit word over I2C
@hw: pointer to hardware structure
@byte_offset: byte offset to read
@dev_addr: address to read from
@data: value read

Performs byte read operation to SFP module's EEPROM over I2C interface at
a specified device address.
Reads 8 bit word over I2C @hw : pointer to hardware structure @byte_offset : byte offset to read @dev_addr : address to read from @data : value read Performs byte read operation to SFP module ' s EEPROM over I2C interface at a specified device address .
s32 txgbe_read_i2c_byte_unlocked(struct txgbe_hw *hw, u8 byte_offset,
					   u8 dev_addr, u8 *data)
{
	UNREFERENCED_PARAMETER(dev_addr);
	DEBUGFUNC("txgbe_read_i2c_byte");
	txgbe_i2c_start(hw);
	if (!po32m(hw, TXGBE_I2CICR, TXGBE_I2CICR_TXEMPTY,
		TXGBE_I2CICR_TXEMPTY, NULL, 100, 100)) {
		return -TERR_TIMEOUT;
	}
	wr32(hw, TXGBE_I2CDATA,
			byte_offset | TXGBE_I2CDATA_STOP);
	wr32(hw, TXGBE_I2CDATA, TXGBE_I2CDATA_READ);
	if (!po32m(hw, TXGBE_I2CICR, TXGBE_I2CICR_RXFULL,
		TXGBE_I2CICR_RXFULL, NULL, 100, 100)) {
		return -TERR_TIMEOUT;
	}
	txgbe_i2c_stop(hw);
	*data = 0xFF & rd32(hw, TXGBE_I2CDATA);
	return 0;
}
s32 txgbe_read_i2c_byte_unlocked ( struct txgbe_hw * hw , u8 byte_offset , u8 dev_addr , u8 * data ) { UNREFERENCED_PARAMETER ( dev_addr ) ; DEBUGFUNC ( " " ) ; txgbe_i2c_start ( hw ) ; if ( ! po32m ( hw , TXGBE_I2CICR , TXGBE_I2CICR_TXEMPTY , TXGBE_I2CICR_TXEMPTY , NULL , 100 , 100 ) ) { return - TERR_TIMEOUT ; } wr32 ( hw , TXGBE_I2CDATA , byte_offset | TXGBE_I2CDATA_STOP ) ; wr32 ( hw , TXGBE_I2CDATA , TXGBE_I2CDATA_READ ) ; if ( ! po32m ( hw , TXGBE_I2CICR , TXGBE_I2CICR_RXFULL , TXGBE_I2CICR_RXFULL , NULL , 100 , 100 ) ) { return - TERR_TIMEOUT ; } txgbe_i2c_stop ( hw ) ; * data = 0xFF & rd32 ( hw , TXGBE_I2CDATA ) ; return 0 ; }
txgbe_read_i2c_byte_unlocked - Reads 8 bit word over I2C
  @hw: pointer to hardware structure
  @byte_offset: byte offset to read
  @dev_addr: address to read from
  @data: value read
txgbe_read_i2c_byte_unlocked - Reads 8 bit word over I2C @hw : pointer to hardware structure @byte_offset : byte offset to read @dev_addr : address to read from @data : value read
/* wait tx empty */ /* read data */ /* wait for read complete */