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 v2 2/5] net: mediatek: mt7988: restore PHY page on PHY setting exit
Date: Sat, 20 Sep 2025 18:09:42 +0200 [thread overview]
Message-ID: <20250920161013.31799-3-ansuelsmth@gmail.com> (raw)
In-Reply-To: <20250920161013.31799-1-ansuelsmth@gmail.com>
On exiting the phy_setting function for MT7988, the PHY page is never
restored to Page 0. This can cause all kind of problem with reading the
status of the PHY at runtime.
Correctly restore PHY page on exiting the PHY setting function.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/net/mtk_eth/mt7988.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/mtk_eth/mt7988.c b/drivers/net/mtk_eth/mt7988.c
index 87b6ed30cd0..06bbe049da3 100644
--- a/drivers/net/mtk_eth/mt7988.c
+++ b/drivers/net/mtk_eth/mt7988.c
@@ -34,8 +34,10 @@ static void mt7988_phy_setting(struct mt753x_switch_priv *priv)
u32 i;
for (i = 0; i < MT753X_NUM_PHYS; i++) {
- /* Enable HW auto downshift */
+ /* Set PHY to PHY page 1 */
mt7531_mii_write(priv, i, 0x1f, 0x1);
+
+ /* Enable HW auto downshift */
val = mt7531_mii_read(priv, i, PHY_EXT_REG_14);
val |= PHY_EN_DOWN_SHFIT;
mt7531_mii_write(priv, i, PHY_EXT_REG_14, val);
@@ -44,6 +46,9 @@ static void mt7988_phy_setting(struct mt753x_switch_priv *priv)
val = mt7531_mii_read(priv, i, PHY_EXT_REG_17);
val |= PHY_LINKDOWN_POWER_SAVING_EN;
mt7531_mii_write(priv, i, PHY_EXT_REG_17, val);
+
+ /* Restore PHY to PHY page 0 */
+ mt7531_mii_write(priv, i, 0x1f, 0x0);
}
}
--
2.51.0
next prev parent reply other threads:[~2025-09-20 16:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-20 16:09 [PATCH v2 0/5] net: mediatek: mt7988: various fixup + MDIO detach Christian Marangi
2025-09-20 16:09 ` [PATCH v2 1/5] net: mediatek: mt7531/7988: fix broken PHY turn ON/OFF Christian Marangi
2025-09-20 16:09 ` Christian Marangi [this message]
2025-09-20 16:09 ` [PATCH v2 3/5] net: mediatek: mt7988: free allocated MDIO bus on cleanup Christian Marangi
2025-09-20 16:09 ` [PATCH v2 4/5] net: mediatek: move MT7531 MMIO MDIO to dedicated driver Christian Marangi
2025-09-20 16:09 ` [PATCH v2 5/5] net: airoha: bind MDIO controller on Ethernet load Christian Marangi
2025-10-22 13:42 ` Jerome Forissier
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=20250920161013.31799-3-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