firefly-linux-kernel-4.4.55.git
10 years agousb: dwc2/gadget: move phy bus legth initialization
Kamil Debski [Tue, 9 Sep 2014 08:44:52 +0000 (10:44 +0200)]
usb: dwc2/gadget: move phy bus legth initialization

This patch moves the part of code that initializes the PHY bus width.
This results in simpler code and removes the need to check whether
the Generic PHY Framework is used.

Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoMerge tag 'phy-for_3.18' of git://git.kernel.org/pub/scm/linux/kernel/git/kishon...
Greg Kroah-Hartman [Thu, 25 Sep 2014 11:11:52 +0000 (13:11 +0200)]
Merge tag 'phy-for_3.18' of git://git./linux/kernel/git/kishon/linux-phy into usb-next

Kishon writes:

Adds 3 new PHY drivers stih407, stih41x and rcar gen2 PHY. It also
includes miscellaneous cleanup of other PHY drivers.

Conflicts:
MAINTAINERS

10 years agoMerge tag 'usb-serial-3.17-final' of git://git.kernel.org/pub/scm/linux/kernel/git...
Greg Kroah-Hartman [Thu, 25 Sep 2014 10:18:11 +0000 (12:18 +0200)]
Merge tag 'usb-serial-3.17-final' of git://git./linux/kernel/git/johan/usb-serial into usb-next

Johan writes:

USB-serial fixes for v3.17

Here are two more device IDs for v3.17.

Signed-off-by: Johan Hovold <johan@kernel.org>
10 years agophy: remove .owner field for drivers using module_platform_driver
Peter Griffin [Fri, 15 Aug 2014 12:40:14 +0000 (13:40 +0100)]
phy: remove .owner field for drivers using module_platform_driver

This patch removes the superflous .owner field for drivers which
use the module_platform_driver or platform_driver_register api,
as this is overriden in __platform_driver_register.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
10 years agophy: exynos-dp-video: Use syscon support to control pmu register
Vivek Gautam [Tue, 16 Sep 2014 05:02:06 +0000 (10:32 +0530)]
phy: exynos-dp-video: Use syscon support to control pmu register

Currently the DP_PHY_ENABLE register is mapped in the driver,
and accessed to control power to the PHY.
With mfd-syscon and regmap interface available at our disposal,
it's wise to use that instead of using a 'reg' property for the
controller and allocating a memory resource for that.

To facilitate this, we have added another compatible string
for Exynso5420 SoC to acquire driver data which contains
different DP-PHY-CONTROL register offset.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Cc: Jingoo Han <jg1.han@samsung.com>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
10 years agoMAINTAINERS: Add phy-stih41x-usb.c to ARCH/STI architecture
Peter Griffin [Mon, 8 Sep 2014 10:33:02 +0000 (11:33 +0100)]
MAINTAINERS: Add phy-stih41x-usb.c to ARCH/STI architecture

This patch adds the new phy-sti41x-usb.c PHY driver found on
STMicroelectronics stih41x consumer electronics SoC's into the STI
arch section of the maintainers file.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
10 years agophy: phy-stih41x-usb: Add dt documentation for USB phy on STiH415/6
Peter Griffin [Mon, 8 Sep 2014 10:33:01 +0000 (11:33 +0100)]
phy: phy-stih41x-usb: Add dt documentation for USB phy on STiH415/6

This patch adds dt documentation bindings for the usb phy found
on STiH415/5 SoC's from STMicroelectronics, which support USB 1.1 and 2.0.

Signed-off-by: Maxime Coquelin <maxime.coquelin@st.com>
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
10 years agophy: phy-stih41x-usb: Add usb phy support for STiH41x SoCs.
Peter Griffin [Mon, 8 Sep 2014 10:33:00 +0000 (11:33 +0100)]
phy: phy-stih41x-usb: Add usb phy support for STiH41x SoCs.

This driver adds support for USB (1.1 and 2.0) phy for STiH415 and
STiH416 System-On-Chips from STMicroelectronics.

Signed-off-by: Maxime Coquelin <maxime.coquelin@st.com>
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
10 years agoMAINTAINERS: Add phy-stih407-usb.c file to ARCH/STI architecture
Peter Griffin [Thu, 11 Sep 2014 17:02:46 +0000 (18:02 +0100)]
MAINTAINERS: Add phy-stih407-usb.c file to ARCH/STI architecture

This patch adds the new phy-stih407-usb.c usb phy driver found on
STMicroelectronics stih407 consumer electronics SoC's into the STI
arch section of the maintainers file.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
10 years agophy: phy-stih407-usb: Add dt documentation for USB picophy found on stih407 SoC family
Peter Griffin [Thu, 11 Sep 2014 17:02:45 +0000 (18:02 +0100)]
phy: phy-stih407-usb: Add dt documentation for USB picophy found on stih407 SoC family

This patch adds the dt documentation for the usb picophy found on stih407 SoC family
available from STMicroelectronics.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
10 years agophy: phy-stih407-usb: Add usb picoPHY driver found on stih407 SoC family
Peter Griffin [Thu, 11 Sep 2014 17:02:44 +0000 (18:02 +0100)]
phy: phy-stih407-usb: Add usb picoPHY driver found on stih407 SoC family

This is the generic phy driver for the picoPHY ports used by the
USB2 and USB3 Host controllers when controlling usb2/1.1 devices. It
is found on STiH407 SoC family from STMicroelectronics.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
10 years agousb: phy: twl4030-usb: Use mutex instead of spinlock for protecting the data
Tony Lindgren [Wed, 27 Aug 2014 23:28:11 +0000 (16:28 -0700)]
usb: phy: twl4030-usb: Use mutex instead of spinlock for protecting the data

We're using threaded irq on a I2C bus and we're sleeping in
twl4030_usb_irq() as it calls twl4030_usb_linkstat() which
calls the i2c functions. If we ever need to lock for longer
I2C transaction sequences a mutex will allow us to do that
easily.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
10 years agousb: phy: twl4030-usb: Remove asleep and rely on runtime PM
Tony Lindgren [Wed, 27 Aug 2014 23:28:10 +0000 (16:28 -0700)]
usb: phy: twl4030-usb: Remove asleep and rely on runtime PM

There's no longer need for tracking the phy state in the driver
with asleep, we can now rely on runtime PM.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
10 years agousb: phy: twl4030-usb: Move code from twl4030_phy_power to the runtime PM calls
Tony Lindgren [Wed, 27 Aug 2014 23:28:09 +0000 (16:28 -0700)]
usb: phy: twl4030-usb: Move code from twl4030_phy_power to the runtime PM calls

We don't need twl4030_phy_power() any longer now that we have
the runtime PM calls. Let's get rid of it as it's confusing.
No functional changes, just move the code and use res instead
of ret as we are not returning that value.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
10 years agousb: phy: twl4030-usb: Simplify phy init to use runtime PM
Tony Lindgren [Wed, 27 Aug 2014 23:28:08 +0000 (16:28 -0700)]
usb: phy: twl4030-usb: Simplify phy init to use runtime PM

We can now let the interrupt and delayed work do all that's
needed with runtime PM.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
10 years agousb: phy: twl4030-usb: Remove unused irq_enabled
Tony Lindgren [Mon, 18 Aug 2014 14:54:16 +0000 (07:54 -0700)]
usb: phy: twl4030-usb: Remove unused irq_enabled

It's not being used any longer.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
10 years agophy: phy-spear1340-miphy: Use module_platform_driver to register driver.
Peter Griffin [Fri, 15 Aug 2014 12:40:16 +0000 (13:40 +0100)]
phy: phy-spear1340-miphy: Use module_platform_driver to register driver.

Using the module_platform_driver macro to register the driver as this gets
rid of a lot of the boilerplate code.

Also remove .owner field as this gets overridden in __platform_driver_register.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
10 years agophy: phy-spear1310-miphy: Use module_platform_driver to register driver.
Peter Griffin [Fri, 15 Aug 2014 12:40:15 +0000 (13:40 +0100)]
phy: phy-spear1310-miphy: Use module_platform_driver to register driver.

Use the module_platform_driver macro to register the driver as this gets
rid of a lot of the boilerplate code.

Also remove .owner field as this gets overridden in __platform_driver_register.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
10 years agophy: phy-spear1340-miphy: Remove unncessary site specific OOM messages
Peter Griffin [Fri, 15 Aug 2014 12:40:13 +0000 (13:40 +0100)]
phy: phy-spear1340-miphy: Remove unncessary site specific OOM messages

The site specific OOM messages are unncessary, because they duplicate
messages from the memory subsystem which include dump_stack().

Removing these superflous messages makes the kernel smaller. A discussion
here http://patchwork.ozlabs.org/patch/324158/ found that all error paths
from kzalloc will print a error message, and that any error path which maybe
found which doesn't would be considered a bug in kzalloc.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
10 years agophy: phy-spear1310-miphy: Remove unncessary site specific OOM messages
Peter Griffin [Fri, 15 Aug 2014 12:40:12 +0000 (13:40 +0100)]
phy: phy-spear1310-miphy: Remove unncessary site specific OOM messages

The site specific OOM messages are unncessary, because they duplicate
messages from the memory subsystem which include dump_stack().

Removing these superflous messages makes the kernel smaller. A discussion
here http://patchwork.ozlabs.org/patch/324158/ found that all error paths
from kzalloc will print a error message, and that any error path which maybe
found which doesn't would be considered a bug in kzalloc.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
10 years agophy: phy-ti-pipe3: Remove unncessary site specific OOM messages
Peter Griffin [Fri, 15 Aug 2014 12:40:11 +0000 (13:40 +0100)]
phy: phy-ti-pipe3: Remove unncessary site specific OOM messages

The site specific OOM messages are unncessary, because they duplicate
messages from the memory subsystem which include dump_stack().

Removing these superflous messages makes the kernel smaller. A discussion
here http://patchwork.ozlabs.org/patch/324158/ found that all error paths
from kzalloc will print a error message, and that any error path which maybe
found which doesn't would be considered a bug in kzalloc.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
10 years agophy: phy-omap-usb2: Remove unncessary site specific OOM messages
Peter Griffin [Fri, 15 Aug 2014 12:40:10 +0000 (13:40 +0100)]
phy: phy-omap-usb2: Remove unncessary site specific OOM messages

The site specific OOM messages are unncessary, because they duplicate
messages from the memory subsystem which include dump_stack().

Removing these superflous messages makes the kernel smaller. A discussion
here http://patchwork.ozlabs.org/patch/324158/ found that all error paths
from kzalloc will print a error message, and that any error path which maybe
found which doesn't would be considered a bug in kzalloc.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
10 years agophy: phy-mvebu-sata: Add missing error check for devm_kzalloc
Peter Griffin [Fri, 15 Aug 2014 12:40:09 +0000 (13:40 +0100)]
phy: phy-mvebu-sata: Add missing error check for devm_kzalloc

Currently this driver is missing a check on the return value of devm_kzalloc,
which would cause a NULL pointer dereference in a OOM situation.

This patch adds the aformentioned missing check.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Acked-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
10 years agophy: phy-omap-control: Remove unncessary site specific OOM messages
Peter Griffin [Fri, 15 Aug 2014 12:40:08 +0000 (13:40 +0100)]
phy: phy-omap-control: Remove unncessary site specific OOM messages

The site specific OOM messages are unncessary, because they duplicate
messages from the memory subsystem which include dump_stack().

Removing these superflous messages makes the kernel smaller. A discussion
here http://patchwork.ozlabs.org/patch/324158/ found that all error paths
from kzalloc will print a error message, and that any error path which maybe
found which doesn't would be considered a bug in kzalloc.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
10 years agophy: Renesas R-Car Gen2 PHY driver
Sergei Shtylyov [Tue, 22 Jul 2014 19:27:14 +0000 (23:27 +0400)]
phy: Renesas R-Car Gen2 PHY driver

This PHY, though formally being a part of Renesas USBHS controller, contains the
UGCTRL2 register that controls multiplexing of the USB ports (Renesas calls them
channels) to the different USB controllers: channel 0 can be connected to either
PCI EHCI/OHCI or USBHS controllers, channel 2 can be connected to PCI EHCI/OHCI
or xHCI controllers.

This is a new driver for this USB PHY currently already supported under drivers/
usb/phy/. The reason for writing the new driver was the requirement that the
multiplexing  of USB channels to the controller be dynamic, depending on what
USB drivers  are loaded,  rather than static as provided by the old driver. The
infrastructure provided by drivers/phy/phy-core.c  seems to fit that purpose
ideally. The new driver only  supports device tree probing  for now.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
10 years agousb: hub: allow to process more usb hub events in parallel
Petr Mladek [Fri, 19 Sep 2014 15:32:24 +0000 (17:32 +0200)]
usb: hub: allow to process more usb hub events in parallel

It seems that only choose_devnum() was not ready to process more hub
events at the same time.

All should be fine if we take bus->usb_address0_mutex there. It will
make sure that more devnums will not be chosen for the given bus and
the related devices at the same time.

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>
10 years agousb: hub: rename khubd to hub_wq in documentation and comments
Petr Mladek [Fri, 19 Sep 2014 15:32:23 +0000 (17:32 +0200)]
usb: hub: rename khubd to hub_wq in documentation and comments

USB hub has started to use a workqueue instead of kthread. Let's update
the documentation and comments here and there.

This patch mostly just replaces "khubd" with "hub_wq". There are only few
exceptions where the whole sentence was updated. These more complicated
changes can be found in the following files:

   Documentation/usb/hotplug.txt
   drivers/net/usb/usbnet.c
   drivers/usb/core/hcd.c
   drivers/usb/host/ohci-hcd.c
   drivers/usb/host/xhci.c

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>
10 years agousb: hub: rename usb_kick_khubd() to usb_kick_hub_wq()
Petr Mladek [Fri, 19 Sep 2014 15:32:22 +0000 (17:32 +0200)]
usb: hub: rename usb_kick_khubd() to usb_kick_hub_wq()

USB hub started to use a workqueue instead of kthread. Let's make it clear from
the function names.

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>
10 years agousb: hub: convert khubd into workqueue
Petr Mladek [Fri, 19 Sep 2014 15:32:21 +0000 (17:32 +0200)]
usb: hub: convert khubd into workqueue

There is no need to have separate kthread for handling USB hub events.
It is more elegant to use the workqueue framework.

The workqueue is allocated as freezable because the original thread was
freezable as well.

Also it is allocated as ordered because the code is not ready for parallel
processing of hub events, see choose_devnum().

struct usb_hub is passed via the work item. Therefore we do not need
hub_event_list.

Also hub_thread() is not longer needed. It would call only hub_event().
The rest of the code did manipulate the kthread and it is handled by the
workqueue framework now.

kick_khubd is renamed to kick_hub_wq() to make the function clear. And the
protection against races is done another way, see below.

hub_event_lock has been removed. It cannot longer be used to protect struct
usb_hub between hub_event() and hub_disconnect(). Instead we need to get
hub->kref already in kick_hub_wq().

The lock is not really needed for the other scenarios as well. queue_work()
returns whether it succeeded. We could revert the needed operations
accordingly. This is enough to avoid duplicity and inconsistencies.

Yes, the removed lock causes that there is not longer such a strong
synchronization between scheduling the work and manipulating
hub->disconnected.

But kick_hub_wq() must never be called together with hub_disconnect()
otherwise even the original code would have failed. Any callers are
responsible for this.

Therefore the only problem is that hub_disconnect() could be called in parallel
with hub_event(). But this was possible even in the past. struct usb_hub is
still guarded by hub->kref and released in hub_events() when needed.

Note that the source file is still full of the obsolete "khubd" strings.
Let's remove them in a follow up patch. This patch already is complex enough.

Thanks a lot Alan Stern <stern@rowland.harvard.edu> for code review, many useful
tips and guidance. Also thanks to Tejun Heo <tj@kernel.org> for hints how to
allocate the workqueue.

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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>