Add device driver support for the ASIX Electronics AX88172 USB 2.0

ethernet controller. The driver has been tested with the LinkSys
USB200M adapter. I know for a fact that there are other devices out
there with this chip but don't have all the USB vendor/device IDs.

Note: I'm not sure if this will force the driver to end up in the
install kernel image or not. Special magic needs to be done to exclude
it to keep the boot floppies from bloating again, someone please
advise.
This commit is contained in:
Bill Paul 2003-04-20 19:05:33 +00:00
parent ce48b9e432
commit 87b4a25958
16 changed files with 1539 additions and 0 deletions

View File

@ -20,6 +20,7 @@ MAN= aac.4 \
atkbdc.4 \
aue.4 \
awi.4 \
axe.4 \
bge.4 \
bktr.4 \
blackhole.4 \

144
share/man/man4/axe.4 Normal file
View File

@ -0,0 +1,144 @@
.\" Copyright (c) 1997, 1998, 1999, 2000-2003
.\" Bill Paul <wpaul@windriver.com>. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by Bill Paul.
.\" 4. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
.\" THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd April 20, 2003
.Dt AXE 4
.Os
.Sh NAME
.Nm axe
.Nd ASIX Electronics AX88172 USB Ethernet driver
.Sh SYNOPSIS
.Cd "device ehci"
.Cd "device uhci"
.Cd "device ohci"
.Cd "device usb"
.Cd "device miibus"
.Cd "device axe"
.Sh DESCRIPTION
The
.Nm
driver provides support for USB ethernet adapters based on the ASIX
Electronics AX88172 USB 2.0 chipset, including the LinkSys USB200M.
.Pp
The AX88172 is a USB 2.0 device which contains a 10/100
ethernet MAC with MII interface and is designed to work with both
ethernet and HomePNA transceivers. The AX88172 will operate with
both USB 1.x and USB 2.0 controllers, however performace with 1.x
contollers will be limited since the USB 1.x standard specifies a
maximum transfer speed of 12Mbps.
Users with USB 1.x controllers should therefore not expect to actually
achieve 100Mbps speeds with these devices.
.Pp
The AX88172 supports a 64-bit multicast hash table, single perfect
filter entry for the station address, all-multicast mode and promiscuous mode.
Packets are
received and transmitted over separate USB bulk transfer endpoints.
.Pp
The
.Nm
driver supports the following media types:
.Pp
.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
.It autoselect
Enable autoselection of the media type and options.
The user can manually override
the autoselected mode by adding media options to the
.Pa /etc/rc.conf
file.
.It 10baseT/UTP
Set 10Mbps operation.
The
.Ar mediaopt
option can also be used to enable
.Ar full-duplex
operation.
Not specifying
.Ar full duplex
implies
.Ar half-duplex
mode.
.It 100baseTX
Set 100Mbps (fast ethernet) operation.
The
.Ar mediaopt
option can also be used to enable
.Ar full-duplex
operation.
Not specifying
.Ar full duplex
implies
.Ar half-duplex
mode.
.El
.Pp
The
.Nm
driver supports the following media options:
.Pp
.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
.It full-duplex
Force full duplex operation.
The interface will operate in
half duplex mode if this media option is not specified.
.El
.Pp
For more information on configuring this device, see
.Xr ifconfig 8 .
.Sh DIAGNOSTICS
.Bl -diag
.It "axe%d: watchdog timeout"
A packet was queued for transmission and a transmit command was
issued, however the device failed to acknowledge the transmission
before a timeout expired.
.It "axe%d: no memory for rx list"
The driver failed to allocate an mbuf for the receiver ring.
.El
.Sh SEE ALSO
.Xr arp 4 ,
.Xr miibus 4 ,
.Xr netintro 4 ,
.Xr ng_ether 4 ,
.Xr ifconfig 8
.Rs
.%T ASIX AX88172 data sheet
.%O http://www.asix.com.tw
.Re
.Sh HISTORY
The
.Nm
device driver first appeared in
.Fx 5.0 .
.Sh AUTHORS
The
.Nm
driver was written by
.An Bill Paul Aq wpaul@windriver.com .

View File

@ -184,5 +184,6 @@ device umass # Disks/Mass storage - Requires scbus and da0
device ums # Mouse
# USB Ethernet
device aue # ADMtek USB ethernet
device axe # ASIX Electronics USB ethernet
device cue # CATC USB ethernet
device kue # Kawasaki LSI USB ethernet

View File

@ -252,5 +252,6 @@ device urio # Diamond Rio 500 MP3 player
device uscanner # Scanners
# USB Ethernet, requires mii
device aue # ADMtek USB ethernet
device axe # ASIX Electronics USB ethernet
device cue # CATC USB ethernet
device kue # Kawasaki LSI USB ethernet

View File

@ -754,6 +754,7 @@ dev/ubsec/ubsec.c optional ubsec
dev/usb/usb_if.m optional usb
dev/usb/hid.c optional usb
dev/usb/if_aue.c optional aue
dev/usb/if_axe.c optional axe
dev/usb/if_cue.c optional cue
dev/usb/if_kue.c optional kue
dev/usb/ehci.c optional ehci

1192
sys/dev/usb/if_axe.c Normal file

File diff suppressed because it is too large Load Diff

178
sys/dev/usb/if_axereg.h Normal file
View File

@ -0,0 +1,178 @@
/*
* Copyright (c) 1997, 1998, 1999, 2000-2003
* Bill Paul <wpaul@windriver.com>. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Bill Paul.
* 4. Neither the name of the author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
/*
* Definitions for the ASIX Electronics AX88172 to ethernet controller.
*/
/*
* Vendor specific commands
* ASIX conveniently doesn't document the 'set NODEID' command in their
* datasheet (thanks a lot guys).
* To make handling these commands easier, I added some extra data
* which is decided by the axe_cmd() routine. Commands are encoded
* in 16 bites, with the format: LDCC. L and D are both nibbles in
* the high byte. L represents the data length (0 to 15) and D
* represents the direction (0 for vendor read, 1 for vendor write).
* CC is the command byte, as specified in the manual.
*/
#define AXE_CMD_DIR(x) (((x) & 0x0F00) >> 8)
#define AXE_CMD_LEN(x) (((x) & 0xF000) >> 12)
#define AXE_CMD_CMD(x) ((x) & 0x00FF)
#define AXE_CMD_READ_RXTX_SRAM 0x2002
#define AXE_CMD_WRITE_RX_SRAM 0x0103
#define AXE_CMD_WRITE_TX_SRAM 0x0104
#define AXE_CMD_MII_OPMODE_SW 0x0106
#define AXE_CMD_MII_READ_REG 0x2007
#define AXE_CMD_MII_WRITE_REG 0x2108
#define AXE_CMD_MII_READ_OPMODE 0x1009
#define AXE_CMD_MII_OPMODE_HW 0x010A
#define AXE_CMD_SROM_READ 0x200B
#define AXE_CMD_SROM_WRITE 0x010C
#define AXE_CMD_SROM_WR_ENABLE 0x010D
#define AXE_CMD_SROM_WR_DISABLE 0x010E
#define AXE_CMD_RXCTL_READ 0x200F
#define AXE_CMD_RXCTL_WRITE 0x0110
#define AXE_CMD_READ_IPG012 0x3011
#define AXE_CMD_WRITE_IPG0 0x0112
#define AXE_CMD_WRITE_IPG1 0x0113
#define AXE_CMD_WRITE_IPG2 0x0114
#define AXE_CMD_READ_MCAST 0x8015
#define AXE_CMD_WRITE_MCAST 0x8116
#define AXE_CMD_READ_NODEID 0x6017
#define AXE_CMD_WRITE_NODEID 0x6118
#define AXE_CMD_READ_PHYID 0x2019
#define AXE_CMD_READ_MEDIA 0x101A
#define AXE_CMD_WRITE_MEDIA 0x011B
#define AXE_CMD_READ_MONITOR_MODE 0x101C
#define AXE_CMD_WRITE_MONITOR_MODE 0x011D
#define AXE_CMD_READ_GPIO 0x101E
#define AXE_CMD_WRITE_GPIO 0x011F
#define AXE_RXCMD_PROMISC 0x0001
#define AXE_RXCMD_ALLMULTI 0x0002
#define AXE_RXCMD_UNICAST 0x0004
#define AXE_RXCMD_BROADCAST 0x0008
#define AXE_RXCMD_MULTICAST 0x0010
#define AXE_RXCMD_ENABLE 0x0080
#define AXE_NOPHY 0xE0
#define AXE_TIMEOUT 1000
#define AXE_BUFSZ 1536
#define AXE_MIN_FRAMELEN 60
#define AXE_RX_FRAMES 1
#define AXE_TX_FRAMES 1
#define AXE_RX_LIST_CNT 1
#define AXE_TX_LIST_CNT 1
#define AXE_CTL_READ 0x01
#define AXE_CTL_WRITE 0x02
#define AXE_CONFIG_NO 1
/*
* The interrupt endpoint is currently unused
* by the ASIX part.
*/
#define AXE_ENDPT_RX 0x0
#define AXE_ENDPT_TX 0x1
#define AXE_ENDPT_INTR 0x2
#define AXE_ENDPT_MAX 0x3
struct axe_type {
u_int16_t axe_vid;
u_int16_t axe_did;
};
struct axe_softc;
struct axe_chain {
struct axe_softc *axe_sc;
usbd_xfer_handle axe_xfer;
char *axe_buf;
struct mbuf *axe_mbuf;
int axe_accum;
int axe_idx;
};
struct axe_cdata {
struct axe_chain axe_tx_chain[AXE_TX_LIST_CNT];
struct axe_chain axe_rx_chain[AXE_RX_LIST_CNT];
int axe_tx_prod;
int axe_tx_cons;
int axe_tx_cnt;
int axe_rx_prod;
};
#define AXE_INC(x, y) (x) = (x + 1) % y
struct axe_softc {
#if defined(__FreeBSD__)
#define GET_MII(sc) (device_get_softc((sc)->axe_miibus))
#elif defined(__NetBSD__)
#define GET_MII(sc) (&(sc)->axe_mii)
#elif defined(__OpenBSD__)
#define GET_MII(sc) (&(sc)->axe_mii)
#endif
struct arpcom arpcom;
device_t axe_miibus;
device_t axe_dev;
usbd_device_handle axe_udev;
usbd_interface_handle axe_iface;
int axe_ed[AXE_ENDPT_MAX];
usbd_pipe_handle axe_ep[AXE_ENDPT_MAX];
int axe_unit;
int axe_if_flags;
struct axe_cdata axe_cdata;
struct callout_handle axe_stat_ch;
struct mtx axe_mtx;
char axe_dying;
int axe_link;
unsigned char axe_ipgs[3];
unsigned char axe_phyaddrs[2];
struct timeval axe_rx_notice;
};
#if 0
#define AXE_LOCK(_sc) mtx_lock(&(_sc)->axe_mtx)
#define AXE_UNLOCK(_sc) mtx_unlock(&(_sc)->axe_mtx)
#else
#define AXE_LOCK(_sc)
#define AXE_UNLOCK(_sc)
#endif

View File

@ -252,6 +252,7 @@ vendor MCT 0x0711 MCT
vendor DIGITALSTREAM 0x074e Digital Stream
vendor AUREAL 0x0755 Aureal Semiconductor
vendor MIDIMAN 0x0763 Midiman
vendor ASIX 0x077b ASIX Electronics
vendor GRIFFIN 0x077d Griffin Technology
vendor SANDISK 0x0781 SanDisk Corp
vendor BRIMAX 0x078e Brimax
@ -451,6 +452,9 @@ product APPLE SPEAKERS 0x1101 Speakers
/* Asahi Optical products */
product ASAHIOPTICAL OPTIO230 0x0004 Digital camera
/* ASIX Electronics products */
product ASIX AX88172 0x2226 USB 2.0 10/100 ethernet controller
/* ATen products */
product ATEN UC1284 0x2001 Parallel printer adapter
product ATEN UC10T 0x2002 10Mbps ethernet adapter

View File

@ -252,5 +252,6 @@ device urio # Diamond Rio 500 MP3 player
device uscanner # Scanners
# USB Ethernet, requires mii
device aue # ADMtek USB ethernet
device axe # ASIX Electronics USB ethernet
device cue # CATC USB ethernet
device kue # Kawasaki LSI USB ethernet

View File

@ -16,6 +16,7 @@ SUBDIR= accf_data \
amr \
an \
aue \
axe \
bge \
bridge \
cam \

10
sys/modules/axe/Makefile Normal file
View File

@ -0,0 +1,10 @@
# $FreeBSD$
S= ${.CURDIR}/../..
.PATH: $S/dev/usb
KMOD= if_axe
SRCS= if_axe.c opt_bdg.h opt_usb.h device_if.h bus_if.h
SRCS+= miibus_if.h
.include <bsd.kmod.mk>

View File

@ -10,6 +10,7 @@ SUBDIR= UI \
eiface \
etf \
ether \
fec \
frame_relay \
gif \
gif_demux \

View File

@ -239,5 +239,6 @@ device bpf # Berkeley packet filter
#device uscanner # Scanners
# USB Ethernet, requires mii
#device aue # ADMtek USB ethernet
#device axe # ASIX Electronics USB ethernet
#device cue # CATC USB ethernet
#device kue # Kawasaki LSI USB ethernet

View File

@ -191,6 +191,7 @@ device bpf #Berkeley packet filter
#device ums # Mouse
# USB Ethernet
#device aue # ADMtek USB ethernet
#device axe # ASIX Electronics USB ethernet
#device cue # CATC USB ethernet
#device kue # Kawasaki LSI USB ethernet

View File

@ -83,6 +83,7 @@ static struct _devname {
{ DEVICE_TYPE_FLOPPY, "fd%d", "floppy drive unit A", 9, 0, 64, 4 },
{ DEVICE_TYPE_NETWORK, "an", "Aironet 4500/4800 802.11 wireless adapter" },
{ DEVICE_TYPE_NETWORK, "aue", "ADMtek USB ethernet adapter" },
{ DEVICE_TYPE_NETWORK, "axe", "ASIX Electronics USB ethernet adapter" },
{ DEVICE_TYPE_NETWORK, "bge", "Broadcom BCM570x PCI gigabit ethernet card" },
{ DEVICE_TYPE_NETWORK, "cue", "CATC USB ethernet adapter" },
{ DEVICE_TYPE_NETWORK, "fpa", "DEC DEFPA PCI FDDI card" },

View File

@ -83,6 +83,7 @@ static struct _devname {
{ DEVICE_TYPE_FLOPPY, "fd%d", "floppy drive unit A", 9, 0, 64, 4 },
{ DEVICE_TYPE_NETWORK, "an", "Aironet 4500/4800 802.11 wireless adapter" },
{ DEVICE_TYPE_NETWORK, "aue", "ADMtek USB ethernet adapter" },
{ DEVICE_TYPE_NETWORK, "axe", "ASIX Electronics USB ethernet adapter" },
{ DEVICE_TYPE_NETWORK, "bge", "Broadcom BCM570x PCI gigabit ethernet card" },
{ DEVICE_TYPE_NETWORK, "cue", "CATC USB ethernet adapter" },
{ DEVICE_TYPE_NETWORK, "fpa", "DEC DEFPA PCI FDDI card" },