netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ethtool: add the stmmac support
@ 2010-09-28  9:51 Giuseppe CAVALLARO
  2010-10-06  5:36 ` Peppe CAVALLARO
  0 siblings, 1 reply; 4+ messages in thread
From: Giuseppe CAVALLARO @ 2010-09-28  9:51 UTC (permalink / raw)
  To: netdev; +Cc: Giuseppe Cavallaro

Add the stmmac support into the ethtool to
dump both the Mac Core and Dma registers.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
 Makefile.am    |    2 +-
 ethtool-util.h |    4 +++
 ethtool.c      |    2 +
 stmmac.c       |   66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 73 insertions(+), 1 deletions(-)
 create mode 100644 stmmac.c

diff --git a/Makefile.am b/Makefile.am
index 632f054..a0d2116 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -8,7 +8,7 @@ ethtool_SOURCES = ethtool.c ethtool-copy.h ethtool-util.h	\
 		  amd8111e.c de2104x.c e100.c e1000.c igb.c	\
 		  fec_8xx.c ibm_emac.c ixgb.c ixgbe.c natsemi.c	\
 		  pcnet32.c realtek.c tg3.c marvell.c vioc.c	\
-		  smsc911x.c at76c50x-usb.c sfc.c
+		  smsc911x.c at76c50x-usb.c sfc.c stmmac.c
 
 dist-hook:
 	cp $(top_srcdir)/ethtool.spec $(distdir)
diff --git a/ethtool-util.h b/ethtool-util.h
index 01b1d03..4ef3a9f 100644
--- a/ethtool-util.h
+++ b/ethtool-util.h
@@ -93,4 +93,8 @@ int at76c50x_usb_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *re
 /* Solarflare Solarstorm controllers */
 int sfc_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
 
+/* STMMAC embedded ethernet controller */
+int st_mac100_dump_regs(struct ethtool_drvinfo *info,
+			struct ethtool_regs *regs);
+int st_gmac_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
 #endif
diff --git a/ethtool.c b/ethtool.c
index 6b2b7c8..ab69b95 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -1539,6 +1539,8 @@ static struct {
         { "smsc911x", smsc911x_dump_regs },
         { "at76c50x-usb", at76c50x_usb_dump_regs },
         { "sfc", sfc_dump_regs },
+	{ "st_mac100", st_mac100_dump_regs },
+	{ "st_gmac", st_gmac_dump_regs },
 };
 
 static int dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
diff --git a/stmmac.c b/stmmac.c
new file mode 100644
index 0000000..ad4311c
--- /dev/null
+++ b/stmmac.c
@@ -0,0 +1,66 @@
+/****************************************************************************
+ * Support for the Synopsys MAC 10/100/1000 on-chip Ethernet controllers
+ *
+ * Copyright (C) 2010  STMicroelectronics Ltd
+ *
+ * Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation, incorporated herein by reference.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include "ethtool-util.h"
+
+int st_mac100_dump_regs(struct ethtool_drvinfo *info,
+			struct ethtool_regs *regs)
+{
+	int i;
+	unsigned int *stmmac_reg = (unsigned int *)regs->data;
+
+	fprintf(stdout, "ST MAC 10/100 Registers\n");
+	fprintf(stdout, "control reg  0x%08X\n", *stmmac_reg++);
+	fprintf(stdout, "addr HI 0x%08X\n", *stmmac_reg++);
+	fprintf(stdout, "addr LO 0x%08X\n", *stmmac_reg++);
+	fprintf(stdout, "multicast hash HI 0x%08X\n", *stmmac_reg++);
+	fprintf(stdout, "multicast hash LO 0x%08X\n", *stmmac_reg++);
+	fprintf(stdout, "MII addr 0x%08X\n", *stmmac_reg++);
+	fprintf(stdout, "MII data %08X\n", *stmmac_reg++);
+	fprintf(stdout, "flow control 0x%08X\n", *stmmac_reg++);
+	fprintf(stdout, "VLAN1 tag 0x%08X\n", *stmmac_reg++);
+	fprintf(stdout, "VLAN2 tag 0x%08X\n", *stmmac_reg++);
+	fprintf(stdout, "mac wakeup frame 0x%08X\n", *stmmac_reg++);
+	fprintf(stdout, "mac wakeup crtl 0x%08X\n", *stmmac_reg++);
+
+	fprintf(stdout, "\n");
+	fprintf(stdout, "DMA Registers\n");
+	for (i = 0; i < 9; i++)
+		fprintf(stdout, "CSR%d  0x%08X\n", i, *stmmac_reg++);
+
+	fprintf(stdout, "DMA cur tx buf addr 0x%08X\n", *stmmac_reg++);
+	fprintf(stdout, "DMA cur rx buf addr 0x%08X\n", *stmmac_reg++);
+
+	fprintf(stdout, "\n");
+
+	return 0;
+}
+
+int st_gmac_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
+{
+	int i;
+	unsigned int *stmmac_reg = (unsigned int *)regs->data;
+
+	fprintf(stdout, "ST GMAC Registers\n");
+	fprintf(stdout, "GMAC Registers\n");
+	for (i = 0; i < 55; 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++)
+		fprintf(stdout, "Reg%d  0x%08X\n", i, *stmmac_reg++);
+
+	return 0;
+}
-- 
1.5.5.6


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

* Re: [PATCH] ethtool: add the stmmac support
  2010-09-28  9:51 [PATCH] ethtool: add the stmmac support Giuseppe CAVALLARO
@ 2010-10-06  5:36 ` Peppe CAVALLARO
  2010-10-07 13:13   ` Ben Hutchings
  0 siblings, 1 reply; 4+ messages in thread
From: Peppe CAVALLARO @ 2010-10-06  5:36 UTC (permalink / raw)
  To: netdev@vger.kernel.org

Hello,

On 09/28/2010 11:51 AM, Giuseppe CAVALLARO wrote:
> Add the stmmac support into the ethtool to
> dump both the Mac Core and Dma registers.

Any news for this patch?

The stmmac is now working on several platforms (not only on STM ST40
based boxes). I think it's worth having the ethtool support for the driver.

Welcome review and advice as usual.

Regards
Peppe

> 
> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> ---
> Makefile.am | 2 +-
> ethtool-util.h | 4 +++
> ethtool.c | 2 +
> stmmac.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 73 insertions(+), 1 deletions(-)
> create mode 100644 stmmac.c
> 
> diff --git a/Makefile.am b/Makefile.am
> index 632f054..a0d2116 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -8,7 +8,7 @@ ethtool_SOURCES = ethtool.c ethtool-copy.h ethtool-util.h \
> amd8111e.c de2104x.c e100.c e1000.c igb.c \
> fec_8xx.c ibm_emac.c ixgb.c ixgbe.c natsemi.c \
> pcnet32.c realtek.c tg3.c marvell.c vioc.c \
> - smsc911x.c at76c50x-usb.c sfc.c
> + smsc911x.c at76c50x-usb.c sfc.c stmmac.c
> 
> dist-hook:
> cp $(top_srcdir)/ethtool.spec $(distdir)
> diff --git a/ethtool-util.h b/ethtool-util.h
> index 01b1d03..4ef3a9f 100644
> --- a/ethtool-util.h
> +++ b/ethtool-util.h
> @@ -93,4 +93,8 @@ int at76c50x_usb_dump_regs(struct ethtool_drvinfo *info, 
> struct ethtool_regs *re
> /* Solarflare Solarstorm controllers */
> int sfc_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
> 
> +/* STMMAC embedded ethernet controller */
> +int st_mac100_dump_regs(struct ethtool_drvinfo *info,
> + struct ethtool_regs *regs);
> +int st_gmac_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
> #endif
> diff --git a/ethtool.c b/ethtool.c
> index 6b2b7c8..ab69b95 100644
> --- a/ethtool.c
> +++ b/ethtool.c
> @@ -1539,6 +1539,8 @@ static struct {
> { "smsc911x", smsc911x_dump_regs },
> { "at76c50x-usb", at76c50x_usb_dump_regs },
> { "sfc", sfc_dump_regs },
> + { "st_mac100", st_mac100_dump_regs },
> + { "st_gmac", st_gmac_dump_regs },
> };
> 
> static int dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
> diff --git a/stmmac.c b/stmmac.c
> new file mode 100644
> index 0000000..ad4311c
> --- /dev/null
> +++ b/stmmac.c
> @@ -0,0 +1,66 @@
> +/****************************************************************************
> + * Support for the Synopsys MAC 10/100/1000 on-chip Ethernet controllers
> + *
> + * Copyright (C) 2010 STMicroelectronics Ltd
> + *
> + * Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License version 2 as published
> + * by the Free Software Foundation, incorporated herein by reference.
> + */
> +
> +#include <stdio.h>
> +#include <string.h>
> +#include "ethtool-util.h"
> +
> +int st_mac100_dump_regs(struct ethtool_drvinfo *info,
> + struct ethtool_regs *regs)
> +{
> + int i;
> + unsigned int *stmmac_reg = (unsigned int *)regs->data;
> +
> + fprintf(stdout, "ST MAC 10/100 Registers\n");
> + fprintf(stdout, "control reg 0x%08X\n", *stmmac_reg++);
> + fprintf(stdout, "addr HI 0x%08X\n", *stmmac_reg++);
> + fprintf(stdout, "addr LO 0x%08X\n", *stmmac_reg++);
> + fprintf(stdout, "multicast hash HI 0x%08X\n", *stmmac_reg++);
> + fprintf(stdout, "multicast hash LO 0x%08X\n", *stmmac_reg++);
> + fprintf(stdout, "MII addr 0x%08X\n", *stmmac_reg++);
> + fprintf(stdout, "MII data %08X\n", *stmmac_reg++);
> + fprintf(stdout, "flow control 0x%08X\n", *stmmac_reg++);
> + fprintf(stdout, "VLAN1 tag 0x%08X\n", *stmmac_reg++);
> + fprintf(stdout, "VLAN2 tag 0x%08X\n", *stmmac_reg++);
> + fprintf(stdout, "mac wakeup frame 0x%08X\n", *stmmac_reg++);
> + fprintf(stdout, "mac wakeup crtl 0x%08X\n", *stmmac_reg++);
> +
> + fprintf(stdout, "\n");
> + fprintf(stdout, "DMA Registers\n");
> + for (i = 0; i < 9; i++)
> + fprintf(stdout, "CSR%d 0x%08X\n", i, *stmmac_reg++);
> +
> + fprintf(stdout, "DMA cur tx buf addr 0x%08X\n", *stmmac_reg++);
> + fprintf(stdout, "DMA cur rx buf addr 0x%08X\n", *stmmac_reg++);
> +
> + fprintf(stdout, "\n");
> +
> + return 0;
> +}
> +
> +int st_gmac_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
> +{
> + int i;
> + unsigned int *stmmac_reg = (unsigned int *)regs->data;
> +
> + fprintf(stdout, "ST GMAC Registers\n");
> + fprintf(stdout, "GMAC Registers\n");
> + for (i = 0; i < 55; 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++)
> + fprintf(stdout, "Reg%d 0x%08X\n", i, *stmmac_reg++);
> +
> + return 0;
> +}
> --
> 1.5.5.6
> 

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

* Re: [PATCH] ethtool: add the stmmac support
  2010-10-06  5:36 ` Peppe CAVALLARO
@ 2010-10-07 13:13   ` Ben Hutchings
  2010-10-12 13:26     ` Peppe CAVALLARO
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Hutchings @ 2010-10-07 13:13 UTC (permalink / raw)
  To: Peppe CAVALLARO; +Cc: netdev@vger.kernel.org

On Wed, 2010-10-06 at 07:36 +0200, Peppe CAVALLARO wrote:
> Hello,
> 
> On 09/28/2010 11:51 AM, Giuseppe CAVALLARO wrote:
> > Add the stmmac support into the ethtool to
> > dump both the Mac Core and Dma registers.
> 
> Any news for this patch?
> 
> The stmmac is now working on several platforms (not only on STM ST40
> based boxes). I think it's worth having the ethtool support for the driver.
> 
> Welcome review and advice as usual.
[...]

You need to send ethtool patches to the ethtool maintainer, Jeff Garzik
<jgarzik@pobox.com>.  I expect he'll make an ethtool release shortly
after Linux 2.6.36, and will apply patches then.

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


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

* Re: [PATCH] ethtool: add the stmmac support
  2010-10-07 13:13   ` Ben Hutchings
@ 2010-10-12 13:26     ` Peppe CAVALLARO
  0 siblings, 0 replies; 4+ messages in thread
From: Peppe CAVALLARO @ 2010-10-12 13:26 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: netdev@vger.kernel.org

 On 10/7/2010 3:13 PM, Ben Hutchings wrote:
>
> On Wed, 2010-10-06 at 07:36 +0200, Peppe CAVALLARO wrote:
> > Hello,
> >
> > On 09/28/2010 11:51 AM, Giuseppe CAVALLARO wrote:
> > > Add the stmmac support into the ethtool to
> > > dump both the Mac Core and Dma registers.
> >
> > Any news for this patch?
> >
> > The stmmac is now working on several platforms (not only on STM ST40
> > based boxes). I think it's worth having the ethtool support for the
> driver.
> >
> > Welcome review and advice as usual.
> [...]
>
> You need to send ethtool patches to the ethtool maintainer, Jeff Garzik
> <jgarzik@pobox.com>.  I expect he'll make an ethtool release shortly
> after Linux 2.6.36, and will apply patches then.
>
Hi Ben
many thanks.
I'll sent the patch again adding in copy the Jeff Garzik.

Regards
Peppe

> Ben.
>
> --
> Ben Hutchings, Senior Software Engineer, Solarflare Communications
> Not speaking for my employer; that's the marketing department's job.
> They asked us to note that Solarflare product names are trademarked.
>

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

end of thread, other threads:[~2010-10-12 13:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-28  9:51 [PATCH] ethtool: add the stmmac support Giuseppe CAVALLARO
2010-10-06  5:36 ` Peppe CAVALLARO
2010-10-07 13:13   ` Ben Hutchings
2010-10-12 13:26     ` Peppe CAVALLARO

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