netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2 0/3] ethtool: stmmac: Fix DMA register dump
@ 2017-06-28 15:13 thor.thayer
  2017-06-28 15:13 ` [PATCHv2 1/3] ethtool: stmmac: Fix Designware ethtool " thor.thayer
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: thor.thayer @ 2017-06-28 15:13 UTC (permalink / raw)
  To: linville, peppe.cavallaro; +Cc: netdev, thor.thayer

From: Thor Thayer <thor.thayer@linux.intel.com>

1. The DMA register dump structure changed which requires this
change to the indexing of the DMA registers.
2. Also dump the DMA HW Feature Register.
3. V2 also adds macros for the number of registers.

Thor Thayer (3):
  ethtool: stmmac: Fix Designware ethtool register dump
  ethtool: stmmac: Add macros for number of registers
  ethtool: stmmac: Add DMA HW Feature Register

 stmmac.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

-- 
2.7.4

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

* [PATCHv2 1/3] ethtool: stmmac: Fix Designware ethtool register dump
  2017-06-28 15:13 [PATCHv2 0/3] ethtool: stmmac: Fix DMA register dump thor.thayer
@ 2017-06-28 15:13 ` thor.thayer
  2017-07-06 20:22   ` Thor Thayer
  2017-06-28 15:13 ` [PATCHv2 2/3] ethtool: stmmac: Add macros for number of registers thor.thayer
  2017-06-28 15:13 ` [PATCHv2 3/3] ethtool: stmmac: Add DMA HW Feature Register thor.thayer
  2 siblings, 1 reply; 6+ messages in thread
From: thor.thayer @ 2017-06-28 15:13 UTC (permalink / raw)
  To: linville, peppe.cavallaro; +Cc: netdev, thor.thayer

From: Thor Thayer <thor.thayer@linux.intel.com>

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 <thor.thayer@linux.intel.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
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 <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++);
 
-- 
2.7.4

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

* [PATCHv2 2/3] ethtool: stmmac: Add macros for number of registers
  2017-06-28 15:13 [PATCHv2 0/3] ethtool: stmmac: Fix DMA register dump thor.thayer
  2017-06-28 15:13 ` [PATCHv2 1/3] ethtool: stmmac: Fix Designware ethtool " thor.thayer
@ 2017-06-28 15:13 ` thor.thayer
  2017-06-28 15:13 ` [PATCHv2 3/3] ethtool: stmmac: Add DMA HW Feature Register thor.thayer
  2 siblings, 0 replies; 6+ messages in thread
From: thor.thayer @ 2017-06-28 15:13 UTC (permalink / raw)
  To: linville, peppe.cavallaro; +Cc: netdev, thor.thayer

From: Thor Thayer <thor.thayer@linux.intel.com>

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

Signed-off-by: Thor Thayer <thor.thayer@linux.intel.com>
---
v2  New commit. Add macros for number of registers.
---
 stmmac.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/stmmac.c b/stmmac.c
index e1bb291..ab83779 100644
--- a/stmmac.c
+++ b/stmmac.c
@@ -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
+
 /* The DMA Registers start at offset 0x1000 in the DW IP */
 #define DMA_REG_OFFSET	(0x1000 / 4)
 
@@ -40,7 +44,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++)
+	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++);
@@ -58,13 +62,13 @@ 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");
 	stmmac_reg = (unsigned int *)regs->data + DMA_REG_OFFSET;
-	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;
-- 
2.7.4

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

* [PATCHv2 3/3] ethtool: stmmac: Add DMA HW Feature Register
  2017-06-28 15:13 [PATCHv2 0/3] ethtool: stmmac: Fix DMA register dump thor.thayer
  2017-06-28 15:13 ` [PATCHv2 1/3] ethtool: stmmac: Fix Designware ethtool " thor.thayer
  2017-06-28 15:13 ` [PATCHv2 2/3] ethtool: stmmac: Add macros for number of registers thor.thayer
@ 2017-06-28 15:13 ` thor.thayer
  2 siblings, 0 replies; 6+ messages in thread
From: thor.thayer @ 2017-06-28 15:13 UTC (permalink / raw)
  To: linville, peppe.cavallaro; +Cc: netdev, thor.thayer

From: Thor Thayer <thor.thayer@linux.intel.com>

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

Signed-off-by: Thor Thayer <thor.thayer@linux.intel.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
v2  Modify for MACRO changes and add Acked-by
---
 stmmac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/stmmac.c b/stmmac.c
index ab83779..e5d8c7b 100644
--- a/stmmac.c
+++ b/stmmac.c
@@ -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
 
 /* The DMA Registers start at offset 0x1000 in the DW IP */
 #define DMA_REG_OFFSET	(0x1000 / 4)
-- 
2.7.4

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

* Re: [PATCHv2 1/3] ethtool: stmmac: Fix Designware ethtool register dump
  2017-06-28 15:13 ` [PATCHv2 1/3] ethtool: stmmac: Fix Designware ethtool " thor.thayer
@ 2017-07-06 20:22   ` Thor Thayer
  2017-07-07  7:10     ` Giuseppe CAVALLARO
  0 siblings, 1 reply; 6+ messages in thread
From: Thor Thayer @ 2017-07-06 20:22 UTC (permalink / raw)
  To: linville, peppe.cavallaro; +Cc: netdev

On 06/28/2017 10:13 AM, thor.thayer@linux.intel.com wrote:
> From: Thor Thayer <thor.thayer@linux.intel.com>
> 
> 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 <thor.thayer@linux.intel.com>
> Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> ---
> 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 <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++);
>   
> 

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

* Re: [PATCHv2 1/3] ethtool: stmmac: Fix Designware ethtool register dump
  2017-07-06 20:22   ` Thor Thayer
@ 2017-07-07  7:10     ` Giuseppe CAVALLARO
  0 siblings, 0 replies; 6+ messages in thread
From: Giuseppe CAVALLARO @ 2017-07-07  7:10 UTC (permalink / raw)
  To: thor.thayer, linville; +Cc: netdev

On 7/6/2017 10:22 PM, Thor Thayer wrote:
> On 06/28/2017 10:13 AM, thor.thayer@linux.intel.com wrote:
>> From: Thor Thayer <thor.thayer@linux.intel.com>
>>
>> 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 <thor.thayer@linux.intel.com>
>> Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
>> ---
>> 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 <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++);
>>
>
>

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

end of thread, other threads:[~2017-07-07  7:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-28 15:13 [PATCHv2 0/3] ethtool: stmmac: Fix DMA register dump thor.thayer
2017-06-28 15:13 ` [PATCHv2 1/3] ethtool: stmmac: Fix Designware ethtool " thor.thayer
2017-07-06 20:22   ` Thor Thayer
2017-07-07  7:10     ` Giuseppe CAVALLARO
2017-06-28 15:13 ` [PATCHv2 2/3] ethtool: stmmac: Add macros for number of registers thor.thayer
2017-06-28 15:13 ` [PATCHv2 3/3] ethtool: stmmac: Add DMA HW Feature Register thor.thayer

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