Commit 77a347f8 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge branch 'net-stmmac-disable-eee-on-i-mx'

Laurent Pinchart says:

====================
net: stmmac: Disable EEE on i.MX

This small patch series fixes a long-standing interrupt storm issue with
stmmac on NXP i.MX platforms.

The initial attempt to fix^Wwork around the problem in DT ([1]) was
painfully but rightfully rejected by Russell, who helped me investigate
the issue in depth. It turned out that the root cause is a mistake in
how interrupts are wired in the SoC, a hardware bug that has been
replicated in all i.MX SoCs that integrate an stmmac. The only viable
solution is to disable EEE on those devices.

Individual patches explain the issue in more details. Patch 1/2,
authored by Russell, adds a new STMMAC_FLAG to disable EEE, and patch
2/2 sets the flag for i.MX platforms.

[1] https://lore.kernel.org/r/20251026122905.29028-1-laurent.pinchart@ideasonboard.com
====================

Link: https://patch.msgid.link/20260325210003.2752013-1-laurent.pinchart@ideasonboard.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents fb4b4a05 39486309
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -325,11 +325,7 @@ static int imx_dwmac_probe(struct platform_device *pdev)
		return ret;
	}

	if (data->flags & STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY)
		plat_dat->flags |= STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY;

	if (data->flags & STMMAC_FLAG_KEEP_PREAMBLE_BEFORE_SFD)
		plat_dat->flags |= STMMAC_FLAG_KEEP_PREAMBLE_BEFORE_SFD;
	plat_dat->flags |= data->flags;

	/* Default TX Q0 to use TSO and rest TXQ for TBS */
	for (int i = 1; i < plat_dat->tx_queues_to_use; i++)
@@ -366,7 +362,8 @@ static struct imx_dwmac_ops imx8mp_dwmac_data = {
	.addr_width = 34,
	.mac_rgmii_txclk_auto_adj = false,
	.set_intf_mode = imx8mp_set_intf_mode,
	.flags = STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY |
	.flags = STMMAC_FLAG_EEE_DISABLE |
		 STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY |
		 STMMAC_FLAG_KEEP_PREAMBLE_BEFORE_SFD,
};

+6 −1
Original line number Diff line number Diff line
@@ -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.
		 */
+7 −6
Original line number Diff line number Diff line
@@ -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;