netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/4] net: stmmac: dwmac4: Fixes and improvements
@ 2024-10-15  6:57 Ley Foon Tan
  2024-10-15  6:57 ` [PATCH net-next 1/4] net: stmmac: dwmac4: Fix MTL_OP_MODE_RTC mask and shift macros Ley Foon Tan
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Ley Foon Tan @ 2024-10-15  6:57 UTC (permalink / raw)
  To: Alexandre Torgue, Jose Abreu
  Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, linux-kernel, lftan.linux

The first three patches fix bugs in the dwmac4 driver, while the fourth
patch adds register dump for the upper 32-bit DMA addresses.

Ley Foon Tan (4):
  net: stmmac: dwmac4: Fix MTL_OP_MODE_RTC mask and shift macros
  net: stmmac: dwmac4: Fix the MTL_OP_MODE_*_MASK operation
  net: stmmac: dwmac4: Receive Watchdog Timeout is not in abnormal
    interrupt summary
  net: stmmac: dwmac4: Dump the DMA high address registers

 drivers/net/ethernet/stmicro/stmmac/dwmac4.h     |  4 ++--
 drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 12 ++++++++++--
 drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h |  2 ++
 drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c |  6 ++++--
 4 files changed, 18 insertions(+), 6 deletions(-)

-- 
2.34.1


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

* [PATCH net-next 1/4] net: stmmac: dwmac4: Fix MTL_OP_MODE_RTC mask and shift macros
  2024-10-15  6:57 [PATCH net-next 0/4] net: stmmac: dwmac4: Fixes and improvements Ley Foon Tan
@ 2024-10-15  6:57 ` Ley Foon Tan
  2024-10-16  2:10   ` Jakub Kicinski
  2024-10-15  6:57 ` [PATCH net-next 2/4] net: stmmac: dwmac4: Fix the MTL_OP_MODE_*_MASK operation Ley Foon Tan
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Ley Foon Tan @ 2024-10-15  6:57 UTC (permalink / raw)
  To: Alexandre Torgue, Jose Abreu
  Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, linux-kernel, lftan.linux

RTC fields are located in bits [1:0]. Correct the _MASK and _SHIFT
macros to use the appropriate mask and shift.

Fixes: 35f74c0c5dce ("stmmac: add GMAC4 DMA/CORE Header File")

Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac4.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4.h b/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
index 93a78fd0737b..acbe5a027c85 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
@@ -389,8 +389,8 @@ static inline u32 mtl_chanx_base_addr(const struct dwmac4_addrs *addrs,
 
 #define MTL_OP_MODE_EHFC		BIT(7)
 
-#define MTL_OP_MODE_RTC_MASK		0x18
-#define MTL_OP_MODE_RTC_SHIFT		3
+#define MTL_OP_MODE_RTC_MASK		GENMASK(1, 0)
+#define MTL_OP_MODE_RTC_SHIFT		0
 
 #define MTL_OP_MODE_RTC_32		(1 << MTL_OP_MODE_RTC_SHIFT)
 #define MTL_OP_MODE_RTC_64		0
-- 
2.34.1


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

* [PATCH net-next 2/4] net: stmmac: dwmac4: Fix the MTL_OP_MODE_*_MASK operation
  2024-10-15  6:57 [PATCH net-next 0/4] net: stmmac: dwmac4: Fixes and improvements Ley Foon Tan
  2024-10-15  6:57 ` [PATCH net-next 1/4] net: stmmac: dwmac4: Fix MTL_OP_MODE_RTC mask and shift macros Ley Foon Tan
@ 2024-10-15  6:57 ` Ley Foon Tan
  2024-10-15  6:57 ` [PATCH net-next 3/4] net: stmmac: dwmac4: Receive Watchdog Timeout is not in abnormal interrupt summary Ley Foon Tan
  2024-10-15  6:57 ` [PATCH net-next 4/4] net: stmmac: dwmac4: Dump the DMA high address registers Ley Foon Tan
  3 siblings, 0 replies; 7+ messages in thread
From: Ley Foon Tan @ 2024-10-15  6:57 UTC (permalink / raw)
  To: Alexandre Torgue, Jose Abreu
  Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, linux-kernel, lftan.linux

In order to mask off the bits, we need to use the '~' operator to invert
all the bits of _MASK and clear them.

Fixes: 48863ce5940f ("stmmac: add DMA support for GMAC 4.xx")

Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
index e0165358c4ac..4e1b1bd98f68 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
@@ -266,7 +266,7 @@ static void dwmac4_dma_rx_chan_op_mode(struct stmmac_priv *priv,
 	} else {
 		pr_debug("GMAC: disable RX SF mode (threshold %d)\n", mode);
 		mtl_rx_op &= ~MTL_OP_MODE_RSF;
-		mtl_rx_op &= MTL_OP_MODE_RTC_MASK;
+		mtl_rx_op &= ~MTL_OP_MODE_RTC_MASK;
 		if (mode <= 32)
 			mtl_rx_op |= MTL_OP_MODE_RTC_32;
 		else if (mode <= 64)
@@ -335,7 +335,7 @@ static void dwmac4_dma_tx_chan_op_mode(struct stmmac_priv *priv,
 	} else {
 		pr_debug("GMAC: disabling TX SF (threshold %d)\n", mode);
 		mtl_tx_op &= ~MTL_OP_MODE_TSF;
-		mtl_tx_op &= MTL_OP_MODE_TTC_MASK;
+		mtl_tx_op &= ~MTL_OP_MODE_TTC_MASK;
 		/* Set the transmit threshold */
 		if (mode <= 32)
 			mtl_tx_op |= MTL_OP_MODE_TTC_32;
-- 
2.34.1


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

* [PATCH net-next 3/4] net: stmmac: dwmac4: Receive Watchdog Timeout is not in abnormal interrupt summary
  2024-10-15  6:57 [PATCH net-next 0/4] net: stmmac: dwmac4: Fixes and improvements Ley Foon Tan
  2024-10-15  6:57 ` [PATCH net-next 1/4] net: stmmac: dwmac4: Fix MTL_OP_MODE_RTC mask and shift macros Ley Foon Tan
  2024-10-15  6:57 ` [PATCH net-next 2/4] net: stmmac: dwmac4: Fix the MTL_OP_MODE_*_MASK operation Ley Foon Tan
@ 2024-10-15  6:57 ` Ley Foon Tan
  2024-10-15  6:57 ` [PATCH net-next 4/4] net: stmmac: dwmac4: Dump the DMA high address registers Ley Foon Tan
  3 siblings, 0 replies; 7+ messages in thread
From: Ley Foon Tan @ 2024-10-15  6:57 UTC (permalink / raw)
  To: Alexandre Torgue, Jose Abreu
  Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, linux-kernel, lftan.linux

The Receive Watchdog Timeout (RWT, bit[9]) is not part of Abnormal
Interrupt Summary (AIS). Move the RWT handling out of the AIS
condition statement.

From databook, the AIS is the logical OR of the following interrupt bits:

- Bit 1: Transmit Process Stopped
- Bit 7: Receive Buffer Unavailable
- Bit 8: Receive Process Stopped
- Bit 10: Early Transmit Interrupt
- Bit 12: Fatal Bus Error
- Bit 13: Context Descriptor Error

Fixes: 48863ce5940f ("stmmac: add DMA support for GMAC 4.xx")

Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
index 0d185e54eb7e..57c03d491774 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
@@ -185,8 +185,6 @@ int dwmac4_dma_interrupt(struct stmmac_priv *priv, void __iomem *ioaddr,
 			x->rx_buf_unav_irq++;
 		if (unlikely(intr_status & DMA_CHAN_STATUS_RPS))
 			x->rx_process_stopped_irq++;
-		if (unlikely(intr_status & DMA_CHAN_STATUS_RWT))
-			x->rx_watchdog_irq++;
 		if (unlikely(intr_status & DMA_CHAN_STATUS_ETI))
 			x->tx_early_irq++;
 		if (unlikely(intr_status & DMA_CHAN_STATUS_TPS)) {
@@ -198,6 +196,10 @@ int dwmac4_dma_interrupt(struct stmmac_priv *priv, void __iomem *ioaddr,
 			ret = tx_hard_error;
 		}
 	}
+
+	if (unlikely(intr_status & DMA_CHAN_STATUS_RWT))
+		x->rx_watchdog_irq++;
+
 	/* TX/RX NORMAL interrupts */
 	if (likely(intr_status & DMA_CHAN_STATUS_RI)) {
 		u64_stats_update_begin(&stats->syncp);
-- 
2.34.1


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

* [PATCH net-next 4/4] net: stmmac: dwmac4: Dump the DMA high address registers
  2024-10-15  6:57 [PATCH net-next 0/4] net: stmmac: dwmac4: Fixes and improvements Ley Foon Tan
                   ` (2 preceding siblings ...)
  2024-10-15  6:57 ` [PATCH net-next 3/4] net: stmmac: dwmac4: Receive Watchdog Timeout is not in abnormal interrupt summary Ley Foon Tan
@ 2024-10-15  6:57 ` Ley Foon Tan
  3 siblings, 0 replies; 7+ messages in thread
From: Ley Foon Tan @ 2024-10-15  6:57 UTC (permalink / raw)
  To: Alexandre Torgue, Jose Abreu
  Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, linux-kernel, lftan.linux

Dump the DMA high address registers (upper 32-bit address).

Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 8 ++++++++
 drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h | 2 ++
 2 files changed, 10 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
index 4e1b1bd98f68..60cee7a06ba2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
@@ -203,8 +203,12 @@ static void _dwmac4_dump_dma_regs(struct stmmac_priv *priv,
 		readl(ioaddr + DMA_CHAN_TX_CONTROL(dwmac4_addrs, channel));
 	reg_space[DMA_CHAN_RX_CONTROL(default_addrs, channel) / 4] =
 		readl(ioaddr + DMA_CHAN_RX_CONTROL(dwmac4_addrs, channel));
+	reg_space[DMA_CHAN_TX_BASE_ADDR_HI(default_addrs, channel) / 4] =
+		readl(ioaddr + DMA_CHAN_TX_BASE_ADDR_HI(dwmac4_addrs, channel));
 	reg_space[DMA_CHAN_TX_BASE_ADDR(default_addrs, channel) / 4] =
 		readl(ioaddr + DMA_CHAN_TX_BASE_ADDR(dwmac4_addrs, channel));
+	reg_space[DMA_CHAN_RX_BASE_ADDR_HI(default_addrs, channel) / 4] =
+		readl(ioaddr + DMA_CHAN_RX_BASE_ADDR_HI(dwmac4_addrs, channel));
 	reg_space[DMA_CHAN_RX_BASE_ADDR(default_addrs, channel) / 4] =
 		readl(ioaddr + DMA_CHAN_RX_BASE_ADDR(dwmac4_addrs, channel));
 	reg_space[DMA_CHAN_TX_END_ADDR(default_addrs, channel) / 4] =
@@ -225,8 +229,12 @@ static void _dwmac4_dump_dma_regs(struct stmmac_priv *priv,
 		readl(ioaddr + DMA_CHAN_CUR_TX_DESC(dwmac4_addrs, channel));
 	reg_space[DMA_CHAN_CUR_RX_DESC(default_addrs, channel) / 4] =
 		readl(ioaddr + DMA_CHAN_CUR_RX_DESC(dwmac4_addrs, channel));
+	reg_space[DMA_CHAN_CUR_TX_BUF_ADDR_HI(default_addrs, channel) / 4] =
+		readl(ioaddr + DMA_CHAN_CUR_TX_BUF_ADDR_HI(dwmac4_addrs, channel));
 	reg_space[DMA_CHAN_CUR_TX_BUF_ADDR(default_addrs, channel) / 4] =
 		readl(ioaddr + DMA_CHAN_CUR_TX_BUF_ADDR(dwmac4_addrs, channel));
+	reg_space[DMA_CHAN_CUR_RX_BUF_ADDR_HI(default_addrs, channel) / 4] =
+		readl(ioaddr + DMA_CHAN_CUR_RX_BUF_ADDR_HI(dwmac4_addrs, channel));
 	reg_space[DMA_CHAN_CUR_RX_BUF_ADDR(default_addrs, channel) / 4] =
 		readl(ioaddr + DMA_CHAN_CUR_RX_BUF_ADDR(dwmac4_addrs, channel));
 	reg_space[DMA_CHAN_STATUS(default_addrs, channel) / 4] =
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h
index 17d9120db5fe..4f980dcd3958 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h
@@ -127,7 +127,9 @@ static inline u32 dma_chanx_base_addr(const struct dwmac4_addrs *addrs,
 #define DMA_CHAN_SLOT_CTRL_STATUS(addrs, x)	(dma_chanx_base_addr(addrs, x) + 0x3c)
 #define DMA_CHAN_CUR_TX_DESC(addrs, x)	(dma_chanx_base_addr(addrs, x) + 0x44)
 #define DMA_CHAN_CUR_RX_DESC(addrs, x)	(dma_chanx_base_addr(addrs, x) + 0x4c)
+#define DMA_CHAN_CUR_TX_BUF_ADDR_HI(addrs, x)	(dma_chanx_base_addr(addrs, x) + 0x50)
 #define DMA_CHAN_CUR_TX_BUF_ADDR(addrs, x)	(dma_chanx_base_addr(addrs, x) + 0x54)
+#define DMA_CHAN_CUR_RX_BUF_ADDR_HI(addrs, x)	(dma_chanx_base_addr(addrs, x) + 0x58)
 #define DMA_CHAN_CUR_RX_BUF_ADDR(addrs, x)	(dma_chanx_base_addr(addrs, x) + 0x5c)
 #define DMA_CHAN_STATUS(addrs, x)	(dma_chanx_base_addr(addrs, x) + 0x60)
 
-- 
2.34.1


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

* Re: [PATCH net-next 1/4] net: stmmac: dwmac4: Fix MTL_OP_MODE_RTC mask and shift macros
  2024-10-15  6:57 ` [PATCH net-next 1/4] net: stmmac: dwmac4: Fix MTL_OP_MODE_RTC mask and shift macros Ley Foon Tan
@ 2024-10-16  2:10   ` Jakub Kicinski
  0 siblings, 0 replies; 7+ messages in thread
From: Jakub Kicinski @ 2024-10-16  2:10 UTC (permalink / raw)
  To: Ley Foon Tan
  Cc: Alexandre Torgue, Jose Abreu, David S . Miller, Eric Dumazet,
	Paolo Abeni, netdev, linux-kernel, lftan.linux

On Tue, 15 Oct 2024 14:57:05 +0800 Ley Foon Tan wrote:
> RTC fields are located in bits [1:0]. Correct the _MASK and _SHIFT
> macros to use the appropriate mask and shift.
> 
> Fixes: 35f74c0c5dce ("stmmac: add GMAC4 DMA/CORE Header File")
> 
> Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>

no empty line between Fixes and Signed-off-by lines, please.

Please fix and resend with [PATCH net] in the title.
All fixes which are needed in current Linus's tree need to go to net,
rather than net-next, see:
https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#git-trees-and-patch-flow
-- 
pw-bot: cr

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

* RE: [PATCH net-next 1/4] net: stmmac: dwmac4: Fix MTL_OP_MODE_RTC mask and shift macros
@ 2024-10-16  2:25 Leyfoon Tan
  0 siblings, 0 replies; 7+ messages in thread
From: Leyfoon Tan @ 2024-10-16  2:25 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Alexandre Torgue, Jose Abreu, David S . Miller, Eric Dumazet,
	Paolo Abeni, netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	lftan.linux@gmai.com



> -----Original Message-----
> From: Jakub Kicinski <kuba@kernel.org>
> Sent: Wednesday, October 16, 2024 10:10 AM
> To: Leyfoon Tan <leyfoon.tan@starfivetech.com>
> Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>; Jose Abreu
> <joabreu@synopsys.com>; David S . Miller <davem@davemloft.net>; Eric
> Dumazet <edumazet@google.com>; Paolo Abeni <pabeni@redhat.com>;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org; lftan.linux@gmai.com
> Subject: Re: [PATCH net-next 1/4] net: stmmac: dwmac4: Fix
> MTL_OP_MODE_RTC mask and shift macros
> 
> On Tue, 15 Oct 2024 14:57:05 +0800 Ley Foon Tan wrote:
> > RTC fields are located in bits [1:0]. Correct the _MASK and _SHIFT
> > macros to use the appropriate mask and shift.
> >
> > Fixes: 35f74c0c5dce ("stmmac: add GMAC4 DMA/CORE Header File")
> >
> > Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
> 
> no empty line between Fixes and Signed-off-by lines, please.
> 
> Please fix and resend with [PATCH net] in the title.
> All fixes which are needed in current Linus's tree need to go to net, rather
> than net-next, see:
> https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#git-
> trees-and-patch-flow
> --
> pw-bot: cr

Noted, will resend.

Thanks.
Regards
Ley Foon

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

end of thread, other threads:[~2024-10-16  6:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-15  6:57 [PATCH net-next 0/4] net: stmmac: dwmac4: Fixes and improvements Ley Foon Tan
2024-10-15  6:57 ` [PATCH net-next 1/4] net: stmmac: dwmac4: Fix MTL_OP_MODE_RTC mask and shift macros Ley Foon Tan
2024-10-16  2:10   ` Jakub Kicinski
2024-10-15  6:57 ` [PATCH net-next 2/4] net: stmmac: dwmac4: Fix the MTL_OP_MODE_*_MASK operation Ley Foon Tan
2024-10-15  6:57 ` [PATCH net-next 3/4] net: stmmac: dwmac4: Receive Watchdog Timeout is not in abnormal interrupt summary Ley Foon Tan
2024-10-15  6:57 ` [PATCH net-next 4/4] net: stmmac: dwmac4: Dump the DMA high address registers Ley Foon Tan
  -- strict thread matches above, loose matches on Subject: below --
2024-10-16  2:25 [PATCH net-next 1/4] net: stmmac: dwmac4: Fix MTL_OP_MODE_RTC mask and shift macros Leyfoon Tan

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