2005-01-06 01:43:34 +00:00
|
|
|
/*-
|
This commit adds device driver support for the ADMtek AN986 Pegasus
USB ethernet chip. Adapters that use this chip include the LinkSys
USB100TX. There are a few others, but I'm not certain of their
availability in the U.S. I used an ADMtek eval board for development.
Note that while the ADMtek chip is a 100Mbps device, you can't really
get 100Mbps speeds over USB. Regardless, this driver uses miibus to
allow speed and duplex mode selection as well as autonegotiation.
Building and kldloading the driver as a module is also supported.
Note that in order to make this driver work, I had to make what some
may consider an ugly hack to sys/dev/usb/usbdi.c. The usbd_transfer()
function will use tsleep() for synchronous transfers that don't complete
right away. This is a problem since there are times when we need to
do sync transfers from an interrupt context (i.e. when reading registers
from the MAC via the control endpoint), where tsleep() us a no-no.
My hack allows the driver to have the code poll for transfer completion
subject to the xfer->timeout timeout rather that calling tsleep().
This hack is controlled by a quirk entry and is only enabled for the
ADMtek device.
Now, I'm sure there are a few of you out there ready to jump on me
and suggest some other approach that doesn't involve a busy wait. The
only solution that might work is to handle the interrupts in a kernel
thread, where you may have something resembling a process context that
makes it okay to tsleep(). This is lovely, except we don't have any
mechanism like that now, and I'm not about to implement such a thing
myself since it's beyond the scope of driver development. (Translation:
I'll be damned if I know how to do it.) If FreeBSD ever aquires such
a mechanism, I'll be glad to revisit the driver to take advantage of
it. In the meantime, I settled for what I perceived to be the solution
that involved the least amount of code changes. In general, the hit
is pretty light.
Also note that my only USB test box has a UHCI controller: I haven't
I don't have a machine with an OHCI controller available.
Highlights:
- Updated usb_quirks.* to add UQ_NO_TSLEEP quirk for ADMtek part.
- Updated usbdevs and regenerated generated files
- Updated HARDWARE.TXT and RELNOTES.TXT files
- Updated sysinstall/device.c and userconfig.c
- Updated kernel configs -- device aue0 is commented out by default
- Updated /sys/conf/files
- Added new kld module directory
1999-12-28 02:01:18 +00:00
|
|
|
* Copyright (c) 1997, 1998, 1999
|
|
|
|
* Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
|
|
|
|
*
|
2006-12-11 09:57:41 +00:00
|
|
|
* Copyright (c) 2006
|
|
|
|
* Alfred Perlstein <alfred@freebsd.org>. All rights reserved.
|
|
|
|
*
|
This commit adds device driver support for the ADMtek AN986 Pegasus
USB ethernet chip. Adapters that use this chip include the LinkSys
USB100TX. There are a few others, but I'm not certain of their
availability in the U.S. I used an ADMtek eval board for development.
Note that while the ADMtek chip is a 100Mbps device, you can't really
get 100Mbps speeds over USB. Regardless, this driver uses miibus to
allow speed and duplex mode selection as well as autonegotiation.
Building and kldloading the driver as a module is also supported.
Note that in order to make this driver work, I had to make what some
may consider an ugly hack to sys/dev/usb/usbdi.c. The usbd_transfer()
function will use tsleep() for synchronous transfers that don't complete
right away. This is a problem since there are times when we need to
do sync transfers from an interrupt context (i.e. when reading registers
from the MAC via the control endpoint), where tsleep() us a no-no.
My hack allows the driver to have the code poll for transfer completion
subject to the xfer->timeout timeout rather that calling tsleep().
This hack is controlled by a quirk entry and is only enabled for the
ADMtek device.
Now, I'm sure there are a few of you out there ready to jump on me
and suggest some other approach that doesn't involve a busy wait. The
only solution that might work is to handle the interrupts in a kernel
thread, where you may have something resembling a process context that
makes it okay to tsleep(). This is lovely, except we don't have any
mechanism like that now, and I'm not about to implement such a thing
myself since it's beyond the scope of driver development. (Translation:
I'll be damned if I know how to do it.) If FreeBSD ever aquires such
a mechanism, I'll be glad to revisit the driver to take advantage of
it. In the meantime, I settled for what I perceived to be the solution
that involved the least amount of code changes. In general, the hit
is pretty light.
Also note that my only USB test box has a UHCI controller: I haven't
I don't have a machine with an OHCI controller available.
Highlights:
- Updated usb_quirks.* to add UQ_NO_TSLEEP quirk for ADMtek part.
- Updated usbdevs and regenerated generated files
- Updated HARDWARE.TXT and RELNOTES.TXT files
- Updated sysinstall/device.c and userconfig.c
- Updated kernel configs -- device aue0 is commented out by default
- Updated /sys/conf/files
- Added new kld module directory
1999-12-28 02:01:18 +00:00
|
|
|
* 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$
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Register definitions for ADMtek Pegasus AN986 USB to Ethernet
|
|
|
|
* chip. The Pegasus uses a total of four USB endpoints: the control
|
|
|
|
* endpoint (0), a bulk read endpoint for receiving packets (1),
|
|
|
|
* a bulk write endpoint for sending packets (2) and an interrupt
|
|
|
|
* endpoint for passing RX and TX status (3). Endpoint 0 is used
|
|
|
|
* to read and write the ethernet module's registers. All registers
|
|
|
|
* are 8 bits wide.
|
|
|
|
*
|
|
|
|
* Packet transfer is done in 64 byte chunks. The last chunk in a
|
|
|
|
* transfer is denoted by having a length less that 64 bytes. For
|
|
|
|
* the RX case, the data includes an optional RX status word.
|
|
|
|
*/
|
|
|
|
|
2006-12-11 09:57:41 +00:00
|
|
|
#ifndef AUEREG_H
|
|
|
|
#define AUEREG_H
|
|
|
|
|
This commit adds device driver support for the ADMtek AN986 Pegasus
USB ethernet chip. Adapters that use this chip include the LinkSys
USB100TX. There are a few others, but I'm not certain of their
availability in the U.S. I used an ADMtek eval board for development.
Note that while the ADMtek chip is a 100Mbps device, you can't really
get 100Mbps speeds over USB. Regardless, this driver uses miibus to
allow speed and duplex mode selection as well as autonegotiation.
Building and kldloading the driver as a module is also supported.
Note that in order to make this driver work, I had to make what some
may consider an ugly hack to sys/dev/usb/usbdi.c. The usbd_transfer()
function will use tsleep() for synchronous transfers that don't complete
right away. This is a problem since there are times when we need to
do sync transfers from an interrupt context (i.e. when reading registers
from the MAC via the control endpoint), where tsleep() us a no-no.
My hack allows the driver to have the code poll for transfer completion
subject to the xfer->timeout timeout rather that calling tsleep().
This hack is controlled by a quirk entry and is only enabled for the
ADMtek device.
Now, I'm sure there are a few of you out there ready to jump on me
and suggest some other approach that doesn't involve a busy wait. The
only solution that might work is to handle the interrupts in a kernel
thread, where you may have something resembling a process context that
makes it okay to tsleep(). This is lovely, except we don't have any
mechanism like that now, and I'm not about to implement such a thing
myself since it's beyond the scope of driver development. (Translation:
I'll be damned if I know how to do it.) If FreeBSD ever aquires such
a mechanism, I'll be glad to revisit the driver to take advantage of
it. In the meantime, I settled for what I perceived to be the solution
that involved the least amount of code changes. In general, the hit
is pretty light.
Also note that my only USB test box has a UHCI controller: I haven't
I don't have a machine with an OHCI controller available.
Highlights:
- Updated usb_quirks.* to add UQ_NO_TSLEEP quirk for ADMtek part.
- Updated usbdevs and regenerated generated files
- Updated HARDWARE.TXT and RELNOTES.TXT files
- Updated sysinstall/device.c and userconfig.c
- Updated kernel configs -- device aue0 is commented out by default
- Updated /sys/conf/files
- Added new kld module directory
1999-12-28 02:01:18 +00:00
|
|
|
#define AUE_UR_READREG 0xF0
|
|
|
|
#define AUE_UR_WRITEREG 0xF1
|
|
|
|
|
2000-01-16 22:45:07 +00:00
|
|
|
#define AUE_CONFIG_NO 1
|
2002-05-23 00:36:14 +00:00
|
|
|
#define AUE_IFACE_IDX 0
|
2000-01-16 22:45:07 +00:00
|
|
|
|
This commit adds device driver support for the ADMtek AN986 Pegasus
USB ethernet chip. Adapters that use this chip include the LinkSys
USB100TX. There are a few others, but I'm not certain of their
availability in the U.S. I used an ADMtek eval board for development.
Note that while the ADMtek chip is a 100Mbps device, you can't really
get 100Mbps speeds over USB. Regardless, this driver uses miibus to
allow speed and duplex mode selection as well as autonegotiation.
Building and kldloading the driver as a module is also supported.
Note that in order to make this driver work, I had to make what some
may consider an ugly hack to sys/dev/usb/usbdi.c. The usbd_transfer()
function will use tsleep() for synchronous transfers that don't complete
right away. This is a problem since there are times when we need to
do sync transfers from an interrupt context (i.e. when reading registers
from the MAC via the control endpoint), where tsleep() us a no-no.
My hack allows the driver to have the code poll for transfer completion
subject to the xfer->timeout timeout rather that calling tsleep().
This hack is controlled by a quirk entry and is only enabled for the
ADMtek device.
Now, I'm sure there are a few of you out there ready to jump on me
and suggest some other approach that doesn't involve a busy wait. The
only solution that might work is to handle the interrupts in a kernel
thread, where you may have something resembling a process context that
makes it okay to tsleep(). This is lovely, except we don't have any
mechanism like that now, and I'm not about to implement such a thing
myself since it's beyond the scope of driver development. (Translation:
I'll be damned if I know how to do it.) If FreeBSD ever aquires such
a mechanism, I'll be glad to revisit the driver to take advantage of
it. In the meantime, I settled for what I perceived to be the solution
that involved the least amount of code changes. In general, the hit
is pretty light.
Also note that my only USB test box has a UHCI controller: I haven't
I don't have a machine with an OHCI controller available.
Highlights:
- Updated usb_quirks.* to add UQ_NO_TSLEEP quirk for ADMtek part.
- Updated usbdevs and regenerated generated files
- Updated HARDWARE.TXT and RELNOTES.TXT files
- Updated sysinstall/device.c and userconfig.c
- Updated kernel configs -- device aue0 is commented out by default
- Updated /sys/conf/files
- Added new kld module directory
1999-12-28 02:01:18 +00:00
|
|
|
/*
|
|
|
|
* Note that while the ADMtek technically has four
|
|
|
|
* endpoints, the control endpoint (endpoint 0) is
|
|
|
|
* regarded as special by the USB code and drivers
|
|
|
|
* don't have direct access to it. (We access it
|
|
|
|
* using usbd_do_request() when reading/writing
|
|
|
|
* registers.) Consequently, our endpoint indexes
|
|
|
|
* don't match those in the ADMtek Pegasus manual:
|
|
|
|
* we consider the RX data endpoint to be index 0
|
|
|
|
* and work up from there.
|
|
|
|
*/
|
|
|
|
#define AUE_ENDPT_RX 0x0
|
|
|
|
#define AUE_ENDPT_TX 0x1
|
|
|
|
#define AUE_ENDPT_INTR 0x2
|
|
|
|
#define AUE_ENDPT_MAX 0x3
|
|
|
|
|
|
|
|
#define AUE_INTR_PKTLEN 0x8
|
|
|
|
|
|
|
|
#define AUE_CTL0 0x00
|
|
|
|
#define AUE_CTL1 0x01
|
|
|
|
#define AUE_CTL2 0x02
|
|
|
|
#define AUE_MAR0 0x08
|
|
|
|
#define AUE_MAR1 0x09
|
|
|
|
#define AUE_MAR2 0x0A
|
|
|
|
#define AUE_MAR3 0x0B
|
|
|
|
#define AUE_MAR4 0x0C
|
|
|
|
#define AUE_MAR5 0x0D
|
|
|
|
#define AUE_MAR6 0x0E
|
|
|
|
#define AUE_MAR7 0x0F
|
|
|
|
#define AUE_MAR AUE_MAR0
|
|
|
|
#define AUE_PAR0 0x10
|
|
|
|
#define AUE_PAR1 0x11
|
|
|
|
#define AUE_PAR2 0x12
|
|
|
|
#define AUE_PAR3 0x13
|
|
|
|
#define AUE_PAR4 0x14
|
|
|
|
#define AUE_PAR5 0x15
|
|
|
|
#define AUE_PAR AUE_PAR0
|
|
|
|
#define AUE_PAUSE0 0x18
|
|
|
|
#define AUE_PAUSE1 0x19
|
|
|
|
#define AUE_PAUSE AUE_PAUSE0
|
|
|
|
#define AUE_RX_FLOWCTL_CNT 0x1A
|
|
|
|
#define AUE_RX_FLOWCTL_FIFO 0x1B
|
2001-11-19 18:47:49 +00:00
|
|
|
#define AUE_REG_1D 0x1D
|
This commit adds device driver support for the ADMtek AN986 Pegasus
USB ethernet chip. Adapters that use this chip include the LinkSys
USB100TX. There are a few others, but I'm not certain of their
availability in the U.S. I used an ADMtek eval board for development.
Note that while the ADMtek chip is a 100Mbps device, you can't really
get 100Mbps speeds over USB. Regardless, this driver uses miibus to
allow speed and duplex mode selection as well as autonegotiation.
Building and kldloading the driver as a module is also supported.
Note that in order to make this driver work, I had to make what some
may consider an ugly hack to sys/dev/usb/usbdi.c. The usbd_transfer()
function will use tsleep() for synchronous transfers that don't complete
right away. This is a problem since there are times when we need to
do sync transfers from an interrupt context (i.e. when reading registers
from the MAC via the control endpoint), where tsleep() us a no-no.
My hack allows the driver to have the code poll for transfer completion
subject to the xfer->timeout timeout rather that calling tsleep().
This hack is controlled by a quirk entry and is only enabled for the
ADMtek device.
Now, I'm sure there are a few of you out there ready to jump on me
and suggest some other approach that doesn't involve a busy wait. The
only solution that might work is to handle the interrupts in a kernel
thread, where you may have something resembling a process context that
makes it okay to tsleep(). This is lovely, except we don't have any
mechanism like that now, and I'm not about to implement such a thing
myself since it's beyond the scope of driver development. (Translation:
I'll be damned if I know how to do it.) If FreeBSD ever aquires such
a mechanism, I'll be glad to revisit the driver to take advantage of
it. In the meantime, I settled for what I perceived to be the solution
that involved the least amount of code changes. In general, the hit
is pretty light.
Also note that my only USB test box has a UHCI controller: I haven't
I don't have a machine with an OHCI controller available.
Highlights:
- Updated usb_quirks.* to add UQ_NO_TSLEEP quirk for ADMtek part.
- Updated usbdevs and regenerated generated files
- Updated HARDWARE.TXT and RELNOTES.TXT files
- Updated sysinstall/device.c and userconfig.c
- Updated kernel configs -- device aue0 is commented out by default
- Updated /sys/conf/files
- Added new kld module directory
1999-12-28 02:01:18 +00:00
|
|
|
#define AUE_EE_REG 0x20
|
|
|
|
#define AUE_EE_DATA0 0x21
|
|
|
|
#define AUE_EE_DATA1 0x22
|
|
|
|
#define AUE_EE_DATA AUE_EE_DATA0
|
|
|
|
#define AUE_EE_CTL 0x23
|
|
|
|
#define AUE_PHY_ADDR 0x25
|
|
|
|
#define AUE_PHY_DATA0 0x26
|
|
|
|
#define AUE_PHY_DATA1 0x27
|
|
|
|
#define AUE_PHY_DATA AUE_PHY_DATA0
|
|
|
|
#define AUE_PHY_CTL 0x28
|
|
|
|
#define AUE_USB_STS 0x2A
|
|
|
|
#define AUE_TXSTAT0 0x2B
|
|
|
|
#define AUE_TXSTAT1 0x2C
|
|
|
|
#define AUE_TXSTAT AUE_TXSTAT0
|
|
|
|
#define AUE_RXSTAT 0x2D
|
|
|
|
#define AUE_PKTLOST0 0x2E
|
|
|
|
#define AUE_PKTLOST1 0x2F
|
|
|
|
#define AUE_PKTLOST AUE_PKTLOST0
|
|
|
|
|
2001-11-19 18:47:49 +00:00
|
|
|
#define AUE_REG_7B 0x7B
|
This commit adds device driver support for the ADMtek AN986 Pegasus
USB ethernet chip. Adapters that use this chip include the LinkSys
USB100TX. There are a few others, but I'm not certain of their
availability in the U.S. I used an ADMtek eval board for development.
Note that while the ADMtek chip is a 100Mbps device, you can't really
get 100Mbps speeds over USB. Regardless, this driver uses miibus to
allow speed and duplex mode selection as well as autonegotiation.
Building and kldloading the driver as a module is also supported.
Note that in order to make this driver work, I had to make what some
may consider an ugly hack to sys/dev/usb/usbdi.c. The usbd_transfer()
function will use tsleep() for synchronous transfers that don't complete
right away. This is a problem since there are times when we need to
do sync transfers from an interrupt context (i.e. when reading registers
from the MAC via the control endpoint), where tsleep() us a no-no.
My hack allows the driver to have the code poll for transfer completion
subject to the xfer->timeout timeout rather that calling tsleep().
This hack is controlled by a quirk entry and is only enabled for the
ADMtek device.
Now, I'm sure there are a few of you out there ready to jump on me
and suggest some other approach that doesn't involve a busy wait. The
only solution that might work is to handle the interrupts in a kernel
thread, where you may have something resembling a process context that
makes it okay to tsleep(). This is lovely, except we don't have any
mechanism like that now, and I'm not about to implement such a thing
myself since it's beyond the scope of driver development. (Translation:
I'll be damned if I know how to do it.) If FreeBSD ever aquires such
a mechanism, I'll be glad to revisit the driver to take advantage of
it. In the meantime, I settled for what I perceived to be the solution
that involved the least amount of code changes. In general, the hit
is pretty light.
Also note that my only USB test box has a UHCI controller: I haven't
I don't have a machine with an OHCI controller available.
Highlights:
- Updated usb_quirks.* to add UQ_NO_TSLEEP quirk for ADMtek part.
- Updated usbdevs and regenerated generated files
- Updated HARDWARE.TXT and RELNOTES.TXT files
- Updated sysinstall/device.c and userconfig.c
- Updated kernel configs -- device aue0 is commented out by default
- Updated /sys/conf/files
- Added new kld module directory
1999-12-28 02:01:18 +00:00
|
|
|
#define AUE_GPIO0 0x7E
|
|
|
|
#define AUE_GPIO1 0x7F
|
2001-11-19 18:47:49 +00:00
|
|
|
#define AUE_REG_81 0x81
|
This commit adds device driver support for the ADMtek AN986 Pegasus
USB ethernet chip. Adapters that use this chip include the LinkSys
USB100TX. There are a few others, but I'm not certain of their
availability in the U.S. I used an ADMtek eval board for development.
Note that while the ADMtek chip is a 100Mbps device, you can't really
get 100Mbps speeds over USB. Regardless, this driver uses miibus to
allow speed and duplex mode selection as well as autonegotiation.
Building and kldloading the driver as a module is also supported.
Note that in order to make this driver work, I had to make what some
may consider an ugly hack to sys/dev/usb/usbdi.c. The usbd_transfer()
function will use tsleep() for synchronous transfers that don't complete
right away. This is a problem since there are times when we need to
do sync transfers from an interrupt context (i.e. when reading registers
from the MAC via the control endpoint), where tsleep() us a no-no.
My hack allows the driver to have the code poll for transfer completion
subject to the xfer->timeout timeout rather that calling tsleep().
This hack is controlled by a quirk entry and is only enabled for the
ADMtek device.
Now, I'm sure there are a few of you out there ready to jump on me
and suggest some other approach that doesn't involve a busy wait. The
only solution that might work is to handle the interrupts in a kernel
thread, where you may have something resembling a process context that
makes it okay to tsleep(). This is lovely, except we don't have any
mechanism like that now, and I'm not about to implement such a thing
myself since it's beyond the scope of driver development. (Translation:
I'll be damned if I know how to do it.) If FreeBSD ever aquires such
a mechanism, I'll be glad to revisit the driver to take advantage of
it. In the meantime, I settled for what I perceived to be the solution
that involved the least amount of code changes. In general, the hit
is pretty light.
Also note that my only USB test box has a UHCI controller: I haven't
I don't have a machine with an OHCI controller available.
Highlights:
- Updated usb_quirks.* to add UQ_NO_TSLEEP quirk for ADMtek part.
- Updated usbdevs and regenerated generated files
- Updated HARDWARE.TXT and RELNOTES.TXT files
- Updated sysinstall/device.c and userconfig.c
- Updated kernel configs -- device aue0 is commented out by default
- Updated /sys/conf/files
- Added new kld module directory
1999-12-28 02:01:18 +00:00
|
|
|
|
|
|
|
#define AUE_CTL0_INCLUDE_RXCRC 0x01
|
|
|
|
#define AUE_CTL0_ALLMULTI 0x02
|
|
|
|
#define AUE_CTL0_STOP_BACKOFF 0x04
|
|
|
|
#define AUE_CTL0_RXSTAT_APPEND 0x08
|
|
|
|
#define AUE_CTL0_WAKEON_ENB 0x10
|
|
|
|
#define AUE_CTL0_RXPAUSE_ENB 0x20
|
|
|
|
#define AUE_CTL0_RX_ENB 0x40
|
|
|
|
#define AUE_CTL0_TX_ENB 0x80
|
|
|
|
|
|
|
|
#define AUE_CTL1_HOMELAN 0x04
|
|
|
|
#define AUE_CTL1_RESETMAC 0x08
|
|
|
|
#define AUE_CTL1_SPEEDSEL 0x10 /* 0 = 10mbps, 1 = 100mbps */
|
|
|
|
#define AUE_CTL1_DUPLEX 0x20 /* 0 = half, 1 = full */
|
|
|
|
#define AUE_CTL1_DELAYHOME 0x40
|
|
|
|
|
|
|
|
#define AUE_CTL2_EP3_CLR 0x01 /* reading EP3 clrs status regs */
|
|
|
|
#define AUE_CTL2_RX_BADFRAMES 0x02
|
|
|
|
#define AUE_CTL2_RX_PROMISC 0x04
|
|
|
|
#define AUE_CTL2_LOOPBACK 0x08
|
|
|
|
#define AUE_CTL2_EEPROMWR_ENB 0x10
|
|
|
|
#define AUE_CTL2_EEPROM_LOAD 0x20
|
|
|
|
|
|
|
|
#define AUE_EECTL_WRITE 0x01
|
|
|
|
#define AUE_EECTL_READ 0x02
|
|
|
|
#define AUE_EECTL_DONE 0x04
|
|
|
|
|
|
|
|
#define AUE_PHYCTL_PHYREG 0x1F
|
|
|
|
#define AUE_PHYCTL_WRITE 0x20
|
|
|
|
#define AUE_PHYCTL_READ 0x40
|
|
|
|
#define AUE_PHYCTL_DONE 0x80
|
|
|
|
|
|
|
|
#define AUE_USBSTS_SUSPEND 0x01
|
|
|
|
#define AUE_USBSTS_RESUME 0x02
|
|
|
|
|
|
|
|
#define AUE_TXSTAT0_JABTIMO 0x04
|
|
|
|
#define AUE_TXSTAT0_CARLOSS 0x08
|
|
|
|
#define AUE_TXSTAT0_NOCARRIER 0x10
|
|
|
|
#define AUE_TXSTAT0_LATECOLL 0x20
|
|
|
|
#define AUE_TXSTAT0_EXCESSCOLL 0x40
|
|
|
|
#define AUE_TXSTAT0_UNDERRUN 0x80
|
|
|
|
|
|
|
|
#define AUE_TXSTAT1_PKTCNT 0x0F
|
|
|
|
#define AUE_TXSTAT1_FIFO_EMPTY 0x40
|
|
|
|
#define AUE_TXSTAT1_FIFO_FULL 0x80
|
|
|
|
|
|
|
|
#define AUE_RXSTAT_OVERRUN 0x01
|
|
|
|
#define AUE_RXSTAT_PAUSE 0x02
|
|
|
|
|
|
|
|
#define AUE_GPIO_IN0 0x01
|
|
|
|
#define AUE_GPIO_OUT0 0x02
|
|
|
|
#define AUE_GPIO_SEL0 0x04
|
|
|
|
#define AUE_GPIO_IN1 0x08
|
|
|
|
#define AUE_GPIO_OUT1 0x10
|
|
|
|
#define AUE_GPIO_SEL1 0x20
|
|
|
|
|
|
|
|
struct aue_intrpkt {
|
|
|
|
u_int8_t aue_txstat0;
|
|
|
|
u_int8_t aue_txstat1;
|
|
|
|
u_int8_t aue_rxstat;
|
|
|
|
u_int8_t aue_rxlostpkt0;
|
|
|
|
u_int8_t aue_rxlostpkt1;
|
|
|
|
u_int8_t aue_wakeupstat;
|
|
|
|
u_int8_t aue_rsvd;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct aue_rxpkt {
|
|
|
|
u_int16_t aue_pktlen;
|
|
|
|
u_int8_t aue_rxstat;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define AUE_RXSTAT_MCAST 0x01
|
|
|
|
#define AUE_RXSTAT_GIANT 0x02
|
|
|
|
#define AUE_RXSTAT_RUNT 0x04
|
|
|
|
#define AUE_RXSTAT_CRCERR 0x08
|
|
|
|
#define AUE_RXSTAT_DRIBBLE 0x10
|
|
|
|
#define AUE_RXSTAT_MASK 0x1E
|
|
|
|
|
|
|
|
#define AUE_INC(x, y) (x) = (x + 1) % y
|
|
|
|
|
|
|
|
struct aue_softc {
|
2002-04-06 20:50:21 +00:00
|
|
|
#if defined(__FreeBSD__)
|
|
|
|
#define GET_MII(sc) (device_get_softc((sc)->aue_miibus))
|
|
|
|
#elif defined(__NetBSD__)
|
|
|
|
#define GET_MII(sc) (&(sc)->aue_mii)
|
|
|
|
#elif defined(__OpenBSD__)
|
|
|
|
#define GET_MII(sc) (&(sc)->aue_mii)
|
|
|
|
#endif
|
2005-06-10 16:49:24 +00:00
|
|
|
struct ifnet *aue_ifp;
|
2005-03-25 00:44:21 +00:00
|
|
|
device_t aue_dev;
|
This commit adds device driver support for the ADMtek AN986 Pegasus
USB ethernet chip. Adapters that use this chip include the LinkSys
USB100TX. There are a few others, but I'm not certain of their
availability in the U.S. I used an ADMtek eval board for development.
Note that while the ADMtek chip is a 100Mbps device, you can't really
get 100Mbps speeds over USB. Regardless, this driver uses miibus to
allow speed and duplex mode selection as well as autonegotiation.
Building and kldloading the driver as a module is also supported.
Note that in order to make this driver work, I had to make what some
may consider an ugly hack to sys/dev/usb/usbdi.c. The usbd_transfer()
function will use tsleep() for synchronous transfers that don't complete
right away. This is a problem since there are times when we need to
do sync transfers from an interrupt context (i.e. when reading registers
from the MAC via the control endpoint), where tsleep() us a no-no.
My hack allows the driver to have the code poll for transfer completion
subject to the xfer->timeout timeout rather that calling tsleep().
This hack is controlled by a quirk entry and is only enabled for the
ADMtek device.
Now, I'm sure there are a few of you out there ready to jump on me
and suggest some other approach that doesn't involve a busy wait. The
only solution that might work is to handle the interrupts in a kernel
thread, where you may have something resembling a process context that
makes it okay to tsleep(). This is lovely, except we don't have any
mechanism like that now, and I'm not about to implement such a thing
myself since it's beyond the scope of driver development. (Translation:
I'll be damned if I know how to do it.) If FreeBSD ever aquires such
a mechanism, I'll be glad to revisit the driver to take advantage of
it. In the meantime, I settled for what I perceived to be the solution
that involved the least amount of code changes. In general, the hit
is pretty light.
Also note that my only USB test box has a UHCI controller: I haven't
I don't have a machine with an OHCI controller available.
Highlights:
- Updated usb_quirks.* to add UQ_NO_TSLEEP quirk for ADMtek part.
- Updated usbdevs and regenerated generated files
- Updated HARDWARE.TXT and RELNOTES.TXT files
- Updated sysinstall/device.c and userconfig.c
- Updated kernel configs -- device aue0 is commented out by default
- Updated /sys/conf/files
- Added new kld module directory
1999-12-28 02:01:18 +00:00
|
|
|
device_t aue_miibus;
|
|
|
|
usbd_device_handle aue_udev;
|
|
|
|
usbd_interface_handle aue_iface;
|
2002-05-26 23:54:37 +00:00
|
|
|
u_int16_t aue_vendor;
|
|
|
|
u_int16_t aue_product;
|
This commit adds device driver support for the ADMtek AN986 Pegasus
USB ethernet chip. Adapters that use this chip include the LinkSys
USB100TX. There are a few others, but I'm not certain of their
availability in the U.S. I used an ADMtek eval board for development.
Note that while the ADMtek chip is a 100Mbps device, you can't really
get 100Mbps speeds over USB. Regardless, this driver uses miibus to
allow speed and duplex mode selection as well as autonegotiation.
Building and kldloading the driver as a module is also supported.
Note that in order to make this driver work, I had to make what some
may consider an ugly hack to sys/dev/usb/usbdi.c. The usbd_transfer()
function will use tsleep() for synchronous transfers that don't complete
right away. This is a problem since there are times when we need to
do sync transfers from an interrupt context (i.e. when reading registers
from the MAC via the control endpoint), where tsleep() us a no-no.
My hack allows the driver to have the code poll for transfer completion
subject to the xfer->timeout timeout rather that calling tsleep().
This hack is controlled by a quirk entry and is only enabled for the
ADMtek device.
Now, I'm sure there are a few of you out there ready to jump on me
and suggest some other approach that doesn't involve a busy wait. The
only solution that might work is to handle the interrupts in a kernel
thread, where you may have something resembling a process context that
makes it okay to tsleep(). This is lovely, except we don't have any
mechanism like that now, and I'm not about to implement such a thing
myself since it's beyond the scope of driver development. (Translation:
I'll be damned if I know how to do it.) If FreeBSD ever aquires such
a mechanism, I'll be glad to revisit the driver to take advantage of
it. In the meantime, I settled for what I perceived to be the solution
that involved the least amount of code changes. In general, the hit
is pretty light.
Also note that my only USB test box has a UHCI controller: I haven't
I don't have a machine with an OHCI controller available.
Highlights:
- Updated usb_quirks.* to add UQ_NO_TSLEEP quirk for ADMtek part.
- Updated usbdevs and regenerated generated files
- Updated HARDWARE.TXT and RELNOTES.TXT files
- Updated sysinstall/device.c and userconfig.c
- Updated kernel configs -- device aue0 is commented out by default
- Updated /sys/conf/files
- Added new kld module directory
1999-12-28 02:01:18 +00:00
|
|
|
int aue_ed[AUE_ENDPT_MAX];
|
|
|
|
usbd_pipe_handle aue_ep[AUE_ENDPT_MAX];
|
|
|
|
int aue_unit;
|
|
|
|
u_int8_t aue_link;
|
2007-01-08 23:24:21 +00:00
|
|
|
int aue_timer;
|
This commit adds device driver support for the ADMtek AN986 Pegasus
USB ethernet chip. Adapters that use this chip include the LinkSys
USB100TX. There are a few others, but I'm not certain of their
availability in the U.S. I used an ADMtek eval board for development.
Note that while the ADMtek chip is a 100Mbps device, you can't really
get 100Mbps speeds over USB. Regardless, this driver uses miibus to
allow speed and duplex mode selection as well as autonegotiation.
Building and kldloading the driver as a module is also supported.
Note that in order to make this driver work, I had to make what some
may consider an ugly hack to sys/dev/usb/usbdi.c. The usbd_transfer()
function will use tsleep() for synchronous transfers that don't complete
right away. This is a problem since there are times when we need to
do sync transfers from an interrupt context (i.e. when reading registers
from the MAC via the control endpoint), where tsleep() us a no-no.
My hack allows the driver to have the code poll for transfer completion
subject to the xfer->timeout timeout rather that calling tsleep().
This hack is controlled by a quirk entry and is only enabled for the
ADMtek device.
Now, I'm sure there are a few of you out there ready to jump on me
and suggest some other approach that doesn't involve a busy wait. The
only solution that might work is to handle the interrupts in a kernel
thread, where you may have something resembling a process context that
makes it okay to tsleep(). This is lovely, except we don't have any
mechanism like that now, and I'm not about to implement such a thing
myself since it's beyond the scope of driver development. (Translation:
I'll be damned if I know how to do it.) If FreeBSD ever aquires such
a mechanism, I'll be glad to revisit the driver to take advantage of
it. In the meantime, I settled for what I perceived to be the solution
that involved the least amount of code changes. In general, the hit
is pretty light.
Also note that my only USB test box has a UHCI controller: I haven't
I don't have a machine with an OHCI controller available.
Highlights:
- Updated usb_quirks.* to add UQ_NO_TSLEEP quirk for ADMtek part.
- Updated usbdevs and regenerated generated files
- Updated HARDWARE.TXT and RELNOTES.TXT files
- Updated sysinstall/device.c and userconfig.c
- Updated kernel configs -- device aue0 is commented out by default
- Updated /sys/conf/files
- Added new kld module directory
1999-12-28 02:01:18 +00:00
|
|
|
int aue_if_flags;
|
2005-03-25 12:42:30 +00:00
|
|
|
struct ue_cdata aue_cdata;
|
2006-12-13 22:38:56 +00:00
|
|
|
struct callout aue_tick_callout;
|
2007-01-08 23:24:21 +00:00
|
|
|
struct usb_taskqueue aue_taskqueue;
|
2006-12-11 09:57:41 +00:00
|
|
|
struct task aue_task;
|
2000-10-24 22:38:54 +00:00
|
|
|
struct mtx aue_mtx;
|
2007-01-08 23:24:21 +00:00
|
|
|
struct sx aue_sx;
|
2002-05-26 23:54:37 +00:00
|
|
|
u_int16_t aue_flags;
|
2002-04-06 20:17:13 +00:00
|
|
|
char aue_dying;
|
2002-04-07 12:04:02 +00:00
|
|
|
struct timeval aue_rx_notice;
|
2004-05-23 12:35:25 +00:00
|
|
|
struct usb_qdat aue_qdat;
|
2006-12-11 09:57:41 +00:00
|
|
|
int aue_deferedtasks;
|
This commit adds device driver support for the ADMtek AN986 Pegasus
USB ethernet chip. Adapters that use this chip include the LinkSys
USB100TX. There are a few others, but I'm not certain of their
availability in the U.S. I used an ADMtek eval board for development.
Note that while the ADMtek chip is a 100Mbps device, you can't really
get 100Mbps speeds over USB. Regardless, this driver uses miibus to
allow speed and duplex mode selection as well as autonegotiation.
Building and kldloading the driver as a module is also supported.
Note that in order to make this driver work, I had to make what some
may consider an ugly hack to sys/dev/usb/usbdi.c. The usbd_transfer()
function will use tsleep() for synchronous transfers that don't complete
right away. This is a problem since there are times when we need to
do sync transfers from an interrupt context (i.e. when reading registers
from the MAC via the control endpoint), where tsleep() us a no-no.
My hack allows the driver to have the code poll for transfer completion
subject to the xfer->timeout timeout rather that calling tsleep().
This hack is controlled by a quirk entry and is only enabled for the
ADMtek device.
Now, I'm sure there are a few of you out there ready to jump on me
and suggest some other approach that doesn't involve a busy wait. The
only solution that might work is to handle the interrupts in a kernel
thread, where you may have something resembling a process context that
makes it okay to tsleep(). This is lovely, except we don't have any
mechanism like that now, and I'm not about to implement such a thing
myself since it's beyond the scope of driver development. (Translation:
I'll be damned if I know how to do it.) If FreeBSD ever aquires such
a mechanism, I'll be glad to revisit the driver to take advantage of
it. In the meantime, I settled for what I perceived to be the solution
that involved the least amount of code changes. In general, the hit
is pretty light.
Also note that my only USB test box has a UHCI controller: I haven't
I don't have a machine with an OHCI controller available.
Highlights:
- Updated usb_quirks.* to add UQ_NO_TSLEEP quirk for ADMtek part.
- Updated usbdevs and regenerated generated files
- Updated HARDWARE.TXT and RELNOTES.TXT files
- Updated sysinstall/device.c and userconfig.c
- Updated kernel configs -- device aue0 is commented out by default
- Updated /sys/conf/files
- Added new kld module directory
1999-12-28 02:01:18 +00:00
|
|
|
};
|
|
|
|
|
2006-12-13 22:38:56 +00:00
|
|
|
#if 0
|
|
|
|
/*
|
|
|
|
* Some debug code to make sure we don't take a blocking lock in
|
|
|
|
* interrupt context.
|
|
|
|
*/
|
2006-12-11 09:57:41 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/proc.h>
|
|
|
|
#include <sys/kdb.h>
|
|
|
|
|
|
|
|
#define AUE_DUMPSTATE(tag) aue_dumpstate(__func__, tag)
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
aue_dumpstate(const char *func, const char *tag)
|
|
|
|
{
|
|
|
|
if ((curthread->td_pflags & TDP_NOSLEEPING) ||
|
|
|
|
(curthread->td_pflags & TDP_ITHREAD)) {
|
|
|
|
kdb_backtrace();
|
|
|
|
printf("%s: %s sleep: %sok ithread: %s\n", func, tag,
|
|
|
|
curthread->td_pflags & TDP_NOSLEEPING ? "not" : "",
|
|
|
|
curthread->td_pflags & TDP_ITHREAD ? "yes" : "no");
|
|
|
|
}
|
|
|
|
}
|
2001-02-27 01:05:25 +00:00
|
|
|
#else
|
2006-12-13 22:38:56 +00:00
|
|
|
#define AUE_DUMPSTATE(tag)
|
2001-02-27 01:05:25 +00:00
|
|
|
#endif
|
2000-10-24 22:38:54 +00:00
|
|
|
|
2006-12-13 22:38:56 +00:00
|
|
|
#define AUE_LOCK(_sc) mtx_lock(&(_sc)->aue_mtx)
|
|
|
|
#define AUE_UNLOCK(_sc) mtx_unlock(&(_sc)->aue_mtx)
|
|
|
|
#define AUE_SXLOCK(_sc) \
|
2007-01-08 23:24:21 +00:00
|
|
|
do { AUE_DUMPSTATE("sxlock"); sx_xlock(&(_sc)->aue_sx); } while(0)
|
|
|
|
#define AUE_SXUNLOCK(_sc) sx_xunlock(&(_sc)->aue_sx)
|
|
|
|
#define AUE_SXASSERTLOCKED(_sc) sx_assert(&(_sc)->aue_sx, SX_XLOCKED)
|
|
|
|
#define AUE_SXASSERTUNLOCKED(_sc) sx_assert(&(_sc)->aue_sx, SX_UNLOCKED)
|
2006-12-11 09:57:41 +00:00
|
|
|
|
This commit adds device driver support for the ADMtek AN986 Pegasus
USB ethernet chip. Adapters that use this chip include the LinkSys
USB100TX. There are a few others, but I'm not certain of their
availability in the U.S. I used an ADMtek eval board for development.
Note that while the ADMtek chip is a 100Mbps device, you can't really
get 100Mbps speeds over USB. Regardless, this driver uses miibus to
allow speed and duplex mode selection as well as autonegotiation.
Building and kldloading the driver as a module is also supported.
Note that in order to make this driver work, I had to make what some
may consider an ugly hack to sys/dev/usb/usbdi.c. The usbd_transfer()
function will use tsleep() for synchronous transfers that don't complete
right away. This is a problem since there are times when we need to
do sync transfers from an interrupt context (i.e. when reading registers
from the MAC via the control endpoint), where tsleep() us a no-no.
My hack allows the driver to have the code poll for transfer completion
subject to the xfer->timeout timeout rather that calling tsleep().
This hack is controlled by a quirk entry and is only enabled for the
ADMtek device.
Now, I'm sure there are a few of you out there ready to jump on me
and suggest some other approach that doesn't involve a busy wait. The
only solution that might work is to handle the interrupts in a kernel
thread, where you may have something resembling a process context that
makes it okay to tsleep(). This is lovely, except we don't have any
mechanism like that now, and I'm not about to implement such a thing
myself since it's beyond the scope of driver development. (Translation:
I'll be damned if I know how to do it.) If FreeBSD ever aquires such
a mechanism, I'll be glad to revisit the driver to take advantage of
it. In the meantime, I settled for what I perceived to be the solution
that involved the least amount of code changes. In general, the hit
is pretty light.
Also note that my only USB test box has a UHCI controller: I haven't
I don't have a machine with an OHCI controller available.
Highlights:
- Updated usb_quirks.* to add UQ_NO_TSLEEP quirk for ADMtek part.
- Updated usbdevs and regenerated generated files
- Updated HARDWARE.TXT and RELNOTES.TXT files
- Updated sysinstall/device.c and userconfig.c
- Updated kernel configs -- device aue0 is commented out by default
- Updated /sys/conf/files
- Added new kld module directory
1999-12-28 02:01:18 +00:00
|
|
|
#define AUE_TIMEOUT 1000
|
|
|
|
#define AUE_MIN_FRAMELEN 60
|
More USB ethernet tweaks:
- Sync ohci, uhci and usbdi modules with NetBSD in order to obtain the
following improvements:
o New USBD_NO_TSLEEP flag can be used in place of UQ_NO_TSLEEP
quirk. This allows drivers to specify busy waiting only for
certain transfers (namely control transfers for reading/writing
registers and stuff).
o New USBD_FORCE_SHORT_XFER flag can be used to deal with
devices like the ADMtek Pegasus that sense the end of bulk OUT
transfers in a special way (if a transfer is exactly a multiple
of 64 bytes in size, you need to send an extra empty packet
to terminate the transfer).
o usbd_open_pipe_intr() now accepts an interval argument which
can be used to change the rate at which the interrupt callback
routine is invoked. Specifying USBD_DEFAULT_INTERVAL uses the
value specified in the device's config data, but drivers can
override it if needed.
- Change if_aue to use USBD_FORCE_SHORT_XFER for packet transmissions.
- Change if_aue, if_kue and if_cue to use USBD_NO_TSLEEP for all
control transfers. We no longer force the non-tsleep hack for
bulk transfers since these are done asynchronously anyway.
- Removed quirk entry fiddling from if_aue and if_kue since we don't
need it anymore now that we have the USBD_NO_TSLEEP flag.
- Tweak ulpt, uhid, ums and ukbd drivers to use the new arg to
usbd_open_pipe_intr().
- Add a flag to the softc struct in the ethernet drivers to indicate
when a device has been detached, and use this flag to perform
tests to prevent the drivers from trying to do control transfers
if this is the case. This is necessary because calling if_detach()
with INET6 enabled will eventually result in a call to the driver's
ioctl() routine to delete the multicast groups on the interface,
which will result in attempts to perform control transfers. (It's
possible this also happens even without INET6 support enabled.) This
is pointless since we know that if the detach method has been called,
the hardware has been unplugged.
- Changed watchdog timeout routines to just call the driver init routines
to initialize the device states without trying to close and re-open the
pipes. This is partly because we don't want to frob things at interrupt
context, but also because this doesn't seem to work right and I don't
want to panic the system just because a USB device may have stopped
responding.
- Fix aue_rxeof() to be a little smarter about detecting when a double
transfer is needed. Unfortunately, the design of the chip makes it hard
to get this exactly right. Hopefully, this will go away once either
Nick or Lennart finds the bug in the uhci driver that makes this ugly
hack necessary.
- Also sync usbdevs with NetBSD.
2000-01-20 07:38:33 +00:00
|
|
|
#define AUE_INTR_INTERVAL 100 /* ms */
|
2006-12-11 09:57:41 +00:00
|
|
|
|
2006-12-13 22:38:56 +00:00
|
|
|
/*
|
|
|
|
* These bits are used to notify the task about pending events.
|
|
|
|
* The names correspond to the interrupt context routines that would
|
|
|
|
* be normally called. (example: AUE_TASK_WATCHDOG -> aue_watchdog())
|
|
|
|
*/
|
|
|
|
#define AUE_TASK_WATCHDOG 0x0001
|
|
|
|
#define AUE_TASK_TICK 0x0002
|
|
|
|
#define AUE_TASK_START 0x0004
|
|
|
|
#define AUE_TASK_RXSTART 0x0008
|
|
|
|
#define AUE_TASK_RXEOF 0x0010
|
|
|
|
#define AUE_TASK_TXEOF 0x0020
|
2006-12-11 09:57:41 +00:00
|
|
|
|
|
|
|
#define AUE_GIANTLOCK() mtx_lock(&Giant);
|
|
|
|
#define AUE_GIANTUNLOCK() mtx_unlock(&Giant);
|
|
|
|
|
|
|
|
#endif /* !AUEREG_H */
|