Commit Graph

19 Commits

Author SHA1 Message Date
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
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
Nick Hibma
a9909bdaab Synchronisation with NetBSD 1999/11/27
- more req[uest]->xfer changes.
- get the corresponding NetBSD Id's right

ohci.c
   - move untimeout above print statement
   - remove usb_delay that panics the system (tsleep in intr context) when
   ohcidebug > 5.

ugen.c
   - create the devices for endpoints with make_dev.

uhub.c
   - change from using usbdebug to uhubdebug
   - add more debugging statements
1999-11-28 21:01:06 +00:00
Nick Hibma
3241be7550 Synchronisation with NetBSD as of 1999/11/16:
Cleaning up the code:
- Declare many functions static
- Change variable names to make them more self explanatory
- Change usbd_request_handle -> usbd_xfer_handle
- Syntactical changes
- Remove some unused code
- Other KNF changes

Interrupt context handling
- Change delay to usbd_delay_ms were possible (takes polling mode into
  account)
- Change detection mechanism for interrupt context

Add support for pre-allocation DMA-able memory by device driver

Add preliminary support for isochronous to the UHCI driver (not for OHCI
yet).

usb.c, uhci.c, ohci.c
- Initial attempt at detachable USB host controllers
- Handle the use_polling flag with a lttle more care and only set it if
we are cold booting.

usb.c, uhci.c ohci.c, usbdi.c usbdi_util.c usb_subr.c
- Make sure an aborted pipe is marked as not running.
- Start queued request in the right order.
- Insert some more DIAGNOSTIC sanity checks.
- Remove (almost) unused definitions USBD_XFER_OUT and USBD_XFER_IN.

usb.c, usb_subr.c
- Add an event mechanism so that a userland process can watch devices
  come and go.

ohci.c
- Handle the case when a USB transfer is so long that it crosses two
  page (4K) boundaries.  OHCI cannot do that with a single TD so we make
  a chain.

ulpt.c
- Use a bigger buffer when transferring data.
- Pre-allocate the DMA buffer.  This makes the driver slightly more
  efficient.
- Comment out the GET_DEVICE_ID code, because for some unknown reason it
  causes printing to fail sometimes.

usb.h
- Add a macro to extract the isoc type.
- Add a macro to check whether the routine has been entered after splusb
  and if not, complain.

usbdi.c
- Fix a glitch in dequeueing and aborting requests on interrupt pipes.
- Add a flag in the request to determine if the data copying is done by
  the driver or the usbdi layer.
1999-11-17 22:33:51 +00:00
Nick Hibma
354b93e124 priorities weren't correct (old version). 1999-10-07 20:58:43 +00:00
Nick Hibma
8c895d718b Major synchronisation with the NetBSD USB stack:
- Some cleanup and improvements in the uhci and ohci drivers
- Support for plugging and unplugging devices improved
- Now available is bulk transport over OHCI controllers
- Resume and suspend have been temporarily been disabled again.  Proper
  support for it is available in the uhci.c and ohci.c files but I have
  not yet spent the brain cycles to use it.
- OpenBSD now uses the USB stack as well
- Add FreeBSD tags
1999-10-07 19:26:38 +00:00
Nick Hibma
6d38342e16 Add comments, change variable names to make them consistent (r -> err,
timo_handle -> timeout_handle, p -> pipe, *pipe -> *rpipe, etc.)
1999-07-25 18:54:22 +00:00
Nick Hibma
178e4460ef Replace usbd_device_set_desc by device_set_desc_copy 1999-06-27 09:42:40 +00:00
Nick Hibma
509a03961f USB stopped working as of the recent cdevsw cleanup. This fixes that. 1999-06-01 07:22:01 +00:00
Nick Hibma
f26c33d249 usbdi.h:
Implement priorities.
GENERIC, LINT, files:
        Remove remarks about ordering of device names.
GENERIC, LINT:
        Sort the devices alphabetically in LINT and GENERIC.
1999-05-20 20:02:37 +00:00
Peter Wemm
6182fdbda8 Bring the 'new-bus' to the i386. This extensively changes the way the
i386 platform boots, it is no longer ISA-centric, and is fully dynamic.
Most old drivers compile and run without modification via 'compatability
shims' to enable a smoother transition.  eisa, isapnp and pccard* are
not yet using the new resource manager.  Once fully converted, all drivers
will be loadable, including PCI and ISA.

(Some other changes appear to have snuck in, including a port of Soren's
 ATA driver to the Alpha.  Soren, back this out if you need to.)

This is a checkpoint of work-in-progress, but is quite functional.

The bulk of the work was done over the last few years by Doug Rabson and
Garrett Wollman.

Approved by:	core
1999-04-16 21:22:55 +00:00
Nick Hibma
67aa00a71b 1) Make debugging more selective.
2) create function usbd_errstr which turns a usbd_status into a sensible
   error message
3) Change the printf in DPRINTF to logprintf which is a define for
   log(KERN_DEBUG, x)
1999-04-11 20:50:33 +00:00
Nick Hibma
ff0ccda34e change wrong names in prototypes (pipe to dev) 1999-04-05 17:19:48 +00:00
Nick Hibma
83fac6ab3f Cosmetical changes. 1999-03-22 19:58:59 +00:00
Nick Hibma
235dddd4ea Textual changes 1999-01-22 00:51:12 +00:00
Nick Hibma
53809e8652 Sync with NetBSD sources. Almost there. Mostly style fixes. 1999-01-10 18:42:54 +00:00
Nick Hibma
a73f7cf01f Major synchronisation with NetBSD USB code 1999-01-07 23:07:57 +00:00
Nick Hibma
6fef2c2c27 Added Id to all files 1998-12-14 09:32:25 +00:00
Nick Hibma
0cec007c5f Initial commit of ported NetBSD USB stack 1998-11-26 23:13:13 +00:00