tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

axe(4) AX88772B extensions pullup to 6



I recently aquired some Asix AX88772B-based USB Ethernet adapters that axe(4)
would not support in 6.0, yet fortunately it did in -current.
I adapted the changes in -current needed to support the 772B with minimal 
changes to 6.0, please find them attached.
Could they be pulled up so 6.1 will support these devices?
--- sys/dev/usb/usbdevs.orig    2013-01-02 20:31:54.000000000 +0100
+++ sys/dev/usb/usbdevs 2013-01-03 19:08:36.000000000 +0100
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.607.2.6 2012/10/24 03:45:59 riz Exp $
+$NetBSD: usbdevs,v $
 
 /*
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -508,6 +508,7 @@
 vendor SWEEX2          0x177f  Sweex
 vendor MISC            0x1781  Misc Vendors
 vendor DISPLAYLINK     0x17e9  DisplayLink
+vendor LENOVO          0x17ef  Lenovo
 vendor E3C             0x18b4  E3C Technologies
 vendor AMIT            0x18c5  AMIT
 vendor QCOM            0x18e8  Qcom
@@ -829,6 +830,8 @@
 product ASIX AX88178           0x1780  AX88178 USB 2.0 10/100 Ethernet adapter
 product ASIX AX88772           0x7720  AX88772 USB 2.0 10/100 Ethernet adapter
 product ASIX AX88772A          0x772a  AX88772A USB 2.0 10/100 Ethernet adapter
+product ASIX AX88772B          0x772b  AX88772B USB 2.0 10/100 Ethernet adapter
+product ASIX AX88772B_1                0x7e2b  AX88772B1 USB 2.0 10/100 
Ethernet adapter
 
 /* ASUSTeK computer products */
 product ASUSTEK WL167G         0x1707  WL-167g USB2.0 WLAN Adapter
@@ -1194,6 +1197,7 @@
 /* D-Link products */
 /*product DLINK DSBS25         0x0100  DSB-S25 serial adapter*/
 product DLINK DUBE100          0x1a00  10/100 ethernet adapter
+product DLINK DUBE100C1                0x1a02  DUB-E100 rev C1
 product DLINK DSB650TX4                0x200c  10/100 ethernet adapter
 product DLINK DWL120E          0x3200  DWL-120 rev E
 product DLINK DWA130C          0x3301  DWA-130 rev C
@@ -1777,6 +1781,9 @@
 product LACIE HD               0xa601  Hard Disk
 product LACIE CDRW             0xa602  CD R/W
 
+/* Lenovo products */
+product LENOVO ETHERNET                0x7203  USB 2.0 Ethernet
+
 /* Lexar products */
 product LEXAR JUMPSHOT         0x0001  jumpSHOT CompactFlash Reader
 product LEXAR 2662WAR          0xa002  2662W-AR
--- sys/dev/usb/usbdevs.h.orig  2013-01-02 20:31:54.000000000 +0100
+++ sys/dev/usb/usbdevs.h       2013-01-03 19:09:13.000000000 +0100
@@ -1,10 +1,10 @@
-/*     $NetBSD: usbdevs.h,v 1.600.2.6 2012/10/24 03:46:49 riz Exp $    */
+/*     $NetBSD$        */
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *     NetBSD
+ *     NetBSD: usbdevs,v
  */
 
 /*
@@ -515,6 +515,7 @@
 #define        USB_VENDOR_SWEEX2       0x177f          /* Sweex */
 #define        USB_VENDOR_MISC 0x1781          /* Misc Vendors */
 #define        USB_VENDOR_DISPLAYLINK  0x17e9          /* DisplayLink */
+#define        USB_VENDOR_LENOVO       0x17ef          /* Lenovo */
 #define        USB_VENDOR_E3C  0x18b4          /* E3C Technologies */
 #define        USB_VENDOR_AMIT 0x18c5          /* AMIT */
 #define        USB_VENDOR_QCOM 0x18e8          /* Qcom */
@@ -836,6 +837,8 @@
 #define        USB_PRODUCT_ASIX_AX88178        0x1780          /* AX88178 USB 
2.0 10/100 Ethernet adapter */
 #define        USB_PRODUCT_ASIX_AX88772        0x7720          /* AX88772 USB 
2.0 10/100 Ethernet adapter */
 #define        USB_PRODUCT_ASIX_AX88772A       0x772a          /* AX88772A USB 
2.0 10/100 Ethernet adapter */
+#define        USB_PRODUCT_ASIX_AX88772B       0x772b          /* AX88772B USB 
2.0 10/100 Ethernet adapter */
+#define        USB_PRODUCT_ASIX_AX88772B_1     0x7e2b          /* AX88772B1 
USB 2.0 10/100 Ethernet adapter */
 
 /* ASUSTeK computer products */
 #define        USB_PRODUCT_ASUSTEK_WL167G      0x1707          /* WL-167g 
USB2.0 WLAN Adapter */
@@ -1201,6 +1204,7 @@
 /* D-Link products */
 /*product DLINK DSBS25         0x0100  DSB-S25 serial adapter*/
 #define        USB_PRODUCT_DLINK_DUBE100       0x1a00          /* 10/100 
ethernet adapter */
+#define        USB_PRODUCT_DLINK_DUBE100C1     0x1a02          /* DUB-E100 rev 
C1 */
 #define        USB_PRODUCT_DLINK_DSB650TX4     0x200c          /* 10/100 
ethernet adapter */
 #define        USB_PRODUCT_DLINK_DWL120E       0x3200          /* DWL-120 rev 
E */
 #define        USB_PRODUCT_DLINK_DWA130C       0x3301          /* DWA-130 rev 
C */
@@ -1784,6 +1788,9 @@
 #define        USB_PRODUCT_LACIE_HD    0xa601          /* Hard Disk */
 #define        USB_PRODUCT_LACIE_CDRW  0xa602          /* CD R/W */
 
+/* Lenovo products */
+#define        USB_PRODUCT_LENOVO_ETHERNET     0x7203          /* USB 2.0 
Ethernet */
+
 /* Lexar products */
 #define        USB_PRODUCT_LEXAR_JUMPSHOT      0x0001          /* jumpSHOT 
CompactFlash Reader */
 #define        USB_PRODUCT_LEXAR_2662WAR       0xa002          /* 2662W-AR */
--- sys/dev/usb/usbdevs_data.h.orig     2013-01-02 20:31:54.000000000 +0100
+++ sys/dev/usb/usbdevs_data.h  2013-01-03 19:09:13.000000000 +0100
@@ -1,10 +1,10 @@
-/*     $NetBSD: usbdevs_data.h,v 1.601.2.6 2012/10/24 03:46:49 riz Exp $       
*/
+/*     $NetBSD$        */
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *     NetBSD
+ *     NetBSD: usbdevs,v
  */
 
 /*
@@ -1839,6 +1839,10 @@
            "DisplayLink",
        },
        {
+           USB_VENDOR_LENOVO,
+           "Lenovo",
+       },
+       {
            USB_VENDOR_E3C,
            "E3C Technologies",
        },
@@ -2059,7 +2063,7 @@
            "GNU Radio USRP",
        },
 };
-const int usb_nvendors = 505;
+const int usb_nvendors = 506;
 
 const struct usb_product usb_products[] = {
        {
@@ -2783,6 +2787,14 @@
            "AX88772A USB 2.0 10/100 Ethernet adapter",
        },
        {
+           USB_VENDOR_ASIX, USB_PRODUCT_ASIX_AX88772B,
+           "AX88772B USB 2.0 10/100 Ethernet adapter",
+       },
+       {
+           USB_VENDOR_ASIX, USB_PRODUCT_ASIX_AX88772B_1,
+           "AX88772B1 USB 2.0 10/100 Ethernet adapter",
+       },
+       {
            USB_VENDOR_ASUSTEK, USB_PRODUCT_ASUSTEK_WL167G,
            "WL-167g USB2.0 WLAN Adapter",
        },
@@ -3819,6 +3831,10 @@
            "10/100 ethernet adapter",
        },
        {
+           USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DUBE100C1,
+           "DUB-E100 rev C1",
+       },
+       {
            USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DSB650TX4,
            "10/100 ethernet adapter",
        },
@@ -5447,6 +5463,10 @@
            "CD R/W",
        },
        {
+           USB_VENDOR_LENOVO, USB_PRODUCT_LENOVO_ETHERNET,
+           "USB 2.0 Ethernet",
+       },
+       {
            USB_VENDOR_LEXAR, USB_PRODUCT_LEXAR_JUMPSHOT,
            "jumpSHOT CompactFlash Reader",
        },
@@ -9135,4 +9155,4 @@
            "Prestige",
        },
 };
-const int usb_nproducts = 1768;
+const int usb_nproducts = 1772;
--- sys/dev/usb/if_axe.c.orig   2012-02-02 20:43:07.000000000 +0100
+++ sys/dev/usb/if_axe.c        2013-01-03 18:12:52.000000000 +0100
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_axe.c,v 1.51 2012/02/02 19:43:07 tls Exp $  */
+/*     $NetBSD: if_axe.c $     */
 /*     $OpenBSD: if_axe.c,v 1.96 2010/01/09 05:33:08 jsg Exp $ */
 
 /*
@@ -89,7 +89,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.51 2012/02/02 19:43:07 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v $");
 
 #if defined(__NetBSD__)
 #ifndef _MODULE
@@ -148,6 +148,8 @@
        { { USB_VENDOR_ASIX,            USB_PRODUCT_ASIX_AX88172}, 0 },
        { { USB_VENDOR_ASIX,            USB_PRODUCT_ASIX_AX88772}, AX772 },
        { { USB_VENDOR_ASIX,            USB_PRODUCT_ASIX_AX88772A}, AX772 },
+       { { USB_VENDOR_ASIX,            USB_PRODUCT_ASIX_AX88772B}, AX772 | 
AX772B },
+       { { USB_VENDOR_ASIX,            USB_PRODUCT_ASIX_AX88772B_1}, AX772 | 
AX772B },
        { { USB_VENDOR_ASIX,            USB_PRODUCT_ASIX_AX88178}, AX178 },
        { { USB_VENDOR_ATEN,            USB_PRODUCT_ATEN_UC210T}, 0 },
        { { USB_VENDOR_BELKIN,          USB_PRODUCT_BELKIN_F5D5055 }, AX178 },
@@ -156,9 +158,11 @@
        { { USB_VENDOR_COREGA,          USB_PRODUCT_COREGA_FETHER_USB2_TX }, 0},
        { { USB_VENDOR_DLINK,           USB_PRODUCT_DLINK_DUBE100}, 0 },
        { { USB_VENDOR_DLINK,           USB_PRODUCT_DLINK_DUBE100B1 }, AX772 },
+       { { USB_VENDOR_DLINK,           USB_PRODUCT_DLINK_DUBE100C1 }, AX772 | 
AX772B },
        { { USB_VENDOR_GOODWAY,         USB_PRODUCT_GOODWAY_GWUSB2E}, 0 },
        { { USB_VENDOR_IODATA,          USB_PRODUCT_IODATA_ETGUS2 }, AX178 },
        { { USB_VENDOR_JVC,             USB_PRODUCT_JVC_MP_PRX1}, 0 },
+       { { USB_VENDOR_LENOVO,          USB_PRODUCT_LENOVO_ETHERNET }, AX772 | 
AX772B },
        { { USB_VENDOR_LINKSYS2,        USB_PRODUCT_LINKSYS2_USB200M}, 0 },
        { { USB_VENDOR_LINKSYS4,        USB_PRODUCT_LINKSYS4_USB1000 }, AX178 },
        { { USB_VENDOR_LOGITEC,         USB_PRODUCT_LOGITEC_LAN_GTJU2}, AX178 },
@@ -602,7 +606,8 @@
 
        err = usbd_set_config_no(dev, AXE_CONFIG_NO, 1);
        if (err) {
-               aprint_error_dev(self, "getting interface handle failed\n");
+               aprint_error_dev(self, "failed to set configuration"
+                   ", err=%s\n", usbd_errstr(err));
                return;
        }
 
@@ -921,12 +926,14 @@
                        total_len -= sizeof(hdr);
                        buf += sizeof(hdr);
 
-                       if ((hdr.len ^ hdr.ilen) != 0xffff) {
+                       if (((le16toh(hdr.len) & AXE_RH1M_RXLEN_MASK) ^
+                           (le16toh(hdr.ilen) & AXE_RH1M_RXLEN_MASK)) != 
+                           AXE_RH1M_RXLEN_MASK) {              
                                ifp->if_ierrors++;
                                goto done;
                        }
 
-                       rxlen = le16toh(hdr.len);
+                       rxlen = le16toh(hdr.len & AXE_RH1M_RXLEN_MASK);
                        if (total_len < rxlen) {
                                pktlen = total_len;
                                total_len = 0;
@@ -1244,7 +1251,9 @@
 
        /* Enable receiver, set RX mode */
        rxmode = AXE_RXCMD_BROADCAST | AXE_RXCMD_MULTICAST | AXE_RXCMD_ENABLE;
-       if (sc->axe_flags & AX178 || sc->axe_flags & AX772) {
+       if (sc->axe_flags & AX772B)
+               rxmode |= AXE_772B_RXCMD_RH1M;
+       else if (sc->axe_flags & AX178 || sc->axe_flags & AX772) {
                if (sc->axe_udev->speed == USB_SPEED_HIGH) {
                        /* Largest possible USB buffer size for AX88178 */
                        rxmode |= AXE_178_RXCMD_MFB;
--- sys/dev/usb/if_axereg.h.orig        2012-02-02 20:43:07.000000000 +0100
+++ sys/dev/usb/if_axereg.h     2013-01-03 19:12:04.000000000 +0100
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_axereg.h,v 1.14 2012/02/02 19:43:07 tls Exp $       */
+/*     $NetBSD: if_axereg.h,v */
 
 /*
  * Copyright (c) 1997, 1998, 1999, 2000-2003
@@ -134,6 +134,12 @@
 #define AXE_NOPHY                              0xE0
 #define AXE_INTPHY                             0x10
 
+#define AXE_772B_RXCMD_RH1M    0x0100
+#define AXE_772B_RXCMD_RH2M    0x0200
+#define AXE_772B_RXCMD_RH3M    0x0400
+
+#define AXE_RH1M_RXLEN_MASK    0x07ff
+
 #define AXE_TIMEOUT            1000
 
 #define AXE_172_BUFSZ          1536
@@ -167,6 +173,7 @@
        uint16_t                axe_flags;
 #define AX178          0x0001          /* AX88178 */
 #define AX772          0x0002          /* AX88772 */
+#define AX772B         0x0004          /* AX88772B */
 #define AXE_ANY_PHY    0x1000          /* Chip lies about valid phys */
 #define AXE_MII                0x2000          /* Chip-specific MII handling */
 };


Home | Main Index | Thread Index | Old Index