Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next] net: phy: mediatek: do not match MT7530 PHY if 10/100 only
@ 2026-09-18 16:11 Caleb James DeLisle
  2026-09-18 16:29 ` Andrew Lunn
  0 siblings, 1 reply; 4+ messages in thread
From: Caleb James DeLisle @ 2026-09-18 16:11 UTC (permalink / raw)
  To: netdev
  Cc: daniel, dqfext, SkyLake.Huang, andrew, hkallweit1, linux, davem,
	edumazet, kuba, pabeni, matthias.bgg, angelogioacchino.delregno,
	linux-kernel, linux-arm-kernel, linux-mediatek,
	Caleb James DeLisle

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


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

* Re: [PATCH net-next] net: phy: mediatek: do not match MT7530 PHY if 10/100 only
  2026-09-18 16:11 [PATCH net-next] net: phy: mediatek: do not match MT7530 PHY if 10/100 only Caleb James DeLisle
@ 2026-09-18 16:29 ` Andrew Lunn
  2026-09-18 16:47   ` Caleb James DeLisle
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Lunn @ 2026-09-18 16:29 UTC (permalink / raw)
  To: Caleb James DeLisle
  Cc: netdev, daniel, dqfext, SkyLake.Huang, hkallweit1, linux, davem,
	edumazet, kuba, pabeni, matthias.bgg, angelogioacchino.delregno,
	linux-kernel, linux-arm-kernel, linux-mediatek

On Fri, Sep 18, 2026 at 04:11:56PM +0000, Caleb James DeLisle wrote:
> 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.

Don't you also need the opposite in mtk-fe-soc.c? Otherwise don't you
rely on the load order of the PHY drivers?

    Andrew

---
pw-bot: cr

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

* Re: [PATCH net-next] net: phy: mediatek: do not match MT7530 PHY if 10/100 only
  2026-09-18 16:29 ` Andrew Lunn
@ 2026-09-18 16:47   ` Caleb James DeLisle
  2026-09-18 16:58     ` Andrew Lunn
  0 siblings, 1 reply; 4+ messages in thread
From: Caleb James DeLisle @ 2026-09-18 16:47 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: netdev, daniel, dqfext, SkyLake.Huang, hkallweit1, linux, davem,
	edumazet, kuba, pabeni, matthias.bgg, angelogioacchino.delregno,
	linux-kernel, linux-arm-kernel, linux-mediatek


On 18/09/2026 18:29, Andrew Lunn wrote:
> On Fri, Sep 18, 2026 at 04:11:56PM +0000, Caleb James DeLisle wrote:
>> 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.
> Don't you also need the opposite in mtk-fe-soc.c? Otherwise don't you
> rely on the load order of the PHY drivers?

The collision is in econet-fe-soc.c of 
https://lore.kernel.org/netdev/20260827065930.2618729-3-cjd@cjdns.fr/

And I notice now that I did add it in that patchset as well, but this 
implementation is better done and that patchset is probably going to 
have a v2 so I think it's better to accept it here.

Thanks,

Caleb

>
>      Andrew
>
> ---
> pw-bot: cr
>

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

* Re: [PATCH net-next] net: phy: mediatek: do not match MT7530 PHY if 10/100 only
  2026-09-18 16:47   ` Caleb James DeLisle
@ 2026-09-18 16:58     ` Andrew Lunn
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2026-09-18 16:58 UTC (permalink / raw)
  To: Caleb James DeLisle
  Cc: netdev, daniel, dqfext, SkyLake.Huang, hkallweit1, linux, davem,
	edumazet, kuba, pabeni, matthias.bgg, angelogioacchino.delregno,
	linux-kernel, linux-arm-kernel, linux-mediatek

On Fri, Sep 18, 2026 at 06:47:02PM +0200, Caleb James DeLisle wrote:
> 
> On 18/09/2026 18:29, Andrew Lunn wrote:
> > On Fri, Sep 18, 2026 at 04:11:56PM +0000, Caleb James DeLisle wrote:
> > > 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.
> > Don't you also need the opposite in mtk-fe-soc.c? Otherwise don't you
> > rely on the load order of the PHY drivers?
> 
> The collision is in econet-fe-soc.c of
> https://lore.kernel.org/netdev/20260827065930.2618729-3-cjd@cjdns.fr/

Ah, you have a similar match function there. Good.

> And I notice now that I did add it in that patchset as well, but this
> implementation is better done.

Yes, the one here is nicer. It would be good to use the same idea in
the econet-fe-soc.c.

     Andrew

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

end of thread, other threads:[~2026-09-18 16:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-18 16:11 [PATCH net-next] net: phy: mediatek: do not match MT7530 PHY if 10/100 only Caleb James DeLisle
2026-09-18 16:29 ` Andrew Lunn
2026-09-18 16:47   ` Caleb James DeLisle
2026-09-18 16:58     ` Andrew Lunn

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