FreeBSD/sys/dev/cxgb/common/cxgb_t3_hw.c
/*
 * MI1 read/write operations for clause 22 PHYs.
 */
MI1 read/write operations for clause 22 PHYs.
MI1 read / write operations for clause 22 PHYs .
int t3_mi1_read(adapter_t *adapter, int phy_addr, int mmd_addr,
		int reg_addr, unsigned int *valp)
{
	int ret;
	u32 addr = V_REGADDR(reg_addr) | V_PHYADDR(phy_addr);
	if (mmd_addr)
		return -EINVAL;
	MDIO_LOCK(adapter);
	t3_set_reg_field(adapter, A_MI1_CFG, V_ST(M_ST), V_ST(1));
	t3_write_reg(adapter, A_MI1_ADDR, addr);
	t3_write_reg(adapter, A_MI1_OP, V_MDI_OP(2));
	ret = t3_wait_op_done(adapter, A_MI1_OP, F_BUSY, 0, MDIO_ATTEMPTS, 10);
	if (!ret)
		*valp = t3_read_reg(adapter, A_MI1_DATA);
	MDIO_UNLOCK(adapter);
	return ret;
}
int t3_mi1_read ( adapter_t * adapter , int phy_addr , int mmd_addr , int reg_addr , unsigned int * valp ) { int ret ; u32 addr = V_REGADDR ( reg_addr ) | V_PHYADDR ( phy_addr ) ; if ( mmd_addr ) return - EINVAL ; MDIO_LOCK ( adapter ) ; t3_set_reg_field ( adapter , A_MI1_CFG , V_ST ( M_ST ) , V_ST ( 1 ) ) ; t3_write_reg ( adapter , A_MI1_ADDR , addr ) ; t3_write_reg ( adapter , A_MI1_OP , V_MDI_OP ( 2 ) ) ; ret = t3_wait_op_done ( adapter , A_MI1_OP , F_BUSY , 0 , MDIO_ATTEMPTS , 10 ) ; if ( ! ret ) * valp = t3_read_reg ( adapter , A_MI1_DATA ) ; MDIO_UNLOCK ( adapter ) ; return ret ; }
MI1 read/write operations for clause 22 PHYs.
MI1 read / write operations for clause 22 PHYs .