From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: netdev@vger.kernel.org, imx@lists.linux.dev
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Fabio Estevam <festevam@gmail.com>,
Francesco Dolcini <francesco.dolcini@toradex.com>,
Frank Li <Frank.Li@nxp.com>, Jakub Kicinski <kuba@kernel.org>,
Joy Zou <joy.zou@nxp.com>,
Kieran Bingham <kieran.bingham@ideasonboard.com>,
Marco Felsch <m.felsch@pengutronix.de>,
Paolo Abeni <pabeni@redhat.com>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>,
Stefan Klug <stefan.klug@ideasonboard.com>,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH net-next v4 1/2] net: stmmac: provide flag to disable EEE
Date: Wed, 25 Mar 2026 23:00:02 +0200 [thread overview]
Message-ID: <20260325210003.2752013-2-laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <20260325210003.2752013-1-laurent.pinchart@ideasonboard.com>
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
Some platforms have problems when EEE is enabled, and thus need a way
to disable stmmac EEE support. Add a flag before the other LPI related
flags which tells stmmac to avoid populating the phylink LPI
capabilities, which causes phylink to call phy_disable_eee() for any
PHY that is attached to the affected phylink instance.
iMX8MP is an example - the lpi_intr_o signal is wired to an OR gate
along with the main dwmac interrupts. Since lpi_intr_o is synchronous
to the receive clock domain, and takes four clock cycles to clear, this
leads to interrupt storms as the interrupt remains asserted for some
time after the LPI control and status register is read.
This problem becomes worse when the receive clock from the PHY stops
when the receive path enters LPI state - which means that lpi_intr_o
can not deassert until the clock restarts. Since the LPI state of the
receive path depends on the link partner, this is out of our control.
We could disable RX clock stop at the PHY, but that doesn't get around
the slow-to-deassert lpi_intr_o mentioned in the above paragraph.
Previously, iMX8MP worked around this by disabling gigabit EEE, but
this is insufficient - the problem is also visible at 100M speeds,
where the receive clock is slower.
There is extensive discussion and investigation in the thread linked
below, the result of which is summarised in this commit message.
Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Closes: https://lore.kernel.org/r/20251026122905.29028-1-laurent.pinchart@ideasonboard.com
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Tested-by: Ovidiu Panait <ovidiu.panait.rb@renesas.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 ++++++-
include/linux/stmmac.h | 13 +++++++------
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 9b6b49331639..ce51b9c22129 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1438,7 +1438,12 @@ static int stmmac_phylink_setup(struct stmmac_priv *priv)
config->supported_interfaces,
pcs->supported_interfaces);
- if (priv->dma_cap.eee) {
+ /* Some platforms, e.g. iMX8MP, wire lpi_intr_o to the same interrupt
+ * used for stmmac's main interrupts, which leads to interrupt storms.
+ * STMMAC_FLAG_EEE_DISABLE allows EEE to be disabled on such platforms.
+ */
+ if (priv->dma_cap.eee &&
+ !(priv->plat->flags & STMMAC_FLAG_EEE_DISABLE)) {
/* The GMAC 3.74a databook states that EEE is only supported
* in MII, GMII, and RGMII interfaces.
*/
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 5b2bece81448..e62d21afd56d 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -207,12 +207,13 @@ enum dwmac_core_type {
#define STMMAC_FLAG_MULTI_MSI_EN BIT(7)
#define STMMAC_FLAG_EXT_SNAPSHOT_EN BIT(8)
#define STMMAC_FLAG_INT_SNAPSHOT_EN BIT(9)
-#define STMMAC_FLAG_RX_CLK_RUNS_IN_LPI BIT(10)
-#define STMMAC_FLAG_EN_TX_LPI_CLOCKGATING BIT(11)
-#define STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP BIT(12)
-#define STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY BIT(13)
-#define STMMAC_FLAG_KEEP_PREAMBLE_BEFORE_SFD BIT(14)
-#define STMMAC_FLAG_SERDES_SUPPORTS_2500M BIT(15)
+#define STMMAC_FLAG_EEE_DISABLE BIT(10)
+#define STMMAC_FLAG_RX_CLK_RUNS_IN_LPI BIT(11)
+#define STMMAC_FLAG_EN_TX_LPI_CLOCKGATING BIT(12)
+#define STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP BIT(13)
+#define STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY BIT(14)
+#define STMMAC_FLAG_KEEP_PREAMBLE_BEFORE_SFD BIT(15)
+#define STMMAC_FLAG_SERDES_SUPPORTS_2500M BIT(16)
struct mac_device_info;
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2026-03-25 21:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-25 21:00 [PATCH net-next v4 0/2] net: stmmac: Disable EEE on i.MX Laurent Pinchart
2026-03-25 21:00 ` Laurent Pinchart [this message]
2026-03-26 15:53 ` [PATCH net-next v4 1/2] net: stmmac: provide flag to disable EEE Laurent Pinchart
2026-03-26 17:31 ` Kieran Bingham
2026-03-26 18:10 ` Russell King (Oracle)
2026-03-25 21:00 ` [PATCH net-next v4 2/2] net: stmmac: imx: Disable EEE Laurent Pinchart
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=20260325210003.2752013-2-laurent.pinchart@ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=Frank.Li@nxp.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=festevam@gmail.com \
--cc=francesco.dolcini@toradex.com \
--cc=imx@lists.linux.dev \
--cc=joy.zou@nxp.com \
--cc=kernel@pengutronix.de \
--cc=kieran.bingham@ideasonboard.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=m.felsch@pengutronix.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rmk+kernel@armlinux.org.uk \
--cc=stefan.klug@ideasonboard.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