summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2012-03-01 04:33:16 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2012-03-01 04:33:16 +0000
commit24ed60b6e179322823d13280e20a48df07ceaec6 (patch)
treeca5f27649e9944931c7571a736aa35f4ce4a16fd /sys
parent2af6f02cba8000cf7ee90424505a3aafc1b253f8 (diff)
add support for AX88772B
tweaked version of a diff from jcs@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/usb/if_axe.c15
-rw-r--r--sys/dev/usb/if_axereg.h9
2 files changed, 19 insertions, 5 deletions
diff --git a/sys/dev/usb/if_axe.c b/sys/dev/usb/if_axe.c
index 2829a5eb175..033659d795c 100644
--- a/sys/dev/usb/if_axe.c
+++ b/sys/dev/usb/if_axe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_axe.c,v 1.107 2011/09/16 17:20:07 miod Exp $ */
+/* $OpenBSD: if_axe.c,v 1.108 2012/03/01 04:33:15 jsg Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Jonathan Gray <jsg@openbsd.org>
@@ -150,6 +150,7 @@ const struct axe_type axe_devs[] = {
{ { 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 },
@@ -765,6 +766,8 @@ axe_attach(struct device *parent, struct device *self, void *aux)
printf("%s:", sc->axe_dev.dv_xname);
if (sc->axe_flags & AX178)
printf(" AX88178");
+ else if (sc->axe_flags & AX772B)
+ printf(" AX88772B");
else if (sc->axe_flags & AX772)
printf(" AX88772");
else
@@ -1025,11 +1028,13 @@ axe_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
memcpy(&hdr, buf, sizeof(hdr));
total_len -= sizeof(hdr);
- if ((hdr.len ^ hdr.ilen) != 0xffff) {
+ if (((hdr.len & AXE_RH1M_RXLEN_MASK) ^
+ (hdr.ilen & AXE_RH1M_RXLEN_MASK)) !=
+ AXE_RH1M_RXLEN_MASK) {
ifp->if_ierrors++;
goto done;
}
- pktlen = letoh16(hdr.len);
+ pktlen = letoh16(hdr.len & AXE_RH1M_RXLEN_MASK);
if (pktlen > total_len) {
ifp->if_ierrors++;
goto done;
@@ -1334,7 +1339,9 @@ axe_init(void *xsc)
/* Enable receiver, set RX mode */
rxmode = 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;
diff --git a/sys/dev/usb/if_axereg.h b/sys/dev/usb/if_axereg.h
index 7e8ecab44f4..f8cc9110e74 100644
--- a/sys/dev/usb/if_axereg.h
+++ b/sys/dev/usb/if_axereg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_axereg.h,v 1.20 2010/12/06 04:41:39 jakemsr Exp $ */
+/* $OpenBSD: if_axereg.h,v 1.21 2012/03/01 04:33:15 jsg Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000-2003
@@ -149,6 +149,12 @@
#define AXE_PHY_NO_AX772_EPHY 0x10 /* Embedded 10/100 PHY of AX88772 */
+#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
#define AXE_178_MIN_BUFSZ 2048
@@ -177,6 +183,7 @@ struct axe_type {
u_int16_t axe_flags;
#define AX178 0x0001 /* AX88178 */
#define AX772 0x0002 /* AX88772 */
+#define AX772B 0x0004 /* AX88772B */
};
struct axe_softc;