Sarah Sharp [Fri, 4 Sep 2009 17:53:13 +0000 (10:53 -0700)]
USB: xhci: Change how xHCI commands are handled.
Some commands to the xHCI hardware cannot be allowed to fail due to out of
memory issues or the command ring being full.
Add a way to reserve a TRB on the command ring, and make all command
queueing functions indicate whether they are using a reserved TRB.
Add a way to pre-allocate all the memory a command might need. A command
needs an input context, a variable to store the status, and (optionally) a
completion for the caller to wait on. Change all code that assumes the
input device context, status, and completion for a command is stored in
the xhci virtual USB device structure (xhci_virt_device).
Store pending completions in a FIFO in xhci_virt_device. Make the event
handler for a configure endpoint command check to see whether a pending
command in the list has completed. We need to use separate input device
contexts for some configure endpoint commands, since multiple drivers can
submit requests at the same time that require a configure endpoint
command.
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Sarah Sharp [Fri, 4 Sep 2009 17:53:11 +0000 (10:53 -0700)]
USB: xhci: Refactor input device context setup.
Refactor common code to set up the add and drop flags for the input device
context setup. This setup is used before a configure endpoint command for
the reset endpoint quirk, and will be used for the command to alloc or
free streams rings.
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Sarah Sharp [Fri, 4 Sep 2009 17:53:09 +0000 (10:53 -0700)]
USB: xhci: Endpoint representation refactoring.
The xhci_ring structure contained information that is really related to an
endpoint, not a ring. This will cause problems later when endpoint
streams are supported and there are multiple rings per endpoint.
Move the endpoint state and cancellation information into a new virtual
endpoint structure, xhci_virt_ep. The list of TRBs to be cancelled should
be per endpoint, not per ring, for easy access. There can be only one TRB
that the endpoint stopped on after a stop endpoint command (even with
streams enabled); move the stopped TRB information into the new virtual
endpoint structure. Also move the 31 endpoint rings and temporary ring
storage from the virtual device structure (xhci_virt_device) into the
virtual endpoint structure (xhci_virt_ep).
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Gergely Imreh [Mon, 7 Sep 2009 02:47:01 +0000 (10:47 +0800)]
USB: fix USBTMC get_capabilities success handling
In order:
Add reference to relevant section of USBTMC usb488 subclass specs.
Print debug output of capabilities only when it was retrieved successfully.
Clear return value on success, otherwise driver always reports failure.
Signed-off-by: Gergely Imreh <imrehg@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Tue, 1 Sep 2009 15:09:56 +0000 (11:09 -0400)]
USB: usbfs: add USBDEVFS_URB_BULK_CONTINUATION flag
This patch (as1283) adds a new flag, USBDEVFS_URB_BULK_CONTINUATION,
to usbfs. It is intended for userspace libraries such as libusb and
openusb. When they have to break up a single usbfs bulk transfer into
multiple URBs, they will set the flag on all but the first URB of the
series.
If an error other than an unlink occurs, the kernel will automatically
cancel all the following URBs for the same endpoint and refuse to
accept new submissions, until an URB is encountered that is not marked
as a BULK_CONTINUATION. Such an URB would indicate the start of a new
transfer or the presence of an older library, so the kernel returns to
normal operation.
This enables libraries to delimit bulk transfers correctly, even in
the presence of early termination as indicated by short packets.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Oliver Neukum [Fri, 4 Sep 2009 21:19:53 +0000 (23:19 +0200)]
USB: support for autosuspend in sierra while online
This implements support for autosuspend in the sierra driver while online.
Remote wakeup is used for reception. Transmission is facilitated with a queue
and the asynchronous autopm mechanism. To prevent races a private flag
for opened ports and a counter of running transmissions needs to be added.
Signed-off-by: Oliver Neukum <oliver@neukum.org> Tested-by: Elina Pasheva <epasheva@sierrawireless.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Jason Wessel [Thu, 20 Aug 2009 20:39:57 +0000 (15:39 -0500)]
USB: ehci-dbgp,documentation: Documentation updates for ehci-dbgp
Add missing information about requirements of using the EHCI usb debug
controller as well as to mention you can use a debug controller other
than the first one in the system.
Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Yinghai Lu <yinghai@kernel.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: Sarah Sharp <sarah.a.sharp@intel.com> Cc: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Jason Wessel [Thu, 20 Aug 2009 20:39:56 +0000 (15:39 -0500)]
USB: ehci-dbgp: errata for EHCI debug/host controller synchronization
On some EHCI debug controllers after the host controller driver is
activated, the debug controller will occasionally fail to submit a
bulk write URB. On controllers that exhibit this behavior a dummy
bulk write must get submitted to resynchronize the device.
The "dummy bulk write" does not get received by the host attached to
the other end of the usb debug device. The usb debug device simply
acknowledges the "dummy bulk write" and returns to a usable state.
The behavior, without this patch is that you see missing text from a
complete kernel boot when using the keep option to the earlyprintk
kernel argument.
Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Yinghai Lu <yinghai@kernel.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Jason Wessel [Thu, 20 Aug 2009 20:39:55 +0000 (15:39 -0500)]
USB: ehci-dbgp: errata for EHCI debug controller initialization
On some EHCI usb debug controllers, the EHCI debug device will fail to
be seen after a port reset, after a warm reset. Two options exist to
get the device to initialize correctly.
Option 1 is to unplug and plug in the device.
Option 2 is to use the EHCI port test to get the usb debug device to
start talking again. At that point the debug controller port reset
will succeed.
Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Yinghai Lu <yinghai@kernel.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> CC: dbrownell@users.sourceforge.net Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Jason Wessel [Thu, 20 Aug 2009 20:39:54 +0000 (15:39 -0500)]
USB: ehci-dbgp,ehci: Allow early or late use of the dbgp device
If the EHCI debug port is initialized and in use, the EHCI host
controller driver must follow two rules.
1) If the EHCI host driver issues a controller reset, the debug
controller driver re-initialization must get called after the reset
is completed.
2) The EHCI host driver should ignore any requests to the physical
EHCI debug port when the EHCI debug port is in use.
The code to check for the debug port was moved from ehci_pci_reinit()
to ehci_pci_setup because it must get called prior to ehci_reset()
which will clear the debug port registers.
Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: dbrownell@users.sourceforge.net Cc: Ingo Molnar <mingo@elte.hu> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Yinghai Lu <yinghai@kernel.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Jason Wessel [Thu, 20 Aug 2009 20:39:53 +0000 (15:39 -0500)]
USB: ehci-dbgp: stability improvements and external re-init
This patch implements several changes:
1) Improve the capability to debug the dbgp driver
The dbgp_ehci_status() was added in a number of places to report
the critical ehci registers to diagnose the cause of a failure of
the ehci-dbgp driver.
2) Capability to survive the host controller initialization
The dbgp_external_startup(), dbgp_not_safe, and dbgp_phys_port were
added so as to allow the ehci-dbgp to re-initialize after the ehci
host controller is reset by the standard host controller driver.
This same routine is common for the early startup or
re-initialization.
This resulted in the need to move some of the initialization code
out of the __init section because the ehci driver has the
possibility to be loaded later on as a kernel module.
3) Stability improvements for device initialization
The device enumeration from 0 to 127 has the possibility to fail
the first time after a warm reset on some older EHCI debug
controllers. The enumeration will be tried up to 3 times to
account for this failure case.
The dbg_wait_until_complete() was changed to wait up to 250 ms
before failing which only comes into play during device
initialization. The maximum delay will never get hit during the
course of normal operation of the driver, unless the device got
unplugged or there was a ehci controller failure, in which case the
dbgp device driver will shut itself down.
Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: dbrownell@users.sourceforge.net Cc: Yinghai Lu <yinghai@kernel.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Jason Wessel [Thu, 20 Aug 2009 20:39:52 +0000 (15:39 -0500)]
early_printk: Allow more than one early console
It is desirable to be able to use one early boot device to debug
another or to have multiple places you can see the early boot
diagnostics, such as the vga screen or serial device.
This patch changes the early_printk console device registration to
allow more than one early printk device to get registered via
register_console().
Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Yinghai Lu <yinghai@kernel.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
When using the EHCI host controller as a polled device, a bit more
tolerance is required in terms of delays. On some 3+ghz systems the
cpu loops were faster than the EHCI device mmio and resulted in the
controller failing to initialize.
On at least one first generation EHCI controller when it was not
operating in interrupt mode, it would fail to report a port change
status, but executing the port reset allowed the debug controller to
work correctly anyway. This errata causes a one time 300ms delay in
the boot time, where as the typical delay is 1-5ms for an EHCI
controller that does not have this errata.
The debug printk's were fixed to have the correct state messages, and
there was a conversion from using early_printk to printk to avoid
calling the dbgp driver while debugging the initialization.
Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Yinghai Lu <yinghai@kernel.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Jason Wessel [Thu, 20 Aug 2009 20:39:50 +0000 (15:39 -0500)]
USB: ehci-dbgp: Execute early BIOS hand off
The PCI quirk code executes a BIOS hand off to obtain full control of
the EHCI host controller, the self contained ehci-dbgp driver must do
the same thing using the early PCI API, else the BIOS can cause a
fatal fault.
Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: dbrownell@users.sourceforge.net Cc: Yinghai Lu <yinghai@kernel.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Jason Wessel [Thu, 20 Aug 2009 20:39:48 +0000 (15:39 -0500)]
USB: ehci,dbgp,early_printk: split ehci debug driver from early_printk.c
Move the dbgp early printk driver in advance of refactoring and adding
new code, so the changes to this code are tracked separately from the
move of the code.
The drivers/usb/early directory will be the location of the current
and future early usb code for driving usb devices prior initializing
the standard interrupt driven USB drivers.
Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Yinghai Lu <yinghai@kernel.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Pete Zaitcev [Fri, 21 Aug 2009 02:00:19 +0000 (20:00 -0600)]
USB: unusual_devs.h: drop some unneeded floppy entries
We set pdt_1f_for_no_lun for UFI devices, so most floppy entiries should
be unnecessary. This patch removes three entries which I'm certain are.
- For Mitsumi I have a customer with RHEL 5 (bz#514296)
- For SMSC I accessed Novell's Bugzilla and verified the entry
- For Y-E I tested the patch with the actual device
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Phil Dibowitz <phil@ipom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Rogério Brito [Sat, 22 Aug 2009 20:33:53 +0000 (17:33 -0300)]
USB: fix paths in usbmon documentation
Hi there.
On Aug 21 2009, Alan Stern wrote:
> On Thu, 20 Aug 2009, Rogério Brito wrote:
> > Again, just reiterating, what I said before, even though I am not sure
> > if I can reproduce it, I will try to.
>
> A usbmon trace showing what happens when you plug in the drive and
> when you run smartctl would help.
The documentation for usbmon in the kernel 2.6.31-rc7 kernel doesn't
match what the kernel exposes in the debug fs tree. This patch fixes it.
Anand Gadiyar [Mon, 24 Aug 2009 14:44:45 +0000 (20:14 +0530)]
USB: OMAP: ISP1301: Compile fix
OMAP: ISP1301: Compile fix
Fix this build error on non- OMAP-H2/H3/H4 systems:
(factored out two empty functions as part of the fix)
CC drivers/usb/otg/isp1301_omap.o
drivers/usb/otg/isp1301_omap.c: In function 'otg_update_isp':
drivers/usb/otg/isp1301_omap.c:635: error: implicit declaration of function 'notresponding'
drivers/usb/otg/isp1301_omap.c: In function 'b_peripheral':
drivers/usb/otg/isp1301_omap.c:973: error: implicit declaration of function 'enable_vbus_draw'
drivers/usb/otg/isp1301_omap.c: In function 'isp_update_otg':
drivers/usb/otg/isp1301_omap.c:1003: error: implicit declaration of function 'enable_vbus_source'
make[2]: *** [drivers/usb/otg/isp1301_omap.o] Error 1
make[1]: *** [drivers/usb/otg] Error 2
make: *** [drivers] Error 2
Jiri Slaby [Sat, 22 Aug 2009 18:24:49 +0000 (20:24 +0200)]
USB: make usb_buffer_map_sg consistent with doc
usb_buffer_map_sg should return negative on error according to
its documentation. But dma_map_sg returns 0 on error. Take this
into account and return -ENOMEM in such situation.
While at it, return -EINVAL instead of -1 when wrong input is
passed in.
If this wasn't done, usb_sg_* operations used after usb_sg_init
which returned 0 may cause oopses/deadlocks since we don't init
structures/entries, esp. completion and status entry.
Alan Stern [Wed, 19 Aug 2009 16:22:44 +0000 (12:22 -0400)]
USB: EHCI: change deschedule logic for interrupt QHs
This patch (as1281) changes the way ehci-hcd deschedules interrupt
QHs, copying the approach used for async QHs. The caller is no longer
responsible for rescheduling the QH if its queue is non-empty; instead
the reschedule is done directly by intr_deschedule(), after calling
qh_completions(). This is exactly the same as how end_unlink_async()
works.
ehci_urb_dequeue() and intr_deschedule() now correctly handle the case
where they are called while another interrupt URB for the same QH is
being given back. This was a surprisingly large blind spot. And
scan_periodic() now respects the new needs_rescan flag.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> CC: David Brownell <david-b@pacbell.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Wed, 19 Aug 2009 16:22:06 +0000 (12:22 -0400)]
USB: EHCI: rescan the queue after an unlink
This patch (as1280) fixes an obscure bug in ehci-hcd's dequeuing logic
for async URBs. If a later URB is unlinked and the completion
routine unlinks an earlier URB, then the earlier URB won't be given
back in a timely manner because the endpoint queue isn't rescanned as
it should be.
Similar bugs occur if an endpoint is reset or a halt is cleared while
a completion routine is running, because the subroutines don't test
for the COMPLETING state.
All these problems are solved by adding a new needs_rescan flag to the
ehci_qh structure. If the flag is set while scanning through an idle
QH, the scan will be repeated. If the QH isn't idle then an unlink
cycle will be initiated, and the proper action will be taken when it
becomes idle.
Also, an unnecessary test is removed from qh_link_async(): That
routine is never called if the QH's state isn't IDLE.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> CC: David Brownell <david-b@pacbell.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Current bindings specify that "fsl,mpc8323-qe-usb" compatible entry
should be used as a base match for QE UDCs, so update the driver to
comply with the bindings.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Cc: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Frank Schaefer [Tue, 18 Aug 2009 18:15:07 +0000 (20:15 +0200)]
USB-serial: pl2303: fix baud rate handling in case of unsupported values
According to the datasheets, the PL2303 supports a set of 25 baudrates.
The baudrate is set as a 4 byte value directly.
During my experiments with device 067b:2303 (PL2303X), I noticed that
- the bridge-controller always uses 9600 baud if invalid/unsupported baud rate
values are set
- the baud rate value returned by usb_control_msg(..., GET_LINE_REQUEST, ...)
does not reflect the actually used baudrate. Always the last set value is
returned, even if it was invalid and not used by the controller.
This patch fixes the following issues with the current code:
1.) make sure that only supported baudrates are set (are there any buggy
chip revisions out there which don't "like" other values... ?).
2.) always set the baudrate to the next nearest supported baudrate.
3.) applications can now read back the resulting baudrate properly, because
tty_encode_baud_rate(...) is now fed with the actually used baudrate.
Signed-off-by: Frank Schaefer <schaefer.frank@gmx.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Mon, 3 Aug 2009 15:05:59 +0000 (11:05 -0400)]
USB: s3c2410: unregister should call unbind, not disconnect
This patch (as1275) fixes the s3c2410 device controller driver. Its
usb_gadget_unregister_driver() routine is supposed to call the gadget
driver's unbind method, not the disconnect method.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Brian Niebuhr [Fri, 14 Aug 2009 15:04:22 +0000 (10:04 -0500)]
USB: gadget: Add EEM gadget driver
This patch adds a CDC EEM ethernet gadget driver. CDC EEM is a newer
USB ethernet specification that uses a simpler interface than the older
CDC ECM. This makes CDC EEM usable by a wider set of USB hardware.
By default the ethernet gadget will still use CDC ECM/Subset, but kernel
configuration and/or a module parameter will allow alternative use of
the CDC EEM protocol.
Changes since last version:
- Brought in missing RNDIS changes that caused compile error
- Modified 'sentinel CRC' checking to match EEM host driver
Signed-off-by: Brian Niebuhr <bniebuhr@efjohnson.com> Cc: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
David VomLehn [Fri, 28 Aug 2009 19:54:27 +0000 (12:54 -0700)]
USB: use kfifo to buffer usb-generic serial writes
When do_output_char() attempts to write a carriage return/line feed sequence,
it first checks to see how much buffer room is available. If there are at least
two characters free, it will write the carriage return/line feed with two calls
to tty_put_char(). It calls the tty_operation functions write() for devices that
don't support the tty_operations function put_char(). If the USB generic serial
device's write URB is not in use, it will return the buffer size when asked how
much room is available. The write() of the carriage return will cause it to mark
the write URB busy, so the subsequent write() of the line feed will be ignored.
This patch uses the kfifo infrastructure to implement a write FIFO that
accurately returns the amount of space available in the buffer.
Signed-off-by: David VomLehn <dvomlehn@cisco.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Randy Dunlap [Tue, 11 Aug 2009 18:31:31 +0000 (11:31 -0700)]
USB: otg: fix twl4030-usb build
subsys_initcall_sync() is only defined for built-in code, not for
loadable modules, so this driver build fails when built as a module.
However, the _sync() forms of the initcalls are not implemented,
so this should not be used -- just use the non-sync form of it.
drivers/usb/otg/twl4030-usb.c:777: warning: data definition has no type or storage class
drivers/usb/otg/twl4030-usb.c:777: warning: type defaults to 'int' in declaration of 'subsys_initcall_sync'
drivers/usb/otg/twl4030-usb.c:777: warning: parameter names (without types) in function declaration
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Cc: Felipe Balbi <felipe.balbi@nokia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This is an alternate solution to the EEM 'sentinel' CRC valiation issue.
CDC EEM allows using a 'sentinel' ethernet frame CRC of 0xdeadbeef in
place of a real CRC. The 'sentinel' value is transmitted in big-endian
order whereas the normal CRC is little-endian. This patch handles both
cases appropriately.
Signed-off-by: Brian Niebuhr <bniebuhr@efjohnson.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Jon Hunter [Wed, 12 Aug 2009 15:57:59 +0000 (11:57 -0400)]
USB: EHCI: ensure all watchdog timer events are deleted when suspending usb
This patch was previously discussed in the following thread:
http://thread.gmane.org/gmane.linux.usb.general/19472/focus=19484
On the OMAP3 device the usbhost controller is in a separate internal
power-domain. So when the usbhost is inactive or suspend is called,
we can disable clocks and power-down the usbhost to save power.
Recently we found that after calling ehci_bus_suspend() and disabling
the usbhost clocks we would see the ehci watchdog timer event fire. This
was causing a kernel panic because the usbhost controllers clocks were
disabled and inside the watchdog timer function the clocks were not
being re-enabled, so when the ehci registers were accessed this resulted
in a CPU data-abort.
To avoid this panic, per recommendation from Alan Stern (see above thread), we
make sure any pending timer events (that may have been scheduled by calling
ehci_work within the ehci_bus_suspend() function) are deleted before returning.
Signed-off-by: Fei Yang <fei.yang@motorola.com> Signed-off-by: Jon Hunter <jon-hunter@ti.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Ming Lei [Sat, 1 Aug 2009 12:39:57 +0000 (20:39 +0800)]
USB: otg: twl4030-usb.c: mark .init as subsys_initcall_sync
This patch fixes the .probe failure of twl4030_usb driver if
it is compiled into kernel.
Since twl4030_usb USB transceiver .probe depends on
twl4030-regulator, marking twl4030_usb_init as subsys_initcall_sync
can make it called after twl4030-regulator initialization is finished,
then twl4030_usb USB transceiver driver can be probed successfully.
Signed-off-by: Ming Lei <tom.leiming@gmail.com> Cc: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
David Woodhouse [Mon, 3 Aug 2009 11:40:27 +0000 (12:40 +0100)]
USB: Work around BIOS bugs by quiescing USB controllers earlier
We are seeing a number of crashes in SMM, when VT-d is enabled while
'Legacy USB support' is enabled in various BIOSes.
The BIOS is supposed to indicate which addresses it uses for DMA in a
special ACPI table ("RMRR"), so that we can punch a hole for it when we
set up the IOMMU.
The problem is, as usual, that BIOS engineers are totally incompetent.
They write code which will crash if the DMA goes AWOL, and then they
either neglect to provide an RMRR table at all, or they put the wrong
addresses in it. And of course they don't do _any_ QA, since that would
take too much time away from their crack-smoking habit.
The real fix, of course, is for consumers to refuse to buy motherboards
which only have closed-source firmware available. If we had _open_
firmware, bugs like this would be easy to fix.
Since that's something I can only dream about, this patch implements an
alternative -- ensuring that the USB controllers are handed off from the
BIOS and quiesced _before_ the IOMMU is initialised. That would have
been a much better design than this RMRR nonsense in the first place, of
course. The bootloader has no business doing DMA after the OS has booted
anyway.
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
The current limit only allows isochronous transfers up to 32kbyte/urb,
updating this to 192 kbyte/urb improves the reliability of the
transfer. USB 2.0 transfer is possible with 32kbyte but increases the
chance of corrupted/incomplete data when the system is performing some
other tasks in the background.
Ken MacLeod [Thu, 6 Aug 2009 19:18:27 +0000 (14:18 -0500)]
USB: isp1362: fix pulldown register defines and conf logic
HCHWCFG_PULLDOWN_DS2 and HCHWCFG_PULLDOWN_DS1 were swapped. Incorrect
operator precedence in isp1362_hc_start() hid part of the problem.
This fixes a problem where Port 1 in Host mode fails to see disconnects.
Signed-Off-By: Ken MacLeod <ken@bitsko.slc.ut.us> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Robin Callender [Sun, 2 Aug 2009 18:38:58 +0000 (11:38 -0700)]
USB: gadget: audio driver seg-fault fix
The included patch can be applied to the new usb gadget audio driver.
It addresses a seg-fault in uncovered in g_audio.ko.
The fault occurs in the function u_audio.c::gaudio_open_end_dev() when
device /dev/snd/pcmC0D0c (FILE_PCM_CAPTURE) is not present.
I suspect there may be similar problems with device /dev/snd/pcmC0D0p
(FILE_PCM_PLAYBACK) handling also. I leave that for the developer(s),
as I was unsure as to the side-effects of not calling
playback_default_hw_params() in the initialization phase.
Signed-off-by: Robin Callender <robin_callender@hotmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fangxiaozhi [Fri, 7 Aug 2009 04:30:35 +0000 (12:30 +0800)]
USB: usb-storage fails to attach to Huawei Datacard cdrom device
In this patch, we always make the return value of function
usb_stor_huawei_e220_init to be zero. Then it will not prevent usb-storage
driver from attaching to the CDROM device of Huawei Datacard.
Ondrej Zary [Thu, 6 Aug 2009 23:09:52 +0000 (16:09 -0700)]
USB: ark3116: add IrDA support for Gembird UIR-22
Add IrDA support to ark3116 driver. This makes Gembird UIR-22 USB to IrDA
adapter work (vendor ID 0x18ec, device ID 0x3118). This adapter contains
ARK3116T USB serial chip and an IrDA transceiver, thus a command like
"irattach /dev/ttyUSB0 -s" is needed.
All magic numbers were captured using usbsnoop from windows driver that
came with the device.
Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
USB: ohci-pxa27x: Allow NOCP and OCPM to be cleared
Some ohci-pxa27x platforms may require OCPM and NOCP in UHCRHDA to be
clear, but the existing code was only allowing setting. This patch
ensures that these bits are clear if the respective flags are not set.
This is particularly important for the PXA3xx family where the
documentation says OCPM must be cleared, but it is set after reset.
USB: audio: guard kernel-only code with __KERNEL__
include/linux/usb/audio.h is exported to userspace,
so part of this file that is for internal kernel
usage need to be guarded with ifdef __KERNEL__.
This way make headers_install will stript it out.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Nicolas Ferre [Mon, 27 Jul 2009 21:59:24 +0000 (14:59 -0700)]
USB: at91: modify OHCI driver to allow shared interrupts
At91sam9g45 series has a set of high speed USB interfaces.
The host driver is an EHCI with its companion OHCI. OHCI is
always handled by ohci-at91.c.
This wrapper is just modified to allow IRQ sharing
between two controllers.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Acked-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Nicolas Ferre [Mon, 27 Jul 2009 21:47:40 +0000 (14:47 -0700)]
USB: at91: Add USB EHCI driver for at91sam9g45 series
Add host USB High speed driver for at91sam9g45 series.
The host driver is an EHCI with its companion OHCI. EHCI is
handled by the new ehci-atmel.c whereas the OHCI is always
handled by ohci-at91.c.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Randy Dunlap [Tue, 28 Jul 2009 18:22:41 +0000 (11:22 -0700)]
USB: usbtmc: fix printk format warnings
Fix printk format warnings:
drivers/usb/class/usbtmc.c:466: warning: format '%zu' expects type 'size_t', but argument 4 has type 'u32'
drivers/usb/class/usbtmc.c:466: warning: format '%zu' expects type 'size_t', but argument 5 has type 'int'
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
USB: usbtmc: sanity checks for DEV_DEP_MSG_IN urbs
According to the specifications, an instrument should not return more data in a
DEV_DEP_MSG_IN urb than requested. However, some instruments can send more
than requested. This could cause the kernel to write the extra data past the
end of the buffer provided by read().
Fix this by checking that the value of the TranserSize field is not larger than
the urb itself and not larger than the size of the userspace buffer. Also
correctly decrement the remaining size of the buffer when userspace read()s
more than USBTMC_SIZE_IOBUFFER.
Alan Stern [Wed, 22 Jul 2009 18:44:17 +0000 (14:44 -0400)]
USB: dummy-hcd: accept mismatch between wLength and transfer length
This patch (as1269) fixes a bug in the way dummy_hcd handles control
URBs. Currently it returns a -EOVERFLOW error if the wLength value in
the setup packet is different from the URB's transfer_buffer_length.
Other host controller drivers don't do this. There's no reason the
two length values have to be equal, and in fact they sometimes aren't
-- a driver might set the transfer length to the maxpacket value in
order to handle buggy devices that don't respect wLength.
This patch simply removes the unnecessary check and error return.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Wed, 22 Jul 2009 18:42:54 +0000 (14:42 -0400)]
USB: don't lose mode switch events on suspended devices
This patch (as1268) changes the way usbcore handles child devices that
undergo a disconnection and reconnection while the parent hub is
suspended. Currently, if the child isn't enabled for remote wakeup we
leave it alone, figuring that it will go through a reset-resume when
somebody tries to use it.
However this isn't a good approach if the reason for the disconnection
is that the child decided to switch modes or in some other way alter
its descriptors. In that case we want to re-enumerate it as soon as
possible, not wait until somebody forces a reset-resume.
To resolve the issue, this patch treats reconnected suspended child
devices as though they had requested a remote wakeup, even if they
weren't enabled for it. The mode switch or descriptor change will be
detected during the reset part of the reset-resume, and the device
will be re-enumerated immediately.
The disadvantage of this change is that it will cause autosuspended
devices to be resumed when the computer wakes up from a system sleep
during which the root hub was reset or lost power. This shouldn't
matter much; some people would even argue that autosuspended devices
should _always_ be resumed when the system wakes up!
Alan Stern [Wed, 22 Jul 2009 18:41:18 +0000 (14:41 -0400)]
USB: check for hub driver not bound to root hub device
This patch (as1267) changes usb_kick_khubd() and hdev_to_hub() to make
them more resilient against situations where a hub device isn't bound
to the hub driver. The code assumes that if a root hub was
successfully registered then it must be bound to the hub driver.
But this assumption can fail if the user manually unbinds the hub
driver, or more importantly, if the host controller dies causing
usb_set_configuration to fail.
To protect against these possibilities, make hdev_to_hub() check that
the hub device is configured before dereferencing the active
configuration, and make usb_kick_khubd() check that the pointer to the
hub's private data structure isn't NULL.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Oliver Neukum [Tue, 21 Jul 2009 06:47:34 +0000 (08:47 +0200)]
USB: fix wrong order of events in usb serial suspension
if a subdriver has an additional suspend method, it must be called
first to allow the subdriver to return -EBUSY, because the second
half cannot be easily undone.
Signed-off-by: Oliver Neukum <oliver@neukum.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Julia Lawall [Sun, 19 Jul 2009 15:29:57 +0000 (17:29 +0200)]
USB: storage: Drop an unneeded a NULL test
In each case, the NULL test is not necessary because the function is static
and at the only places where it is called, the us argument has already been
dereferenced.
The semantic patch that finds the problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)
USB: isp1760: allow platform devices to customize devflags
Platform device support was merged earlier, but support for boards to
customize the devflags aspect of the controller was not. We want this on
Blackfin systems to control the bus width, but might as well expose all of
the fields while we're at it.
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alek Du [Mon, 13 Jul 2009 04:41:20 +0000 (12:41 +0800)]
USB: EHCI: Add Intel Moorestown EHCI controller HOSTPCx extensions and support phy low power mode
The Intel Moorestown EHCI controller supports non-standard HOSTPCx register
extension. This register controls the LPM behaviour and controls the behaviour
of each USB port.
Signed-off-by: Jacob Pan <jacob.jun.pan@intel.com> Signed-off-by: Alek Du <alek.du@intel.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Cc: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alek Du [Mon, 13 Jul 2009 23:23:29 +0000 (07:23 +0800)]
USB: EHCI: split ehci_qh into hw and sw parts
The ehci_qh structure merged hw and sw together which is not good:
1. More and more items are being added into ehci_qh, the ehci_qh software
part are unnecessary to be allocated in DMA qh_pool.
2. If HCD has local SRAM, the sw part will consume it too, and it won't
bring any benefit.
3. For non-cache-coherence system, the entire ehci_qh is uncachable, actually
we only need the hw part to be uncacheable. Spliting them will let the sw
part to be cacheable.
Signed-off-by: Alek Du <alek.du@intel.com> Cc: David Brownell <dbrownell@users.sourceforge.net> CC: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alek Du [Mon, 13 Jul 2009 09:30:41 +0000 (17:30 +0800)]
USB: EHCI: add need_io_watchdog flag to ehci_hcd
Basically the io watchdog is only useful for those quirk HCDs. For most
good ones, it only brings unnecessary wakeups. At least, I know the
Intel EHCI HCDs should turn off the flag.
Signed-off-by: Alek Du <alek.du@intel.com> Cc: David Brownell <dbrownell@users.sourceforge.net> Cc: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Oliver Neukum [Wed, 1 Jul 2009 14:00:32 +0000 (16:00 +0200)]
USB: serial: full autosuspend support for the option driver
this adds autosupport usable even in an always online mode.
- enables remote wakeup on open
- autoresume for sending
- timeout based autosuspend if nothing is sent or recieved
- autosuspend without remote wakeup support on open/close
Signed-off-by: Oliver Neukum <oliver@neukum.org> Tested-off-by: Zhao Ming <zhao.ming9@zte.com.cn> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Philipp Zabel [Wed, 1 Jul 2009 10:46:25 +0000 (03:46 -0700)]
USB: gadget: pxa25x: basic transceiver support
This adds very basic otg_transceiver support, with vbus_session
and vbus_draw callbacks.
Now VBUS sensing can be handled by an external driver which registers
the otg_transceiver interface. It also allows gadget drivers to configure
the current drawn from VBUS. The UDC driver just passes their requests
along to the transceiver driver.
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Mon, 29 Jun 2009 15:02:04 +0000 (11:02 -0400)]
USB: make the "usbfs_snoop" log more pertinent
This patch (as1261) reduces the amount of detailed URB information
logged by usbfs when the usbfs_snoop parameter is enabled.
Currently we don't display the final status value for a completed URB.
But we do display the entire data buffer twice: both before submission
and after completion. The after-completion display doesn't limit
itself to the actual_length value. But since usbmon is readily
available in virtually all distributions, there's no reason for usbfs
to print out any buffer contents at all!
So this patch restricts the information to: userspace buffer pointer,
endpoint number, type, and direction, length or actual_length, and
timeout value or status. Now everything fits neatly into a single
line.
Along with those changes, the patch also fixes the snoop output for
the REAPURBNDELAY and REAPURBNDELAY32 ioctls. The current version
omits the 'N' from the names.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Mon, 29 Jun 2009 15:00:01 +0000 (11:00 -0400)]
USB: make intf.pm_usage an atomic_t
This patch (as1260) changes the pm_usage_cnt field in struct
usb_interface from an int to an atomic_t. This is so that drivers can
invoke the usb_autopm_get_interface_async() and
usb_autopm_put_interface_async() routines without locking and without
fear of corrupting the pm_usage_cnt value.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Mon, 29 Jun 2009 14:56:54 +0000 (10:56 -0400)]
USB: add API for userspace drivers to "claim" ports
This patch (as1258) implements a feature that users have been asking
for: It gives programs the ability to "claim" a port on a hub, via a
new usbfs ioctl. A device plugged into a "claimed" port will not be
touched by the kernel beyond the immediate necessities of
initialization and enumeration.
In particular, when a device is plugged into a "claimed" port, the
kernel will not select and install a configuration. And when a config
is installed by usbfs or sysfs, the kernel will not probe any drivers
for any of the interfaces. (However the kernel will fetch various
string descriptors during enumeration. One could argue that this
isn't really necessary, but the strings are exported in sysfs.)
The patch does not guarantee exclusive access to these devices; it is
still possible for more than one program to open the device file
concurrently. Programs are responsible for coordinating access among
themselves.
A demonstration program showing how to use the new interface can be
found in an attachment to
The patch also makes a small simplification to the hub driver,
replacing a bunch of more-or-less useless variants of "out of memory"
with a single message.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
David Vrabel [Wed, 24 Jun 2009 17:26:40 +0000 (18:26 +0100)]
USB: whci-hcd: make endpoint_reset method async
usb_hcd_endpoint_reset() may be called in atomic context and must not
sleep. So make whci-hcd's endpoint_reset() asynchronous. URBs
submitted while the reset is in progress will be queued (on the std
list) and transfers will resume once the reset is complete.
Signed-off-by: David Vrabel <david.vrabel@csr.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Laurent Pinchart [Sun, 21 Jun 2009 21:23:05 +0000 (23:23 +0200)]
USB audio gadget: Prefix all macro definitions with UAC_ in linux/usb/audio.h
linux/usb/audio.h is a public header file that includes definitions
exported to userspace. To avoid namespace clashes, prefix all macro
definitions with UAC_. Existing macros and structures prefixed with
USB_AC_ and USB_AS_ are renamed for consistency.