Netdev List
 help / color / mirror / Atom feed
From: Caleb James DeLisle <cjd@cjdns.fr>
To: netdev@vger.kernel.org
Cc: daniel@makrotopia.org, dqfext@gmail.com,
	SkyLake.Huang@mediatek.com, andrew@lunn.ch, hkallweit1@gmail.com,
	linux@armlinux.org.uk, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, matthias.bgg@gmail.com,
	angelogioacchino.delregno@collabora.com,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org,
	Caleb James DeLisle <cjd@cjdns.fr>
Subject: [PATCH net-next] net: phy: mediatek: do not match MT7530 PHY if 10/100 only
Date: Fri, 18 Sep 2026 16:11:56 +0000	[thread overview]
Message-ID: <20260918161156.377822-1-cjd@cjdns.fr> (raw)

An EcoNet SoC 10/100 PHY uses the same ID as the MT7530 PHY, but a true
MT7530 PHY always has gigabit support so they can be distinguished by
the presence of the ESTATUS_1000_TFULL flag. Add a match_phy_device
which refuses to match if the PHY is not gigabit.

Signed-off-by: Caleb James DeLisle <cjd@cjdns.fr>
---
This supercedes [PATCH v6 net-next] net: phy: mediatek: support MT7530 PHYs on EN71221 MCM
Link: https://lore.kernel.org/netdev/20260917130534.297930-1-cjd@cjdns.fr
Because after the recent EEE disablement in the driver, it is found
that the default MT7530 PHY driver does apparently work with the EcoNet
MCM MT7530.
---
 drivers/net/phy/mediatek/mtk-ge.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/net/phy/mediatek/mtk-ge.c b/drivers/net/phy/mediatek/mtk-ge.c
index 96d8ac5154e5..f801966bb4ee 100644
--- a/drivers/net/phy/mediatek/mtk-ge.c
+++ b/drivers/net/phy/mediatek/mtk-ge.c
@@ -101,6 +101,18 @@ static int mt7530_phy_config_init(struct phy_device *phydev)
 	return 0;
 }
 
+/*
+ * MTK_GPHY_ID_MT7530 ID is also used for an EcoNet SoC FE phy, but that PHY
+ * does not advertise ESTATUS_1000_TFULL. Match this driver only if the PHY
+ * advertizes gigabit capability.
+ */
+static int mt753x_gphy_match(struct phy_device *phydev,
+			     const struct phy_driver *phydrv)
+{
+	return genphy_match_phy_device(phydev, phydrv) &&
+	       (phy_read(phydev, MII_ESTATUS) & ESTATUS_1000_TFULL) != 0;
+}
+
 static int mt7531_phy_config_init(struct phy_device *phydev)
 {
 	mtk_gephy_config_init(phydev);
@@ -135,6 +147,7 @@ static struct phy_driver mtk_gephy_driver[] = {
 		 */
 		.config_intr	= genphy_no_config_intr,
 		.handle_interrupt = genphy_handle_interrupt_no_ack,
+		.match_phy_device = mt753x_gphy_match,
 		.suspend	= genphy_suspend,
 		.resume		= genphy_resume,
 		.read_page	= mtk_phy_read_page,
-- 
2.39.5


             reply	other threads:[~2026-09-18 16:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-18 16:11 Caleb James DeLisle [this message]
2026-09-18 16:29 ` [PATCH net-next] net: phy: mediatek: do not match MT7530 PHY if 10/100 only Andrew Lunn
2026-09-18 16:47   ` Caleb James DeLisle
2026-09-18 16:58     ` Andrew Lunn

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=20260918161156.377822-1-cjd@cjdns.fr \
    --to=cjd@cjdns.fr \
    --cc=SkyLake.Huang@mediatek.com \
    --cc=andrew@lunn.ch \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=dqfext@gmail.com \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    --cc=matthias.bgg@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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