Alan Stern [Wed, 17 Feb 2010 15:05:47 +0000 (10:05 -0500)]
USB: remove references to port->port.count from the serial drivers
This patch (as1344) removes references to port->port.count from the
USB serial drivers. Now that serial ports are properly reference
counted, port.count checking is unnecessary and incorrect. Drivers
should assume that the port is in use from the time the open method
runs until the close method is called.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Cox [Thu, 18 Feb 2010 16:44:01 +0000 (16:44 +0000)]
USB: tty: Prune uses of tty_request_room in the USB layer
We have lots of callers that do not need to do this in the first place.
Remove the calls as they both cost CPU and for big buffers can mess up the
multi-page allocation avoidance.
Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Roel Kluin [Thu, 18 Feb 2010 01:36:23 +0000 (02:36 +0100)]
USB: don't read past config->interface[] if usb_control_msg() fails in usb_reset_configuration()
While looping over the interfaces, if usb_hcd_alloc_bandwidth() fails it calls
hcd->driver->reset_bandwidth(), so there was no need to reinstate the interface
again.
If no break occurred, the index equals config->desc.bNumInterfaces. A
subsequent usb_control_msg() failure resulted in a read from
config->interface[config->desc.bNumInterfaces] at label reset_old_alts.
In either case the last interface should be skipped.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Acked-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Roel Kluin [Wed, 17 Feb 2010 10:50:26 +0000 (11:50 +0100)]
USB: storage: fix misplaced parenthesis
Due to a misplaced parenthesis the usbat_write_block() return value was not
stored, but a boolean. USB_STOR_TRANSPORT_NO_SENSE and USB_STOR_TRANSPORT_ERROR
were returned as USB_STOR_TRANSPORT_FAILED.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Cc: Joe Perches <joe@perches.com> Cc: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Dennis O'Brien [Mon, 15 Feb 2010 16:50:38 +0000 (08:50 -0800)]
USB: vstusb.c: removal of driver for Vernier Software & Technology, Inc., devices and spectrometers
This patch removes the vstusb driver and support from the Linux tree.
This driver provided support for Vernier Software & Technology devices
and spectrometers (Ocean Optics). This driver is being replaced by a
user space - libusb - implementation.
Signed-off-by: Jim Collar <jim.collar@eqware.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Fri, 26 Feb 2010 16:49:39 +0000 (11:49 -0500)]
usb-storage: use max_hw_sectors instead of max_sectors
This patch (as1347) makes some adjustments to the way usb-storage
handles the request-queue parameters.
USB host controllers are able to handle arbitrarily long
scatter-gather lists, since they are limited only by main memory and
not by the controller hardware. Hence the sg_tablesize field in the
host template can be increased to the maximum value.
Drivers like usb-storage aren't supposed to touch the queue's
max_sectors parameter; instead they are supposed to use the
max_hw_sectors value. Accordingly, the patch replaces calls of
queue_max_sectors() with calls of queue_max_hw_sectors(). Oddly
enough, the blk_queue_max_sectors() routine is nevertheless still
appropriate.
The existing code imposes a limit of SCSI_DEFAULT_MAX_SECTORS (1024)
on the values accepted by the max_sectors attribute file. There's no
reason not to accept larger values, so the limit is removed. (It
would be nice to change the file's name to max_hw_sectors, but the old
name is already a well-established API.)
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> CC: Matthew Dharm <mdharm-usb@one-eyed-alien.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Sergei Shtylyov [Fri, 12 Feb 2010 19:52:34 +0000 (23:52 +0400)]
USB: OHCI: DA8xx/OMAP-L1x glue layer
Texas Instruments DA8xx/OMAP-L1x OHCI glue layer.
This OHCI implementation is not without quirks: there's only one physical port
despite the root hub reporting two; the port's power control and over-current
status bits are not connected to any pins, however, at least on the DA830 EVM
board, those signals are connected via GPIO, thus the provision was made for
overriding the OHCI port power and over-current bits at the board level...
Anand Gadiyar [Fri, 12 Feb 2010 12:18:59 +0000 (17:48 +0530)]
USB: ehci: omap: use default interrupt threshold
The current driver reduces the interrupt threshold to 1 microframe.
This was an accidental change and is not really required.
The default of 8 microframes will do just fine. So change it back.
Anand Gadiyar [Fri, 12 Feb 2010 12:24:59 +0000 (17:54 +0530)]
USB: omap: ehci: kill 2 compile warnings
Kill these compile warnings:
CC [M] drivers/usb/host/ehci-hcd.o
drivers/usb/host/ehci-dbg.c:45: warning: 'dbg_hcs_params' defined but not used
drivers/usb/host/ehci-dbg.c:89: warning: 'dbg_hcc_params' defined but not used
Elina Pasheva [Mon, 15 Feb 2010 22:50:14 +0000 (14:50 -0800)]
USB: serial: sierra driver indat_callback fix
A crash has been reported with sierra driver on disconnect with
Ubuntu/Lucid distribution based on kernel-2.6.32.
The cause of the crash was determined as "NULL tty pointer was being
referenced" and the NULL pointer was passed by sierra_indat_callback().
This patch modifies sierra_indat_callback() function to check for NULL
tty structure pointer. This modification prevents a crash from happening
when the device is disconnected.
This patch fixes the bug reported in Launchpad:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/511157
Elina Pasheva [Fri, 12 Feb 2010 02:37:40 +0000 (18:37 -0800)]
USB: serial: sierra driver adding reset_resume function
This patch adds a new function to the sierra.c driver, sierra_reset_resume().
This new function completes the suite of Dynamic Power Management commands
in the sierra.c driver.
According "5.3.6 Capability Parameters (HCCPARAMS)" of xHCI rev0.96 spec,
value of xECP register indicates a relative offset, in 32-bit words,
from Base to the beginning of the first extended capability.
The wrong calculation will cause BIOS handoff fail (not handoff from BIOS)
in some platform with BIOS USB legacy sup support.
Signed-off-by: Edward Shao <laface.tw@gmail.com> Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com> Cc: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Jason Wessel [Fri, 5 Feb 2010 17:49:05 +0000 (11:49 -0600)]
USB: ehci-dbgp: split PID register updates for IN and OUT pipes
This patch addresses two problems:
1) Bulk reads should always use the DATA0 for the pid, and the write
PID should toggle between DATA0 and DATA1. The fix is using
dbgp_pid_write_update() and dbgp_pid_read_update().
2) The delay loop for waiting for a transaction was not long enough to
always complete the initial handshake inside dbgp_wait_until_done().
After the initial handshake the maximum delay length is never reached.
The combined result of these two changes allows for the removal of the
forced resynchronization where a bulk write was issued with a dummy
data payload only to get the device to start accepting data writes
again.
CC: Eric Biederman <ebiederm@xmission.com> CC: Yinghai Lu <yhlu.kernel@gmail.com> Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Forest Bond [Fri, 5 Feb 2010 16:30:28 +0000 (11:30 -0500)]
USB: serial: Add support for ViVOtech ViVOpay devices.
Add support for USB serial interface provided by ViVOtech ViVOpay devices via
new driver vivopay-serial. Currently only the ViVOpay 8800 device is supported,
but support for similar devices can be added by adding the appropriate device
IDs to the driver.
Signed-off-by: Forest Bond <forest.bond@outpostembedded.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Eirik Aanonsen [Fri, 5 Feb 2010 08:49:25 +0000 (09:49 +0100)]
USB: atmel uaba: Adding invert vbus_pin
Adding vbus_pin_inverted so that the usb detect pin can be active high
or low depending on HW implementation also replaced the
gpio_get_value(udc->vbus_pin); with a call to vbus_is_present(udc); This
allows the driver to be loaded and save about 0,15W on the consumption.
Christoph Egger [Fri, 5 Feb 2010 12:24:12 +0000 (13:24 +0100)]
USB: Remove unsupported usb gadget drivers
A bunch of USB gadget drivers where never ported from the linux 2.4
series to 2.6 kernels. However there's some code still in the tree for
them which isn't used and is probably untested for ages.
As the chance of these drivers being forward ported is probably quite
small now it might be time to get rid of them.
Signed-off-by: Christoph Egger <siccegge@stud.informatik.uni-erlangen.de> Cc: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This patch fixes warning caused by calling min() macro
with arguments of different types:
drivers/usb/gadget/f_mass_storage.c:623: warning: \
comparison of distinct pointer types lacks a cast
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com> Cc: Marek Szyprowski <m.nazarewicz@samsung.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Catalin Marinas [Tue, 2 Feb 2010 15:31:02 +0000 (15:31 +0000)]
USB: isp1760: Flush the D-cache for the pipe-in transfer buffers
When the HDC driver writes the data to the transfer buffers it pollutes
the D-cache (unlike DMA drivers where the device writes the data). If
the corresponding pages get mapped into user space, there are no
additional cache flushing operations performed and this causes random
user space faults on architectures with separate I and D caches
(Harvard) or those with aliasing D-cache.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Cc: Matthew Dharm <mdharm-kernel@one-eyed-alien.net> Cc: Greg KH <greg@kroah.com> Cc: Sebastian Siewior <bigeasy@linutronix.de> Cc: Oliver Neukum <oliver@neukum.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
As Alan Cox have pinpointed the driver still required protection against
parallels calls to the config ioctl(). If lock is still necessary the use of
BKL is abused here. So replace BKL with a more convenient mutex.
Signed-off-by: Alessio Igor Bogani <abogani@texware.it> Cc: Greg Kroah-Hartman <gregkh@suse.de> Cc: Johan Hovold <jhovold@gmail.com> Cc: Alan Cox <alan@linux.intel.com> Cc: Daniel Mack <daniel@caiaq.de> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
USB: g_mass_storage: superfluous and missing packets fixed
The mass storage function responded needlessly to a set
configuration packet. This was a leftover from converting
gadget (file storage gadget) into a composite function.
Moreover, it has failed to respond to get max LUN request.
Adding request queueing made the function work better.
Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Adds a fallback which forces all LUNs ejection (including
non-removable and with prevent_medium_removal flag) when mass storage
function (MSF) worker thread exits and gadget fails to handle the
situation.
Previously, if thread_exits was not specified mass storage function
(MSF) did nothing when exiting thread as it's unclear for *function*
what to do when it's thread terminates so responsibility of handling
this situation was left to the *gadget* using the function.
The g_mass_storage handled the situation by unregistering itself (the
same thing that file storage gadget does). However, g_multi did
nothing and so MSF did not eject LUNs which prevented file system
unmounting.
Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com> Reviewed-by: Kyungmin Park <kyungmin.park@samsung.com> Cc: David Brownell <dbrownell@users.sourceforge.net> Cc: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Cliff Cai [Fri, 29 Jan 2010 01:43:44 +0000 (20:43 -0500)]
USB: musb: set version of Blackfin version
All current Blackfin parts are using RTL v1.9, but they don't expose the
hardware registers to probe this dynamically. So hardcode the version to
v1.9 for now.
Need to move the local hwvers related defines higher up in the header so
that sub-musb headers may utilize them.
Signed-off-by: Cliff Cai <cliff.cai@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Robert Jarzmik [Wed, 27 Jan 2010 17:38:03 +0000 (18:38 +0100)]
USB: pxa27x_udc: Fix deadlocks on request queueing
As reported by Antonio, there are cases where the ep->lock
can be taken twice, triggering a deadlock.
The typical sequence is :
irq_handler
\
-> gadget.complete()
\
-> pxa27x_udc.pxa_ep_queue() : ep->lock is taken
\
-> gadget.complete()
\
-> pxa27x_udc.pxa_ep_queue() : ep->lock is taken
==> *deadlock*
The patch fixes this by :
- releasing the lock each time gadget.complete() is called
- adding a check in handle_ep() to detect a recursive call,
in which case the function becomes on no-op.
The patch is still not good enough for ep0. For this unique
endpoint, another well thought over patch will be needed.
Reported-by: Antonio Ospite <ospite@studenti.unina.it> Tested-by: Antonio Ospite <ospite@studenti.unina.it> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Cc: David Brownell <dbrownell@users.sourceforge.net> Cc: Eric Miao <eric.y.miao@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Mike Dunn [Tue, 26 Jan 2010 17:12:12 +0000 (12:12 -0500)]
USB: serial: add support for serial port on the moschip 7715
Add support for the serial port on devices based on the MosChip 7715,
which provides a serial and parallel port on a single usb interface.
This is added to the existing driver for the Moschip 7720 dual serial
port device. The 7715 is very similiar to the 7720, requiring only the
addition of a calc_num_ports() function, a separate interrupt-in
endpoint callback, and some manipulation of the port pointers added to
the attach() function to correct the fact that the usbserial core
erroneously assigns the first bulk in/out endpoint pair to the serial
port (the 7715 uses these for its parallel port). There is no support
for the 7715's parallel port yet.
Signed-off-by: Mike Dunn <mikedunn@newsguy.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Dan Carpenter [Mon, 25 Jan 2010 11:53:33 +0000 (14:53 +0300)]
USB: io_edgeport: eliminate get_string()
Johan Hovold points out that get_string() is basically just a
re-implimentation of usb_string(). It is also buggy. It does DMA on
the stack and it doesn't handle negative returns from
usb_get_descriptor(). Plus unicode_to_ascii() is a rubbish function and
moving to usb_string() avoids using it.
Let's eliminate get_string() entirely.
Reported-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Dan Carpenter <error27@gmail.com> Acked-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/gadget/s3c-hsotg.c: In function 's3c_hsotg_unmap_dma':
drivers/usb/gadget/s3c-hsotg.c:376: warning: 'dma_sync_single' is deprecated (declared at /home/fujita/git/linux-2.6/include/linux/dma-mapping.h:109)
drivers/usb/gadget/s3c-hsotg.c: In function 's3c_hsotg_map_dma':
drivers/usb/gadget/s3c-hsotg.c:758: warning: 'dma_sync_single' is deprecated (declared at /home/fujita/git/linux-2.6/include/linux/dma-mapping.h:109)
Felipe Balbi [Thu, 21 Jan 2010 13:33:58 +0000 (15:33 +0200)]
USB: musb: only print info message if probe() is successful
we were printing the info about musb probe too early where
it was still possible for things to go wrong. Move the
down right before the return 0 statement. While at that
also convert pr_info to dev_info.
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Adding support for MUSB register save and restore during system
suspend and resume.
Changes:
- Added musb_save/restore_context() functions
- Added platform specific musb_platform_save/restore_context()
to handle platform specific jobs.
- Maintaining BlackFin compatibility by adding read/write
functions for registers which are not available in BlackFin
Tested system suspend and resume on OMAP3EVM board.
Marcel Holtmann [Sat, 16 Jan 2010 06:13:58 +0000 (22:13 -0800)]
USB: gadget: Add DEVTYPE support for Ethernet functions
The problem with Ethernet based networking devices is to clearly
identify what's their usage. Special interfaces like bridges, WiFi,
Bluetooth, WiMAX or WWAN are already using DEVTYPE identification.
This patch marks the Ethernet functions of gadgets from the device
type "gadget". Automatic setup of these interfaces can now happen
from userspace without the need of hardcoding the network interface
name.
The Barry project's userspace program, bcharge, can better handle this
device and functionality, and it also works with the latest phones,
which this driver does not support. So remove it, as the userspace code
should be used instead.
Cc: Chris Frey <cdfrey@foursquare.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Oliver Neukum [Thu, 14 Jan 2010 15:10:38 +0000 (16:10 +0100)]
USB: BKL removal: rio500
This driver had used BKL to guard against disconnect but
was incorrectly converted leaving an SMP race.
BKL was added to disconnect() to fix this race
BKL was removed from ioctl() as the mutex is sufficient
on its own.
Signed-off-by: Oliver Neukum <oliver@neukum.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Gernot Hillier [Mon, 11 Jan 2010 08:35:17 +0000 (09:35 +0100)]
USB: serial: option.c: Add 4G W14 stick to blacklist for option_send_setup
The 4G XS Stick W14 seems to not understand RTS/DTR setting in
option_send_setup causing long timeouts on any open() which disturbs a
lot of well-known userspace applications like minicom or ModemManager.
Therefore, we enable OPTION_BLACKLIST_SENDSETUP blacklisting for it.
Gernot Hillier [Mon, 11 Jan 2010 08:30:00 +0000 (09:30 +0100)]
USB: serial: option.c: Add blacklisting infrastructure for special device handling
As suggested by Matthias Urlichs, this patch adds a somehow generic
mechanism for special handling of devices which don't support all bits
expected by this driver.
The blacklisting code is heavily stolen from sierra.c, but extended to
support different special cases.
For now, one case is implemented (OPTION_BLACKLIST_SENDSETUP), targeted
at the 4G W14 device: devices which don't understand the setting of
RTS/DTR in option_send_setup() causing a USB timeout of 5 s in any
userspace open() which leads to errors in most userspace applications.
In addition, I prepared another case for devices with interfaces which
shall not be accessed by this driver (targeted at the D-Link DWM 652).
However, OPTION_BLACKLIST_RESERVED_IF is not fully implemented yet as I
have no device to test this. Anyone volunteering to help here? If not,
I'll contact the guys who added D-Link DWM 652 support soon.
Herbert Xu [Sun, 10 Jan 2010 09:15:03 +0000 (20:15 +1100)]
USB: Move hcd free_dev call into usb_disconnect to fix oops
USB: Move hcd free_dev call into usb_disconnect
I found a way to oops the kernel:
1. Open a USB device through devio.
2. Remove the hcd module in the host kernel.
3. Close the devio file descriptor.
The problem is that closing the file descriptor does usb_release_dev
as it is the last reference. usb_release_dev then tries to invoke
the hcd free_dev function (or rather dereferencing the hcd driver
struct). This causes an oops as the hcd driver has already been
unloaded so the struct is gone.
This patch tries to fix this by bringing the free_dev call earlier
and into usb_disconnect. I have verified that repeating the
above steps no longer crashes with this patch applied.
Pete Zaitcev [Fri, 8 Jan 2010 22:39:22 +0000 (15:39 -0700)]
USB: fix crash in uhci_scan_schedule
When hardware is removed on a Stratus, the system may crash like this:
ACPI: PCI interrupt for device 0000:7c:00.1 disabled
Trying to free nonexistent resource <00000000a8000000-00000000afffffff>
Trying to free nonexistent resource <00000000a4800000-00000000a480ffff>
uhci_hcd 0000:7e:1d.0: remove, state 1
usb usb2: USB disconnect, address 1
usb 2-1: USB disconnect, address 2
Unable to handle kernel paging request at 0000000000100100 RIP:
[<ffffffff88021950>] :uhci_hcd:uhci_scan_schedule+0xa2/0x89c
This occurs because an interrupt scans uhci->skelqh, which is
being freed. We do the right thing: disable the interrupts in the
device, and do not do any processing if the interrupt is shared
with other source, but it's possible that another CPU gets
delayed somewhere (e.g. loops) until we started freeing.
The agreed-upon solution is to wait for interrupts to play out
before proceeding. No other bareers are neceesary.
A backport of this patch was tested on a 2.6.18 based kernel.
Testing of 2.6.32-based kernels is under way, but it takes us
forever (months) to turn this around. So I think it's a good
patch and we should keep it.
Alan Stern [Fri, 8 Jan 2010 17:57:28 +0000 (12:57 -0500)]
USB: convert to the runtime PM framework
This patch (as1329) converts the USB stack over to the PM core's
runtime PM framework. This involves numerous changes throughout
usbcore, especially to hub.c and driver.c. Perhaps the most notable
change is that CONFIG_USB_SUSPEND now depends on CONFIG_PM_RUNTIME
instead of CONFIG_PM.
Several fields in the usb_device and usb_interface structures are no
longer needed. Some code which used to depend on CONFIG_USB_PM now
depends on CONFIG_USB_SUSPEND (requiring some rearrangement of header
files).
The only visible change in behavior should be that following a system
sleep (resume from RAM or resume from hibernation), autosuspended USB
devices will be resumed just like everything else. They won't remain
suspended. But if they aren't in use then they will naturally
autosuspend again in a few seconds.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>