cascardo/linux.git
9 years agousb: hub: rename hub_events() to hub_event() and handle only one event there
Petr Mladek [Fri, 19 Sep 2014 15:32:20 +0000 (17:32 +0200)]
usb: hub: rename hub_events() to hub_event() and handle only one event there

We would like to convert khubd kthread to a workqueue. As a result hub_events()
will handle only one event per call.

In fact, we could do this already now because there is another cycle in
hub_thread(). It calls hub_events() until hub_event_list is empty.

This patch renames the function to hub_event(), removes the while cycle, and
renames the goto targets from loop* to out*.

When touching the code, it fixes also formatting of dev_err() and dev_dbg()
calls to make checkpatch.pl happy :-)

Signed-off-by: Petr Mladek <pmladek@suse.cz>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: hub: keep hub->dev reference all the time when struct usb_hub lives
Petr Mladek [Fri, 19 Sep 2014 15:32:19 +0000 (17:32 +0200)]
usb: hub: keep hub->dev reference all the time when struct usb_hub lives

This is just a small optimization of the fix from the commit c605f3cdff53a743f6
("usb: hub: take hub->hdev reference when processing from eventlist).

We do not need to take the reference for each event. Instead we could get it
when struct usb_hub is allocated and put it when it is released. By other words,
we could handle it the same way as the reference for hub->intfdev.

The motivation is that it will make the life easier when switching from khubd
kthread to a workqueue.

Suggested-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Petr Mladek <pmladek@suse.cz>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostorage: Add quirk for another SCM-based USB-SCSI converter
Mark Knibbs [Tue, 23 Sep 2014 11:43:02 +0000 (12:43 +0100)]
storage: Add quirk for another SCM-based USB-SCSI converter

There is apparently another SCM USB-SCSI converter with ID 04E6:000F. It
is listed along with 04E6:000B in the Windows INF file for the Startech
ICUSBSCSI2 as "eUSB SCSI Adapter (Bus Powered)". The quirk allows
devices with SCSI ID other than 0 to be accessed.

Also make a couple of existing SCM product IDs lower case to be
consistent with other entries.

Signed-off-by: Mark Knibbs <markk@clara.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostorage: Add quirks for Castlewood and Double-H USB-SCSI converters
Mark Knibbs [Tue, 23 Sep 2014 10:20:17 +0000 (11:20 +0100)]
storage: Add quirks for Castlewood and Double-H USB-SCSI converters

Castlewood Systems supplied various models of USB-SCSI converter with their
ORB external removable-media drive. The ORB Windows and Macintosh drivers
support six USB IDs:
 084B:A001     [VID 084B is Castlewood Systems]
 04E6:0002 (*) ORB USB Smart Cable P/N 88205-001 (generic SCM ID)
 2027:A001     Double-H Technology DH-2000SC
 1822:0001 (*) Ariston iConnect/iSCSI
 07AF:0004 (*) Microtech XpressSCSI (25-pin)
 07AF:0005 (*) Microtech XpressSCSI (50-pin)

*: quirk already in unusual-devs.h

[Apparently the official VID for Double-H Technology is 0x07EB = 2027
decimal. That's another hex/decimal mix-up with these SCM-based products
(in addition to the Ariston and Entrega ones). Perhaps the USB-IF informed
companies of their allocated VID in decimal, but they assumed it was hex?
It seems all Entrega products used VID 0x1645, not just the USB-SCSI
converter.]

Double-H Technology Co., Ltd. produced a USB-SCSI converter, model
DH-2000SC, which is probably the one supported by the ORB drivers. Perhaps
the Castlewood-bundled product had a different label or PID though?
Castlewood mentioned Conmate as being one type of USB-SCSI converter.
Conmate and Double-H seem related somehow; both company addresses in the
same road, and at one point the Conmate web site mentioned DH-2000H4,
DH-200D4/DH-2000C4 as models of USB hub (DH short for Double-H presumably).
Conmate did show a USB-SCSI converter model CM-660 on their web site at one
point. My guess is that was identical to the DH-2000SC.

Mention of the Double-H product:
  http://web.archive.org/web/20010221010141/http://www.doubleh.com.tw/dh-2000sc.htm
The only picture I could find is at
  http://jp.acesuppliers.com/catalog/j64/component/page03.html
The casing design looks the same as my ORB USB Smart Cable which has ID
04E6:0002.

Anyway, that's enough rambling. Here's the patch.

storage: Add quirks for Castlewood and Double-H USB-SCSI converters

Add quirks for two SCM-based USB-SCSI converters which were bundled with
some Castlewood ORB removable drives. Without the quirk only the (single)
drive with SCSI ID 0 can be accessed.

Signed-off-by: Mark Knibbs <markk@clara.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostorage: Replace magic number with define in usb_stor_euscsi_init()
Mark Knibbs [Sun, 21 Sep 2014 18:59:42 +0000 (19:59 +0100)]
storage: Replace magic number with define in usb_stor_euscsi_init()

usb_stor_euscsi_init() calls usb_stor_control_msg() with timeout
argument 5000. USB_CTRL_SET_TIMEOUT is defined to be 5000 in usb.h, so
would it make sense to use that instead? Patch below if it would.

Signed-off-by: Mark Knibbs <markk@clara.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoUSB: quirks.h: use BIT()
Greg Kroah-Hartman [Wed, 24 Sep 2014 05:23:55 +0000 (22:23 -0700)]
USB: quirks.h: use BIT()

Use the BIT macro instead of "open coding" bit fields.  This makes it
easier to actually see that the bits are not conflicting/overlapping.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoUSB: Add device quirk for ASUS T100 Base Station keyboard
Lu Baolu [Fri, 19 Sep 2014 02:13:50 +0000 (10:13 +0800)]
USB: Add device quirk for ASUS T100 Base Station keyboard

This full-speed USB device generates spurious remote wakeup event
as soon as USB_DEVICE_REMOTE_WAKEUP feature is set. As the result,
Linux can't enter system suspend and S0ix power saving modes once
this keyboard is used.

This patch tries to introduce USB_QUIRK_IGNORE_REMOTE_WAKEUP quirk.
With this quirk set, wakeup capability will be ignored during
device configure.

This patch could be back-ported to kernels as old as 2.6.39.

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb3503: clarify what the registers 'PDS' and 'CFG1' really do
Tobias Jakobi [Fri, 5 Sep 2014 05:19:48 +0000 (07:19 +0200)]
usb3503: clarify what the registers 'PDS' and 'CFG1' really do

The current comment sounds like you have to disable some of
the ports to be able to use self-powered mode. This is
misleading, so change the wording to reflect this.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb3503: fix typos in devicetree binding documentation
Tobias Jakobi [Fri, 5 Sep 2014 05:19:47 +0000 (07:19 +0200)]
usb3503: fix typos in devicetree binding documentation

'availe' to 'available'
'desribed' to 'described'

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb3503: correct error message in probe ('connect' to 'interrupt')
Tobias Jakobi [Fri, 5 Sep 2014 05:19:46 +0000 (07:19 +0200)]
usb3503: correct error message in probe ('connect' to 'interrupt')

intn is obviously the interrupt pin.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: Fixed a few typos
Mickael Maison [Thu, 18 Sep 2014 09:25:04 +0000 (11:25 +0200)]
usb: Fixed a few typos

Fixed typos in comments of various drivers/usb files

Signed-off-by: Mickael Maison <mickael.maison@gmail.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoUSB: storage: use %*ph specifier to dump small buffers
Andy Shevchenko [Fri, 5 Sep 2014 14:56:25 +0000 (17:56 +0300)]
USB: storage: use %*ph specifier to dump small buffers

Instead of dereference each byte let's use %*ph specifier in the printk()
calls.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agodrivers/usb/host/ehci-xilinx-of.c: Include "linux/of_irq.h" to avoid compiling error
Chen Gang [Wed, 3 Sep 2014 15:50:31 +0000 (23:50 +0800)]
drivers/usb/host/ehci-xilinx-of.c: Include "linux/of_irq.h" to avoid compiling error

Need include it for irq_of_parse_and_map(), the related error with
allmodconfig under microblaze:

  drivers/usb/host/ehci-xilinx-of.c: In function ‘ehci_hcd_xilinx_of_probe’:
  drivers/usb/host/ehci-xilinx-of.c:156:2: error: implicit declaration of function ‘irq_of_parse_and_map’ [-Werror=implicit-function-declaration]
    irq = irq_of_parse_and_map(dn, 0);
    ^

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
Acked-by: Michal Simek <monstr@monstr.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: wusbcore: fix device disconnect on rekey timeout
Thomas Pugliese [Tue, 16 Sep 2014 21:40:15 +0000 (16:40 -0500)]
usb: wusbcore: fix device disconnect on rekey timeout

If three or more wireless devices are connected and two of them
disconnect between 1-3 seconds apart, it can cause the HWA to disconnect
the remaining devices due to failing to see a DN_Alive message from
them.  This happens because when the HWA detects that the first device
is gone, it will attempt to rekey the remaining devices.  If one of the
devices is not responding because it has also been disconnected but not
yet timed out, the synchronous rekey operation running on the wusbd
workqueue can block for up to 5 seconds.  This will prevent the
KEEPALIVE timer from running and DN_Alive messages from being processed
because they are processed by the same workqueue.  This patch moves the
rekey operation to a separate workqueue since it is the only wusb work
item that needs to communicate directly with wireless devices.  The rest
of the WUSB work items either perform no device IO or communicate
directly with the host controller and should not be blocked out by a
non-responding wireless device.

Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: wusbcore: skip done segs before completing aborted transfer
Thomas Pugliese [Tue, 16 Sep 2014 21:36:02 +0000 (16:36 -0500)]
usb: wusbcore: skip done segs before completing aborted transfer

When completing an aborted transfer, skip done segs before calling
wa_complete_remaining_xfer_segs to avoid a runtime warning.  The warning
is harmless in this case but avoiding it prevents false error reports.

Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: wusbcore: USB_WUSB_CBAF depends on USB
Thomas Pugliese [Tue, 16 Sep 2014 21:25:26 +0000 (16:25 -0500)]
usb: wusbcore: USB_WUSB_CBAF depends on USB

Add USB build dependency for USB_WUSB_CBAF.

Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: wusbcore: remove USB_WUSB build dependency on PCI
Thomas Pugliese [Tue, 16 Sep 2014 21:25:25 +0000 (16:25 -0500)]
usb: wusbcore: remove USB_WUSB build dependency on PCI

Wireless USB does not require PCI so remove USB_WUSB build dependency on
PCI.

Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: hwa: add USB build dependency for USB_HWA_HCD
Thomas Pugliese [Tue, 16 Sep 2014 21:25:24 +0000 (16:25 -0500)]
usb: hwa: add USB build dependency for USB_HWA_HCD

An HWA is a USB device so it depends on USB.

Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouwb: doc: add documentation for ASIE sysfs attribute
Thomas Pugliese [Tue, 16 Sep 2014 21:10:51 +0000 (16:10 -0500)]
uwb: doc: add documentation for ASIE sysfs attribute

Document the /sys/class/uwb_rc/uwbN/ASIE sysfs attribute

Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouwb: add an ASIE sysfs attribute to uwb_rc devices
Thomas Pugliese [Tue, 16 Sep 2014 21:10:50 +0000 (16:10 -0500)]
uwb: add an ASIE sysfs attribute to uwb_rc devices

Allow user mode to add and remove application specific information
elements (ASIEs) to the beacon of a uwb_rc device.

Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouwb: doc: bring uwb documentation up to date
Thomas Pugliese [Tue, 16 Sep 2014 20:53:09 +0000 (15:53 -0500)]
uwb: doc: bring uwb documentation up to date

The existing UWB documentation states that UWB devices show up in
/sys/class/uwb and /sys/bus/uwb/devices.  Up until the most recent
changes to add uwb devices to their own bus, neither of these statements
were actually true.  Now, UWB devices do show up in /sys/bus/uwb/devices
so the documentation has been updated to reflect that and removed
references to /sys/class/uwb.

The existing documentation also states that local UWB radio controller
(RC) devices also show up as UWB devices along with their wireless peer
UWB devices under /sys/class/uwb.  This is not true so that statement
has been removed.

Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouwb: create a uwb bus type and add in-range peer devices to it
Thomas Pugliese [Tue, 16 Sep 2014 20:53:08 +0000 (15:53 -0500)]
uwb: create a uwb bus type and add in-range peer devices to it

Documentation/usb/WUSB-Design-overview.txt states that UWB devices seen
by a UWB radio controller are added to /sys/bus/uwb/devices, but this
was not actually being done.  This functionality is needed in order for
UWB peer devices to be enumerated by user mode tools.  This patch
creates a uwb bus type and adds UWB peer devices to it as they are
discovered by the radio controller.

Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouwb: remove UWB build dependency on PCI
Thomas Pugliese [Tue, 16 Sep 2014 20:40:04 +0000 (15:40 -0500)]
uwb: remove UWB build dependency on PCI

UWB does not require PCI to be enabled so remove build dependency.

Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouwb: update uwb device prints to be more useful
Thomas Pugliese [Tue, 16 Sep 2014 20:40:03 +0000 (15:40 -0500)]
uwb: update uwb device prints to be more useful

Print info about the radio controller device instead of the its parent
when UWB devices connect and disconnect.

Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouwb: line length cleanup
Thomas Pugliese [Tue, 16 Sep 2014 20:40:02 +0000 (15:40 -0500)]
uwb: line length cleanup

Fix line length in uwb-internal.h

Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agowusb: delete double assignment
Julia Lawall [Sat, 23 Aug 2014 18:33:26 +0000 (20:33 +0200)]
wusb: delete double assignment

Delete successive assignments to the same location.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression i;
@@

*i = ...;
 i = ...;
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: renesas_usbhs: fix driver dependencies
Bartlomiej Zolnierkiewicz [Mon, 1 Sep 2014 14:24:40 +0000 (16:24 +0200)]
usb: renesas_usbhs: fix driver dependencies

Renesas USBHS controller support should be available only on
Renesas ARM SoCs and SuperH architecture.

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Magnus Damm <magnus.damm@gmail.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Acked-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: host: ohci-exynos: Remove unnecessary usb-phy support
Vivek Gautam [Mon, 22 Sep 2014 05:46:19 +0000 (11:16 +0530)]
usb: host: ohci-exynos: Remove unnecessary usb-phy support

Now that we have completely moved from older USB-PHY drivers
to newer GENERIC-PHY drivers for PHYs available with USB controllers
on Exynos series of SoCs, we can remove the support for the same
in our host drivers too.

We also defer the probe for our host in case we end up getting
EPROBE_DEFER error when getting PHYs.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Acked-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: misc: yurex: remove useless casting of private_data
Arjun Sreedharan [Mon, 18 Aug 2014 22:53:34 +0000 (04:23 +0530)]
usb: misc: yurex: remove useless casting of private_data

Signed-off-by: Arjun Sreedharan <arjun024@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoxhci: Log extra info on "ERROR Transfer event TRB DMA ptr not part of current TD"
Hans de Goede [Wed, 20 Aug 2014 13:41:51 +0000 (16:41 +0300)]
xhci: Log extra info on "ERROR Transfer event TRB DMA ptr not part of current TD"

Lately (with the use of uas / bulk-streams) we have been seeing several
cases where this error triggers (which should never happen).

Add some extra logging to make debugging these errors easier.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoxhci: Remove "FIXME - check all the stream rings for pending cancellations"
Hans de Goede [Wed, 20 Aug 2014 13:41:54 +0000 (16:41 +0300)]
xhci: Remove "FIXME - check all the stream rings for pending cancellations"

Even though a Set TR deq ptr command operates on a ring, and an endpoint
can have multiple rings, we can have only one Set TR deq ptr command pending.

When an endpoint with streams halts or is stopped to unlink urbs, there
will only be at most one ring active / one td being executed (the td
stopped_td points to).

So when we reset the endpoint (for a halt), or the stop command completes, we
will queue one Set TR deq ptr command at most, cancelled urbs on other stream
rings then the one being executed will have there trbs turned to nops, and
once the hcd gets around to execute that stream ring they will be simply
skipped.

So the SET_DEQ_PENDING flag in the endpoint is sufficient protection against
starting the endpoing before all stream rings are cleaned up.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoxhci: Always ring the doorbell for active eps when a Set TR deq ptr cmd completes
Hans de Goede [Wed, 20 Aug 2014 13:41:55 +0000 (16:41 +0300)]
xhci: Always ring the doorbell for active eps when a Set TR deq ptr cmd completes

Even if the stream for which the command was intended has been freed in the
mean time. This ensures that things start rolling again after an unlink / halt.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoxhci: Fold queue_set_tr_deq into xhci_queue_new_dequeue_state
Hans de Goede [Wed, 20 Aug 2014 13:41:53 +0000 (16:41 +0300)]
xhci: Fold queue_set_tr_deq into xhci_queue_new_dequeue_state

xhci_queue_new_dequeue_state is the only caller of queue_set_tr_deq
and queue_set_tr_deq checks for SET_DEQ_PENDING, where as
xhci_queue_new_dequeue_state sets it which is inconsistent.

Simply fold the 2 into one is a nice cleanup and fixes the inconsistency.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoxhci: xhci_ring_device: Ring stream ring bells for endpoints with streams
Hans de Goede [Wed, 20 Aug 2014 13:41:56 +0000 (16:41 +0300)]
xhci: xhci_ring_device: Ring stream ring bells for endpoints with streams

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: xhci_suspend is not stopping the root hub timer for the shared HCD
Al Cooper [Wed, 20 Aug 2014 13:41:57 +0000 (16:41 +0300)]
usb: xhci_suspend is not stopping the root hub timer for the shared HCD

V2 - Restart polling (which will restart the timer) for the shared
HCD in xhci_resume().

xhci_suspend() will stop the primary HCD's root hub timer, but leaves
the shared HCD's timer running. This change adds stopping of the
shared HCD timer.

Signed-off-by: Al Cooper <alcooperx@gmail.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoxhci: Move allocating of command for new_dequeue_state to queue_set_tr_deq()
Hans de Goede [Wed, 20 Aug 2014 13:41:52 +0000 (16:41 +0300)]
xhci: Move allocating of command for new_dequeue_state to queue_set_tr_deq()

There are multiple reasons for this:

1) This fixes a missing check for xhci_alloc_command failing in
   xhci_handle_cmd_stop_ep()
2) This adds a warning when we cannot set the new dequeue state because of
   xhci_alloc_command failing
3) It puts the allocation of the command after the sanity checks in
   queue_set_tr_deq(), avoiding leaking the command if those fail
4) Since queue_set_tr_deq now owns the command it can free it if queue_command
   fails
5) It reduces code duplication

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouas: Add response iu handling
Hans de Goede [Sat, 13 Sep 2014 10:26:51 +0000 (12:26 +0200)]
uas: Add response iu handling

If something goes wrong in our communication with an uas device we may get
a response iu in reaction to a cmnd, rather then a status iu. In this case
propagate an error upwards, rather then logging a bogus iu message.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouas: Log error codes when logging errors
Hans de Goede [Sat, 13 Sep 2014 10:26:50 +0000 (12:26 +0200)]
uas: Log error codes when logging errors

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouas: Cleanup uas_log_cmd_state usage
Hans de Goede [Sat, 13 Sep 2014 10:26:49 +0000 (12:26 +0200)]
uas: Cleanup uas_log_cmd_state usage

Instead of doing:

uas_log_cmd_state(cmnd, __func__)
scmd_printk(KERN_ERR, cmnd, "error doing foo %d\n", err)

On error, resulting in 2 log calls for a single error, make uas_log_cmd_state
take a status code, and change calls like the above to:

uas_log_cmd_state(cmnd, "error doing foo", err)

Also change various sanity checks (which should never trigger) from:
"scmd_printk(KERN_ERR, cmnd, "sanity foo failed\n")" to calling the new
uas_log_cmd_state(), so that when they do trigger we get more info.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouas: Remove protype hardware usb interface info
Hans de Goede [Sat, 13 Sep 2014 10:26:48 +0000 (12:26 +0200)]
uas: Remove protype hardware usb interface info

We've removed all hack from the driver for pre-production hardware.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouas: Remove support for old sense ui as used in pre-production hardware
Hans de Goede [Sat, 13 Sep 2014 10:26:47 +0000 (12:26 +0200)]
uas: Remove support for old sense ui as used in pre-production hardware

I've access to a number of different uas devices now, and none of them use
old style sense urbs. The only case where these code-paths trigger is with
the asm1051 and there they do the wrong thing, as the asm1051 sends 8 bytes
status iu-s when it does not have any sense data, but uses new style
sense iu-s regardless, as can be seen for scsi cmnds where there is sense
data.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouas: Drop COMMAND_COMPLETED flag
Hans de Goede [Sat, 13 Sep 2014 10:26:46 +0000 (12:26 +0200)]
uas: Drop COMMAND_COMPLETED flag

It was only used to sanity check against completing the same cmnd twice,
but that is the case we're likely operating on free-ed memory, and doing
sanity checks on free-ed memory is not really helpful.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouas: Use scsi_print_command
Hans de Goede [Sat, 13 Sep 2014 10:26:45 +0000 (12:26 +0200)]
uas: Use scsi_print_command

Use scsi_print_command to print commands during errors, rather then printing
the rather meaningless pointer to the command.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouas: Do not log urb status error on cancellation
Hans de Goede [Sat, 13 Sep 2014 10:26:44 +0000 (12:26 +0200)]
uas: Do not log urb status error on cancellation

Check for both type of cancellation codes for sense and data urbs.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouas: Use streams on upcoming 10Gbps / 3.1 USB
Hans de Goede [Sat, 13 Sep 2014 10:26:43 +0000 (12:26 +0200)]
uas: Use streams on upcoming 10Gbps / 3.1 USB

Limit the no-streams case to speeds less then USB_SPEED_SUPER.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouas: pre_reset and suspend: Fix a few races
Hans de Goede [Sat, 13 Sep 2014 10:26:42 +0000 (12:26 +0200)]
uas: pre_reset and suspend: Fix a few races

The purpose of uas_pre_reset is to:

1) Stop any new commands from being submitted while an externally triggered
   usb-device-reset is running
2) Wait for any pending commands to finish before allowing the usb-device-reset
   to continue

The purpose of uas_suspend is to:
2) Wait for any pending commands to finish before suspending

This commit fixes races in both paths:

1) For 1) we use scsi_block_requests, but the scsi midlayer calls queuecommand
   without holding any locks, so a queuecommand may already past the midlayer
   scsi_block_requests checks when we call it, add a check to uas_queuecommand
   to fix this

2) For 2) we were waiting for all sense-urbs to complete, there are 2 problems
   with this approach:
a) data-urbs may complete after the sense urb, so we need to check for those
   too
b) if a sense-urb completes with a iu id of READ/WRITE_READY a command is not
   yet done. We submit a new sense-urb immediately in this case, but that
   submit may fail (in which case it will get retried by uas_do_work), if this
   happens the sense_urbs anchor may become empty while the cmnd is not yet
   done

Also unblock requests on timeout, to avoid things getting stuck in that case.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouas: Fix memleak of non-submitted urbs
Hans de Goede [Sat, 13 Sep 2014 10:26:41 +0000 (12:26 +0200)]
uas: Fix memleak of non-submitted urbs

Not all urbs we've allocated are necessarily also submitted, non-submitted
urbs will not be free-ed by their completion handler. So we need to free
them manually.

There are 2 scenarios where this can happen:

1) We have failed to submit some urbs at abort / disconnect
2) When running over usb-2 we may have never tried to submit the data urbs
   when completing the scsi cmnd, because we never got a READ/WRITE_READY iu

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouas: Drop all references to a scsi_cmnd once it has been aborted
Hans de Goede [Sat, 13 Sep 2014 10:26:40 +0000 (12:26 +0200)]
uas: Drop all references to a scsi_cmnd once it has been aborted

Do not keep references around to a cmnd which is under error handling.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouas: Remove cmnd reference from the cmd urb
Hans de Goede [Sat, 13 Sep 2014 10:26:39 +0000 (12:26 +0200)]
uas: Remove cmnd reference from the cmd urb

It is not strictly necessary for the cmd urb to have a reference to the
cmnd, and without this reference it becomes easier to drop all references to
a cmnd on an abort.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouas: Drop inflight list
Hans de Goede [Sat, 13 Sep 2014 10:26:38 +0000 (12:26 +0200)]
uas: Drop inflight list

We've the same info doubled in both the inflight list and the cmnd array,
drop the list.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouas: zap_pending: data urbs should have completed at this time
Hans de Goede [Sat, 13 Sep 2014 10:26:37 +0000 (12:26 +0200)]
uas: zap_pending: data urbs should have completed at this time

The data urbs are all killed before calling zap_pending, and their completion
handler should have cleared their inflight flag.

Do not 0 the data inflight flags, and add a check for try_complete succeeding,
as it should always succeed when called from zap_pending.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouas: Simplify reset / disconnect handling
Hans de Goede [Sat, 13 Sep 2014 10:26:36 +0000 (12:26 +0200)]
uas: Simplify reset / disconnect handling

Drop the whole dance with first moving cmnds to a dead-list. The resetting
flag ensures that no new cmds / urbs will be submitted, and that any urb
completions are short-circuited without trying to complete the scsi cmnd.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouas: Free data urbs on completion
Hans de Goede [Sat, 13 Sep 2014 10:26:35 +0000 (12:26 +0200)]
uas: Free data urbs on completion

Now that we no longer drop our lock to unlink the data urbs, we can simply
free them on completion, making their handling consistent with the other urbs.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouas: Simplify unlink of data urbs on error
Hans de Goede [Sat, 13 Sep 2014 10:26:34 +0000 (12:26 +0200)]
uas: Simplify unlink of data urbs on error

There is no need for all the trickery with dropping the lock, we can
simply reference the urbs while we hold the lock to ensure the urbs don't
disappear beneath us, and do the actual unlink (+ unreference) after we've
dropped the lock.

This also fixes a race where we may loose of cmnd ownership to the scsi
midlayer without holding the lock due to the midlayer re-claiming ownership
through an abort (which will be handled by a future patch in this series).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouas: Check against unexpected completions
Hans de Goede [Sat, 13 Sep 2014 10:26:33 +0000 (12:26 +0200)]
uas: Check against unexpected completions

The status urb should not complete before the command has been submitted, nor
should we get a second status urb for the same tag after a IU_ID_STATUS.

Data urbs should not complete before the command has been submitted, but may
complete after the IU_ID_STATUS.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouas: Do not use scsi_host_find_tag
Hans de Goede [Sat, 13 Sep 2014 10:26:32 +0000 (12:26 +0200)]
uas: Do not use scsi_host_find_tag

Using scsi_host_find_tag with tags returned by the device is unsafe for
multiple reasons:

1) It returns tags->rqs[tag], which may be non NULL even when the cmnd is
   not owned by us
2) It returns tags->rqs[tag], without holding any locks protecting it
3) It returns tags->rqs[tag], without doing any boundary checking

Instead keep our own list which maps tags -> inflight cmnds.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouas: Add uas_get_tag() helper function
Hans de Goede [Sat, 13 Sep 2014 10:26:31 +0000 (12:26 +0200)]
uas: Add uas_get_tag() helper function

Factor out the mapping of scsi-tags -> uas-tags/stream-ids to a helper function
so that there is a single place where this "magic" happens.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouas: Fix resetting flag handling
Hans de Goede [Sat, 13 Sep 2014 10:26:30 +0000 (12:26 +0200)]
uas: Fix resetting flag handling

- Make sure we always hold the lock when setting / checking resetting
- Check resetting before checking urb->status
- Add missing check for resetting to uas_data_cmplt
- Add missing check for resetting to uas_do_work

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouas: Remove task-management / abort error handling code
Hans de Goede [Sat, 13 Sep 2014 10:26:29 +0000 (12:26 +0200)]
uas: Remove task-management / abort error handling code

There are various bug reports about oopses / hangs with the uas driver,
which all point to the abort-command and logical-unit-reset (task-management)
error handling paths.

Getting these right is very hard, there are quite a few corner cases, and
testing is almost impossible since under normal operation these code paths
are not used at all.

Another problem is that there are also some cases where it simply is not clear
what to do at all. E.g. over usb-2 multiple outstanding commands share the same
endpoint. What if a command gets aborted while its sense urb is half way
through completing (so some data has been transfered but not all). Since the
urb is not yet complete we don't know if the sense urb is actually for this
command, or for one of the other oustanding commands. If it is for one of the
other commands and we cancel it, then we end up in an undefined state. But if
it is actually for the command we're aborting, and the abort succeeds, then it
may never complete...

This exact same problem applies to logical unit resets too, if there are
multiple luns, then commands outstanding on both luns share the sense
endpoint. If there is only a single lun, then doing a logical unit reset is
little better then doing a full usb device reset.

So summarizing because:
1) abort / lun-reset is very tricky to get right
2) Not being able to test the tricky code, which means it will have bugs
3) This being a code path which under normal operation will never happen,
   so being slow / sub-optimal here is not really an issue
4) Under error conditions we will still be able to recover through usb
   device resets.
5) This may be a bit slower in some cases, but this is actually faster in
   cases where the bridge ship has locked up, which seems to be the most
   common error case sofar.

This commit removes the abort / lun-reset error handling paths, and also the
taks-mgmt code since those are the only 2 task-mgmt users. Leaving only the
(tested and testable) usb-device-reset error handling path in place.

Note I realize that this is somewhat of a big hammer, but currently people
are seeing very hard to debug oopses with uas. First let focus on making uas
work reliable, then we can later look into adding more fine grained error
handling.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouas: Add another ASM1051 usb-id to the uas blacklist
Hans de Goede [Tue, 23 Sep 2014 13:48:50 +0000 (15:48 +0200)]
uas: Add another ASM1051 usb-id to the uas blacklist

As most ASM1051 based devices, this one has unfixable issues with uas too.

Cc: stable@vger.kernel.org # 3.16
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouas: Add US_FL_NO_ATA_1X quirk for Seagate (0bc2:ab20) drives
Hans de Goede [Wed, 17 Sep 2014 08:10:58 +0000 (10:10 +0200)]
uas: Add US_FL_NO_ATA_1X quirk for Seagate (0bc2:ab20) drives

https://bbs.archlinux.org/viewtopic.php?pid=1457492

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouas: Add no-report-opcodes quirk
Hans de Goede [Tue, 16 Sep 2014 16:36:52 +0000 (18:36 +0200)]
uas: Add no-report-opcodes quirk

Besides the ASM1051 (*) needing sdev->no_report_opcodes = 1, it turns out that
the JMicron JMS567 also needs it to work properly with uas (usb-storage always
sets it). Since some of the scsi devs were not to keen on the idea to
outrightly set sdev->no_report_opcodes = 1 for all uas devices, so add a quirk
for this, and set it for the JMS567.

*) Which has become a non-issue since we've completely blacklisted uas on
the ASM1051 for other reasons

Cc: stable@vger.kernel.org
Reported-and-tested-by: Claudio Bizzarri <claudio.bizzarri@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouas: Add a quirk for rejecting ATA_12 and ATA_16 commands
Hans de Goede [Mon, 15 Sep 2014 14:04:12 +0000 (16:04 +0200)]
uas: Add a quirk for rejecting ATA_12 and ATA_16 commands

And set this quirk for the Seagate Expansion Desk (0bc2:2312), as that one
seems to hang upon receiving an ATA_12 or ATA_16 command.

https://bugzilla.kernel.org/show_bug.cgi?id=79511
https://bbs.archlinux.org/viewtopic.php?id=183190

While at it also add missing documentation for the u value for usb-storage
quirks.

Cc: stable@vger.kernel.org # 3.16, 3.17
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
--
Changes in v2: Add documentation for new t and u usb-storage.quirks flags
Changes in v3: Fix typo in documentation
Changes in v4: Also apply the quirk to (0bc2:3312)
Changes in v5: Rebased on 3.17-rc5, drop u documentation, already upstream
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agouas: replace WARN_ON_ONCE() with lockdep_assert_held()
Sanjeev Sharma [Tue, 12 Aug 2014 06:40:21 +0000 (12:10 +0530)]
uas: replace WARN_ON_ONCE() with lockdep_assert_held()

on some architecture spin_is_locked() always return false in
uniprocessor configuration and therefore it would be advise
to replace with lockdep_assert_held().

Signed-off-by: Sanjeev Sharma <Sanjeev_Sharma@mentor.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoMAINTAINERS: Add ehci-st.c and ohci-st.c to ARCH/STI architecture
Peter Griffin [Mon, 8 Sep 2014 12:04:48 +0000 (13:04 +0100)]
MAINTAINERS: Add ehci-st.c and ohci-st.c to ARCH/STI architecture

This patch adds the ehci-st.c and ohci-st.c files for the usb 2.0
& usb1.1 host controller drivers found on stih41x and stih4xx STMicroelectronics
SoC's into the STI arch section of the maintainers file.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: host: ohci-st: Add ohci-st devicetree bindings documentation
Peter Griffin [Mon, 8 Sep 2014 12:04:47 +0000 (13:04 +0100)]
usb: host: ohci-st: Add ohci-st devicetree bindings documentation

This patch documents the device tree bindings required for
the ohci on-chip controller found in ST consumer electronics SoC's.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: host: ehci-st: Add ehci-st devicetree bindings documentation
Peter Griffin [Mon, 8 Sep 2014 12:04:46 +0000 (13:04 +0100)]
usb: host: ehci-st: Add ehci-st devicetree bindings documentation

This patch documents the device tree bindings required for the
ehci on-chip controller found in ST consumer electronics SoC's.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: host: ohci-st: Add OHCI driver support for ST STB devices
Peter Griffin [Mon, 8 Sep 2014 12:04:45 +0000 (13:04 +0100)]
usb: host: ohci-st: Add OHCI driver support for ST STB devices

This patch adds the glue code required to ensure the on-chip OHCI
controller works on STi consumer electronics SoC's from STMicroelectronics.

It mainly manages the setting and enabling of the relevant clocks and manages
the reset / power signals to the IP block.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: host: ehci-st: Add EHCI support for ST STB devices
Peter Griffin [Mon, 8 Sep 2014 12:04:44 +0000 (13:04 +0100)]
usb: host: ehci-st: Add EHCI support for ST STB devices

This patch adds the glue code required to ensure the on-chip EHCI
controller works on STi consumer electronics SoC's from STMicroelectronics.

It mainly manages the setting and enabling of the relevant clocks and manages
the reset / power signals to the IP block.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoUSB: isp1362: Use devm_ioremap_resource
Tobias Klauser [Tue, 5 Aug 2014 12:01:35 +0000 (14:01 +0200)]
USB: isp1362: Use devm_ioremap_resource

Use devm_ioremap_resource to simplify error handling in the probe
function and to get rid of some boilerplate in the remove function.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoof: add vendor prefix for Chipidea
Peter Chen [Mon, 22 Sep 2014 00:14:18 +0000 (08:14 +0800)]
of: add vendor prefix for Chipidea

Adds chipidea to the list of DT vendor prefixes.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: chipidea: enhance kernel-doc format
Peter Chen [Mon, 22 Sep 2014 00:14:17 +0000 (08:14 +0800)]
usb: chipidea: enhance kernel-doc format

Some kernel-doc style comment are not satisfied for format, fix them.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: chipidea: otg initialization is only needed when the gadget is supported
Peter Chen [Mon, 22 Sep 2014 00:14:16 +0000 (08:14 +0800)]
usb: chipidea: otg initialization is only needed when the gadget is supported

We have only needed to enable otg initialization when both of
below conditions are satisfied:

- The controller is otg capable
- The gadget function is enabled

If the controller is otg capable, but is host-only configuration, we do
not need to access register otgsc and do any otg operations (eg, create
otg workqueue).

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agochipidea: usbmisc_imx: Add USB support for VF610 SoCs
Stefan Agner [Mon, 22 Sep 2014 00:14:15 +0000 (08:14 +0800)]
chipidea: usbmisc_imx: Add USB support for VF610 SoCs

This adds Vybrid VF610 SoC support. The IP is very similar to i.MX6,
however, the non-core registers are spread in two different register
areas. Hence we support multiple instances of the USB misc driver
and add the driver instance to the imx_usbmisc_data structure.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agodoc: dt-binding: ci-hdrc-imx: add TPL support
Peter Chen [Tue, 19 Aug 2014 01:51:57 +0000 (09:51 +0800)]
doc: dt-binding: ci-hdrc-imx: add TPL support

TPL (Targeted Peripheral List) is needed for targets host
(OTG and Embedded Hosts) for usb certification and other
vendor specific requirements.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: chipidea: add TPL support for targeted hosts
Peter Chen [Tue, 19 Aug 2014 01:51:56 +0000 (09:51 +0800)]
usb: chipidea: add TPL support for targeted hosts

For OTG and Embedded hosts, they may need TPL (Targeted Peripheral List)
for usb certification and other vender specific requirements, the
platform can tell chipidea core driver if it supports tpl through DT
or platform data.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: common: add API to get if the platform supports TPL
Peter Chen [Tue, 19 Aug 2014 01:51:55 +0000 (09:51 +0800)]
usb: common: add API to get if the platform supports TPL

The TPL (Targeted Peripheral List) is used for targeted hosts
(non-PC hosts), and it can be used at USB OTG & EH certification
and some specific products which need white list.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: core: Kconfig: TPL should apply for both OTG and EH
Peter Chen [Tue, 19 Aug 2014 01:51:54 +0000 (09:51 +0800)]
usb: core: Kconfig: TPL should apply for both OTG and EH

Update configuration for USB_OTG_WHITELIST, any targeted hosts
(non PC-hosts) can have TPL (Targered Peripheral List).

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: core: TPL should apply for both OTG and EH
Peter Chen [Tue, 19 Aug 2014 01:51:53 +0000 (09:51 +0800)]
usb: core: TPL should apply for both OTG and EH

According to On-The-Go and Embedded Host Supplement to the USB Revision
2.0 Specification, the targeted hosts (non-PC hosts) include both
embedded hosts and otg, and each targeted host product defines the
set of supported peripherals on a TPL (Targeted Peripheral List). So,
TPL should apply for both OTG and embedded host, and the otg support is
not a must for embedded host.

The TPL support feature will only be effect when CONFIG_USB_OTG_WHITELIST
has been chosen and hcd->tpl_support flag is set, it can avoid the enumeration
fails problem for the user who chooses CONFIG_USB_OTG_WHITELIST wrongly.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: hcd: add TPL support flag
Peter Chen [Tue, 19 Aug 2014 01:51:52 +0000 (09:51 +0800)]
usb: hcd: add TPL support flag

The targeted hosts (non-PC hosts) need to have TPL (Targeted Peripheral List)
for USB OTG & EH certification and other vendor specific requirements.

The platform who needs TPL feature should set this flag at usb host
controller driver.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoUSB: quirks: enable device-qualifier quirk for Elan Touchscreen
Johan Hovold [Mon, 25 Aug 2014 15:51:27 +0000 (17:51 +0200)]
USB: quirks: enable device-qualifier quirk for Elan Touchscreen

Enable device-qualifier quirk for Elan Touchscreen, which often fails to
handle requests for the device_descriptor.

Note that the device sometimes do respond properly with a Request Error
(three times as USB core retries), but usually fails to respond at all.
When this happens any further descriptor requests also fails, for
example:

[ 1528.688934] usb 2-7: new full-speed USB device number 4 using xhci_hcd
[ 1530.945588] usb 2-7: unable to read config index 0 descriptor/start: -71
[ 1530.945592] usb 2-7: can't read configurations, error -71

This has been observed repeating for over a minute before eventual
successful enumeration.

Reported-by: Drew Von Spreecken <drewvs@gmail.com>
Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoUSB: core: add device-qualifier quirk
Johan Hovold [Mon, 25 Aug 2014 15:51:26 +0000 (17:51 +0200)]
USB: core: add device-qualifier quirk

Add new quirk for devices that cannot handle requests for the
device_qualifier descriptor.

A USB-2.0 compliant device must respond to requests for the
device_qualifier descriptor (even if it's with a request error), but at
least one device is known to misbehave after such a request.

Suggested-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoRevert "usb: gadget: composite: dequeue cdev->req before free it in composite_dev_cle...
Felipe Balbi [Thu, 18 Sep 2014 14:31:32 +0000 (09:31 -0500)]
Revert "usb: gadget: composite: dequeue cdev->req before free it in composite_dev_cleanup"

This reverts commit f2267089ea17fa97b796b1b4247e3f8957655df3.

That commit causes more problem than fixes. Firstly, kfree()
should be called after usb_ep_dequeue() and secondly, the way
things are, we will try to dequeue a request that has already
completed much more frequently than one which is pending.

Cc: Li Jun <b47624@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Cc: stable <stable@vger.kernel.org> # 3.17
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoMerge 3.17-rc6 into usb-next
Greg Kroah-Hartman [Mon, 22 Sep 2014 13:46:16 +0000 (06:46 -0700)]
Merge 3.17-rc6 into usb-next

We want the USB fixes in this branch as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoMerge tag 'usb-serial-3.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
Greg Kroah-Hartman [Mon, 22 Sep 2014 13:18:07 +0000 (06:18 -0700)]
Merge tag 'usb-serial-3.18-rc1' of git://git./linux/kernel/git/johan/usb-serial into usb-next

Johan writes:

USB-serial updates for v3.18-rc1

These changes add two new "simple" drivers, while removing the redundant
zte_ev driver (PIDs moved to option).

Included are also some minor clean ups to the xsens_mt driver, and the
enabling of further baud rates for pl2303 devices.

Signed-off-by: Johan Hovold <johan@kernel.org>
9 years agoLinux 3.17-rc6 v3.17-rc6
Linus Torvalds [Sun, 21 Sep 2014 22:43:02 +0000 (15:43 -0700)]
Linux 3.17-rc6

9 years agoMerge branch 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm
Linus Torvalds [Sun, 21 Sep 2014 19:11:52 +0000 (12:11 -0700)]
Merge branch 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm

Pull ARM fixes from Russell King:
 "Fixes for ARM, the most notable being the fix from Nathan Lynch to fix
  the state of various registers during execve, to ensure that data
  can't be leaked between two executables.

  Fixes from Victor Kamensky for get_user() on big endian platforms,
  since the addition of 8-byte get_user() support broke these fairly
  badly.

  A fix from Sudeep Holla for affinity setting when hotplugging CPU 0.

  A fix from Stephen Boyd for a perf-induced sleep attempt while atomic.

  Lastly, a correctness fix for emulation of the SWP instruction on
  ARMv7+, and a fix for wrong carry handling when updating the
  translation table base address on LPAE platforms"

* 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm:
  ARM: 8149/1: perf: Don't sleep while atomic when enabling per-cpu interrupts
  ARM: 8148/1: flush TLS and thumbee register state during exec
  ARM: 8151/1: add missing exports for asm functions required by get_user macro
  ARM: 8137/1: fix get_user BE behavior for target variable with size of 8 bytes
  ARM: 8135/1: Fix in-correct barrier usage in SWP{B} emulation
  ARM: 8133/1: use irq_set_affinity with force=false when migrating irqs
  ARM: 8132/1: LPAE: drop wrong carry flag correction after adding TTBR1_OFFSET

9 years agoMerge tag 'media-v3.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab...
Linus Torvalds [Sun, 21 Sep 2014 17:56:50 +0000 (10:56 -0700)]
Merge tag 'media-v3.17-rc6' of git://git./linux/kernel/git/mchehab/linux-media

Pull media fixes from Mauro Carvalho Chehab:
 "some media bug fixes:
   - a Kconfig dependency issue
   - some fixes for af9033/it913x demod to be more reliable and address
     a performance regression
   - cx18: fix an oops on devices with tda8290 tuner
   - two new USB IDs for af9035
   - a couple fixes on smapp driver"

* tag 'media-v3.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
  [media] af9035: new IDs: add support for PCTV 78e and PCTV 79e
  [media] af9033: feed clock to RF tuner
  [media] it913x: init tuner on attach
  [media] af9033: update IT9135 tuner inittabs
  [media] Kconfig: do not select SPI bus on sub-driver auto-select
  [media] cx18: fix kernel oops with tda8290 tuner
  [media] smiapp: Set sub-device owner
  [media] smiapp: Fix power count handling

9 years agoMerge tag 'staging-3.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
Linus Torvalds [Sat, 20 Sep 2014 17:43:37 +0000 (10:43 -0700)]
Merge tag 'staging-3.17-rc6' of git://git./linux/kernel/git/gregkh/staging

Pull staging / IIO fixes from Greg KH:
 "Here are some IIO and Staging driver fixes for 3.17-rc6.  They are all
  pretty simple, and resolve reported issues"

* tag 'staging-3.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  staging: vt6655: buffer overflow in ioctl
  iio:magnetometer: bugfix magnetometers gain values
  iio: adc: at91: don't use the last converted data register
  iio: adc: xilinx-xadc: assign auxiliary channels address correctly
  iio: meter: ade7758: Fix indio_dev->trig assignment
  iio: inv_mpu6050: Fix indio_dev->trig assignment
  iio: gyro: itg3200: Fix indio_dev->trig assignment
  iio: st_sensors: Fix indio_dev->trig assignment
  iio: hid_sensor_hub: Fix indio_dev->trig assignment
  iio: adc: ad_sigma_delta: Fix indio_dev->trig assignment
  iio: accel: bma180: Fix indio_dev->trig assignment
  iio:trigger: modify return value for iio_trigger_get
  iio:inkern: fix overwritten -EPROBE_DEFER in of_iio_channel_get_by_name

9 years agoMerge tag 'usb-3.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Linus Torvalds [Sat, 20 Sep 2014 17:42:56 +0000 (10:42 -0700)]
Merge tag 'usb-3.17-rc6' of git://git./linux/kernel/git/gregkh/usb

Pull USB fixes / quirks from Greg KH:
 "Here are some USB and PHY fixes and quirks for 3.17-rc6.  Nothing
  major, just a few things that have been reported"

* tag 'usb-3.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
  USB: storage: Add quirks for Entrega/Xircom USB to SCSI converters
  USB: storage: Add quirk for Ariston Technologies iConnect USB to SCSI adapter
  USB: storage: Add quirk for Adaptec USBConnect 2000 USB-to-SCSI Adapter
  USB: EHCI: unlink QHs even after the controller has stopped
  phy: spear1340-miphy: fix driver dependencies
  phy: spear1310-miphy: fix driver dependencies
  phy: miphy365x: Fix off-by-one error

9 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Linus Torvalds [Sat, 20 Sep 2014 17:41:38 +0000 (10:41 -0700)]
Merge git://git./linux/kernel/git/nab/target-pending

Pull SCSI target fixes from Nicholas Bellinger:
 "Here are the target pending fixes for v3.17-rc6.

  Included are Sagi's long overdue fixes related to iser-target
  shutdown, along with a couple of fixes from Sebastian related to ALUA
  Referrals changes that when in during the v3.14 time-frame.

  Also included are a few iscsi-target fixes, most recently of which
  where found during Joern's Coverity scanning of target code"

* git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending:
  iscsi-target: avoid NULL pointer in iscsi_copy_param_list failure
  iscsi-target: Fix memory corruption in iscsit_logout_post_handler_diffcid
  target: Fix inverted logic in SE_DEV_ALUA_SUPPORT_STATE_STORE
  target: Fix user data segment multiplier in spc_emulate_evpd_b3()
  iscsi-target: Ignore ICF_GOT_LAST_DATAOUT during Data-Out ITT lookup
  Target/iser: Fix initiator_depth and responder_resources
  Target/iser: Avoid calling rdma_disconnect twice
  Target/iser: Don't put isert_conn inside disconnected handler
  Target/iser: Get isert_conn reference once got to connected_handler

9 years agoMerge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
Linus Torvalds [Sat, 20 Sep 2014 17:10:14 +0000 (10:10 -0700)]
Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux

Pull drm fixes from Dave Airlie:
 "A bunch of radeon fixes for oops on module unload, and problems with
  resetting the dma engine, one nouveau fix for black boxes in rendering
  on my mbp retina, one sti fix, and a couple of intel fixes"

* 'drm-fixes' of git://people.freedesktop.org/~airlied/linux:
  drm/nouveau: ltc/gf100-: fix cbc issues on certain boards
  drm/bochs: add missing drm_connector_register call
  drm/cirrus: add missing drm_connector_register call
  drm/radeon: Fix typo 'addr' -> 'entry' in rs400_gart_set_page
  drm/nouveau/runpm: fix module unload
  drm/radeon/px: fix module unload
  vgaswitcheroo: add vga_switcheroo_fini_domain_pm_ops
  drm/radeon: don't reset dma on r6xx-evergreen init
  drm/radeon: don't reset sdma on CIK init
  drm/radeon: don't reset dma on NI/SI init
  drm/radeon/dpm: fix resume on mullins
  drm/radeon: Disable HDP flush before every CS again for < r600
  drm/radeon: delete unused PTE_* defines
  drm/i915: Add limited color range readout for HDMI/DP ports on g4x/vlv/chv
  drm: sti: do not iterate over the info frame array
  drm/i915: Fix SRC_COPY width on 830/845g

9 years agodrm/nouveau: ltc/gf100-: fix cbc issues on certain boards
Ben Skeggs [Sat, 20 Sep 2014 07:39:00 +0000 (17:39 +1000)]
drm/nouveau: ltc/gf100-: fix cbc issues on certain boards

A mismatch between FB and LTC's idea of how big a large page is causes
issues such as black "holes" in rendering to occur on some boards
(those where LTC is configured for 64KiB large pages) when compression
is used.

Confirmed to fix at least the GK107 MBP.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoMerge branch 'drm-fixes-3.17' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Sat, 20 Sep 2014 07:23:37 +0000 (17:23 +1000)]
Merge branch 'drm-fixes-3.17' of git://people.freedesktop.org/~agd5f/linux into drm-fixes

single fix for regression on rs4xx/rs690/rs740
* 'drm-fixes-3.17' of git://people.freedesktop.org/~agd5f/linux:
  drm/radeon: Fix typo 'addr' -> 'entry' in rs400_gart_set_page

9 years agodrm/bochs: add missing drm_connector_register call
Gerd Hoffmann [Fri, 19 Sep 2014 08:11:37 +0000 (10:11 +0200)]
drm/bochs: add missing drm_connector_register call

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agodrm/cirrus: add missing drm_connector_register call
Gerd Hoffmann [Fri, 19 Sep 2014 08:11:36 +0000 (10:11 +0200)]
drm/cirrus: add missing drm_connector_register call

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agousb: dwc2: add T: line to MAINTAINERS showing Felipe's tree
Paul Zimmerman [Fri, 19 Sep 2014 21:49:36 +0000 (14:49 -0700)]
usb: dwc2: add T: line to MAINTAINERS showing Felipe's tree

Starting with v3.18-rc, patches for dwc2 will go through Felipe's
tree. Add a T: line to MAINTAINERS to document this.

Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: dwc2: handle DMA buffer unmapping sanely
Paul Zimmerman [Tue, 16 Sep 2014 20:47:27 +0000 (13:47 -0700)]
usb: dwc2: handle DMA buffer unmapping sanely

The driver's handling of DMA buffers for non-aligned transfers
was kind of nuts. For IN transfers, it left the URB DMA buffer
mapped until the transfer completed, then synced it, copied the
data from the bounce buffer, then synced it again.

Instead of that, just call usb_hcd_unmap_urb_for_dma() to unmap
the buffer before starting the transfer. Then no syncing is
required when doing the copy. This should also allow handling of
other types of mappings besides just dma_map_single() ones.

Also reduce the size of the bounce buffer allocation for Isoc
endpoints to 3K, since that's the largest possible transfer size.

Tested on Raspberry Pi and Altera SOCFPGA.

Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: dwc2: clip max_transfer_size to 65535
Paul Zimmerman [Tue, 16 Sep 2014 20:47:26 +0000 (13:47 -0700)]
usb: dwc2: clip max_transfer_size to 65535

Clip max_transfer_size to 65535 for host. dwc2_hc_setup_align_buf()
allocates coherent buffers with this size, and if it's too large we
can exhaust the coherent DMA pool.

Tested on Raspberry Pi and Altera SOCFPGA.

Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agousb: dwc2/gadget: disable clock when it's not needed
Robert Baldyga [Tue, 9 Sep 2014 08:44:57 +0000 (10:44 +0200)]
usb: dwc2/gadget: disable clock when it's not needed

When device is stopped or suspended clock is not needed so we
can disable it for this time.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>