Commit Graph

103 Commits

Author SHA1 Message Date
Hans Petter Selasky
963169b4af This commit adds full support for USB 3.0 devices in host and device
mode in the USB core.  The patch mostly consists of updating the USB
HUB code to support USB 3.0 HUBs. This patch also add some more USB
controller methods to support more active-alike USB controllers like
the XHCI which needs to be informed about various device state events.

USB 3.0 HUBs are not tested yet, due to lack of hardware, but are
believed to work.

After this update the initial device descriptor is only read twice
when we know that the bMaxPacketSize is too small for a single packet
transfer of this descriptor.

Approved by:    thompsa (mentor)
2010-10-04 23:18:05 +00:00
Hans Petter Selasky
864bc41261 Add missing DRIVER_MODULE() entry for the musbotg driver.
Add some more comments.

Approved by:    thompsa (mentor)
2010-10-04 21:30:15 +00:00
Hans Petter Selasky
3df007ce6b The root mount hold reference was not released on USB controller
attach failures during boot. Fix this.

Approved by:    thompsa (mentor)
2010-10-04 21:24:10 +00:00
Hans Petter Selasky
1354026034 Commit initial version of new XHCI driver which was written from
scratch. This driver adds support for USB3.0 devices. The XHCI
interface is also backwards compatible to USB2.0 and USB1.0 and will
evntually replace the OHCI/UHCI and EHCI drivers.

There will be follow-up commits during the coming week to link the
driver into the default kernel build and add missing USB3.0
functionality in the USB core. Currently only the driver files are
committed.

Approved by:	thompsa (mentor)
2010-10-03 08:12:17 +00:00
Andrew Thompson
527aa7b226 Change argument for usbd_get_dma_delay() from USB bus to USB device, some
embedded hardware needs to know exactly which device is in question before it
exactly can decide the required delay.

Submitted by:	Hans Petter Selasky
2010-09-02 04:01:18 +00:00
Andrew Thompson
a4cadedb58 Add support for LOW speed BULK transfers. This mode is not recommended by the
USB 2.0 standard, though some USB devices use it anyway.

Submitted by:	Hans Petter Selasky
2010-06-22 20:57:48 +00:00
Rafal Jaworowski
db5ef4fc77 Convert Marvell ARM platforms to FDT convention.
The following systems are involved:

  - DB-88F5182
  - DB-88F5281
  - DB-88F6281
  - DB-78100
  - SheevaPlug

This overhaul covers the following major changes:

  - All integrated peripherals drivers for Marvell ARM SoC, which are
    currently in the FreeBSD source tree are reworked and adjusted so they
    derive config data out of the device tree blob (instead of hard coded /
    tabelarized values).

  - Since the common FDT infrastrucutre (fdtbus, simplebus) is used we say
    good by to obio / mbus drivers and numerous hard-coded config data.

Note that world needs to be built WITH_FDT for the affected platforms.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation.
2010-06-13 13:28:53 +00:00
Andrew Thompson
d1f7c4baa1 Back out r203140 which was causing problems when the first and the last
microframe slot was not in the smask. The problem was that the EHCI driver was
then thinking that the transfer was immediately complete in some cases. Which
could lead to freeze-like situations, which can be recovered by unplugging the
USB device.

Reported by:	Richard Kolkovich
Submitted by:	Hans Petter Selasky
2010-05-12 22:55:45 +00:00
Andrew Thompson
e727a16cf1 Add missing ifdefs for usb power saving support.
Submitted by:	Hans Petter Selasky
2010-05-12 22:51:45 +00:00
Andrew Thompson
b850ecc180 Change USB_DEBUG to #ifdef and allow it to be turned off. Previously this had
the illusion of a tunable setting but was always turned on regardless.

MFC after:	1 week
2010-04-22 21:31:34 +00:00
Andrew Thompson
4a4bd31b44 Add PCI IDs for two more nForce controllers.
Submitted by:	Dmitry Luhtionov @ gmail.com
2010-03-28 20:02:50 +00:00
Warner Losh
30e980f2d1 Add support for the Samsung S3C2xx0 family of ARM SoCs written by
Andrew Turner.  The kernel supports the LN2410SBC evaluation board,
and likely others.  These parts (or similar ones) are in some open
hardware designs for phones.

Submitted by:	Andrew Turner
2010-03-20 03:39:35 +00:00
Andrew Thompson
6703f98c02 For USS820 driver we need to manually reset TX FIFO at each SETUP transaction
because the chip doesn't do this by itself.

Submitted by:	Hans Petter Selasky
2010-03-11 21:49:00 +00:00
Andrew Thompson
f0c078e6e0 Wrap the proc wakeup special case for ddb in ifdef DDB.
Submitted by:	Giovanni Trematerra
2010-03-11 08:33:39 +00:00
Joel Dahl
7e4b1c0608 The NetBSD Foundation has granted permission to remove clause 3 and 4 from
their software.

Obtained from:	NetBSD
2010-03-03 10:18:03 +00:00
Andrew Thompson
cf223a88bc Disable the use of the IAAD usb doorbell on NVidia controllers as it can cause
the hardware to stall.

Submitted by:	Hans Petter Selasky
2010-02-09 00:38:40 +00:00
Andrew Thompson
89119752d0 Optimise EHCI ISOC HS done check.
Submitted by:	Hans Petter Selasky
2010-01-29 01:30:13 +00:00
Edward Tomasz Napierala
07020dae57 Remove unused uhci_dump_qhs().
Reviewed by:	hps
2010-01-08 15:52:06 +00:00
Martin Blapp
c2ede4b379 Remove extraneous semicolons, no functional changes.
Submitted by:	Marc Balmer <marc@msys.ch>
MFC after:	1 week
2010-01-07 21:01:37 +00:00
Andrew Thompson
725f67ad7b Add more OHCI pci ids.
Submitted by:	Hans Petter Selasky
2009-12-22 01:59:17 +00:00
Andrew Thompson
bae15f4ab1 Add more EHCI pci ids.
Submitted by:	Hans Petter Selasky
2009-12-22 01:57:34 +00:00
Andrew Thompson
741194f111 Correct name, 82801IJ -> 82801JI
Submitted by:	mitya_cabletv.dp.ua
2009-12-09 20:17:22 +00:00
Andrew Thompson
ce70efd12e Add uhci/ehci controller ids.
Submitted by:	mitya_cabletv.dp.ua
2009-12-03 23:24:12 +00:00
Andrew Thompson
767cb2e29d Remove overuse of exclamation marks in kernel printfs, there mere fact a
message has been printed is enough to get someones attention. Also remove the
line number for DPRINTF/DPRINTFN, it already prints the funtion name and a
unique message.
2009-11-26 00:43:17 +00:00
Andrew Thompson
e6af527c11 Disable interrupts after doing early takeover of the usb controller in case usb
isnt actually compiled in (or kldloaded) as the controller could cause spurious
interrupts.

Tested by:	Florian Smeets
2009-11-25 20:50:43 +00:00
Andrew Thompson
bda9babe90 Actually disable interrupts in ehci_detach().
Reviewed by:	HPS
2009-11-23 18:12:09 +00:00
Andrew Thompson
add5cc2fad Add missed register change in r199676.
Submitted by:	Hans Petter Selasky
2009-11-22 21:31:31 +00:00
Andrew Thompson
f1eac1007e Correct register access for USB device side operation on the musb controller.
Submitted by:	Hans Petter Selasky
2009-11-22 21:24:38 +00:00
Andrew Thompson
c13fd8d42b Provide tunables for some of the usb sysctls that affect boot behaviour.
Submitted by:	Andriy Gapon
2009-11-22 21:21:22 +00:00
Andrew Thompson
78c94708fb Initialise variable before use.
Submitted by:	Hans Petter Selasky
2009-11-22 21:19:01 +00:00
Andrew Thompson
f12c6c2913 Improve High Speed slot allocation mechanism by moving the computation to the
endpoint rather than per xfer and provide functions around get/free of resources.

Submitted by:	Hans Petter Selasky
2009-11-22 21:16:43 +00:00
Andrew Thompson
883bb30022 improve support for high speed isochronous endpoints which does not run 1:1,
but needs intervalling 1:2, 1:4 or 1:8

Submitted by:	Hans Petter Selasky
2009-11-08 20:54:03 +00:00
Andrew Thompson
30b22abe40 Integrate lost interrupts patch from the old USB stack.
Some EHCI chips from VIA / ATI seem to trigger interrupts before writing back
the qTD status, or miss signalling occasionally under heavy load.  If the host
machine is too fast, we can miss transaction completion - when we scan the
active list the transaction still seems to be active. This generally exhibits
itself as a umass stall that never recovers.

We work around this behaviour by setting up this callback after any softintr
that completes with transactions still pending, giving us another chance to
check for completion after the writeback has taken place

Submitted by:	Alexander Nedotsuko
MFC after:	3 days
2009-11-08 20:51:15 +00:00
Andrew Thompson
10454ab700 ehci_init() will do reset and set the usbrev flag. Fix problem where
ehci_reset() was called before ehci_init().

PR:		usb/140242
Submitted by:	Sebastian Huber
2009-11-08 20:44:55 +00:00
Andrew Thompson
c2e8b89ce4 Revert r198500 for now, this will break situations when
hw.pci.usb_early_takeover is set to zero and the SMM release
is never done.

Pointed out by:	marcel
2009-10-26 21:47:16 +00:00
Andrew Thompson
77cbe30ea9 Remove usb controller takeover code now that it is handled by the pci code.
Reminded by:	jhb
Reviewed by:	HPS
2009-10-26 20:23:15 +00:00
Andrew Thompson
1def609a63 Workaround buggy BIOS code in USB regard. By doing the BIOS to OS handover for
all host controllers at the same time, we avoid problems where the BIOS will
actually write to the USB registers of all the USB host controllers every time
we handover one of them, and consequently reset the OS programmed values.

Submitted by:	avg
Reviewed by:	jhb
2009-10-15 20:07:08 +00:00
Andrew Thompson
c8a14b9124 EHCI Hardware BUG workaround
The EHCI HW can use the qtd_next field instead of qtd_altnext when a short
packet is received. This contradicts what is stated in the EHCI datasheet.
Also the total-bytes field in the status field of the following TD gets
corrupted upon reception of a short packet!  We work this around in software by
not queueing more than one job/TD at a time of up to 16Kbytes! The bug has been
seen on multiple INTEL based EHCI chips.  Other vendors have not been tested
yet.

- Applications using /dev/usb/X.Y.Z, where Z is non-zero are affected, but not
  applications using LibUSB v0.1, v1.2 and v2.0.
- Mass Storage (umass) is affected.

Submitted by:	Hans Petter Selasky
MFC after:	3 days
2009-10-01 18:37:16 +00:00
Andrew Thompson
33ea13230a Clear all interrupts rather than just SETUP packet.
Submitted by:	Hans Petter Selasky
2009-09-28 07:10:32 +00:00
Andrew Thompson
2094ecda08 Simplify logic around setting EHCI_QH_DTC and expand some htohc32(temp.sc, 0)
statements to zero.

Submitted by:	Hans Petter Selasky
2009-09-28 07:09:17 +00:00
Andrew Thompson
6450e5babf Import two PCI quirks from Linux
- Add quirk for ATI SB600 and SB700 to free SMB controller
 - Correct schedule sleep time to 10us on the VIA ehci controller

Reported by:	Dorian B<FC>ttner, Andriy Gapon
Submitted by:	Hans Petter Selasky
2009-09-28 07:06:47 +00:00
Andrew Thompson
d88688c7da MFp4 @ 168387
- clean up USB detach logic. There seems to be some problems detaching multiple
  USB HUBs connected in series from the root.

- after this patch the rule is:
  1) Always use device_detach() on the USB HUB first.
  2) Never just device_delete_child() on the USB HUB, because that function
  will traverse to all the device leaves and free them first, and then the USB
  stack will free the devices twice which doesn't work very well.

- make sure the did DMA delay gets set after the timeout has elapsed to make
  logic more clear. There is no functional difference.

Submitted by:	Hans Petter Selasky
2009-09-28 07:01:54 +00:00
Alfred Perlstein
34b4872224 - allow disabling "root_mount_hold()" by
setting a sysctl/tunable at boot
        - remove some redundant initial explore code

Submitted by:	hps
2009-08-24 04:58:11 +00:00
John Baldwin
a56fe095f0 Temporarily revert the new-bus locking for 8.0 release. It will be
reintroduced after HEAD is reopened for commits by re@.

Approved by:	re (kib), attilio
2009-08-20 19:17:53 +00:00
Attilio Rao
444b91868b Make the newbus subsystem Giant free by adding the new newbus sxlock.
The newbus lock is responsible for protecting newbus internIal structures,
device states and devclass flags. It is necessary to hold it when all
such datas are accessed. For the other operations, softc locking should
ensure enough protection to avoid races.

Newbus lock is automatically held when virtual operations on the device
and bus are invoked when loading the driver or when the suspend/resume
take place. For other 'spourious' operations trying to access/modify
the newbus topology, newbus lock needs to be automatically acquired and
dropped.

For the moment Giant is also acquired in some key point (modules subsystem)
in order to avoid problems before the 8.0 release as module handlers could
make assumptions about it. This Giant locking should go just after
the release happens.

Please keep in mind that the public interface can be expanded in order
to provide more support, if there are really necessities at some point
and also some bugs could arise as long as the patch needs a bit of
further testing.

Bump __FreeBSD_version in order to reflect the newbus lock introduction.

Reviewed by:    ed, hps, jhb, imp, mav, scottl
No answer by:   ariff, thompsa, yongari
Tested by:      pho,
                G. Trematerra <giovanni dot trematerra at gmail dot com>,
                Brandon Gooch <jamesbrandongooch at gmail dot com>
Sponsored by:   Yahoo! Incorporated
Approved by:	re (ksmith)
2009-08-02 14:28:40 +00:00
Alfred Perlstein
a0c61406ad USB controller:
- allow disabling "root_mount_hold()" by setting "hw.usb.no_boot_wait" sysctl

Submitted by:	hps
Approved by:	re
2009-07-30 00:16:32 +00:00
Alfred Perlstein
dddb25f98a USB CORE:
- Add minimum polling support to drive UMASS
  and UKBD in case of panic.
- Add extra check to ukbd probe to fix problem about
  mouse devices attaching like keyboards.
- P4 ID: 166148

Submitted by:	hps
Approved by:	re
2009-07-30 00:14:34 +00:00
Alfred Perlstein
f724bcec31 USB controller:
- patch from Alexander Motin <mav@freebsd.org>
          - add more ID's
          - P4 ID: 165805

Submitted by:	hps
Approved by:	re
2009-07-30 00:12:47 +00:00
Andrew Thompson
29bd7d7e9a Sync to p4
- Add support for devices that handle set and clear stall in hardware.
 - Add missing get timestamp function
 - Add more xfer flags

Submitted by:	Hans Petter Selasky
Approved by:	re (kib)
2009-06-27 21:23:30 +00:00
Andrew Thompson
ed6d949afd - Make struct usb_xfer opaque so that drivers can not access the internals
- Reduce the number of headers needed for a usb driver, the common case is just   usb.h and usbdi.h
2009-06-23 02:19:59 +00:00