public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Christian Marangi <ansuelsmth@gmail.com>
To: Tom Rini <trini@konsulko.com>,
	Joe Hershberger <joe.hershberger@ni.com>,
	Ramon Fried <rfried.dev@gmail.com>,
	Weijie Gao <weijie.gao@mediatek.com>,
	Christian Marangi <ansuelsmth@gmail.com>,
	u-boot@lists.denx.de
Subject: [PATCH 1/5] net: mediatek: mt7988: fix broken phy_setting config
Date: Sat, 20 Sep 2025 16:36:46 +0200	[thread overview]
Message-ID: <20250920143656.29770-2-ansuelsmth@gmail.com> (raw)
In-Reply-To: <20250920143656.29770-1-ansuelsmth@gmail.com>

The PHY setting for MT7988 are actually never configured for the
affected PHY as we are read/writing to the wrong PHY address.

This is caused by the fact that we use the index of the NUM_PHYS loop as
the PHY address without first offsetting it to the base address.

Correctly offset the PHY address before configuring the PHY setting.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
 drivers/net/mtk_eth/mt7988.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/net/mtk_eth/mt7988.c b/drivers/net/mtk_eth/mt7988.c
index a416d87840c..bc58462af26 100644
--- a/drivers/net/mtk_eth/mt7988.c
+++ b/drivers/net/mtk_eth/mt7988.c
@@ -34,16 +34,18 @@ static void mt7988_phy_setting(struct mt753x_switch_priv *priv)
 	u32 i;
 
 	for (i = 0; i < MT753X_NUM_PHYS; i++) {
+		u16 addr = MT753X_PHY_ADDR(priv->phy_base, i);
+
 		/* Enable HW auto downshift */
-		mt7531_mii_write(priv, i, 0x1f, 0x1);
-		val = mt7531_mii_read(priv, i, PHY_EXT_REG_14);
+		mt7531_mii_write(priv, addr, 0x1f, 0x1);
+		val = mt7531_mii_read(priv, addr, PHY_EXT_REG_14);
 		val |= PHY_EN_DOWN_SHFIT;
-		mt7531_mii_write(priv, i, PHY_EXT_REG_14, val);
+		mt7531_mii_write(priv, addr, PHY_EXT_REG_14, val);
 
 		/* PHY link down power saving enable */
-		val = mt7531_mii_read(priv, i, PHY_EXT_REG_17);
+		val = mt7531_mii_read(priv, addr, PHY_EXT_REG_17);
 		val |= PHY_LINKDOWN_POWER_SAVING_EN;
-		mt7531_mii_write(priv, i, PHY_EXT_REG_17, val);
+		mt7531_mii_write(priv, addr, PHY_EXT_REG_17, val);
 	}
 }
 
-- 
2.51.0


  reply	other threads:[~2025-09-20 14:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-20 14:36 [PATCH 0/5] net: mediatek: mt7988: various fixup + MDIO detach Christian Marangi
2025-09-20 14:36 ` Christian Marangi [this message]
2025-09-20 14:36 ` [PATCH 2/5] net: mediatek: mt7988: restore PHY page on PHY setting exit Christian Marangi
2025-09-20 14:36 ` [PATCH 3/5] net: mediatek: mt7988: free allocated MDIO bus on cleanup Christian Marangi
2025-09-20 14:36 ` [PATCH 4/5] net: mediatek: move MT7531 MMIO MDIO to dedicated driver Christian Marangi
2025-09-20 14:36 ` [PATCH 5/5] net: airoha: bind MDIO controller on Ethernet load Christian Marangi

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=20250920143656.29770-2-ansuelsmth@gmail.com \
    --to=ansuelsmth@gmail.com \
    --cc=joe.hershberger@ni.com \
    --cc=rfried.dev@gmail.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=weijie.gao@mediatek.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox