Re: [PATCHv2 1/3] ethtool: stmmac: Fix Designware ethtool register dump

2017-07-07 Thread Giuseppe CAVALLARO

On 7/6/2017 10:22 PM, Thor Thayer wrote:

On 06/28/2017 10:13 AM, thor.tha...@linux.intel.com wrote:

From: Thor Thayer 

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

in the Linux kernel 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.

Signed-off-by: Thor Thayer 
Acked-by: Giuseppe Cavallaro 
---
v2  Modify the commit message to specify commit from Linux kernel.
 Add Acked-by.
---


Please disregard this patch.

After further reflection, it would be better to leave this alone and 
change the kernel driver. This change would require using different 
ethtool for different versions.


The other 2 patches with macro changes are still valid.


I think it is better to resend a V3 with the two patches

Regards
Peppe



Thanks,

Thor


  stmmac.c | 5 +
  1 file changed, 5 insertions(+)

diff --git a/stmmac.c b/stmmac.c
index fb69bfe..e1bb291 100644
--- a/stmmac.c
+++ b/stmmac.c
@@ -14,6 +14,9 @@
  #include 
  #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++);








Re: [PATCHv2 1/3] ethtool: stmmac: Fix Designware ethtool register dump

2017-07-06 Thread Thor Thayer

On 06/28/2017 10:13 AM, thor.tha...@linux.intel.com wrote:

From: Thor Thayer 

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

in the Linux kernel 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.

Signed-off-by: Thor Thayer 
Acked-by: Giuseppe Cavallaro 
---
v2  Modify the commit message to specify commit from Linux kernel.
 Add Acked-by.
---


Please disregard this patch.

After further reflection, it would be better to leave this alone and 
change the kernel driver. This change would require using different 
ethtool for different versions.


The other 2 patches with macro changes are still valid.

Thanks,

Thor


  stmmac.c | 5 +
  1 file changed, 5 insertions(+)

diff --git a/stmmac.c b/stmmac.c
index fb69bfe..e1bb291 100644
--- a/stmmac.c
+++ b/stmmac.c
@@ -14,6 +14,9 @@
  #include 
  #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++);
  





[PATCHv2 1/3] ethtool: stmmac: Fix Designware ethtool register dump

2017-06-28 Thread thor . thayer
From: Thor Thayer 

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

in the Linux kernel 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.

Signed-off-by: Thor Thayer 
Acked-by: Giuseppe Cavallaro 
---
v2  Modify the commit message to specify commit from Linux kernel.
Add Acked-by.
---
 stmmac.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/stmmac.c b/stmmac.c
index fb69bfe..e1bb291 100644
--- a/stmmac.c
+++ b/stmmac.c
@@ -14,6 +14,9 @@
 #include 
 #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++);
 
-- 
2.7.4