netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>,
	Emanuele Ghidoli <ghidoliemanuele@gmail.com>
Cc: Heiner Kallweit <hkallweit1@gmail.com>,
	Emanuele Ghidoli <emanuele.ghidoli@toradex.com>,
	Oleksij Rempel <o.rempel@pengutronix.de>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH v1] net: phy: dp83867: Disable EEE support as not implemented
Date: Mon, 27 Oct 2025 17:23:21 +0000	[thread overview]
Message-ID: <aP-qiSsYzFDe-xlV@shell.armlinux.org.uk> (raw)
In-Reply-To: <aP-hca4pDsDlEGUt@shell.armlinux.org.uk>

On Mon, Oct 27, 2025 at 04:44:33PM +0000, Russell King (Oracle) wrote:
> On Mon, Oct 27, 2025 at 04:34:54PM +0100, Emanuele Ghidoli wrote:
> > > So, this needs to be tested - please modify phylib's
> > > genphy_c45_read_eee_cap1() to print the value read from the register.
> > > 
> > > If it is 0xffff, that confirms that theory.
> > It’s not 0xffff; I verified that the value read is:
> > TI DP83867 stmmac-0:02: Reading EEE capabilities from MDIO_PCS_EEE_ABLE: 0x0006
> 
> Thanks for testing. So the published manual for this PHY is wrong.
> https://www.ti.com/lit/ds/symlink/dp83867ir.pdf page 64.
> 
> The comment I quoted from that page implies that the PCS and AN
> MMD registers shouldn't be implemented.
> 
> Given what we now know, I'd suggest TI PHYs are a mess. Stuff they
> say in the documentation that is ignored plainly isn't, and their
> PHYs report stuff as capable but their PHYs aren't capable.
> 
> I was suggesting to clear phydev->supported_eee, but that won't
> work if the MDIO_AN_EEE_ADV register is implemented even as far
> as exchanging EEE capabilities with the link partner. We use the
> supported_eee bitmap to know whether a register is implemented.
> Clearing ->supported_eee will mean we won't write to the advertisement
> register. That's risky. Given the brokenness so far, I wouldn't like
> to assume that the MDIO_AN_EEE_ADV register contains zero by default.
> 
> Calling phy_disable_eee() from .get_features() won't work, because
> after we call that method, of_set_phy_eee_broken() will then be
> called, which will clear phydev->eee_disabled_modes. I think that is
> a mistake. Is there any reason why we would want to clear the
> disabled modes? Isn't it already zero? (note that if OF_MDIO is
> disabled, or there's no DT node, we don't zero this.)
> 
> Your placement is the only possible location as the code currently
> stands, but I would like to suggest that of_set_phy_eee_broken()
> should _not_ be calling linkmode_zero(modes), and we should be able
> to set phydev->eee_disabled_modes in the .get_features() method.
> 
> Andrew, would you agree?

What I'm thinking of is an overall change such as (against net-next):

diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
index deeefb962566..f923f3a57b11 100644
--- a/drivers/net/phy/dp83867.c
+++ b/drivers/net/phy/dp83867.c
@@ -708,6 +708,21 @@ static int dp83867_probe(struct phy_device *phydev)
 	return dp83867_of_init(phydev);
 }
 
+static int dp83867_get_features(struct phy_device *phydev)
+{
+	int err = genphy_read_abilities(phydev);
+
+	/* TI Gigabit PHYs do not support EEE, even though they report support
+	 * in their "ignored" Clause 45 indirect registers, appear to implement
+	 * the advertisement registers and exchange the relevant AN page. Set
+	 * all EEE link modes as disabled, so we still write to the C45 EEE
+	 * advertisement register to ensure it is set to zero.
+	 */
+	linkmode_fill(phydev->eee_disabled_modes);
+
+	return err;
+}
+
 static int dp83867_config_init(struct phy_device *phydev)
 {
 	struct dp83867_private *dp83867 = phydev->priv;
@@ -1118,6 +1133,7 @@ static struct phy_driver dp83867_driver[] = {
 		/* PHY_GBIT_FEATURES */
 
 		.probe          = dp83867_probe,
+		.get_features	= dp83867_get_features,
 		.config_init	= dp83867_config_init,
 		.soft_reset	= dp83867_phy_reset,
 
diff --git a/drivers/net/phy/phy-core.c b/drivers/net/phy/phy-core.c
index 605ca20ae192..43ccbd3a09f8 100644
--- a/drivers/net/phy/phy-core.c
+++ b/drivers/net/phy/phy-core.c
@@ -207,8 +207,6 @@ void of_set_phy_eee_broken(struct phy_device *phydev)
 	if (!IS_ENABLED(CONFIG_OF_MDIO) || !node)
 		return;
 
-	linkmode_zero(modes);
-
 	if (of_property_read_bool(node, "eee-broken-100tx"))
 		linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, modes);
 	if (of_property_read_bool(node, "eee-broken-1000t"))

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

  reply	other threads:[~2025-10-27 17:23 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-23 14:48 [PATCH v1] net: phy: dp83867: Disable EEE support as not implemented Emanuele Ghidoli
2025-10-23 17:01 ` Andrew Lunn
2025-10-25  2:20 ` patchwork-bot+netdevbpf
2025-10-25  8:44 ` Russell King (Oracle)
2025-10-25  9:19   ` Oleksij Rempel
2025-10-25  9:37     ` Russell King (Oracle)
2025-10-26 23:45 ` Andrew Lunn
2025-10-27 12:57   ` Emanuele Ghidoli
2025-10-27 13:25     ` Andrew Lunn
2025-10-27 13:57       ` Oleksij Rempel
2025-10-27 14:35       ` Francesco Dolcini
2025-10-27 14:41         ` Andrew Lunn
2025-10-27 14:53     ` Russell King (Oracle)
2025-10-27 15:34       ` Emanuele Ghidoli
2025-10-27 16:44         ` Russell King (Oracle)
2025-10-27 17:23           ` Russell King (Oracle) [this message]
2025-10-27 19:26           ` 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=aP-qiSsYzFDe-xlV@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=emanuele.ghidoli@toradex.com \
    --cc=ghidoliemanuele@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).