[PATCH v2 3/5] drivers: net: Add Felix DSA switch driver

Michael Walle michael at walle.cc
Tue Jan 19 23:43:35 CET 2021


Hi Claudiu,

Am 2021-01-19 18:01, schrieb Claudiu Manoil:
> From: Alex Marginean <alexandru.marginean at nxp.com>
> 
> This driver is used for the Ethernet switch integrated into LS1028A 
> NXP.
> Felix on LS1028A has 4 front panel ports and two internal ports, I/O
> to/from the switch is done through an ENETC Ethernet interface.
> The 4 front panel ports are available as Ethernet interfaces and can be
> used with the typical network commands like tftp.
> 
> Signed-off-by: Alex Marginean <alexandru.marginean at nxp.com>
> Signed-off-by: Vladimir Oltean <vladimir.oltean at nxp.com>
> Signed-off-by: Claudiu Manoil <claudiu.manoil at nxp.com>
> ---
[..]
> +void felix_init(struct udevice *dev)
> +{
> +	struct dsa_pdata *pdata = dev_get_uclass_plat(dev);
> +	struct felix_priv *priv = dev_get_priv(dev);
> +	void *base = priv->regs_base;
> +	int supported, to = 100;
> +	struct udevice *pdev;
> +
> +	/* Init core memories */
> +	out_le32(base + FELIX_SYS_RAM_CTRL, FELIX_SYS_RAM_CTRL_INIT);
> +	while (in_le32(base + FELIX_SYS_RAM_CTRL) & FELIX_SYS_RAM_CTRL_INIT 
> &&
> +	       --to)
> +		udelay(10);
> +	if (in_le32(base + FELIX_SYS_RAM_CTRL) & FELIX_SYS_RAM_CTRL_INIT)
> +		dev_dbg(dev, "Time-out waiting for switch memories\n");
> +
> +	/* Start switch core, set up ES0, IS1, IS2 */
> +	out_le32(base + FELIX_SYS_SYSTEM, FELIX_SYS_SYSTEM_EN);
> +	out_le32(base + FELIX_ES0_TCAM_CTRL, FELIX_ES0_TCAM_CTRL_EN);
> +	out_le32(base + FELIX_IS1_TCAM_CTRL, FELIX_IS1_TCAM_CTRL_EN);
> +	out_le32(base + FELIX_IS2_TCAM_CTRL, FELIX_IS2_TCAM_CTRL_EN);
> +	udelay(20);
> +
> +	supported = PHY_GBIT_FEATURES | SUPPORTED_2500baseX_Full;
> +	priv->imdio.read = felix_mdio_read;
> +	priv->imdio.write = felix_mdio_write;
> +	priv->imdio.priv = priv->imdio_base + FELIX_PM_IMDIO_BASE;
> +	strncpy(priv->imdio.name, dev->name, MDIO_NAME_LEN);
> +
> +	dsa_foreach_port(pdev, dev) {

This doesn't work for me. Seems like felix_init() is called before
any ports are added via dsa_port_probe().

> +		struct dsa_port_pdata *port_pdata = dsa_port_get_pdata(pdev);
> +		struct phy_device *phy = port_pdata->phy;
> +
> +		/* Set up MAC registers */
> +		out_le32(base + FELIX_GMII_CLOCK_CFG(port_pdata->index),
> +			 FELIX_GMII_CLOCK_CFG_LINK_1G);
> +
> +		out_le32(base + FELIX_GMII_MAC_IFG_CFG(port_pdata->index),
> +			 FELIX_GMII_MAC_IFG_CFG_DEF);
> +
> +		felix_start_pcs(pdev, &priv->imdio);
> +
> +		if (phy) {
> +			phy->supported &= supported;
> +			phy->advertising &= supported;
> +			phy_config(phy);

I've noticed because my PHY was never configured.

> +		}
> +	}
> +
> +	/* set up CPU port */
> +	out_le32(base + FELIX_QSYS_SYSTEM_EXT_CPU_CFG,
> +		 FELIX_QSYS_SYSTEM_EXT_CPU_PORT(pdata->cpu_port));
> +	out_le32(base + FELIX_SYS_SYSTEM_PORT_MODE(pdata->cpu_port),
> +		 FELIX_SYS_SYSTEM_PORT_MODE_CPU);
> +}
> +
[..]

-michael


More information about the U-Boot mailing list