Commit Graph

268 Commits

Author SHA1 Message Date
Nick Hibma
75fc24dc62 Add comments and debugging info. 2000-01-29 14:41:48 +00:00
Nick Hibma
a59ac0e8be The toggle carry bit is stored in the headp not the tailp. 2000-01-29 14:18:31 +00:00
Nick Hibma
e0d607e198 Mask off the last two bits before comparing. It might just be that some
hardware might leave those bits in the wrong state.
2000-01-29 11:59:31 +00:00
Nick Hibma
fa1df741fb Tripmine for bad hardware. 2000-01-29 11:50:44 +00:00
Bill Paul
e225ecbbd4 Minor tweak: the D-Link 10/100 USB ethernet adapter is apparently using
the same design as the LinkSys adapter and needs the same special handling
to enable its PHY.
2000-01-29 02:16:47 +00:00
Nick Hibma
031ca4fb23 Correct the list of error messages. It was incomplete. 2000-01-28 13:05:26 +00:00
Nick Hibma
e1b2b4098c Regen. 2000-01-28 10:31:12 +00:00
Nick Hibma
d8634f7c3d Correct the entry for the Kodak DC290.
Submitted By:	Oliver Fromme <olli@dorifer.heim3.tu-clausthal.de>
2000-01-28 10:26:29 +00:00
Bill Paul
935e6be657 Fix a bug in the uhci driver that breaks large bulk IN transfers. The
uhci_check_intr() routine needs to be more careful about deciding when
the end of a transfer has been detected.

This allows me to remove the nasty workaround code from if_aue and if_cue.
Receive performance is now much better for these adapters (500KB/sec
vs. 350KB/sec).

Also removed unused KUE_CUTOFF define from if_kuereg.h.

Submitted by: Lennart Augustsson
Reviewed by: n_hibma
2000-01-28 02:15:31 +00:00
Nick Hibma
fd43044e52 The values for OHCI_HALTED and OHCI_TOGGLECARRY were reversed. 2000-01-28 00:03:45 +00:00
Nick Hibma
8648a2cdb9 Move the defines to the right location.
Add a DIAGNOSTIC when closing interrupt pipes.

Insert splx(s) which were left out with iso pipes (non-functional yet) and
in a DIAGNOSTIC.
2000-01-27 23:25:58 +00:00
Nick Hibma
cc16f1b9d9 Add umass.c 2000-01-27 23:19:14 +00:00
Nick Hibma
2aff98945c Properly teardown the allocated and initialised stuff when an error
occurs (OHCIwas already done for UHCI).

Get rid of the usbus variable. It is confusing.

Align uhci_pci.c and ohci_pci.c again.
2000-01-26 10:52:27 +00:00
Nick Hibma
9e2bdb4369 Don't set ivars until we checked the return value from device_add_child. 2000-01-26 10:27:12 +00:00
Nick Hibma
06ffae8586 Add comments 2000-01-26 08:46:41 +00:00
Nick Hibma
f68d3a9c5c Add usbd_clear_endpoint_toggle(pipe) function.
This is needed to implement a asynchronous callback for clear endpoint
stall, needed for the umass driver.
2000-01-25 18:40:39 +00:00
Nick Hibma
ad705781e1 Correct subroutine names in DPRINTF 2000-01-25 18:37:58 +00:00
Nick Hibma
dd3d335141 The previous fix for the USB ugen device set configuration ioctl()
has a slight error, and returns EIO way too often.

PR:		16315
Submitted by:  Louis Mamakos <louie@TransSys.COM>
2000-01-24 10:23:57 +00:00
Peter Wemm
fe8140cd15 Fix some warnings. 2000-01-23 19:27:11 +00:00
Peter Wemm
62797de451 remove "extern int cold" from SPLUSBCHECK - it causes a heap of warnings. 2000-01-23 19:26:16 +00:00
Peter Wemm
10a1190c8b Fix a warning in DIAGNOSTIC code. 2000-01-23 19:25:29 +00:00
Nick Hibma
db972b58b5 Check whether we can change config at all. If any of the endpoints
has been opened, we should not allow configuration changes as endpoint
descriptors might disappear.

PR:	16256, 16168
2000-01-23 15:48:29 +00:00
Nick Hibma
bf79729b6e Zap the vnodes for the control endpoint as well. 2000-01-23 15:42:08 +00:00
Nick Hibma
bd7bdb532c Add ID for the AMD-756 OHCI controller 2000-01-21 10:46:29 +00:00
Nick Hibma
341777d004 Add support for DEVICE_SUSPEND, DEVICE_RESUME and DEVICE_SHUTDOWN
methods for USB devices.

However: with none of the devices I have here suspend seems to work
properly.  This is probably a bug in uhci_power which I still have to
look at.

Prodded and pushed by:  Christopher Masto <chris@netmonger.net>
2000-01-20 22:24:35 +00:00
Nick Hibma
fc096eaad4 Remove duplicate include 2000-01-20 22:05:30 +00:00
Nick Hibma
5fa5aeec53 Properly remove interrupts if initialisation fails. 2000-01-20 21:36:07 +00:00
Bill Paul
58295f6ace Fix test for deciding when a bulk IN transfer got truncated. I thought
I fixed this last night, but apparently I only applied the patch to the
copy of the code in /dev/brain0.
2000-01-20 19:57:43 +00:00
Kazutaka YOKOTA
cf3024b76c Do not include `ukbd.h'; it's not used.
Pointed out by: bde
2000-01-20 13:24:28 +00:00
Bill Paul
1aebda0582 Regen. 2000-01-20 07:39:19 +00:00
Bill Paul
a6d9a40e81 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
Bill Paul
76fd432173 Fix a couple of bugs:
- The busy wait hack in usbdi.c was doing its timeout in microseconds
  instead of milliseconds.
- if_aue.c:aue_intr() is creating a bitmask by and'ing two bits when it
  should be or'ing them.

Submitted by:	Lennart Augustsson
2000-01-19 01:01:56 +00:00
Bill Paul
7b7b87d7ef Change the mechanism by which we detect that the firmware is already
running. It turns out that trying to read the MAC address when there's
no firmware creates a zero length transfer. This apparently doesn't
hurt anything on a UHCI controller, but OHCI controllers generate an
IOERROR, and the device doesn't initialize.

Instead, check the bcdDevice revision code. We know this will be
different when the firmware is running, so if we detect the firmware's
code instead of the bare hardware's code, we skip the firmware load.
2000-01-17 23:14:40 +00:00
Bill Paul
4c10dd65ca The correct part number for the CATC ASIC is USB-EL1210A, not
USB-EL1201A or even USB-EL1202A. Wonder what drugs I was on when
I made this mistake, and then propagated it to 6 different files.

*sigh*
2000-01-17 18:49:20 +00:00
Bill Paul
20a08a85e4 Remove device name strings from vendor/product lists since we don't use
them (they're read from the device directly). Also do a set_config
command for the ADMtek and CATC drivers.
2000-01-16 22:45:07 +00:00
Bill Paul
4640135aaf Minor enhancement: set the 'dual link LED' bit in the auxmode register
of the Broadcom BCM5201 PHY on the LinkSys USB100TX adapter so that the
link LED correctly (lights up amber for 10mbps link, green for 100mbps
link).

Note that the sticker on the bottom of the adapter says amber for 10
and green for 100, but the appendix in the manual that comes with
the adapter says green for 10 and amber for 100. Given that there doesn't
seem to be any way to make the hardware produce the latter combination,
I think it's safe to say the sticker is right and the manual is wrong.
I'm just shocked, shocked I tell you.
2000-01-15 18:43:07 +00:00
Bill Paul
e4f25e405c Fix multicast filter programming. 2000-01-14 17:03:00 +00:00
Bill Paul
cfc5d9f44e Do a few minor cleanups. 2000-01-14 07:08:33 +00:00
Bill Paul
0177987224 Add device driver support for USB ethernet adapters based on the CATC
USB-EL1202A chipset. Between this and the other two drivers, we should
have support for pretty much every USB ethernet adapter on the market.
The only other USB chip that I know of is the SMC USB97C196, and right
now I don't know of any adapters that use it (including the ones made
by SMC :/ ).

Note that the CATC chip supports a nifty feature: read and write combining.
This allows multiple ethernet packets to be transfered in a single USB
bulk in/out transaction. However I'm again having trouble with large
bulk in transfers like I did with the ADMtek chip, which leads me to
believe that our USB stack needs some work before we can really make
use of this feature. When/if things improve, I intend to revisit the
aue and cue drivers. For now, I've lost enough sanity points.
2000-01-14 03:14:49 +00:00
Bill Paul
4c645f4852 Pull my head out of my ass and actually make the tx netisr stuff work right.
Do not not not call m_freem() in the txeof routines. Let the netisr routine
do it. This also makes the tx netisr queuing much simpler (I can just use
another ifqueue instead of the mess I had before.)

Thanks to Bosko Milekic for making me actually think about what I was
doing for a minute.
2000-01-14 01:36:16 +00:00
Bill Paul
f1a80ccf63 Clean up rxeof routines a little. 2000-01-14 00:49:28 +00:00
Bill Paul
e562c84330 Fix instance of AUE_BUFSZ that should have been AUE_CUTOFF. 2000-01-13 23:40:00 +00:00
Bill Paul
c76ce56239 Remove debug printf I left in by mistake. 2000-01-13 20:53:49 +00:00
Bill Paul
278b83e09b Regenerate. 2000-01-13 20:17:11 +00:00
Bill Paul
4f0a6f0403 Bunch of updates:
- Add vendor/device ID for Corega USB-T ethernet adapter to necessary
  places so that it will work with the kue driver.

- Add vendor/device ID for CATC Netmate devices for driver to be added
  soon.

- Get really crazy about netisr stuff: avoid doing any mbuf allocations
  or deallocations at splbio/splusb.

- Fix if_aue driver so that it works with LinkSys USB100TX: you need
  to flip the GPIO bits just the right way to put the PHY in the right
  mode.
2000-01-13 20:13:58 +00:00
Bill Paul
502c509ce0 Apply the same netisr mechanism to transmissions as well. In order to
drive the transmitter, we have to check the interface's send queue in the
TX end of frame handler (i.e. the usb bulk out callback) and push out new
transmissions if the queue has packets in it and the transmitter is
ready. But the txeof handler is also called from a USB callback running
at splusb() too.

Grrr.
2000-01-12 17:46:40 +00:00
Bill Paul
611d6a1573 Straighten out the logic in kue_setmulti() a little (the case where we
have no multicast entries to add is not handled right).
2000-01-11 18:09:19 +00:00
Kazutaka YOKOTA
7642cc829e Rework shifta/ctla/alta key handling. It appears that there was
misunderstanding between the PR originator and me.  I hope I got it
right this time.
2000-01-11 13:39:05 +00:00
Bill Paul
a0067d7b89 Attempt to fix a problem with receiving packets on USB ethernet interfaces.
Packets are received inside USB bulk transfer callbacks, which run at
splusb() (actually splbio()). The packet input queues are meant to be
manipulated at splimp(). However the locking apparently breaks down under
certain circumstances and the input queues can get trampled.

There's a similar problem with if_ppp, which is driven by hardware/tty
interrupts from the serial driver, but which must also manipulate the
packet input queues at splimp(). The fix there is to use a netisr, and
that's the fix I used here. (I can hear you groaning back there. Hush up.)

The usb_ethersubr module maintains a single queue of its own. When a
packet is received in the USB callback routine, it's placed on this
queue with usb_ether_input(). This routine also schedules a soft net
interrupt with schednetisr(). The ISR routine then runs later, at
splnet, outside of the USB callback/interrupt context, and passes the
packet to ether_input(), hopefully in a safe manner.

The reason this is implemented as a separate module is that there are
a limited number of NETISRs that we can use, and snarfing one up for
each driver that needs it is wasteful (there will be three once I get
the CATC driver done). It also reduces code duplication to a certain
small extent. Unfortunately, it also needs to be linked in with the
usb.ko module in order for the USB ethernet drivers to share it.

Also removed some uneeded includes from if_aue.c and if_kue.c

Fix suggested by: peter
Not rejected as a hairbrained idea by: n_hibma
2000-01-10 23:12:54 +00:00
Nick Hibma
3a08f9ce41 Add an extra debugging message. 2000-01-10 22:33:43 +00:00