Index | Thread | Search

From:
Kevin Lo <kevlo@kevlo.org>
Subject:
Re: axen: add support for ax88772d
To:
tech@openbsd.org
Date:
Mon, 7 Oct 2024 13:28:05 +0800

Download raw body.

Thread
On Mon, Oct 07, 2024 at 01:05:46PM +0800, Kevin Lo wrote:
>
> Hi,
>
> AX88772D is a USB 2.0 device.  It is very similar to AX88192A overall.
> The most significant difference is that AX88192A supports 1000Mbps speeds
> while AX88772D does not.

My typo: s/AX88192A/AX88179A

> Tested on:
> axen0 at uhub0 port 1 configuration 1 interface 0 "ASIX AX88772D" rev 2.10/3.00 addr 2
> axen0: USB_SPEED_HIGHaxen0: AX88772D, address 20:7b:d2:xx:xx:xx
> ukphy0 at axen0 phy 3: Generic IEEE 802.3u media interface, rev. 1: OUI 0x00070b, model 0x0006
>
> ok?
>
> Index: share/man/man4/axen.4
> ===================================================================
> RCS file: /cvs/src/share/man/man4/axen.4,v
> diff -u -p -u -p -r1.10 axen.4
> --- share/man/man4/axen.4	4 Jan 2024 08:41:59 -0000	1.10
> +++ share/man/man4/axen.4	7 Oct 2024 02:31:09 -0000
> @@ -19,7 +19,7 @@
>  .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,7 +38,13 @@ Electronics AX88179/AX88179A USB 3.0 chi
>  .It StarTech USB31000S
>  .It TP-LINK UE300C v2
>  .It TP-Link UE306
> +.It Ugreen CM650-15632
>  .El
> +.Pp
> +The AX88772D is 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
> Index: share/man/man4/usb.4
> ===================================================================
> RCS file: /cvs/src/share/man/man4/usb.4,v
> diff -u -p -u -p -r1.219 usb.4
> --- share/man/man4/usb.4	15 May 2024 01:41:18 -0000	1.219
> +++ share/man/man4/usb.4	7 Oct 2024 02:31:09 -0000
> @@ -112,7 +112,7 @@ ADMtek AN986/ADM8511 Pegasus family 10/1
>  .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
> Index: sys/dev/usb/if_axen.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/usb/if_axen.c,v
> diff -u -p -u -p -r1.33 if_axen.c
> --- sys/dev/usb/if_axen.c	23 May 2024 03:21:08 -0000	1.33
> +++ sys/dev/usb/if_axen.c	7 Oct 2024 02:31:11 -0000
> @@ -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, struc
>  	}
>
>  	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, struc
>  		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
>  	/* 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 {
> Index: sys/dev/usb/if_axenreg.h
> ===================================================================
> RCS file: /cvs/src/sys/dev/usb/if_axenreg.h,v
> diff -u -p -u -p -r1.7 if_axenreg.h
> --- sys/dev/usb/if_axenreg.h	4 Jan 2024 08:41:59 -0000	1.7
> +++ sys/dev/usb/if_axenreg.h	7 Oct 2024 02:31:11 -0000
> @@ -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;
>