All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Walle <michael@walle.cc>
To: u-boot@lists.denx.de
Subject: [PATCH v2 3/5] drivers: net: Add Felix DSA switch driver
Date: Tue, 19 Jan 2021 23:43:35 +0100	[thread overview]
Message-ID: <97053784dca309a955c271c733f5978a@walle.cc> (raw)
In-Reply-To: <20210119170110.27746-4-claudiu.manoil@nxp.com>

Hi Claudiu,

Am 2021-01-19 18:01, schrieb Claudiu Manoil:
> From: Alex Marginean <alexandru.marginean@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@nxp.com>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> Signed-off-by: Claudiu Manoil <claudiu.manoil@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

  reply	other threads:[~2021-01-19 22:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-19 17:01 [PATCH v2 0/5] Introduce DSA Ethernet switch class and Felix driver Claudiu Manoil
2021-01-19 17:01 ` [PATCH v2 1/5] net: Introduce DSA class for Ethernet switches Claudiu Manoil
2021-01-19 17:01 ` [PATCH v2 2/5] sandbox: Add a DSA sandbox driver and unit test Claudiu Manoil
2021-01-19 17:01 ` [PATCH v2 3/5] drivers: net: Add Felix DSA switch driver Claudiu Manoil
2021-01-19 22:43   ` Michael Walle [this message]
2021-01-20 11:36     ` Claudiu Manoil
2021-01-19 17:01 ` [PATCH v2 4/5] arm: dts: ls1028a: Add Ethernet switch node and dependencies Claudiu Manoil
2021-01-19 17:01 ` [PATCH v2 5/5] configs: ls1028a: Enable the Ethernet switch driver in defconfig Claudiu Manoil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=97053784dca309a955c271c733f5978a@walle.cc \
    --to=michael@walle.cc \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.