Exemple #1
0
int ethss_config(u32 ctl, u32 max_pkt_size)
{
	u32 i;

	/* Max length register */
	writel(max_pkt_size, DEVICE_CPSW_BASE + CPSW_REG_MAXLEN);

	/* Control register */
	writel(ctl, DEVICE_CPSW_BASE + CPSW_REG_CTL);

	/* All statistics enabled by default */
	writel(CPSW_REG_VAL_STAT_ENABLE_ALL,
	       DEVICE_CPSW_BASE + CPSW_REG_STAT_PORT_EN);

	/* Reset and enable the ALE */
	writel(CPSW_REG_VAL_ALE_CTL_RESET_AND_ENABLE |
	       CPSW_REG_VAL_ALE_CTL_BYPASS,
	       DEVICE_CPSW_BASE + CPSW_REG_ALE_CONTROL);

	/* All ports put into forward mode */
	for (i = 0; i < DEVICE_CPSW_NUM_PORTS; i++)
		writel(CPSW_REG_VAL_PORTCTL_FORWARD_MODE,
		       DEVICE_CPSW_BASE + CPSW_REG_ALE_PORTCTL(i));

	return 0;
}
Exemple #2
0
/************************************************************************************************
 * FUNCTION PURPOSE: Configure the switch
 ************************************************************************************************
 * DESCRIPTION: The switch is setup without respect to its current state. The ALE 
 *              is reset during the configuration.
 ************************************************************************************************/
SINT16 hwCpswConfig (UINT32 ctl, UINT32 maxPktSize)
{
    UINT32 i;

    /* Max length register */
    DEVICE_REG32_W (DEVICE_CPSW_BASE + CPSW_REG_MAXLEN, maxPktSize);

    /* Control register */
    DEVICE_REG32_W (DEVICE_CPSW_BASE + CPSW_REG_CTL, ctl);

    /* All statistics enabled by default */
    DEVICE_REG32_W (DEVICE_CPSW_BASE + CPSW_REG_STAT_PORT_EN, CPSW_REG_VAL_STAT_ENABLE_ALL);

    /* Reset and enable the ALE */
    DEVICE_REG32_W (DEVICE_CPSW_BASE + CPSW_REG_ALE_CONTROL, CPSW_REG_VAL_ALE_CTL_RESET_AND_ENABLE);

    /* All ports put into forward mode */
    for (i = 0; i < DEVICE_CPSW_NUM_PORTS; i++)
        DEVICE_REG32_W (DEVICE_CPSW_BASE + CPSW_REG_ALE_PORTCTL(i), CPSW_REG_VAL_PORTCTL_FORWARD_MODE);


    return (0);

} /* hwCpswConfig */