[PATCH] net: stmmac: Use interrupt mode INTM=1 for per channel irq
From: muhammad . nazim . amirul . nazle . asmade
Date: Wed Apr 29 2026 - 02:25:01 EST
From: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@xxxxxxxxxx>
commit 6ccf12ae111e ("net: stmmac: use interrupt mode INTM=1 for
multi-MSI") introduced INTM=1 interrupt mode for platforms using MSI.
Apply a similar approach to enable per-channel interrupts using shared
peripheral interrupt (SPI), so that only per-channel TX and RX
interrupts (TI/RI) are handled by the TX/RX ISR without invoking the
common interrupt ISR.
The TX/RX NORMAL interrupt check is decoupled since the NIS bit is not
asserted for TI/RI events when INTM=1.
Signed-off-by: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@xxxxxxxxxx>
---
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 3 +++
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 7 +++++++
include/linux/stmmac.h | 6 ++++++
3 files changed, 16 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
index 51943705a2b0..94cbf24b3118 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
@@ -320,6 +320,9 @@
/* DMA Registers */
#define XGMAC_DMA_MODE 0x00003000
#define XGMAC_SWR BIT(0)
+#define DMA_MODE_INTM_MASK GENMASK(13, 12)
+#define DMA_MODE_INTM_SHIFT 12
+#define DMA_MODE_INTM_MODE1 0x1
#define XGMAC_DMA_SYSBUS_MODE 0x00003004
#define XGMAC_WR_OSR_LMT GENMASK(29, 24)
#define XGMAC_RD_OSR_LMT GENMASK(21, 16)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c
index 03437f1cf3df..3789b62cd2e3 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c
@@ -31,6 +31,13 @@ static void dwxgmac2_dma_init(void __iomem *ioaddr,
value |= XGMAC_EAME;
writel(value, ioaddr + XGMAC_DMA_SYSBUS_MODE);
+
+ if (dma_cfg->multi_irq_en) {
+ value = readl(ioaddr + XGMAC_DMA_MODE);
+ value &= ~DMA_MODE_INTM_MASK;
+ value |= (DMA_MODE_INTM_MODE1 << DMA_MODE_INTM_SHIFT);
+ writel(value, ioaddr + XGMAC_DMA_MODE);
+ }
}
static void dwxgmac2_dma_init_chan(struct stmmac_priv *priv,
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 4430b967abde..5deaa1a797a5 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -122,6 +122,7 @@ struct stmmac_dma_cfg {
bool eame;
/* multi_msi_en: stmmac core internal */
bool multi_msi_en;
+ bool multi_irq_en;
/* atds: stmmac core internal */
bool atds;
};
@@ -349,6 +350,11 @@ struct plat_stmmacenet_data {
u8 vlan_fail_q;
bool provide_bus_info;
int int_snapshot_num;
+ int ext_snapshot_num;
+ bool int_snapshot_en;
+ bool ext_snapshot_en;
+ bool multi_msi_en;
+ bool multi_irq_en;
int msi_mac_vec;
int msi_wol_vec;
int msi_sfty_ce_vec;
--
2.43.7