From 9060cf22087b8abfbc84b90a97c49db3aee880ce Mon Sep 17 00:00:00 2001 From: kevlo Date: Mon, 7 Oct 2024 07:35:40 +0000 Subject: [PATCH] Add support for AX88772D. AX88772D is a USB 2.0 device. It is very similar to AX88179A overall. The most significant difference is that AX88179A supports 1000Mbps speeds while AX88772D does not. grammer fix from jmc@ ok miod@ --- share/man/man4/axen.4 | 14 ++++++++++---- share/man/man4/usb.4 | 6 +++--- sys/dev/usb/if_axen.c | 18 ++++++++++++++---- sys/dev/usb/if_axenreg.h | 3 ++- 4 files changed, 29 insertions(+), 12 deletions(-) diff --git a/share/man/man4/axen.4 b/share/man/man4/axen.4 index 81ca9bab06a..5fb1ad0ac3f 100644 --- a/share/man/man4/axen.4 +++ b/share/man/man4/axen.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: axen.4,v 1.10 2024/01/04 08:41:59 kevlo Exp $ +.\" $OpenBSD: axen.4,v 1.11 2024/10/07 07:35:40 kevlo Exp $ .\" .\" Copyright (c) 2013 Yojiro UO .\" @@ -14,12 +14,12 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: January 4 2024 $ +.Dd $Mdocdate: October 7 2024 $ .Dt AXEN 4 .Os .Sh NAME .Nm axen -.Nd ASIX Electronics AX88179/AX88179A 10/100/1Gb USB Ethernet device +.Nd ASIX Electronics AX88179/AX88179A/AX88772D 10/100/1Gb USB Ethernet device .Sh SYNOPSIS .Cd "axen* at uhub?" .Cd "rgephy* at mii?" @@ -28,7 +28,7 @@ The .Nm driver provides support for USB Ethernet adapters based on the ASIX -Electronics AX88179/AX88179A USB 3.0 chipset, including the following: +Electronics AX88179/AX88179A/AX88772D chipset, including the following: .Pp .Bl -tag -width Ds -offset indent -compact .It D-Link DUB-1312 @@ -38,8 +38,14 @@ Electronics AX88179/AX88179A USB 3.0 chipset, including the following: .It StarTech USB31000S .It TP-LINK UE300C v2 .It TP-Link UE306 +.It Ugreen CM650-15632 .El .Pp +The AX88772D is a USB 2.0 device which supports both +10 and 100Mbps speeds in either full or half duplex. +The AX88179 and AX88179A are USB 3.0 devices, which contain +a 10/100/1Gb Ethernet MAC with a GMII/MII interface. +.Pp The .Nm driver supports the following media types: diff --git a/share/man/man4/usb.4 b/share/man/man4/usb.4 index c51113aa4a5..a4af3789a86 100644 --- a/share/man/man4/usb.4 +++ b/share/man/man4/usb.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: usb.4,v 1.219 2024/05/15 01:41:18 kevlo Exp $ +.\" $OpenBSD: usb.4,v 1.220 2024/10/07 07:35:40 kevlo Exp $ .\" $NetBSD: usb.4,v 1.15 1999/07/29 14:20:32 augustss Exp $ .\" .\" Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -28,7 +28,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: May 15 2024 $ +.Dd $Mdocdate: October 7 2024 $ .Dt USB 4 .Os .Sh NAME @@ -112,7 +112,7 @@ ADMtek AN986/ADM8511 Pegasus family 10/100 USB Ethernet device .It Xr axe 4 ASIX Electronics AX88172/AX88178/AX88772 10/100/1Gb USB Ethernet device .It Xr axen 4 -ASIX Electronics AX88179/AX88179A 10/100/1Gb USB Ethernet device +ASIX Electronics AX88179/AX88179A/AX88772D 10/100/1Gb USB Ethernet device .It Xr cdce 4 USB Communication Device Class Ethernet device .It Xr cue 4 diff --git a/sys/dev/usb/if_axen.c b/sys/dev/usb/if_axen.c index cb384fa8352..12176504611 100644 --- a/sys/dev/usb/if_axen.c +++ b/sys/dev/usb/if_axen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_axen.c,v 1.33 2024/05/23 03:21:08 jsg Exp $ */ +/* $OpenBSD: if_axen.c,v 1.34 2024/10/07 07:35:40 kevlo Exp $ */ /* * Copyright (c) 2013 Yojiro UO @@ -17,7 +17,7 @@ */ /* - * ASIX Electronics AX88178a USB 2.0 ethernet and + * ASIX Electronics AX88178a/AX88772d USB 2.0 ethernet and * AX88179/AX88179a USB 3.0 Ethernet driver. */ @@ -251,6 +251,8 @@ axen_miibus_statchg(struct device *dev) sc->axen_link++; break; case IFM_1000_T: + if ((sc->axen_flags & AX772D) != 0) + break; sc->axen_link++; break; default: @@ -658,8 +660,14 @@ axen_attach(struct device *parent, struct device *self, void *aux) } dd = usbd_get_device_descriptor(sc->axen_udev); - if (UGETW(dd->bcdDevice) == 0x200) + switch (UGETW(dd->bcdDevice)) { + case 0x200: sc->axen_flags = AX179A; + break; + case 0x300: + sc->axen_flags = AX772D; + break; + } s = splnet(); @@ -683,6 +691,8 @@ axen_attach(struct device *parent, struct device *self, void *aux) printf(" AX88178a"); else if (sc->axen_flags & AX179) printf(" AX88179"); + else if (sc->axen_flags & AX772D) + printf(" AX88772D"); else printf(" AX88179A"); printf(", address %s\n", ether_sprintf(eaddr)); @@ -968,7 +978,7 @@ axen_rxeof(struct usbd_xfer *xfer, void *priv, usbd_status status) /* skip pseudo header (2byte) */ padlen = 2; /* skip trailer padding (4Byte) for ax88179 */ - if (!(sc->axen_flags & AX179A)) + if (!(sc->axen_flags & (AX179A | AX772D))) padlen += 4; do { diff --git a/sys/dev/usb/if_axenreg.h b/sys/dev/usb/if_axenreg.h index 98be650b5eb..86ca2699a79 100644 --- a/sys/dev/usb/if_axenreg.h +++ b/sys/dev/usb/if_axenreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_axenreg.h,v 1.7 2024/01/04 08:41:59 kevlo Exp $ */ +/* $OpenBSD: if_axenreg.h,v 1.8 2024/10/07 07:35:40 kevlo Exp $ */ /* * Copyright (c) 2013 Yojiro UO . All right reserved. @@ -228,6 +228,7 @@ struct axen_type { #define AX178A 0x0001 /* AX88178a */ #define AX179 0x0002 /* AX88179 */ #define AX179A 0x0004 /* AX88179a */ +#define AX772D 0x0008 /* AX88772d */ }; struct axen_softc; -- 2.20.1