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.
Pete Zaitcev [Thu, 11 Jun 2009 14:40:39 +0000 (08:40 -0600)]
USB: Let usb_sg_init to set transfer_buffer more often
This fix permits the "new" usbmon to access usb-storage's data buffer
without DMA remapping tricks. It should be compatible with PIO controllers
and not add any new crashes. Note that from now on PIO controllers and
usbmon are uniform in their access pattern and if one crashes then
the other will too. Hopefuly neither does.
As a side effect, we get rid for #ifdefs, which were a little ugly.
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Pete Zaitcev [Thu, 11 Jun 2009 14:53:20 +0000 (08:53 -0600)]
USB: usbmon: end ugly tricks with DMA peeking
This patch fixes crashes when usbmon attempts to access GART aperture.
The old code attempted to take a bus address and convert it into a
virtual address, which clearly was impossible on systems with actual
IOMMUs. Let us not persist in this foolishness, and use transfer_buffer
in all cases instead.
I think downsides are negligible. The ones I see are:
- A driver may pass an address of one buffer down as transfer_buffer,
and entirely different entity mapped for DMA, resulting in misleading
output of usbmon. Note, however, that PIO based controllers would
do transfer the same data that usbmon sees here.
- Out of tree drivers may crash usbmon if they store garbage in
transfer_buffer. I inspected the in-tree drivers, and clarified
the documentation in comments.
- Drivers that use get_user_pages will not be possible to monitor.
I only found one driver with this problem (drivers/staging/rspiusb).
- Same happens with with usb_storage transferring from highmem, but
it works fine on 64-bit systems, so I think it's not a concern.
At least we don't crash anymore.
Why didn't we do this in 2.6.10? That's because back in those days
it was popular not to fill in transfer_buffer, so almost all
traffic would be invisible (e.g. all of HID was like that).
But now, the tree is almost 100% PIO friendly, so we can do the
right thing at last.
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Pete Zaitcev [Wed, 10 Jun 2009 20:15:52 +0000 (14:15 -0600)]
USB: sisusbvga: drop usb_buffer_alloc
This patch falls out of my work to fix usbmon so it uses virtual addresses.
It is not necessary, the "new" usbmon should work just fine with sisusbvga.
However, it seems ridiculous that anyone would use uncached memory to
transfer bulk data. Dropping the unnecessary use of usb_buffer_alloc
should be beneficial here, in case anyone ever uses the dongle on
anything beyond x86.
I had no success in raising the author of the driver by e-mail, so
the patch is not actually tested.
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Sarah Sharp [Tue, 8 Sep 2009 20:20:16 +0000 (13:20 -0700)]
USB: Fix SS endpoint companion descriptor parsing.
When there's a descriptor after the SuperSpeed endpoint companion
descriptor, the previous code would have skipped over twice the length it
was supposed to. This code fixes crashes seen with UASP devices (which
have a UASP descriptor after the SS endpoint companion descriptor).
Sarah Sharp [Wed, 2 Sep 2009 19:14:28 +0000 (12:14 -0700)]
USB: xhci: Support interrupt transfers.
Interrupt transfers are submitted to the xHCI hardware using the same TRB
type as bulk transfers. Re-use the bulk transfer enqueueing code to
enqueue interrupt transfers.
Interrupt transfers are a bit different than bulk transfers. When the
interrupt endpoint is to be serviced, the xHC will consume (at most) one
TD. A TD (comprised of sg list entries) can take several service
intervals to transmit. The important thing for device drivers to note is
that if they use the scatter gather interface to submit interrupt
requests, they will not get data sent from two different scatter gather
lists in the same service interval.
For now, the xHCI driver will use the service interval from the endpoint's
descriptor (bInterval). Drivers will need a hook to poll at a more
frequent interval. Set urb->interval to the interval that the xHCI
hardware will use.
Sarah Sharp [Fri, 28 Aug 2009 21:28:18 +0000 (14:28 -0700)]
USB: xhci: Set -EREMOTEIO when xHC gives bad transfer length.
The xHCI hardware reports the number of bytes untransferred for a given
transfer buffer. If the hardware reports a bytes untransferred value
greater than the submitted buffer size, we want to play it safe and say no
data was transferred. If the driver considers a short packet to be an
error, remember to set -EREMOTEIO.
Sarah Sharp [Thu, 27 Aug 2009 21:36:24 +0000 (14:36 -0700)]
USB: xhci: Check URB's actual transfer buffer size.
Make sure that the amount of data the xHC says was transmitted is less
than or equal to the size of the requested transfer buffer. Before, if
the host controller erroneously reported that the number of bytes
untransferred was bigger than the buffer in the URB, urb->actual_length
could be set to a very large size.
Make sure urb->actual_length <= urb->transfer_buffer_length.
Sarah Sharp [Thu, 27 Aug 2009 21:36:14 +0000 (14:36 -0700)]
USB: xhci: Don't touch xhci_td after it's freed.
On a successful transfer, urb->td is freed before the URB is ready to be
given back to the driver. Don't touch urb->td after it's freed. This bug
would have only shown up when xHCI debugging was turned on, and the freed
memory was quickly reused for something else.
Sarah Sharp [Thu, 27 Aug 2009 21:36:03 +0000 (14:36 -0700)]
USB: xhci: Handle babbling endpoints correctly.
The 0.95 xHCI spec says that non-control endpoints will be halted if a
babble is detected on a transfer. The 0.96 xHCI spec says all types of
endpoints will be halted when a babble is detected. Some hardware that
claims to be 0.95 compliant halts the control endpoint anyway.
When a babble is detected on a control endpoint, check the hardware's
output endpoint context to see if the endpoint is marked as halted. If
the control endpoint is halted, a reset endpoint command must be issued
and the transfer ring dequeue pointer needs to be moved past the stopped
transfer. Basically, we treat it as if the control endpoint had stalled.
Handle bulk babbling endpoints as if we got a completion event with a
stall completion code.
Sarah Sharp [Fri, 7 Aug 2009 21:04:55 +0000 (14:04 -0700)]
USB: xhci: Add quirk for Fresco Logic xHCI hardware.
This Fresco Logic xHCI host controller chip revision puts bad data into
the output endpoint context after a Reset Endpoint command. It needs a
Configure Endpoint command (instead of a Set TR Dequeue Pointer command)
after the reset endpoint command.
Set up the input context before issuing the Reset Endpoint command so we
don't copy bad data from the output endpoint context. The HW also can't
handle two commands queued at once, so submit the TRB for the Configure
Endpoint command in the event handler for the Reset Endpoint command.
Devices that stall on control endpoints before a configuration is selected
will not work under this Fresco Logic xHCI host controller revision.
This patch is for prototype hardware that will be given to other companies
for evaluation purposes only, and should not reach consumer hands. Fresco
Logic's next chip rev should have this bug fixed.
Sarah Sharp [Fri, 7 Aug 2009 21:04:52 +0000 (14:04 -0700)]
USB: xhci: Handle stalled control endpoints.
When a control endpoint stalls, the next control transfer will clear the
stall. The USB core doesn't call down to the host controller driver's
endpoint_reset() method when control endpoints stall, so the xHCI driver
has to do all its stall handling for internal state in its interrupt handler.
When the host stalls on a control endpoint, it may stop on the data phase
or status phase of the control transfer. Like other stalled endpoints,
the xHCI driver needs to queue a Reset Endpoint command and move the
hardware's control endpoint ring dequeue pointer past the failed control
transfer (with a Set TR Dequeue Pointer or a Configure Endpoint command).
Since the USB core doesn't call usb_hcd_reset_endpoint() for control
endpoints, we need to do this in interrupt context when we get notified of
the stalled transfer. URBs may be queued to the hardware before these two
commands complete. The endpoint queue will be restarted once both
commands complete.
Sarah Sharp [Fri, 7 Aug 2009 21:04:49 +0000 (14:04 -0700)]
USB: xhci: Support full speed devices.
Full speed devices have varying max packet sizes (8, 16, 32, or 64) for
endpoint 0. The xHCI hardware needs to know the real max packet size
that the USB core discovers after it fetches the first 8 bytes of the
device descriptor.
In order to fix this without adding a new hook to host controller drivers,
the xHCI driver looks for an updated max packet size for control
endpoints. If it finds an updated size, it issues an evaluate context
command and waits for that command to finish. This should only happen in
the initialization and device descriptor fetching steps in the khubd
thread, so blocking should be fine.
Sarah Sharp [Fri, 7 Aug 2009 21:04:46 +0000 (14:04 -0700)]
USB: xhci: Set correct max packet size for HS/FS control endpoints.
Set the max packet size for the default control endpoint on high speed
devices to be 64 bytes. High speed devices always have a max packet size
of 64 bytes. There's no use setting it to eight for the initial 8 byte
descriptor fetch and then issuing (and waiting for) an evaluate context
command to update it to 64 bytes for the subsequent control transfers.
The USB core guesses that the max packet size on a full speed control
endpoint is 64 bytes, and then updates it after the first 8-byte
descriptor fetch. Change the initial setup for the xHCI internal
representation of the full speed device to have a 64 byte max packet size.
Sarah Sharp [Fri, 7 Aug 2009 21:04:43 +0000 (14:04 -0700)]
USB: xhci: Configure endpoint code refactoring.
Refactor out the code issue, wait for, and parse the event completion code
for a configure endpoint command. Modify it to support the evaluate
context command, which has a very similar submission process. Add
functions to copy parts of the output context into the input context
(which will be used in the evaluate context command).
Sarah Sharp [Fri, 7 Aug 2009 21:04:36 +0000 (14:04 -0700)]
USB: xhci: Work around for chain bit in link TRBs.
Different sections of the xHCI 0.95 specification had opposing
requirements for the chain bit in a link transaction request buffer (TRB).
The chain bit is used to designate that adjacent TRBs are all part of the
same scatter gather list that should be sent to the device. Link TRBs can
be in the middle, or at the beginning or end of these chained TRBs.
Sections 4.11.5.1 and 6.4.4.1 both stated the link TRB "shall have the
chain bit set to 1", meaning it is always chained to the next TRB.
However, section 4.6.9 on the stop endpoint command has specific cases for
what the hardware must do for a link TRB with the chain bit set to 0. The
0.96 specification errata later cleared up this issue by fixing the
4.11.5.1 and 6.4.4.1 sections to state that a link TRB can have the chain
bit set to 1 or 0.
The problem is that the xHCI cancellation code depends on the chain bit of
the link TRB being cleared when it's at the end of a TD, and some 0.95
xHCI hardware simply stops processing the ring when it encounters a link
TRB with the chain bit cleared.
Allow users who are testing 0.95 xHCI prototypes to set a module parameter
(link_quirk) to turn on this link TRB work around. Cancellation may not
work if the ring is stopped exactly on a link TRB with chain bit set, but
cancellation should be a relatively uncommon case.
SL811 Device detected after removal used to be working in linux-2.6.22
but then broke somewhere between 2.6.22 and 2.6.28. Current
hub_port_connect_change() in drivers/usb/core/hub.c won't call
usb_disconnect() in case the SL811 driver sets portstatus
USB_PORT_FEAT_CONNECTION upon removal.
AFAIK the SL811 has only a combined Device Insert/Remove
detection bit, therefore use a count to distinguish insert or remove.
Some devices from the OpenDCC project are missing in the list
of the FTDI PIDs. These PIDs are listed at
http://www.opendcc.de/elektronik/usb/opendcc_usb.html
(Sorry for the german only page.)
This patch adds the three missing devices.
Merge branch 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
perf_event, powerpc: Fix compilation after big perf_counter rename
Merge branch 'for-2.6.32' of git://linux-nfs.org/~bfields/linux
* 'for-2.6.32' of git://linux-nfs.org/~bfields/linux: (68 commits)
nfsd4: nfsv4 clients should cross mountpoints
nfsd: revise 4.1 status documentation
sunrpc/cache: avoid variable over-loading in cache_defer_req
sunrpc/cache: use list_del_init for the list_head entries in cache_deferred_req
nfsd: return success for non-NFS4 nfs4_state_start
nfsd41: Refactor create_client()
nfsd41: modify nfsd4.1 backchannel to use new xprt class
nfsd41: Backchannel: Implement cb_recall over NFSv4.1
nfsd41: Backchannel: cb_sequence callback
nfsd41: Backchannel: Setup sequence information
nfsd41: Backchannel: Server backchannel RPC wait queue
nfsd41: Backchannel: Add sequence arguments to callback RPC arguments
nfsd41: Backchannel: callback infrastructure
nfsd4: use common rpc_cred for all callbacks
nfsd4: allow nfs4 state startup to fail
SUNRPC: Defer the auth_gss upcall when the RPC call is asynchronous
nfsd4: fix null dereference creating nfsv4 callback client
nfsd4: fix whitespace in NFSPROC4_CLNT_CB_NULL definition
nfsd41: sunrpc: add new xprt class for nfsv4.1 backchannel
sunrpc/cache: simplify cache_fresh_locked and cache_fresh_unlocked.
...
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (34 commits)
trivial: fix typo in aic7xxx comment
trivial: fix comment typo in drivers/ata/pata_hpt37x.c
trivial: typo in kernel-parameters.txt
trivial: fix typo in tracing documentation
trivial: add __init/__exit macros in drivers/gpio/bt8xxgpio.c
trivial: add __init macro/ fix of __exit macro location in ipmi_poweroff.c
trivial: remove unnecessary semicolons
trivial: Fix duplicated word "options" in comment
trivial: kbuild: remove extraneous blank line after declaration of usage()
trivial: improve help text for mm debug config options
trivial: doc: hpfall: accept disk device to unload as argument
trivial: doc: hpfall: reduce risk that hpfall can do harm
trivial: SubmittingPatches: Fix reference to renumbered step
trivial: fix typos "man[ae]g?ment" -> "management"
trivial: media/video/cx88: add __init/__exit macros to cx88 drivers
trivial: fix typo in CONFIG_DEBUG_FS in gcov doc
trivial: fix missing printk space in amd_k7_smp_check
trivial: fix typo s/ketymap/keymap/ in comment
trivial: fix typo "to to" in multiple files
trivial: fix typos in comments s/DGBU/DBGU/
...
Henrik Rydberg [Tue, 22 Sep 2009 00:04:50 +0000 (17:04 -0700)]
hwmon: applesmc: restore accelerometer and keyboard backlight on resume
On resume from suspend, the driver currently resets the logical state as
if it was brought up from halt. This patch uses the
dev_pm_ops.resume/restore methods to synchronize the hardware with the
memorized logical state, in effect bringing back the accelerometer and
backlight to the state prior to suspend. Works for both suspend to ram
and hibernation. The patch has zero effect on the running state.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se> Cc: Nicolas Boichat <nicolas@boichat.ch> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Michael Abbott [Tue, 22 Sep 2009 00:04:47 +0000 (17:04 -0700)]
drivers/hwmon/adm1021.c: add low_power support for adm1021 driver
Occasionally it is helpful to be able to turn a temperature sensor off
(for example if it's making unwanted electrical noise). This patch
adds a sysfs node to put any adm1021 compatible device into low power mode.
Signed-off-by: Michael Abbott <michael.abbott@diamond.ac.uk> Cc: Jean Delvare <khali@linux-fr.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>