stmmac irq fixes/cleanups
Subsystems (4)
cover stmmac irq fixes/cleanups
A couple of small stmmac irq fixes/cleanups.
Niklas Cassel (3):
net: stmmac: discard disabled flags in interrupt status register
net: stmmac: rename GMAC_INT_DEFAULT_MASK for dwmac4
net: stmmac: remove redundant enable of PMT irq
drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c | 2 -- drivers/net/ethernet/stmicro/stmmac/dwmac4.h | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 13 +++++++------ 3 files changed, 8 insertions(+), 9 deletions(-)
Signature · 1 line
2.14.2
PATCH 1/3 net: stmmac: discard disabled flags in interrupt status register
The interrupt status register in both dwmac1000 and dwmac4 ignores interrupt enable (for dwmac4) / interrupt mask (for dwmac1000). Therefore, if we want to check only the bits that can actually trigger an irq, we have to filter the interrupt status register manually.
Commit 0a764db10337 ("stmmac: Discard masked flags in interrupt status register") fixed this for dwmac1000. Fix the same issue for dwmac4.
Just like commit 0a764db10337 ("stmmac: Discard masked flags in interrupt status register"), this makes sure that we do not get spurious link up/link down prints.
--- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +4 -2
@@ -572,10 +572,12 @@ static int dwmac4_irq_status(struct mac_device_info *hw, struct stmmac_extra_stats *x) {void __iomem *ioaddr = hw->pcsr; -u32 intr_status; +u32 intr_status =readl (ioaddr +GMAC_INT_STATUS ); +u32 intr_enable =readl (ioaddr +GMAC_INT_EN );int ret =0 ; - intr_status =readl (ioaddr +GMAC_INT_STATUS ); +/* Discard disabled bits */ + intr_status &= intr_enable;/* Not used events (e.g. MMC interrupts) are not handled. */ if ((intr_status & mmc_tx_irq))
Signature · 1 line
2.14.2
PATCH 2/3 net: stmmac: rename GMAC_INT_DEFAULT_MASK for dwmac4
In reply to Niklas CasselGMAC_INT_DEFAULT_MASK is written to the interrupt enable register. In previous versions of the IP (e.g. dwmac1000), this register was instead an interrupt mask register.
To improve clarity and reflect reality, rename GMAC_INT_DEFAULT_MASK to GMAC_INT_DEFAULT_ENABLE.
--- drivers/net/ethernet/stmicro/stmmac/dwmac4.h | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4.h +1 -1
@@ -98,7 +98,7 @@#define GMAC_PCS_IRQ_DEFAULT (GMAC_INT_RGSMIIS | GMAC_INT_PCS_LINK | \ GMAC_INT_PCS_ANE) -#define GMAC_INT_DEFAULT_MASK (GMAC_INT_PMT_EN | GMAC_INT_LPI_EN) +#define GMAC_INT_DEFAULT_ENABLE (GMAC_INT_PMT_EN | GMAC_INT_LPI_EN)enum dwmac4_irq_status { time_stamp_irq =0x00001000 ,
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +2 -2
@@ -61,8 +61,8 @@ static void dwmac4_core_init(struct mac_device_info *hw,writel (value, ioaddr +GMAC_CONFIG ); -/* Mask GMAC interrupts */ - value =GMAC_INT_DEFAULT_MASK ; +/* Enable GMAC interrupts */ + value =GMAC_INT_DEFAULT_ENABLE ;if (hw->pmt) value |=GMAC_INT_PMT_EN ;if (hw->pcs)
Signature · 1 line
2.14.2
PATCH 3/3 net: stmmac: remove redundant enable of PMT irq
In reply to Niklas CasselFor dwmac4, GMAC_INT_DEFAULT_ENABLE already includes GMAC_INT_PMT_EN, so it is redundant to check if hw->pmt is set, and if so, setting the bit again.
For dwmac1000, GMAC_INT_DEFAULT_MASK does not include GMAC_INT_DISABLE_PMT, so it is redundant to check if hw->pmt is set, and if so, clearing an already cleared bit.
Improve code readability by removing this redundant code.
--- drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c | 2 -- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c +0 -2
@@ -74,8 +74,6 @@ static void dwmac1000_core_init(struct mac_device_info *hw,/* Mask GMAC interrupts */ value =GMAC_INT_DEFAULT_MASK ; -if (hw->pmt) - value &= ~GMAC_INT_DISABLE_PMT ;if (hw->pcs) value &= ~GMAC_INT_DISABLE_PCS ;
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +1 -2
@@ -63,8 +63,7 @@ static void dwmac4_core_init(struct mac_device_info *hw,/* Enable GMAC interrupts */ value =GMAC_INT_DEFAULT_ENABLE ; -if (hw->pmt) - value |=GMAC_INT_PMT_EN ; +if (hw->pcs) value |=GMAC_PCS_IRQ_DEFAULT ;
Signature · 1 line
2.14.2
David Miller
maintainerFrom: Niklas Cassel <[email protected]>
Date: Fri, 9 Feb 2018 17:22:44 +0100
Quoted 1 line
A couple of small stmmac irq fixes/cleanups.
Seires applied.