Skip to contentSkip to conversation

ethtool: add support for at76c50x-usb driver

PATCH Applied John W. Linville 2 participants 2 messages Dec 23, 2009

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

PATCH 1/1 ethtool: add support for at76c50x-usb driver

---
 Makefile.am    |    2 +-
 at76c50x-usb.c |   32 ++++++++++++++++++++++++++++++++
 ethtool-util.h |    2 ++
 ethtool.c      |    1 +
 4 files changed, 36 insertions(+), 1 deletions(-)
 create mode 100644 at76c50x-usb.c
Makefile.am +1 -1
index eac65fe..a384949 100644
@@ -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
+		  smsc911x.c at76c50x-usb.c
 
 dist-hook:
 	cp $(top_srcdir)/ethtool.spec $(distdir)
at76c50x-usb.c new file +32 -0
new file mode 100644
index 0000000..241618c
@@ -0,0 +1,32 @@
+#include <stdio.h>
+#include "ethtool-util.h"
+
+static char *hw_versions[] = {
+        "503_ISL3861",
+        "503_ISL3863",
+        "        503",
+        "    503_ACC",
+        "        505",
+        "   505_2958",
+        "       505A",
+        "     505AMX",
+};
+
+int
+at76c50x_usb_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
+{
+	u8 version = (u8)(regs->version >> 24);
+	u8 rev_id = (u8)(regs->version);
+	char *ver_string;
+
+	if(version != 0)
+		return -1;
+
+	ver_string = hw_versions[rev_id];
+	fprintf(stdout,
+		"Hardware Version                    %s\n",
+		ver_string);
+
+	return 0;
+}
+
ethtool-util.h +2 -0
index 8ae7e47..bc66df7 100644
@@ -67,4 +67,6 @@ int vioc_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
 /* SMSC LAN911x/LAN921x embedded ethernet controller */
 int smsc911x_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
 
+int at76c50x_usb_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
+
 #endif
ethtool.c +1 -0
index 298b690..4b750a4 100644
@@ -1255,6 +1255,7 @@ static struct {
 	{ "sky2", sky2_dump_regs },
         { "vioc", vioc_dump_regs },
         { "smsc911x", smsc911x_dump_regs },
+        { "at76c50x-usb", at76c50x_usb_dump_regs },
 };
 
 static int dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
Signature · 1 line
1.6.2.5
Applied
#1 lore raw
Quoted 14 lines · John W. Linville
---
  Makefile.am    |    2 +-
  at76c50x-usb.c |   32 ++++++++++++++++++++++++++++++++
  ethtool-util.h |    2 ++
  ethtool.c      |    1 +
  4 files changed, 36 insertions(+), 1 deletions(-)

create mode 100644 at76c50x-usb.c

at76c50x-usb.c new file +5 -0
+at76c50x_usb_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
+{
+	u8 version = (u8)(regs->version>>  24);
+	u8 rev_id = (u8)(regs->version);
+	char *ver_string;

at76c50x-usb.c line 30

Quoted 10 lines
at76c50x-usb.c new file +10 -0
+
+	if (version != 0)
+		return -1;
+
+	ver_string = hw_versions[rev_id];
+	fprintf(stdout,
+		"Hardware Version                    %s\n",
+		ver_string);
+
+	return 0;

applied... don't forget to update 'version', should the register dump data passed to userspace ever change.