Commit Graph

7567 Commits (f799e7678390029e322ae2dc3cda389b11f38124)

Author SHA1 Message Date
Greg Kroah-Hartman f799e76783 USB: serial: remove usb_serial_register and usb_serial_deregister
No one uses them anymore, they should be using the safer
usb_serial_register_drivers() and usb_serial_deregister_drivers()
functions instead.

Thanks to Alan Stern for writing these functions and porting all
in-kernel users to them.

Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-24 12:50:30 -08:00
Greg Kroah-Hartman 8c49fc99b6 usb-serial: use new registration API in keyspan_pda.c
This was missed in Alan's last round of conversions.

Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-24 12:49:34 -08:00
Alan Stern 29618e9fb5 usb-serial: use new registration API in [t-z]* drivers
This patch (as1529) modifies the following usb-serial drivers to
utilize the new usb_serial_{de}register_drivers() routines:

	ti_usb_3410_5052, usb_debug, visor, vivopay-serial,
	whiteheat, and zio.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-24 12:39:21 -08:00
Alan Stern d860322f34 usb-serial: use new registration API in [q-s]* drivers
This patch (as1528) modifies the following usb-serial drivers to
utilize the new usb_serial_{de}register_drivers() routines:

	qcaux, qcserial, safe_serial, siemens_mpi, sierra,
	spcp8x5, ssu100, and symbolserial.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-24 12:39:20 -08:00
Alan Stern f667ddad41 usb-serial: use new registration API in [n-p]* drivers
This patch (as1527) modifies the following usb-serial drivers to
utilize the new usb_serial_{de}register_drivers() routines:

	navman, omninet, opticon, option, oti6858, and pl2303.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-24 12:39:20 -08:00
Alan Stern 4d2a7aff10 usb-serial: use new registration API in [k-m]* drivers
This patch (as1526) modifies the following usb-serial drivers to
utilize the new usb_serial_{de}register_drivers() routines:

	keyspan, kl5kusb105, kobil_sct, mct_u232, mos7720,
	mos7840, and moto_modem.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-24 12:39:19 -08:00
Alan Stern 7dbe246098 usb-serial: use new registration API in [i-j]* drivers
This patch (as1525) modifies the following usb-serial drivers to
utilize the new usb_serial_{de}register_drivers() routines:

	io_edgeport, io_ti, ipaq, ipw, ir-usb, and iuu_phoenix.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-24 12:39:18 -08:00
Alan Stern 97b6b6d233 usb-serial: use new registration API in [d-h]* drivers
This patch (as1524) modifies the following usb-serial drivers to
utilize the new usb_serial_{de}register_drivers() routines:

	digi_acceleport, empeg, ftdi_sio, funsoft, garmin_gps,
	and hp4x.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-24 12:39:18 -08:00
Alan Stern 08a4f6bc2e usb-serial: use new registration API in [a-c]* drivers
This patch (as1523) modifies the following usb-serial drivers to
utilize the new usb_serial_{de}register_drivers() routines:

	aircable, ark3116, belkin_sa, ch341, cp210x, cyberjack,
	and cypress_m8.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-24 12:39:17 -08:00
Alan Stern 765e0ba626 usb-serial: new API for driver registration
This patch (as1522) adds two new routines to the usb-serial core, for
registering and unregistering serial drivers.  Instead of registering
the usb_driver and usb_serial_drivers separately, with error checking
for each one, the drivers can all be registered and unregistered by a
single function call.  This reduces duplicated code.

More importantly, the new core routines change the order in which the
drivers are registered.  Currently the usb-serial drivers are all
registered first and the usb_driver is done last, which leaves a
window for problems.  A udev script may quickly add a new dynamic-ID
for a usb-serial driver, causing the corresponding usb_driver to be
probed.  If the usb_driver hasn't been registered yet then an oops
will occur.

The new routine prevents such problems by registering the usb_driver
first.  To insure that it gets probed properly for already-attached
serial devices, we call driver_attach() after all the usb-serial
drivers have been registered.

Along with adding the new routines, the patch modifies the "generic"
serial driver to use them.  Further patches will similarly modify all
the other in-tree USB serial drivers.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-24 12:39:17 -08:00
Greg Kroah-Hartman c69263c66e Merge branch 'usb-3.3-rc4' into usb-next
This is to pull in the xhci changes and the other fixes and device id
updates that were done in Linus's tree.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-23 08:21:03 -08:00
Bruno Thomsen c6c1e4491d USB: Added Kamstrup VID/PIDs to cp210x serial driver.
Signed-off-by: Bruno Thomsen <bruno.thomsen@gmail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-21 16:29:15 -08:00
Andrew Lunn 7fd25702ba USB: Serial: ti_usb_3410_5052: Add Abbot Diabetes Care cable id
This USB-serial cable with mini stereo jack enumerates as:
Bus 001 Device 004: ID 1a61:3410 Abbott Diabetes Care

It is a TI3410 inside.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-21 16:29:15 -08:00
Alan Stern bb94a40668 usb-storage: fix freezing of the scanning thread
This patch (as1521b) fixes the interaction between usb-storage's
scanning thread and the freezer.  The current implementation has a
race: If the device is unplugged shortly after being plugged in and
just as a system sleep begins, the scanning thread may get frozen
before the khubd task.  Khubd won't be able to freeze until the
disconnect processing is complete, and the disconnect processing can't
proceed until the scanning thread finishes, so the sleep transition
will fail.

The implementation in the 3.2 kernel suffers from an additional
problem.  There the scanning thread calls set_freezable_with_signal(),
and the signals sent by the freezer will mess up the thread's I/O
delays, which are all interruptible.

The solution to both problems is the same: Replace the kernel thread
used for scanning with a delayed-work routine on the system freezable
work queue.  Freezable work queues have the nice property that you can
cancel a work item even while the work queue is frozen, and no signals
are needed.

The 3.2 version of this patch solves the problem in Bugzilla #42730.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Seth Forshee <seth.forshee@canonical.com>
CC: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-21 16:29:15 -08:00
Sarah Sharp 340a3504fd xhci: Fix encoding for HS bulk/control NAK rate.
The xHCI 0.96 spec says that HS bulk and control endpoint NAK rate must
be encoded as an exponent of two number of microframes.  The endpoint
descriptor has the NAK rate encoded in number of microframes.  We were
just copying the value from the endpoint descriptor into the endpoint
context interval field, which was not correct.  This lead to the VIA
host rejecting the add of a bulk OUT endpoint from any USB 2.0 mass
storage device.

The fix is to use the correct encoding.  Refactor the code to convert
number of frames to an exponential number of microframes, and make sure
we convert the number of microframes in HS bulk and control endpoints to
an exponent.

This should be back ported to kernels as old as 2.6.31, that contain the
commit dfa49c4ad1 "USB: xhci - fix math
in xhci_get_endpoint_interval"

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Tested-by: Felipe Contreras <felipe.contreras@gmail.com>
Suggested-by: Andiry Xu <andiry.xu@amd.com>
Cc: stable@vger.kernel.org
2012-02-21 15:48:46 -08:00
Elric Fu a45aa3b305 USB: Set hub depth after USB3 hub reset
The superspeed device attached to a USB 3.0 hub(such as VIA's)
doesn't respond the address device command after resume. The
root cause is the superspeed hub will miss the Hub Depth value
that is used as an offset into the route string to locate the
bits it uses to determine the downstream port number after
reset, and all packets can't be routed to the device attached
to the superspeed hub.

Hub driver sends a Set Hub Depth request to the superspeed hub
except for USB 3.0 root hub when the hub is initialized and
doesn't send the request again after reset due to the resume
process. So moving the code that sends the Set Hub Depth request
to the superspeed hub from hub_configure() to hub_activate()
is to cover those situations include initialization and reset.

The patch should be backported to kernels as old as 2.6.39.

Signed-off-by: Elric Fu <elricfu1@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: stable@vger.kernel.org
2012-02-21 15:45:25 -08:00
Sarah Sharp cab928ee1f USB: Fix handoff when BIOS disables host PCI device.
On some systems with an Intel Panther Point xHCI host controller, the
BIOS disables the xHCI PCI device during boot, and switches the xHCI
ports over to EHCI.  This allows the BIOS to access USB devices without
having xHCI support.

The downside is that the xHCI BIOS handoff mechanism will fail because
memory mapped I/O is not enabled for the disabled PCI device.
Jesse Barnes says this is expected behavior.  The PCI core will enable
BARs before quirks run, but it will leave it in an undefined state, and
it may not have memory mapped I/O enabled.

Make the generic USB quirk handler call pci_enable_device() to re-enable
MMIO, and call pci_disable_device() once the host-specific BIOS handoff
is finished.  This will balance the ref counts in the PCI core.  When
the PCI probe function is called, usb_hcd_pci_probe() will call
pci_enable_device() again.

This should be back ported to kernels as old as 2.6.31.  That was the
first kernel with xHCI support, and no one has complained about BIOS
handoffs failing due to memory mapped I/O being disabled on other hosts
(EHCI, UHCI, or OHCI).

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Acked-by: Oliver Neukum <oneukum@suse.de>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: stable@vger.kernel.org
2012-02-21 15:45:08 -08:00
Felipe Balbi 5407a3c3d9 usb: host: ehci: allow ehci_* symbols to be unused
not all platforms will use all of those ehci_*
symbols on their hc_driver structure. Sometimes
we might need to provide a modified version of
a certain method or not provide it at all, as is
the case with OMAPs which don't support port handoff
feature.

Whenever we compile a kernel for an OMAP board with
EHCI enabled, we get compile warnings:

drivers/usb/host/ehci-hub.c:1079: warning: 'ehci_relinquish_port' \
	defined but not used
drivers/usb/host/ehci-hub.c:1088: warning: 'ehci_port_handed_over' \
	defined but not used

In order to cleanup those warnings, we're adding
__maybe_unused annotation to those functions.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-15 17:16:40 -08:00
li.rui27@zte.com.cn b9e44fe5ec USB: option: cleanup zte 3g-dongle's pid in option.c
1. Remove all old mass-storage ids's pid:
     0x0026,0x0053,0x0098,0x0099,0x0149,0x0150,0x0160;
  2. As the pid from 0x1401 to 0x1510 which have not surely assigned to
     use for serial-port or mass-storage port,so i think it should be
     removed now, and will re-add after it have assigned in future;
  3. sort the pid to WCDMA and CDMA.

Signed-off-by: Rui li <li.rui27@zte.com.cn>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-14 15:08:40 -08:00
Sarah Sharp 2839f5bcfc USB: Turn on auto-suspend for USB 3.0 hubs.
Now that USB 3.0 hub remote wakeup on port status changes is enabled,
and USB 3.0 device remote wakeup is handled in the USB core properly,
let's turn on auto-suspend for all USB 3.0 hubs.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2012-02-14 12:12:28 -08:00
Sarah Sharp 72937e1e34 USB: Set wakeup bits for all children hubs.
This patch takes care of the race condition between the Function Wake
Device Notification and the auto-suspend timeout for this situation:

Roothub
  | (U3)
hub A
  | (U3)
hub B
  | (U3)
device C

When device C signals a resume, the xHCI driver will set the wakeup_bits
for the roothub port that hub A is attached to.  However, since USB 3.0
hubs do not set a link state change bit on device-initiated resume, hub
A will not indicate a port event when polled.  Without this patch, khubd
will notice the wakeup-bits are set for the roothub port, it will resume
hub A, and then it will poll the events bits for hub A and notice that
nothing has changed.  Then it will be suspended after 2 seconds.

Change hub_activate() to look at the port link state for each USB 3.0
hub port, and set hub->change_bits if the link state is U0, indicating
the device has finished resume.  Change the resume function called by
hub_events(), hub_handle_remote_wakeup(), to check the link status
for resume instead of just the port's wakeup_bits.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2012-02-14 12:12:27 -08:00
Sarah Sharp 4ee823b83b USB/xHCI: Support device-initiated USB 3.0 resume.
USB 3.0 hubs don't have a port suspend change bit (that bit is now
reserved).  Instead, when a host-initiated resume finishes, the hub sets
the port link state change bit.

When a USB 3.0 device initiates remote wakeup, the parent hubs with
their upstream links in U3 will pass the LFPS up the chain.  The first
hub that has an upstream link in U0 (which may be the roothub) will
reflect that LFPS back down the path to the device.

However, the parent hubs in the resumed path will not set their link
state change bit.  Instead, the device that initiated the resume has to
send an asynchronous "Function Wake" Device Notification up to the host
controller.  Therefore, we need a way to notify the USB core of a device
resume without going through the normal hub URB completion method.

First, make the xHCI roothub act like an external USB 3.0 hub and not
pass up the port link state change bit when a device-initiated resume
finishes.  Introduce a new xHCI bit field, port_remote_wakeup, so that
we can tell the difference between a port coming out of the U3Exit state
(host-initiated resume) and the RExit state (ending state of
device-initiated resume).

Since the USB core can't tell whether a port on a hub has resumed by
looking at the Hub Status buffer, we need to introduce a bitfield,
wakeup_bits, that indicates which ports have resumed.  When the xHCI
driver notices a port finishing a device-initiated resume, we call into
a new USB core function, usb_wakeup_notification(), that will set
the right bit in wakeup_bits, and kick khubd for that hub.

We also call usb_wakeup_notification() when the Function Wake Device
Notification is received by the xHCI driver.  This covers the case where
the link between the roothub and the first-tier hub is in U0, and the
hub reflects the resume signaling back to the device without giving any
indication it has done so until the device sends the Function Wake
notification.

Change the code in khubd that handles the remote wakeup to look at the
state the USB core thinks the device is in, and handle the remote wakeup
if the port's wakeup bit is set.

This patch only takes care of the case where the device is attached
directly to the roothub, or the USB 3.0 hub that is attached to the root
hub is the device sending the Function Wake Device Notification (e.g.
because a new USB device was attached).  The other cases will be covered
in a second patch.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2012-02-14 12:12:26 -08:00
Sarah Sharp 714b07be3b USB: Refactor hub remote wake handling.
Refactor the code to check for a remote wakeup on a port into its own
function.  Keep the behavior the same, and set connect_change in
hub_events if the device disconnected on resume.  Cleanup references to
hdev->children[i-1] to use a common variable.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2012-02-14 12:12:25 -08:00
Sarah Sharp 4296c70a5e USB/xHCI: Enable USB 3.0 hub remote wakeup.
USB 3.0 hubs have a different remote wakeup policy than USB 2.0 hubs.
USB 2.0 hubs, once they have remote wakeup enabled, will always send
remote wakes when anything changes on a port.

However, USB 3.0 hubs have a per-port remote wake up policy that is off
by default.  The Set Feature remote wake mask can be changed for any
port, enabling remote wakeup for a connect, disconnect, or overcurrent
event, much like EHCI and xHCI host controller "wake on" port status
bits.  The bits are cleared to zero on the initial hub power on, or
after the hub has been reset.

Without this patch, when a USB 3.0 hub gets suspended, it will not send
a remote wakeup on device connect or disconnect.  This would show up to
the user as "dead ports" unless they ran lsusb -v (since newer versions
of lsusb use the sysfs files, rather than sending control transfers).

Change the hub driver's suspend method to enable remote wake up for
disconnect, connect, and overcurrent for all ports on the hub.  Modify
the xHCI driver's roothub code to handle that request, and set the "wake
on" bits in the port status registers accordingly.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2012-02-14 12:12:24 -08:00
Sarah Sharp 3b9b6acd47 USB: Suspend functions before putting dev into U3.
The USB 3.0 bus specification introduces a new type of power management
called function suspend.  The idea is to be able to suspend different
functions (i.e. a scanner or an SD card reader on a USB printer)
independently.  A device can be in U0, but have one or more functions
suspended.  Thus, signaling a function resume with the standard device
remote wake signaling was not possible.

Instead, a device will (without prompt from the host) send a "device
notification" for the function remote wake.  A new Set Feature Function
Remote Wake was developed to turn remote wake up on and off for each
function.

USB 3.0 devices can still go into device suspend (U3), and signal a
remote wakeup to bring the link back into U1.  However, they now use the
function remote wake device notification to allow the host to know which
function woke the device from U3.

The spec is a bit ambiguous about whether a function is allowed to
signal a remote wakeup if the function has been enabled for remote
wakeup, but not placed in function suspend before the device is placed
into U3.

Section 9.2.5.1 says "Suspending a device with more than one function
effectively suspends all the functions within the device."  I interpret
that to mean that putting a device in U3 suspends all functions, and
thus if the host has previously enabled remote wake for those functions,
it should be able to signal a remote wake up on port status changes.
However, hub vendors may have a different interpretation, and it can't
hurt to put the function into suspend before putting the device into U3.

I cannot get an answer out of the USB 3.0 spec architects about this
ambiguity, so I'm erring on the safe side and always suspending the
first function before placing the device in U3.  Note, this code should
be fixed if we ever find any USB 3.0 devices that have more than one
function.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2012-02-14 12:12:23 -08:00
Sarah Sharp 623bef9e03 USB/xhci: Enable remote wakeup for USB3 devices.
When the USB 3.0 hub support went in, I disabled selective suspend for
all external USB 3.0 hubs because they used a different mechanism to
enable remote wakeup.  In fact, other USB 3.0 devices that could signal
remote wakeup would have been prevented from going into suspend because
they would have stalled the SetFeature Device Remote Wakeup request.

This patch adds support for the USB 3.0 way of enabling remote wake up
(with a SetFeature Function Suspend request), and enables selective
suspend for all hubs during hub_probe.  It assumes that all USB 3.0 have
only one "function" as defined by the interface association descriptor,
which is true of all the USB 3.0 devices I've seen so far.  FIXME if
that turns out to change later.

After a device signals a remote wakeup, it is supposed to send a Device
Notification packet to the host controller, signaling which function
sent the remote wakeup.  The host can then put any other functions back
into function suspend.  Since we don't have support for function suspend
(and no devices currently support it), we'll just assume the hub
function will resume the device properly when it received the port
status change notification, and simply ignore any device notification
events from the xHCI host controller.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2012-02-14 12:12:22 -08:00
Sarah Sharp d93814cfad xHCI: Kick khubd when USB3 resume really completes.
xHCI roothubs go through slightly different port state machines when
either a device initiates a remote wakeup and signals resume, or when
the host initiates a resume.

According to section 4.19.1.2.13 of the xHCI 1.0 spec, on host-initiated
resume, the xHC port state machine automatically goes through the U3Exit
state into the U0 state, setting the port link state change (PLC) bit in
the process.

When a device initiates resume, the xHCI port state machine goes into
the "Resume" state and sets the PLC bit.  Then the xHCI driver writes U0
into the port link state register to transition the port to U0 from the
Resume state.

We can't be sure the device is actually in the U0 state until we receive
the next port status change event with the PLC bit set.  We really don't
want khubd to be polling the roothub port status bits until the device
is really in U0.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Acked-by: Andiry Xu <andiry.xu@amd.com>
2012-02-14 12:11:50 -08:00
Sarah Sharp 68d07f64b8 USB: Don't fail USB3 probe on missing legacy PCI IRQ.
Intel has a PCI USB xhci host controller on a new platform. It doesn't
have a line IRQ definition in BIOS.  The Linux driver refuses to
initialize this controller, but Windows works well because it only depends
on MSI.

Actually, Linux also can work for MSI.  This patch avoids the line IRQ
checking for USB3 HCDs in usb core PCI probe.  It allows the xHCI driver
to try to enable MSI or MSI-X first.  It will fail the probe if MSI
enabling failed and there's no legacy PCI IRQ.

This patch should be backported to kernels as old as 2.6.32.

Signed-off-by: Alex Shi <alex.shi@intel.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@vger.kernel.org
2012-02-14 10:48:05 -08:00
Greg Kroah-Hartman 50e5dfb6c4 Merge branch 'usb-linus' into usb-next
This is needed so that Sarah can queue up some xhci changes for 3.4

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-13 15:10:12 -08:00
Masanari Iida 5ee71cf3be usb: Fix typo in imx21-dbg.c
Correct spelling "alocate" to "allocate" in
drivers/usb/host/imx21-dbg.c

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-13 14:32:34 -08:00
Sarah Sharp 3278a55a1a xhci: Fix oops caused by more USB2 ports than USB3 ports.
The code to set the device removable bits in the USB 2.0 roothub
descriptor was accidentally looking at the USB 3.0 port registers
instead of the USB 2.0 registers.  This can cause an oops if there are
more USB 2.0 registers than USB 3.0 registers.

This should be backported to kernels as old as 2.6.39, that contain the
commit 4bbb0ace9a "xhci: Return a USB 3.0
hub descriptor for USB3 roothub."

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@vger.kernel.org
2012-02-10 14:24:32 -08:00
Bjørn Mork 8804420275 usb: cdc-wdm: make reset work with blocking IO
Add a flag to tell wdm_read/wdm_write that a reset is in progress,
and wake any blocking read/write before taking the mutexes.  This
allows the device to reset without waiting for blocking IO to
finish.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Acked-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-10 11:28:18 -08:00
Greg Kroah-Hartman 7483948fdd Merge tag 'usb-3.3-rc3' into usb-next
This is done to resolve a merge conflict with:
	drivers/usb/class/cdc-wdm.c
and to better handle future patches for this driver as it is under
active development at the moment.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-10 11:13:53 -08:00
Johan Hovold 22a416c4e0 USB: serial: use dev_err_console in custom write paths
Use dev_err_console in write paths for devices which can be used as a
console but do not use the generic write implementation.

Compile-only tested.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-10 10:21:04 -08:00
Johan Hovold f1475a00a1 USB: serial: use dev_err_console in generic write
Use dev_err_console in write path so that an error at least gets
reported once.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-10 10:21:04 -08:00
Johan Hovold 548dd4b6da USB: serial: fix console error reporting
Do not report errors in write path if port is used as a console as this
may trigger the same error (and error report) resulting in a loop.

Reported-by: Stephen Hemminger <shemminger@vyatta.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-10 10:20:36 -08:00
Matthew Garrett d35e70d50a usb: Use hub port data to determine whether a port is removable
Hubs have a flag to indicate whether a given port carries removable devices
or not. This is not strictly accurate in that some built-in devices
will be flagged as removable, but followup patches will make use of platform
data to make this more reliable.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-09 08:40:11 -08:00
Matthew Garrett 0846e7e985 usb: Add support for indicating whether a port is removable
Userspace may want to make policy decisions based on whether or not a
given USB device is removable. Add a per-device member and support
for exposing it in sysfs. Information sources to populate it will be
added later.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-09 08:40:11 -08:00
Alan Stern af74d2dae8 usb-storage: reorganize target-specific code
Now that usb-storage has a target_alloc() routine, this patch (as1508)
moves some existing target-specific code out of the slave_alloc()
routine to where it really belongs.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-08 17:36:41 -08:00
Alan Stern 09b6b51b0b SCSI & usb-storage: add flags for VPD pages and REPORT LUNS
This patch (as1507) adds a skip_vpd_pages flag to struct scsi_device
and a no_report_luns flag to struct scsi_target.  The first is used to
control whether sd will look at VPD pages for information on block
provisioning, limits, and characteristics.  The second prevents
scsi_report_lun_scan() from issuing a REPORT LUNS command.

The patch also modifies usb-storage to set the new flag bits for all
USB devices and targets, and to stop adjusting the scsi_level value.

Historically we have seen that USB mass-storage devices often don't
support VPD pages or REPORT LUNS properly.  Until now we have avoided
these things by setting the scsi_level to SCSI_2 for all USB devices.
But this has the side effect of storing the LUN bits into the second
byte of each CDB, and now we have a report of a device which doesn't
like that.  The best solution is to stop abusing scsi_level and
instead have separate flags for VPD pages and REPORT LUNS.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Perry Wagle <wagle@mac.com>
CC: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-08 17:36:41 -08:00
Milan Kocian 90451e6973 USB: usbserial: add new PID number (0xa951) to the ftdi driver
Signed-off-by: Milan Kocian <milon@wq.cz>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-03 11:22:44 -08:00
Greg Kroah-Hartman 8739348391 Few fixes for 3.3-rc3, nothing major. Mostly build fixes
introduced recently.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJPK5m8AAoJEIaOsuA1yqREAVwQAKW/4n3XNudLEkAJOXp4CuAI
 bUmXHWb52JZbfomT9EOK3GvWz/n353BE+O/IklD+alcsK4uufLZilKJ9D/Z6KujP
 YdSu4NWi+TBkA7EP2aIRUzfvZGY+mzLuk/EpXv9Tun7H8dl0xMrxadJ4+v7/fZX+
 OvJDLqlUIqbKtgXMt6AVS2dhy6AfdjcadFWCzYCVYZ6LYBcI50k5ZazxjJmftnfN
 bK7AnuFPF0jG/aGd3mw+tlzJM53LJWCfb1LamfenDMdBufTcKWBIB5n+7FNbA74j
 CTczgV9q7O/aPe7/a11l/Z8Yz1RD6r7G2yM9e5UYNxwN6xxRJZ397eGaScU/cyV3
 GZkJRFS0r758bzR9hp5uBKyEA8erjbguGwNfxsEEG44P3UAy8E/nsxNa/lgY0nUo
 8jISIJ/Mm6wsCKKxI/cepDLRvG4K68dTc8ZpWvOaJXof7xnGpeAvUvppX+pkoNRl
 T2WeZm/3AMWrFvvJbmffbE4Ak/u4L4mcDzxWaRCrD0uEBMzN+accDGtOTcQ5plGz
 SECpSVTGGQSGJ0r3vBR2vlC9fAl+MiDy0jQtf0ExxZEMLuld6HRVlWwlzCo60eWZ
 Mmb1LMgQ0jhQoFfV33eJ5CkSPpPu2GXx8M0BRCydZem+js6X+HiXnO/GbzaehkBl
 T2E/yLOo9AIRPeJ6YpQs
 =srlB
 -----END PGP SIGNATURE-----

Merge tag 'for-3.3-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus

Few fixes for 3.3-rc3, nothing major. Mostly build fixes
introduced recently.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-03 11:15:23 -08:00
Cong Wang 976d98cb72 usb: musb: fix a build error on mips
On mips, we got:

drivers/usb/musb/musb_io.h:44: error: conflicting types for 'readsl'
arch/mips/include/asm/io.h:529: error: previous definition of 'readsl' was here
drivers/usb/musb/musb_io.h:46: error: conflicting types for 'readsw'
arch/mips/include/asm/io.h:528: error: previous definition of 'readsw' was here
drivers/usb/musb/musb_io.h:48: error: conflicting types for 'readsb'

so, should add !defined(CONFIG_MIPS) too.

Cc: Felipe Balbi <balbi@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-02-03 09:29:13 +02:00
Alan Stern 0cb54a3e47 USB: debugging code shouldn't alter control flow
People have complained that debugging code shouldn't alter the flow of
control; it should restrict itself to printing out warnings and error
messages.  Bowing to popular opinion, this patch (as1518) changes the
debugging checks in usb_submit_urb() to follow this guideline.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Keith Packard <keithp@keithp.com>
CC: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-02 16:15:44 -08:00
Sebastian Andrzej Siewior e4d8318a85 usb/uas: make sure data urb is gone if we receive status before that
Just run into the following:
- new disk arrived in the system
- udev couldn't wait to get its hands on to to run ata_id /dev/sda
- this sent the cdb 0xa1 to the device.
- my UAS-gadget recevied the cdb and had no idea what to do with it. It
  decided to send a status URB back with sense set to invalid opcode.
- the host side received it status and completed the scsi command.
- the host sent another scsi with 4kib data buffer
- Now I was confused why the data transfer is only 512 bytes instead of
  4kib since the host is always allocating the complete transfer in one
  go.
- Finally the system crashed while walking through the sg list.

This patch adds three new flags in order to distinguish between DATA
URB completed and outstanding. If we receive status before data, we
cancel data and let data complete the command.
This solves the problem for IN and OUT transfers but does not work for
BIDI.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2012-02-02 14:51:30 -08:00
Sebastian Andrzej Siewior 348748b0e8 usb/uas: move UAS structs / defines into a header file
The protocol specific structures and defines which are used by UAS are
moved into a header files by this patch so it can be accessed by the UAS
gadget as well.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2012-02-02 14:51:11 -08:00
Sebastian Andrzej Siewior c898add51c usb/uas: only bind if the hcd supports SG
The UAS driver requires SG support by the HCD operating the device. This
patch stops UAS from operating on a HCD without sg support and prints a
message to let him know.

The spec says:
|For [USB2] backward compatibility, the device shall present [BOT] as
|alternate interface zero (primary) and [UAS] as alternate interface one
|(secondary). A device which does not need backward compatibility with
|[BOT] shall present [UAS] as alternate interface zero. In [USB2]
|systems, the [BOT] driver or an associated filter driver may need to
|issue a SET INTERFACE request for alternate interface one and then allow
|the [UAS] driver to load.

If the user used usb_modeswitch to switch to UAS then he can go back to
BOT or use a different HCD. In case UAS is the only interface then there
is currently no way out.
In future usb_sg_wait() should be extended to provide a non-blocking
interface so it can work with the UAS driver.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2012-02-02 14:51:00 -08:00
Sarah Sharp b603669842 UAS fixes for Sarah
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJO8x85AAoJEHuW6BYqjPXRXWgQAI/+xBuTNKwfe/zAcIYxH1I5
 Lq3jQaaqZ/TYWMZH2BwHYPXLLayLpHyvYSmub4hJm9okPp/iWJeE6nnYg8Ige8CD
 jmpGa8p25pvdP+Rn8GW0EVIA+X0ZVdUV1llz88+21piY4ydobBQOtUtXAIl5jsBv
 EVjqCZ6kmn0X7utdutpTHQ421/5k/9x5bh7mHOQTLiMcouXDyA/KVYjet4DVt5PU
 Umqrk+uOMUjnygShRZ3C+FLBi/cfJ2jKUQo34dJbhxtD4hZyDe3CXM0UKnvZ5dso
 EAykudlN32L29vT000F5KCocEUjQfnqvlBKK+acI7gvdmHCerDn0X/luHx/skSQV
 li+pqCqfcfnX6Xg68WWLod9xrt5TtUlD1vAwhvi+ObDIFcVkCqLIdD5lBl+pZz3s
 L2j/NgxVkAEVr4VotCNCHCAw17nWYSyle7Px5rLzU1+gfRFTGXiepBxnp52ZPXFf
 l+rM+U+OZzrEtuXQq2AEIqh07G4EeovEigWB2v0Eyl77ZmE+SprMHoFVLTtB5Xqc
 iau4YMG3nuJdIEyxIHMTrIX91iEgKFfo2Zc030GIe1EH7Gllr8VSYnoQLZf6/tF7
 D4NzlqAVQUd6RIDlwQn6XpOGm4FLMF0rJL+Di3QqZ1vk/CRfSmGPSP7mFLbaCNOg
 YhMYuzWknxi80kYRMZgy
 =GTUe
 -----END PGP SIGNATURE-----

Merge tag 'uas_for_sarah' of git://linutronix.de/users/bigeasy/linux into for-uas-next

Merge UAS bug fixes from Sebastian Andrzej Siewior, including some patches of
mine that he signed.

UAS fixes for Sarah
2012-02-02 14:47:14 -08:00
Randy Dunlap 36f8ecbf71 uwb & wusb & usb wireless controllers: fix kconfig error & build errors
Fix kconfig warnings and build errors in UWB/WUSB/USB_HWA etc.
by making all of these related symbols depend on UWB.

warning: (USB_WHCI_HCD && USB_HWA_HCD) selects USB_WUSB which has unmet direct dependencies (USB_SUPPORT && EXPERIMENTAL && USB && PCI && UWB)
warning: (USB_HWA_HCD) selects UWB_HWA which has unmet direct dependencies (UWB && USB)

which lead to:

ERROR: "uwb_rsv_establish" [drivers/usb/wusbcore/wusbcore.ko] undefined!
ERROR: "uwb_pal_register" [drivers/usb/wusbcore/wusbcore.ko] undefined!
ERROR: "uwb_rsv_get_usable_mas" [drivers/usb/wusbcore/wusbcore.ko] undefined!
ERROR: "uwb_rsv_destroy" [drivers/usb/wusbcore/wusbcore.ko] undefined!
ERROR: "uwb_radio_stop" [drivers/usb/wusbcore/wusbcore.ko] undefined!
ERROR: "uwb_rsv_terminate" [drivers/usb/wusbcore/wusbcore.ko] undefined!
ERROR: "uwb_pal_unregister" [drivers/usb/wusbcore/wusbcore.ko] undefined!
ERROR: "uwb_pal_init" [drivers/usb/wusbcore/wusbcore.ko] undefined!
ERROR: "uwb_rc_reset_all" [drivers/usb/wusbcore/wusbcore.ko] undefined!
ERROR: "uwb_radio_start" [drivers/usb/wusbcore/wusbcore.ko] undefined!
ERROR: "uwb_rsv_create" [drivers/usb/wusbcore/wusbcore.ko] undefined!
ERROR: "uwb_rc_put" [drivers/usb/host/whci/whci-hcd.ko] undefined!
ERROR: "uwb_rc_get_by_grandpa" [drivers/usb/host/whci/whci-hcd.ko] undefined!
ERROR: "__umc_driver_register" [drivers/usb/host/whci/whci-hcd.ko] undefined!
ERROR: "umc_driver_unregister" [drivers/usb/host/whci/whci-hcd.ko] undefined!
ERROR: "whci_wait_for" [drivers/usb/host/whci/whci-hcd.ko] undefined!
ERROR: "uwb_rc_get_by_grandpa" [drivers/usb/host/hwa-hc.ko] undefined!
ERROR: "uwb_rc_put" [drivers/usb/host/hwa-hc.ko] undefined!

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-02 12:46:36 -08:00
Jayachandran C e4436a7c17 usb: Skip PCI USB quirk handling for Netlogic XLP
The Netlogic XLP SoC's on-chip USB controller appears as a PCI
USB device, but does not need the EHCI/OHCI handoff done in
usb/host/pci-quirks.c.

The pci-quirks.c is enabled for all vendors and devices, and is
enabled if USB and PCI are configured.

If we do not skip the qurik handling on XLP, the readb() call in
ehci_bios_handoff() will cause a crash since byte access is not
supported for EHCI registers in XLP.

Signed-off-by: Jayachandran C <jayachandranc@netlogicmicro.com>
Cc: stable <stable@vger.kernel.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-02 12:46:36 -08:00