Skip to contentSkip to conversation

ethtool: stmmac: Add macros for number of registers

PATCH New [email protected] 1 participant 2 messages Jul 7, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 ethtool: stmmac: Add macros for number of registers

From: Thor Thayer <[email protected]>

This patch adds macros for the number of registers to loop through to make the code easier to read.

---
v2 New commit. Add macros for number of registers. v3 Only add macros - remove DMA indexing.

---
 stmmac.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
stmmac.c +7 -3
index fb69bfe..23ed31a 100644
@@ -14,6 +14,10 @@
 #include <string.h>
 #include "internal.h"
 
+#define MAC100_DMA_REG_NUM	9
+#define GMAC_REG_NUM		55
+#define GMAC_DMA_REG_NUM	22
+
 int st_mac100_dump_regs(struct ethtool_drvinfo *info,
 			struct ethtool_regs *regs)
 {
@@ -36,7 +40,7 @@ int st_mac100_dump_regs(struct ethtool_drvinfo *info,
 
 	fprintf(stdout, "\n");
 	fprintf(stdout, "DMA Registers\n");
-	for (i = 0; i < 9; i++)
+	for (i = 0; i < MAC100_DMA_REG_NUM; i++)
 		fprintf(stdout, "CSR%d  0x%08X\n", i, *stmmac_reg++);
 
 	fprintf(stdout, "DMA cur tx buf addr 0x%08X\n", *stmmac_reg++);
@@ -54,12 +58,12 @@ int st_gmac_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
 
 	fprintf(stdout, "ST GMAC Registers\n");
 	fprintf(stdout, "GMAC Registers\n");
-	for (i = 0; i < 55; i++)
+	for (i = 0; i < GMAC_REG_NUM; i++)
 		fprintf(stdout, "Reg%d  0x%08X\n", i, *stmmac_reg++);
 
 	fprintf(stdout, "\n");
 	fprintf(stdout, "DMA Registers\n");
-	for (i = 0; i < 22; i++)
+	for (i = 0; i < GMAC_DMA_REG_NUM; i++)
 		fprintf(stdout, "Reg%d  0x%08X\n", i, *stmmac_reg++);
 
 	return 0;
Signature · 1 line
2.7.4
#1 lore raw

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

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.

---
v2 Modify for MACRO changes and add Acked-by
v3 No change

---
 stmmac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
stmmac.c +1 -1
index 23ed31a..79ef151 100644
@@ -16,7 +16,7 @@
 
 #define MAC100_DMA_REG_NUM	9
 #define GMAC_REG_NUM		55
-#define GMAC_DMA_REG_NUM	22
+#define GMAC_DMA_REG_NUM	23
 
 int st_mac100_dump_regs(struct ethtool_drvinfo *info,
 			struct ethtool_regs *regs)
Signature · 1 line
2.7.4