NetBSD-Bugs archive

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

kern/47245: Add AX88772B support to axe(4), e.g. for DLINK DUB-E100 C1



>Number:         47245
>Category:       kern
>Synopsis:       Add AX88772B support to axe(4), e.g. for DLINK DUB-E100 C1
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Nov 25 22:10:00 +0000 2012
>Originator:     Toby Karyadi
>Release:        current
>Organization:
>Environment:
NetBSD kowari.simplecubes.com 6.99.15 NetBSD 6.99.15 (SHEEVAAXE) #2: Sat Nov 24 
20:15:44 EST 2012  
archie%zutu.simplecubes.com@localhost:/mnt/v01/build/src/current/2012.11.17.05.20.00/obj/sys/arch/evbarm/compile/SHEEVAAXE
 evbarm
>Description:
The attached patchset adds support for AX88772B devices into the axe(4) driver. 
These changes incorporates the changes in openbsd on src/sys/dev/usb/if_axe.c, 
specifically revision 1.108 and 1.109 (and also the associated changes to 
if_axereg.h)

The impetus for this is because I was trying to use the DLINK DUB-E100 rev C1 
RJ45 USB 2.0 eth device on my SheevaPlug. I've tested these changes for that 
specific device by simply doing simultaneous incoming and outgoing scp. Note 
that the actual device mappings will be included as an addendum to this PR as a 
separate patchset.  
>How-To-Repeat:
N/A
>Fix:
--- src/sys/dev/usb/if_axe.c.orig       2012-08-24 05:01:23.000000000 -0400
+++ src/sys/dev/usb/if_axe.c    2012-11-24 19:15:31.000000000 -0500
@@ -145,6 +145,7 @@
        { { 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_AX88178}, AX178 },
        { { USB_VENDOR_ATEN,            USB_PRODUCT_ATEN_UC210T}, 0 },
        { { USB_VENDOR_BELKIN,          USB_PRODUCT_BELKIN_F5D5055 }, AX178 },
@@ -918,12 +919,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;
@@ -1241,7 +1244,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;
--- src/sys/dev/usb/if_axereg.h.orig    2012-02-02 14:43:07.000000000 -0500
+++ src/sys/dev/usb/if_axereg.h 2012-11-17 17:45:26.000000000 -0500
@@ -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