]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: stmmac: provide flag to disable EEE
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Wed, 25 Mar 2026 21:00:02 +0000 (23:00 +0200)
committerJakub Kicinski <kuba@kernel.org>
Sat, 28 Mar 2026 03:57:38 +0000 (20:57 -0700)
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>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Link: https://patch.msgid.link/20260325210003.2752013-2-laurent.pinchart@ideasonboard.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
include/linux/stmmac.h

index 9b6b493316399e704b3456cd5e604fbbd0edf6f4..ce51b9c221299e121e126cf8fe4e33a4a0378450 100644 (file)
@@ -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.
                 */
index eaaee329ef9d7c0d903d3799ab5005960296d695..4430b967abdeb13d835e7388c0f582e13995fe5b 100644 (file)
@@ -204,12 +204,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;