U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: fsl_enetc: fix imdio register calculation
@ 2025-04-28  9:59 Heiko Thiery
  2025-04-28 10:06 ` Michael Walle
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Heiko Thiery @ 2025-04-28  9:59 UTC (permalink / raw)
  To: u-boot
  Cc: Joe Hershberger, Ramon Fried, Tom Rini, Marek Vasut, Alice Guo,
	Ye Li, Tim Harvey, Michael Walle, Thomas Schaefer, Heiko Thiery

From: Thomas Schaefer <thomas.schaefer@kontron.com>

With commit cc4e8af2c552, fsl_enetc register accessors have been split to
handle different register offsets on different SoCs. However, for
internal MDIO register calculation, only ENETC_PM_IMDIO_BASE was fixed
without adding the SoC specific MAC register offset.

As a result, the network support for the Kontron SMARC-sAL28 and
probably other boards based on the LS1028A CPU is broken.

Add the SoC specific MAC register offset to calculation of imdio.priv to
fix this.

Fixes: cc4e8af2c552 ("net: fsl_enetc: Split register accessors")
Signed-off-by: Thomas Schaefer <thomas.schaefer@kontron.com>
Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>

---

But the question that now arises is, does this code path work on the imx
SoCs as well. Now the imx specific offset 0x5000 is added here and was not
used before.

Can someone please test this on an imx9 and confirm?

 drivers/net/fsl_enetc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/fsl_enetc.c b/drivers/net/fsl_enetc.c
index 52fa820f51..97cccda451 100644
--- a/drivers/net/fsl_enetc.c
+++ b/drivers/net/fsl_enetc.c
@@ -473,13 +473,15 @@ static int enetc_init_sxgmii(struct udevice *dev)
 /* Apply protocol specific configuration to MAC, serdes as needed */
 static void enetc_start_pcs(struct udevice *dev)
 {
+	struct enetc_data *data = (struct enetc_data *)dev_get_driver_data(dev);
 	struct enetc_priv *priv = dev_get_priv(dev);
 
 	/* register internal MDIO for debug purposes */
 	if (enetc_read_pcapr_mdio(dev)) {
 		priv->imdio.read = enetc_mdio_read;
 		priv->imdio.write = enetc_mdio_write;
-		priv->imdio.priv = priv->port_regs + ENETC_PM_IMDIO_BASE;
+		priv->imdio.priv = priv->port_regs + data->reg_offset_mac +
+		                   ENETC_PM_IMDIO_BASE;
 		strlcpy(priv->imdio.name, dev->name, MDIO_NAME_LEN);
 		if (!miiphy_get_dev_by_name(priv->imdio.name))
 			mdio_register(&priv->imdio);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-05-12 21:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-28  9:59 [PATCH] net: fsl_enetc: fix imdio register calculation Heiko Thiery
2025-04-28 10:06 ` Michael Walle
2025-04-28 14:23   ` Vladimir Oltean
2025-04-29  1:19     ` Wei Fang
2025-05-06  9:32       ` Heiko Thiery
2025-05-06 15:31         ` Tim Harvey
2025-05-07  5:12           ` Heiko Thiery
2025-05-11 20:55 ` Marek Vasut
2025-05-12  1:27 ` 回复: " Alice Guo (OSS)
2025-05-12 21:50 ` Fabio Estevam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox