src/dpdk/drivers/net/txgbe/base/txgbe_phy.c
s32 txgbe_write_phy_reg_mdi(struct txgbe_hw *hw, u32 reg_addr,
				u32 device_type, u16 phy_data)
{
	u32 command;

	/* write command */
	command = TXGBE_MDIOSCA_REG(reg_addr) |
		  TXGBE_MDIOSCA_DEV(device_type) |
		  TXGBE_MDIOSCA_PORT(hw->phy.addr);
	wr32(hw, TXGBE_MDIOSCA, command);

	command = TXGBE_MDIOSCD_CMD_WRITE |
		  TXGBE_MDIOSCD_DAT(phy_data) |
		  TXGBE_MDIOSCD_BUSY;
	wr32(hw, TXGBE_MDIOSCD, command);

	/* wait for completion */
	if (!po32m(hw, TXGBE_MDIOSCD, TXGBE_MDIOSCD_BUSY,
		0, NULL, 100, 100)) {
		TLOG_DEBUG("PHY write cmd didn't complete\n");
		return -TERR_PHY;
	}

	return 0;
}
/**
 *  txgbe_write_phy_reg_mdi - Writes a value to specified PHY register
 *  without SWFW lock
 *  @hw: pointer to hardware structure
 *  @reg_addr: 32 bit PHY register to write
 *  @device_type: 5 bit device type
 *  @phy_data: Data to write to the PHY register
 **/
Writes a value to specified PHY register
without SWFW lock
@hw: pointer to hardware structure
@reg_addr: 32 bit PHY register to write
@device_type: 5 bit device type
@phy_data: Data to write to the PHY register
Writes a value to specified PHY register without SWFW lock @hw : pointer to hardware structure @reg_addr : 32 bit PHY register to write @device_type : 5 bit device type @phy_data : Data to write to the PHY register
s32 txgbe_write_phy_reg_mdi(struct txgbe_hw *hw, u32 reg_addr,
				u32 device_type, u16 phy_data)
{
	u32 command;
	command = TXGBE_MDIOSCA_REG(reg_addr) |
		  TXGBE_MDIOSCA_DEV(device_type) |
		  TXGBE_MDIOSCA_PORT(hw->phy.addr);
	wr32(hw, TXGBE_MDIOSCA, command);
	command = TXGBE_MDIOSCD_CMD_WRITE |
		  TXGBE_MDIOSCD_DAT(phy_data) |
		  TXGBE_MDIOSCD_BUSY;
	wr32(hw, TXGBE_MDIOSCD, command);
	if (!po32m(hw, TXGBE_MDIOSCD, TXGBE_MDIOSCD_BUSY,
		0, NULL, 100, 100)) {
		TLOG_DEBUG("PHY write cmd didn't complete\n");
		return -TERR_PHY;
	}
	return 0;
}
s32 txgbe_write_phy_reg_mdi ( struct txgbe_hw * hw , u32 reg_addr , u32 device_type , u16 phy_data ) { u32 command ; command = TXGBE_MDIOSCA_REG ( reg_addr ) | TXGBE_MDIOSCA_DEV ( device_type ) | TXGBE_MDIOSCA_PORT ( hw -> phy . addr ) ; wr32 ( hw , TXGBE_MDIOSCA , command ) ; command = TXGBE_MDIOSCD_CMD_WRITE | TXGBE_MDIOSCD_DAT ( phy_data ) | TXGBE_MDIOSCD_BUSY ; wr32 ( hw , TXGBE_MDIOSCD , command ) ; if ( ! po32m ( hw , TXGBE_MDIOSCD , TXGBE_MDIOSCD_BUSY , 0 , NULL , 100 , 100 ) ) { TLOG_DEBUG ( " \n " ) ; return - TERR_PHY ; } return 0 ; }
txgbe_write_phy_reg_mdi - Writes a value to specified PHY register
  without SWFW lock
  @hw: pointer to hardware structure
  @reg_addr: 32 bit PHY register to write
  @device_type: 5 bit device type
  @phy_data: Data to write to the PHY register
txgbe_write_phy_reg_mdi - Writes a value to specified PHY register without SWFW lock @hw : pointer to hardware structure @reg_addr : 32 bit PHY register to write @device_type : 5 bit device type @phy_data : Data to write to the PHY register
/* write command */ /* wait for completion */