Skip to contentSkip to conversation

ethtool: stmmac: Fix DMA register dump

PATCH Superseded [email protected] 2 participants 5 messages Jun 27, 2017 – Jun 28, 2017

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover ethtool: stmmac: Fix DMA register dump

From: Thor Thayer <[email protected]>

The DMA register dump structure changed which requires this change to the indexing of the DMA registers.
Also dump the DMA HW Feature Register.

Thor Thayer (2):
ethtool: stmmac: Fix Designware ethtool register dump
ethtool: stmmac: Add DMA HW Feature Register

 stmmac.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/2 ethtool: stmmac: Fix Designware ethtool register dump

From: Thor Thayer <[email protected]>

The commit fbf68229ffe7 ("net: stmmac: unify registers dumps methods")

modified the register dump to store the DMA registers at the DMA register offset (0x1000) but ethtool (stmmac.c) looks for the DMA registers after the MAC registers which is offset 12.
This patch adds the DMA register offset so that indexing is correct.

---
 stmmac.c | 5 +++++
 1 file changed, 5 insertions(+)
stmmac.c +5 -0
index fb69bfe..e1bb291 100644
@@ -14,6 +14,9 @@
 #include <string.h>
 #include "internal.h"
 
+/* The DMA Registers start at offset 0x1000 in the DW IP */
+#define DMA_REG_OFFSET	(0x1000 / 4)
+
 int st_mac100_dump_regs(struct ethtool_drvinfo *info,
 			struct ethtool_regs *regs)
 {
@@ -36,6 +39,7 @@ int st_mac100_dump_regs(struct ethtool_drvinfo *info,
 
 	fprintf(stdout, "\n");
 	fprintf(stdout, "DMA Registers\n");
+	stmmac_reg = (unsigned int *)regs->data + DMA_REG_OFFSET;
 	for (i = 0; i < 9; i++)
 		fprintf(stdout, "CSR%d  0x%08X\n", i, *stmmac_reg++);
 
@@ -59,6 +63,7 @@ int st_gmac_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
 
 	fprintf(stdout, "\n");
 	fprintf(stdout, "DMA Registers\n");
+	stmmac_reg = (unsigned int *)regs->data + DMA_REG_OFFSET;
 	for (i = 0; i < 22; i++)
 		fprintf(stdout, "Reg%d  0x%08X\n", i, *stmmac_reg++);
 
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/2 ethtool: stmmac: Add DMA HW Feature Register

In reply to [email protected]

From: Thor Thayer <[email protected]>

This patch adds the DMA HW Feature Register which is at the end of the DMA registers and is documented in Version 3.70a.

---
 stmmac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
stmmac.c +1 -1
index e1bb291..7d7bebd 100644
@@ -64,7 +64,7 @@ int st_gmac_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
 	fprintf(stdout, "\n");
 	fprintf(stdout, "DMA Registers\n");
 	stmmac_reg = (unsigned int *)regs->data + DMA_REG_OFFSET;
-	for (i = 0; i < 22; i++)
+	for (i = 0; i < 23; i++)
 		fprintf(stdout, "Reg%d  0x%08X\n", i, *stmmac_reg++);
 
 	return 0;
Signature · 1 line
2.7.4
#3 lore raw

Re: [PATCH 2/2] ethtool: stmmac: Add DMA HW Feature Register

Quoted 15 lines · On 6/27/2017 11:51 PM, [email protected] wrote:

From: Thor Thayer <[email protected]>

This patch adds the DMA HW Feature Register which is at the end of the DMA registers and is documented in Version 3.70a.

---
  stmmac.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
stmmac.c +0 -0
index e1bb291..7d7bebd 100644

stmmac.c int st_gmac_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs) · line 67

Quoted 5 lines
stmmac.c +1 -1
@@ -64,7 +64,7 @@ int st_gmac_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
  	fprintf(stdout, "\n");
  	fprintf(stdout, "DMA Registers\n");
  	stmmac_reg = (unsigned int *)regs->data + DMA_REG_OFFSET;
-	for (i = 0; i < 22; i++)
+	for (i = 0; i < 23; i++)

thx Thor for these changes, I wonder if you could add a macro instead 23 while doing this kind of changes

Sorry if I didn't it in the past.

the, you can send the series with my Acked-by: Giuseppe Cavallaro <[email protected]>

Regards

peppe

Quoted 3 lines
stmmac.c +0 -0
  		fprintf(stdout, "Reg%d  0x%08X\n", i, *stmmac_reg++);
 
  	return 0;
#4 lore raw

Re: [PATCH 2/2] ethtool: stmmac: Add DMA HW Feature Register

Quoted 25 lines · Giuseppe CAVALLARO
Quoted 15 lines · On 6/27/2017 11:51 PM, [email protected] wrote:

From: Thor Thayer <[email protected]>

This patch adds the DMA HW Feature Register which is at the end of the DMA registers and is documented in Version 3.70a.

---
  stmmac.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
stmmac.c +0 -0
index e1bb291..7d7bebd 100644

stmmac.c int st_gmac_dump_regs(struct ethtool_drvinfo *info, · line 68

Quoted 6 lines
stmmac.c +1 -1
@@ -64,7 +64,7 @@ int st_gmac_dump_regs(struct ethtool_drvinfo *info, 
 struct ethtool_regs *regs)
      fprintf(stdout, "\n");
      fprintf(stdout, "DMA Registers\n");
      stmmac_reg = (unsigned int *)regs->data + DMA_REG_OFFSET;
-    for (i = 0; i < 22; i++)
+    for (i = 0; i < 23; i++)

thx Thor for these changes, I wonder if you could add a macro instead 23 while doing this kind of changes

Quoted 8 lines

Sorry if I didn't it in the past.

the, you can send the series with my Acked-by: Giuseppe Cavallaro <[email protected]>

Regards

peppe

Sure. I'll also add a macro for the # of main registers too (55). Some maintainers prefer the macros while others prefer the number to reduce the space.

Thanks for the quick review!

Thor

Quoted 6 lines
Quoted 3 lines
stmmac.c +0 -0
          fprintf(stdout, "Reg%d  0x%08X\n", i, *stmmac_reg++);
      return 0;