linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] stmmac irq fixes/cleanups
@ 2018-02-09 16:22 Niklas Cassel
  2018-02-09 16:22 ` [PATCH net-next 1/3] net: stmmac: discard disabled flags in interrupt status register Niklas Cassel
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Niklas Cassel @ 2018-02-09 16:22 UTC (permalink / raw)
  To: netdev; +Cc: Niklas Cassel, linux-kernel

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(-)

-- 
2.14.2

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net-next 1/3] net: stmmac: discard disabled flags in interrupt status register
  2018-02-09 16:22 [PATCH net-next 0/3] stmmac irq fixes/cleanups Niklas Cassel
@ 2018-02-09 16:22 ` Niklas Cassel
  2018-02-09 16:22 ` [PATCH net-next 2/3] net: stmmac: rename GMAC_INT_DEFAULT_MASK for dwmac4 Niklas Cassel
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Niklas Cassel @ 2018-02-09 16:22 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue; +Cc: Niklas Cassel, netdev, linux-kernel

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.

Signed-off-by: Niklas Cassel <niklas.cassel@axis.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
index ed222b20fcf1..1e0a7668b752 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
@@ -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))
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next 2/3] net: stmmac: rename GMAC_INT_DEFAULT_MASK for dwmac4
  2018-02-09 16:22 [PATCH net-next 0/3] stmmac irq fixes/cleanups Niklas Cassel
  2018-02-09 16:22 ` [PATCH net-next 1/3] net: stmmac: discard disabled flags in interrupt status register Niklas Cassel
@ 2018-02-09 16:22 ` Niklas Cassel
  2018-02-09 16:22 ` [PATCH net-next 3/3] net: stmmac: remove redundant enable of PMT irq Niklas Cassel
  2018-02-09 19:23 ` [PATCH net-next 0/3] stmmac irq fixes/cleanups David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Niklas Cassel @ 2018-02-09 16:22 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue; +Cc: Niklas Cassel, netdev, linux-kernel

GMAC_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.

Signed-off-by: Niklas Cassel <niklas.cassel@axis.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac4.h      | 2 +-
 drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4.h b/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
index 789dad8a07b5..7761a26ec9c5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
@@ -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,
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
index 1e0a7668b752..6badc63d8e6d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
@@ -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)
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next 3/3] net: stmmac: remove redundant enable of PMT irq
  2018-02-09 16:22 [PATCH net-next 0/3] stmmac irq fixes/cleanups Niklas Cassel
  2018-02-09 16:22 ` [PATCH net-next 1/3] net: stmmac: discard disabled flags in interrupt status register Niklas Cassel
  2018-02-09 16:22 ` [PATCH net-next 2/3] net: stmmac: rename GMAC_INT_DEFAULT_MASK for dwmac4 Niklas Cassel
@ 2018-02-09 16:22 ` Niklas Cassel
  2018-02-09 19:23 ` [PATCH net-next 0/3] stmmac irq fixes/cleanups David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Niklas Cassel @ 2018-02-09 16:22 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue; +Cc: Niklas Cassel, netdev, linux-kernel

For 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.

Signed-off-by: Niklas Cassel <niklas.cassel@axis.com>
---
 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(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
index 540d21786a43..ef10baf14186 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
@@ -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;
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
index 6badc63d8e6d..63795ecafc8d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
@@ -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;
 
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 0/3] stmmac irq fixes/cleanups
  2018-02-09 16:22 [PATCH net-next 0/3] stmmac irq fixes/cleanups Niklas Cassel
                   ` (2 preceding siblings ...)
  2018-02-09 16:22 ` [PATCH net-next 3/3] net: stmmac: remove redundant enable of PMT irq Niklas Cassel
@ 2018-02-09 19:23 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2018-02-09 19:23 UTC (permalink / raw)
  To: niklas.cassel; +Cc: netdev, niklass, linux-kernel

From: Niklas Cassel <niklas.cassel@axis.com>
Date: Fri,  9 Feb 2018 17:22:44 +0100

> A couple of small stmmac irq fixes/cleanups.

Seires applied.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-02-09 19:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-09 16:22 [PATCH net-next 0/3] stmmac irq fixes/cleanups Niklas Cassel
2018-02-09 16:22 ` [PATCH net-next 1/3] net: stmmac: discard disabled flags in interrupt status register Niklas Cassel
2018-02-09 16:22 ` [PATCH net-next 2/3] net: stmmac: rename GMAC_INT_DEFAULT_MASK for dwmac4 Niklas Cassel
2018-02-09 16:22 ` [PATCH net-next 3/3] net: stmmac: remove redundant enable of PMT irq Niklas Cassel
2018-02-09 19:23 ` [PATCH net-next 0/3] stmmac irq fixes/cleanups David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).