FreeBSD/sys/dev/cxgb/common/cxgb_t3_hw.c
/*
 * MI1 read/write operations for clause 45 PHYs.
 */
MI1 read/write operations for clause 45 PHYs.
MI1 read / write operations for clause 45 PHYs .
static int mi1_ext_read(adapter_t *adapter, int phy_addr, int mmd_addr,
			int reg_addr, unsigned int *valp)
{
	int ret;
	u32 addr = V_REGADDR(mmd_addr) | V_PHYADDR(phy_addr);
	MDIO_LOCK(adapter);
	t3_set_reg_field(adapter, A_MI1_CFG, V_ST(M_ST), 0);
	t3_write_reg(adapter, A_MI1_ADDR, addr);
	t3_write_reg(adapter, A_MI1_DATA, reg_addr);
	t3_write_reg(adapter, A_MI1_OP, V_MDI_OP(0));
	ret = t3_wait_op_done(adapter, A_MI1_OP, F_BUSY, 0, MDIO_ATTEMPTS, 10);
	if (!ret) {
		t3_write_reg(adapter, A_MI1_OP, V_MDI_OP(3));
		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;
}
static int mi1_ext_read ( adapter_t * adapter , int phy_addr , int mmd_addr , int reg_addr , unsigned int * valp ) { int ret ; u32 addr = V_REGADDR ( mmd_addr ) | V_PHYADDR ( phy_addr ) ; MDIO_LOCK ( adapter ) ; t3_set_reg_field ( adapter , A_MI1_CFG , V_ST ( M_ST ) , 0 ) ; t3_write_reg ( adapter , A_MI1_ADDR , addr ) ; t3_write_reg ( adapter , A_MI1_DATA , reg_addr ) ; t3_write_reg ( adapter , A_MI1_OP , V_MDI_OP ( 0 ) ) ; ret = t3_wait_op_done ( adapter , A_MI1_OP , F_BUSY , 0 , MDIO_ATTEMPTS , 10 ) ; if ( ! ret ) { t3_write_reg ( adapter , A_MI1_OP , V_MDI_OP ( 3 ) ) ; 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 45 PHYs.
MI1 read / write operations for clause 45 PHYs .