Mike Dunn [Thu, 15 Apr 2010 21:01:33 +0000 (17:01 -0400)]
USB: usbserial: mos7720: add support for parallel port on moschip 7715
Add support for the parallel port on the moschip MCS7715 device. The port
registers itself with the parport subsystem as a low-level driver. A separate
entry to the kernel configuration is added beneath that for the mos7720, to
avoid the need to link with the parport subsystem code for users who don't have
or don't want the parallel port. Only compatibility mode is currently supported
(no ECP/EPP). Tested with both moschip devices (7720 and 7715) on UP and SMP
hosts, including regression testing of serial port, concurrent operation of
serial and parallel ports, and various connect / disconnect scenarios.
Signed-off-by: Mike Dunn <mikedunn@newsguy.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
David Miller [Wed, 7 Apr 2010 01:26:03 +0000 (18:26 -0700)]
USB: ehci: Elide I/O watchdog on NEC parts
I've been running with this patch on my Niagara2 boxes for some time
and have not seen any ill effects yet. Maybe we can stash this into
the USB tree to get exposure for some time in -next and if anything
crops up we can simply revert?
Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
It seems unlikely that this entry is needed anymore since the kernel
has logic to handle devices that poorly respond to INQUIRY. Since we
now have another entry with the same VID/PID but different flags, it's
a good time to attempt to clean this up.
The original submitter's email no longer works, so we'll keep an eye
out for any regression reports.
Signed-off-by: Phil Dibowitz <phil@ipom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Sarah Sharp [Mon, 5 Apr 2010 17:55:58 +0000 (10:55 -0700)]
USB: Support for allocating USB 3.0 streams.
Bulk endpoint streams were added in the USB 3.0 specification. Streams
allow a device driver to overload a bulk endpoint so that multiple
transfers can be queued at once.
The device then decides which transfer it wants to work on first, and can
queue part of a transfer before it switches to a new stream. All this
switching is invisible to the device driver, which just gets a completion
for the URB. Drivers that use streams must be able to handle URBs
completing in a different order than they were submitted to the endpoint.
This requires adding new API to set up xHCI data structures to support
multiple queues ("stream rings") per endpoint. Drivers will allocate a
number of stream IDs before enqueueing URBs to the bulk endpoints of the
device, and free the stream IDs in their disconnect function. See
Documentation/usb/bulk-streams.txt for details.
The new mass storage device class, USB Attached SCSI Protocol (UASP), uses
these streams API.
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Sarah Sharp [Fri, 2 Apr 2010 22:34:43 +0000 (15:34 -0700)]
USB: xhci: Correct assumptions about number of rings per endpoint.
Much of the xHCI driver code assumes that endpoints only have one ring.
Now an endpoint can have one ring per enabled stream ID, so correct that
assumption. Use functions that translate the stream_id field in the URB
or the DMA address of a TRB into the correct stream ring.
Correct the polling loop to print out all enabled stream rings. Make the
URB cancellation routine find the correct stream ring if the URB has
stream_id set. Make sure the URB enqueueing routine does the same. Also
correct the code that handles stalled/halted endpoints.
Check that commands and registers that can take stream IDs handle them
properly. That includes ringing an endpoint doorbell, resetting a
stalled/halted endpoint, and setting a transfer ring dequeue pointer
(since that command can set the dequeue pointer in a stream context or an
endpoint context).
Correct the transfer event handler to translate a TRB DMA address into the
stream ring it was enqueued to. Make the code to allocate and prepare TD
structures adds the TD to the right td_list for the stream ring. Make
sure the code to give the first TRB in a TD to the hardware manipulates
the correct stream ring.
When an endpoint stalls, store the stream ID of the stream ring that
stalled in the xhci_virt_ep structure. Use that instead of the stream ID
in the URB, since an URB may be re-used after it is given back after a
non-control endpoint stall.
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Sarah Sharp [Fri, 2 Apr 2010 22:34:16 +0000 (15:34 -0700)]
USB: xhci: Add memory allocation for USB3 bulk streams.
Add support for allocating streams for USB 3.0 bulk endpoints. See
Documentation/usb/bulk-streams.txt for more information about how and why
you would use streams.
When an endpoint has streams enabled, instead of having one ring where all
transfers are enqueued to the hardware, it has several rings. The ring
dequeue pointer in the endpoint context is changed to point to a "Stream
Context Array". This is basically an array of pointers to transfer rings,
one for each stream ID that the driver wants to use.
The Stream Context Array size must be a power of two, and host controllers
can place a limit on the size of the array (4 to 2^16 entries). These
two facts make calculating the size of the Stream Context Array and the
number of entries actually used by the driver a bit tricky.
Besides the Stream Context Array and rings for all the stream IDs, we need
one more data structure. The xHCI hardware will not tell us which stream
ID a transfer event was for, but it will give us the slot ID, endpoint
index, and physical address for the TRB that caused the event. For every
endpoint on a device, add a radix tree to map physical TRB addresses to
virtual segments within a stream ring.
Keep track of whether an endpoint is transitioning to using streams, and
don't enqueue any URBs while that's taking place. Refuse to transition an
endpoint to streams if there are already URBs enqueued for that endpoint.
We need to make sure that freeing streams does not fail, since a driver's
disconnect() function may attempt to do this, and it cannot fail.
Pre-allocate the command structure used to issue the Configure Endpoint
command, and reserve space on the command ring for each stream endpoint.
This may be a bit overkill, but it is permissible for the driver to
allocate all streams in one call and free them in multiple calls. (It is
not advised, however, since it is a waste of resources and time.)
Even with the memory and ring room pre-allocated, freeing streams can
still fail because the xHC rejects the configure endpoint command. It is
valid (by the xHCI 0.96 spec) to return a "Bandwidth Error" or a "Resource
Error" for a configure endpoint command. We should never see a Bandwidth
Error, since bulk endpoints do not effect the reserved bandwidth. The
host controller can still return a Resource Error, but it's improbable
since the xHC would be going from a more resource-intensive configuration
(streams) to a less resource-intensive configuration (no streams).
If the xHC returns a Resource Error, the endpoint will be stuck with
streams and will be unusable for drivers. It's an unavoidable consequence
of broken host controller hardware.
Includes bug fixes from the original patch, contributed by
John Youn <John.Youn@synopsys.com> and Andy Green <AGreen@PLXTech.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Sarah Sharp [Fri, 2 Apr 2010 22:34:10 +0000 (15:34 -0700)]
USB: Add stream ID field to struct urb.
Bulk endpoint streams were added in the USB 3.0 specification. Streams
allow a device driver to overload a bulk endpoint so that multiple
transfers can be queued at once.
Add a new field, stream_id, to struct urb so that USB 3.0 drivers can
specify which stream they want the URB to be queued to.
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Sarah Sharp [Fri, 2 Apr 2010 22:33:56 +0000 (15:33 -0700)]
USB: Add parsing of SuperSpeed endpoint companion descriptor.
Allow the xHCI drivers (and any new USB 3.0 drivers) to parse the
SuperSpeed endpoint companion descriptor to find the maximum number of
bulk endpoint streams the endpoint supports. This is used to calculate
the maximum total number of streams the driver can allocate.
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Matthew Garrett [Thu, 1 Apr 2010 16:31:07 +0000 (12:31 -0400)]
usb serial: Add generic USB wwan support
The generic USB serial code is ill-suited for high-speed USB wwan devices,
resulting in the option driver. However, other non-option devices may also
gain similar benefits from not using the generic code. Factorise out the
non-option specific code from the option driver and make it available to
other users.
Signed-off-by: Matthew Garrett <mjg@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Fri, 2 Apr 2010 17:22:16 +0000 (13:22 -0400)]
USB: deprecate the power/level sysfs attribute
This patch (as1367) deprecates USB's power/level sysfs attribute in
favor of the power/control attribute provided by the runtime PM core.
The two attributes do the same thing.
It would be nice to replace power/level with a symlink to
power/control, but at the moment sysfs doesn't offer any way to do so.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Fri, 2 Apr 2010 17:22:09 +0000 (13:22 -0400)]
USB: use PM core routines to enable/disable autosuspend
This patch (as1366) replaces the private routines
usb_enable_autosuspend() and usb_disable_autosuspend() with calls to
the standard pm_runtime_allow() and pm_runtime_forbid() functions in
the runtime PM framework. They do the same thing.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Fri, 2 Apr 2010 17:21:33 +0000 (13:21 -0400)]
USB: don't enable remote wakeup by default
This patch (as1364) avoids enabling remote wakeup by default on all
non-root-hub USB devices. Individual drivers or userspace will have
to enable it wherever it is needed, such as for keyboards or network
interfaces. Note: This affects only system sleep, not autosuspend.
External hubs will continue to relay wakeup requests received from
downstream through their upstream port, even when remote wakeup is not
enabled for the hub itself. Disabling remote wakeup on a hub merely
prevents it from generating wakeup requests in response to connect,
disconnect, and overcurrent events.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Fri, 2 Apr 2010 17:18:50 +0000 (13:18 -0400)]
USB: improve runtime remote wakeup settings
This patch (as1362) adjusts the way the USB autosuspend routines
handle remote-wakeup settings. They aren't supposed to use
device_may_wakeup(); that test is intended only for system sleep, not
runtime power management. Instead the code checks to see if any
interface drivers need remote wakeup; if they do then it is enabled,
provided the device is capable of it.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Fri, 2 Apr 2010 17:27:28 +0000 (13:27 -0400)]
USB: fix usbmon and DMA mapping for scatter-gather URBs
This patch (as1368) fixes a rather obscure bug in usbmon: When tracing
URBs sent by the scatter-gather library, it accesses the data buffers
while they are still mapped for DMA.
The solution is to move the mapping and unmapping out of the s-g
library and into the usual place in hcd.c. This requires the addition
of new URB flag bits to describe the kind of mapping needed, since we
have to call dma_map_sg() if the HCD supports native scatter-gather
operation and dma_map_page() if it doesn't. The nice thing about
having the new flags is that they simplify the testing for unmapping.
The patch removes the only caller of usb_buffer_[un]map_sg(), so those
functions are #if'ed out. A later patch will remove them entirely.
As a result of this change, urb->sg will be set in situations where
it wasn't set previously. Hence the xhci and whci drivers are
adjusted to test urb->num_sgs instead, which retains its original
meaning and is nonzero only when the HCD has to handle a scatterlist.
Finally, even when a submission error occurs we don't want to hand
URBs to usbmon before they are unmapped. The submission path is
rearranged so that map_urb_for_dma() is called only for non-root-hub
URBs and unmap_urb_for_dma() is called immediately after a submission
error. This simplifies the error handling.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> CC: <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Matt Reimer [Thu, 1 Apr 2010 20:44:04 +0000 (13:44 -0700)]
USB: pxa27x_udc: use four bits to store endpoint addresses
Endpoint addresses on pxa27x can be programmed as 1-15, but since
only three bits were being used to store the endpoint number it
was possible to overflow.
Signed-off-by: Matt Reimer <mreimer@sdgsystems.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Mass Storage Function (MSF) used the same descriptors for each
usb_function instance (meaning usb_function::descriptors of different
functions pointed to the same static area (the same was true for
usb_function::hs_descriptors)).
This would leads to problems if MSF were used in several USB
configurations with different interface and/or endpoint numbers.
Descriptors for all configurations would have interface/endpoint
numbers overwritten by the values valid for the last configuration.
This patch adds code that copies the descriptors each time MSF is
added to USB configuration (that is for each usb_function).
Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com> Cc: Kyungmin Park <kyungmin.park@samsung.com>
The composite framework allows gadgets with more than one function. This
can lead to situations where the configuration descriptor is larger than
the maximum of 512 bytes currently allowed by the composite framework.
This patch proposes to double that limit to 1024.
Signed-off-by: Robert Lukassen <robert.lukassen@tomtom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
James Maki [Sun, 21 Mar 2010 17:53:59 +0000 (12:53 -0500)]
USB: option.c: option_indat_callback: Resubmit some unsuccessful URBs
All unsuccessful (non-zero status) URBs were being dropped. After N_IN_URBs are
dropped you will no longer be able to receive data.
This patch resubmits unsuccessful URBs unless the status indicates that it should
be terminated. The statuses that indicate the URB should be terminated was
gathered from other similar drivers.
Signed-off-by: James Maki <jamescmaki@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
g_hid is a USB gadget driver implementing the Human Interface Device class
specification. The driver handles basic HID protocol handling in the
kernel, and allows userspace to read/write HID reports trough /dev/hidgX
character devices.
Johan Hovold [Wed, 17 Mar 2010 22:06:07 +0000 (23:06 +0100)]
USB: serial: re-implement multi-urb writes in generic driver
Use dynamic transfer buffer sizes since it is more efficient to let the
host controller do the partitioning to fit endpoint size. This way we
also do not use more than one urb per write request.
Replace max_in_flight_urbs with multi_urb_write flag in struct
usb_serial_driver to enable multi-urb writes.
Use MAX_TX_URBS=40 and a max buffer size of PAGE_SIZE to prevent DoS
attacks.
Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Add process_read_urb to usb_serial_driver so that a driver can rely on
the generic read (and throttle) mechanism but still do device specific
processing of incoming data (such as adding tty_flags before pushing to
line discipline).
The default generic implementation handles sysrq for consoles but
otherwise simply pushes to tty.
Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Johan Hovold [Wed, 17 Mar 2010 22:05:56 +0000 (23:05 +0100)]
USB: serial: clean up read processing in generic driver
Always process and flush read urb, but only resubmit when not throttled.
The new tty-layer supply plenty of slack so there is really no need to
cache and delay processing of a single urb while throttled.
Note that unthrottle now submits using GFP_KERNEL as we are not in
atomic context (so there is no need to save irq state either).
Note also that the process_read_urb function could be added to
usb_serial_driver should any driver need to do any device specific
processing.
Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Johan Hovold [Wed, 17 Mar 2010 22:05:54 +0000 (23:05 +0100)]
USB: serial: remove unnecessary re-initialisation of generic urbs
The generic read and write bulk urbs are initialised when allocated in
usb_serial_probe. The only field that needs to be updated after that is
the transfer_buffer_length of the write urb.
Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Johan Hovold [Wed, 17 Mar 2010 22:00:40 +0000 (23:00 +0100)]
USB: pl2303: increase the bulk-out buffer size to 256 byte
Increase the bulk-out buffer size from 64 to 256 byte.
This gives a significant increase in throughput already at 1Mbaud as well
as lowered CPU usage. The buffer is big enough to keep up also at 3Mbaud
(128b would not suffice).
Johan Hovold [Wed, 17 Mar 2010 22:00:37 +0000 (23:00 +0100)]
USB: serial: allow drivers to define bulk buffer sizes
Allow drivers to define custom bulk in/out buffer sizes in struct
usb_serial_driver. If not set, fall back to the default buffer size
which matches the endpoint size.
Three drivers are currently freeing the pre-allocated buffers and
allocating larger ones to achieve this at port probe (ftdi_sio) or even
at port open (ipaq and iuu_phoenix), which needless to say is suboptimal.
Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Hans de Goede [Mon, 29 Mar 2010 10:03:17 +0000 (12:03 +0200)]
USB: Add a new quirk: USB_QUIRK_HONOR_BNUMINTERFACES
Add a new quirk USB_QUIRK_HONOR_BNUMINTERFACES, when this quirk is
set and a device has more interface descriptors in a configuration
then it claims to have in config->bNumInterfaces, ignore all additional
interfaces.
This is needed for devices which try to hide unused interfaces by only
lowering config->bNumInterfaces, and which can't handle if you try to talk
to the "hidden" interfaces.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Jason Wessel [Tue, 16 Mar 2010 21:05:44 +0000 (16:05 -0500)]
usb-console: pass baud from console to the initial tty open
The usb console code has had a long standing problem of not being able
to pass the baud rate from the kernel argument console=ttyUSB0,BAUD
down to the initial tty open, unless you were willing to settle for
9600 baud.
The solution is to directly use tty_init_termios() in
usb_console_setup() as this will preserve any changes to the initial
termios setting on future opens.
CC: Alan Cox <alan@linux.intel.com> CC: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
USB: f_mass_storage: dynamic buffers for better alignment
"Static" buffers in fsg_buffhd structure (ie. fields which are arrays
rather then pointers to dynamically allocated memory) are not aligned
to any "big" power of two which may lead to poor DMA performance
(copying "by hand" of head or tail) or no DMA at all even if otherwise
hardware supports it.
Therefore, this patch makes mass storage function use kmalloc()ed
buffers which are (because of their size) page aligned (which should
be enough for any hardware).
Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Felipe Balbi [Fri, 12 Mar 2010 08:29:12 +0000 (10:29 +0200)]
usb: musb: gadget: support musb-specific test modes
we can support the musb-specific test modes on the
vendor specific range of test selector as stated
on USB Specification Table 9-7 Test Mode Selectors.
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Felipe Balbi [Fri, 12 Mar 2010 08:29:06 +0000 (10:29 +0200)]
usb: musb: allow board to pass down fifo mode
boards might want to optimize their fifo configuration
to the particular needs of that specific board. Allow
that by moving all related data structures to
<linux/usb/musb.h>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Manuel Lauss [Mon, 8 Mar 2010 19:43:32 +0000 (20:43 +0100)]
USB: ehci-au1xxx does not need EHCI IO watchdog
I've been running variations of this patch for well over a year now;
my usual zoo of test devices didn't trigger any ill effects even
under heavy load. As a nice sideeffect idle-wakeups are reduced
from 20/s to about 2/s (EHCI hub with mouse and kbd).
Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Fri, 5 Mar 2010 20:10:17 +0000 (15:10 -0500)]
USB: remove uses of URB_NO_SETUP_DMA_MAP
This patch (as1350) removes all usages of coherent buffers for USB
control-request setup-packet buffers. There's no good reason to
reserve coherent memory for these things; control requests are hardly
ever used in large quantity (the major exception is firmware
transfers, and they aren't time-critical). Furthermore, only seven
drivers used it. We might as well always use streaming DMA mappings
for setup-packet buffers, and remove some extra complexity from
usbcore.
The DMA-mapping portion of hcd.c is currently in flux. A separate
patch will be submitted to remove support for URB_NO_SETUP_DMA_MAP
after everything else settles down. The removal should go smoothly,
as by then nobody will be using it.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Thu, 4 Mar 2010 22:05:08 +0000 (17:05 -0500)]
USB: straighten out port feature vs. port status usage
This patch (as1349b) clears up the confusion in many USB host
controller drivers between port features and port statuses. In mosty
cases it's true that the status bit is in the position given by the
corresponding feature value, but that's not always true and it's not
guaranteed in the USB spec.
There's no functional change, just replacing expressions of the form
(1 << USB_PORT_FEAT_x) with USB_PORT_STAT_x, which has the same value.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Thu, 4 Mar 2010 16:32:30 +0000 (11:32 -0500)]
USB: remove bogus USB_PORT_FEAT_*_SPEED symbols
This patch (as1348) removes the bogus
USB_PORT_FEAT_{HIGHSPEED,SUPERSPEED} symbols from ch11.h. No such
features are defined by the USB spec. (There is a PORT_LOWSPEED
feature, but the spec doesn't mention it except to say that host
software should never use it.) The speed indicators are port
statuses, not port features.
As a temporary workaround for the xhci-hcd driver, a fictional
USB_PORT_STAT_SUPER_SPEED symbol is added.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> CC: Sarah Sharp <sarah.a.sharp@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Ian Munsie [Wed, 3 Mar 2010 00:00:37 +0000 (11:00 +1100)]
USB: Remove large struct from the stack in USB storage isd200 driver
The compiler throws the following warning when compiling for a PowerPC 64
bit machine:
drivers/usb/storage/isd200.c:580: warning: the frame size of 2208 bytes is larger than 2048 bytes
There is a struct scsi_device which is placed on the stack and is
largely responsible for such wastage. The struct is just a dummy struct
filled with NULLs and set as the scsi_cmnd->device to make the
usb_stor_Bulk_transport function happy.
This patch makes the struct static, so that it is never placed onto the
stack and silences the compiler warning.
Signed-off-by: Ian Munsie <imunsie@au.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Eric Lescouet [Sat, 24 Apr 2010 21:38:17 +0000 (23:38 +0200)]
USB: split hub.h into ch11.h and merge-in hcd.h
Base on inputs from Alan Stern, split the hub.h header into:
- new ch11.h header (most of it) containing constants and
structures from chapter 11 of the USB 2.0 spec.
- a small remaining part being merged into hcd.h.
Signed-of-by: Eric Lescouet <eric@lescouet.org> Cc: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Eric Lescouet [Sat, 24 Apr 2010 21:34:27 +0000 (23:34 +0200)]
USB: make hub.h public (drivers dependency)
The usbcore headers: hcd.h and hub.h are shared between usbcore,
HCDs and a couple of other drivers (e.g. USBIP modules).
So, it makes sense to move them into a more public location and
to cleanup dependency of those modules on kernel internal headers.
This patch moves hub.h from drivers/usb/core into include/linux/usb/
Signed-of-by: Eric Lescouet <eric@lescouet.org> Cc: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Eric Lescouet [Sat, 24 Apr 2010 21:21:52 +0000 (23:21 +0200)]
USB: make hcd.h public (drivers dependency)
The usbcore headers: hcd.h and hub.h are shared between usbcore,
HCDs and a couple of other drivers (e.g. USBIP modules).
So, it makes sense to move them into a more public location and
to cleanup dependency of those modules on kernel internal headers.
This patch moves hcd.h from drivers/usb/core into include/linux/usb/
Signed-of-by: Eric Lescouet <eric@lescouet.org> Cc: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Sarah Sharp [Tue, 18 May 2010 23:05:26 +0000 (16:05 -0700)]
USB: xhci: Fix check for room on the ring.
The length of the scatter gather list a driver can enqueue is limited by
the bus' sg_tablesize to 62 entries. Each entry will be described by at
least one transfer request block (TRB). If the entry's buffer crosses a
64KB boundary, then that entry will have to be described by two or more
TRBs. So even if the USB device driver respects sg_tablesize, the whole
scatter list may take more than 62 TRBs to describe, and won't fit on
the ring.
Don't assume that an empty ring means there is enough room on the
transfer ring. The old code would unconditionally queue this too-large
transfer, and over write the beginning of the transfer. This would mean
the cycle bit was unchanged in those overwritten transfers, causing the
hardware to think it didn't own the TRBs, and the host would seem to
hang.
Now drivers may see submit_urb() fail with -ENOMEM if the transfers are
too big to fit on the ring.
Sarah Sharp [Tue, 18 May 2010 23:05:21 +0000 (16:05 -0700)]
USB: xhci: Limit bus sg_tablesize to 62 TRBs.
When a scatter-gather list is enqueued to the xHCI driver, it translates
each entry into a transfer request block (TRB). Only 63 TRBs can be
used per ring segment, and there must be one additional TRB reserved to
make sure the hardware does not think the ring is empty (so the enqueue
pointer doesn't equal the dequeue pointer). Limit the bus sg_tablesize
to 62 TRBs.
Sarah Sharp [Thu, 6 May 2010 20:40:08 +0000 (13:40 -0700)]
USB: xhci: Fix issue with set interface after stall.
When the USB core installs a new interface, it unconditionally clears the
halts on all the endpoints on the new interface. Usually the xHCI host
needs to know when an endpoint is reset, so it can change its internal
endpoint state. In this case, it doesn't care, because the endpoints were
never halted in the first place.
To avoid issuing a redundant Reset Endpoint command, the xHCI driver looks
at xhci_virt_ep->stopped_td to determine if the endpoint was actually
halted. However, the functions that handle the stall never set that
variable to NULL after it dealt with the stall. So if an endpoint stalled
and a Reset Endpoint command completed, and then the class driver tried to
install a new alternate setting, the xHCI driver would access the old
xhci_virt_ep->stopped_td pointer. A similar problem occurs if the
endpoint has been stopped to cancel a transfer.
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6:
rtnetlink: make SR-IOV VF interface symmetric
sctp: delete active ICMP proto unreachable timer when free transport
tcp: fix MD5 (RFC2385) support
Linus Torvalds [Sun, 16 May 2010 18:11:31 +0000 (11:11 -0700)]
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
* 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus:
MIPS: Oprofile: Fix Loongson irq handler
MIPS: N32: Use compat version for sys_ppoll.
MIPS FPU emulator: allow Cause bits of FCSR to be writeable by ctc1