FreeBSD/sys/dev/cxgb/common/cxgb_t3_hw.c
/**
 *	early_hw_init - HW initialization done at card detection time
 *	@adapter: the adapter
 *	@ai: contains information about the adapter type and properties
 *
 *	Perfoms the part of HW initialization that is done early on when the
 *	driver first detecs the card.  Most of the HW state is initialized
 *	lazily later on when a port or an offload function are first used.
 */
HW initialization done at card detection time
@adapter: the adapter
@ai: contains information about the adapter type and properties

Perfoms the part of HW initialization that is done early on when the
driver first detecs the card.  Most of the HW state is initialized
lazily later on when a port or an offload function are first used.
HW initialization done at card detection time @adapter : the adapter @ai : contains information about the adapter type and properties Perfoms the part of HW initialization that is done early on when the driver first detecs the card . Most of the HW state is initialized lazily later on when a port or an offload function are first used .
void early_hw_init(adapter_t *adapter, const struct adapter_info *ai)
{
	u32 val = V_PORTSPEED(is_10G(adapter) || adapter->params.nports > 2 ?
			      3 : 2);
	u32 gpio_out = ai->gpio_out;
	mi1_init(adapter, ai);
	t3_write_reg(adapter, A_I2C_CFG,                  
		     V_I2C_CLKDIV(adapter->params.vpd.cclk / 80 - 1));
	t3_write_reg(adapter, A_T3DBG_GPIO_EN,
		     gpio_out | F_GPIO0_OEN | F_GPIO0_OUT_VAL);
	t3_write_reg(adapter, A_MC5_DB_SERVER_INDEX, 0);
	t3_write_reg(adapter, A_SG_OCO_BASE, V_BASE1(0xfff));
	if (adapter->params.rev == 0 || !uses_xaui(adapter))
		val |= F_ENRGMII;
	t3_write_reg(adapter, A_XGM_PORT_CFG, val);
	(void) t3_read_reg(adapter, A_XGM_PORT_CFG);
	val |= F_CLKDIVRESET_;
	t3_write_reg(adapter, A_XGM_PORT_CFG, val);
	(void) t3_read_reg(adapter, A_XGM_PORT_CFG);
	t3_write_reg(adapter, XGM_REG(A_XGM_PORT_CFG, 1), val);
	(void) t3_read_reg(adapter, A_XGM_PORT_CFG);
}
void early_hw_init ( adapter_t * adapter , const struct adapter_info * ai ) { u32 val = V_PORTSPEED ( is_10G ( adapter ) || adapter -> params . nports > 2 ? 3 : 2 ) ; u32 gpio_out = ai -> gpio_out ; mi1_init ( adapter , ai ) ; t3_write_reg ( adapter , A_I2C_CFG , V_I2C_CLKDIV ( adapter -> params . vpd . cclk / 80 - 1 ) ) ; t3_write_reg ( adapter , A_T3DBG_GPIO_EN , gpio_out | F_GPIO0_OEN | F_GPIO0_OUT_VAL ) ; t3_write_reg ( adapter , A_MC5_DB_SERVER_INDEX , 0 ) ; t3_write_reg ( adapter , A_SG_OCO_BASE , V_BASE1 ( 0xfff ) ) ; if ( adapter -> params . rev == 0 || ! uses_xaui ( adapter ) ) val |= F_ENRGMII ; t3_write_reg ( adapter , A_XGM_PORT_CFG , val ) ; ( void ) t3_read_reg ( adapter , A_XGM_PORT_CFG ) ; val |= F_CLKDIVRESET_ ; t3_write_reg ( adapter , A_XGM_PORT_CFG , val ) ; ( void ) t3_read_reg ( adapter , A_XGM_PORT_CFG ) ; t3_write_reg ( adapter , XGM_REG ( A_XGM_PORT_CFG , 1 ) , val ) ; ( void ) t3_read_reg ( adapter , A_XGM_PORT_CFG ) ; }
early_hw_init - HW initialization done at card detection time
      @adapter: the adapter
      @ai: contains information about the adapter type and properties
early_hw_init - HW initialization done at card detection time @adapter : the adapter @ai : contains information about the adapter type and properties
/* set for 80KHz */ /* Enable MAC clocks so we can access the registers */