Thomas Pugliese [Fri, 7 Mar 2014 21:37:34 +0000 (15:37 -0600)]
usb: wusbcore: combine iso transfer result frame reads when possible
When reading the transfer result data for an isochronous in request, if
the current frame actual_length is contiguous with the next frame and
actual_length is a multiple of the DTI endpoint max packet size, combine
the current frame with the next frame in a single URB. This reduces the
number of URBs that must be submitted in that case which increases
performance and reduces CPU interrupt overhead.
Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Greg Kroah-Hartman [Sat, 8 Mar 2014 00:47:36 +0000 (16:47 -0800)]
Merge tag 'usb-for-v3.15' of git://git./linux/kernel/git/balbi/usb into usb-next
Felipe writes:
usb: patches for v3.15
another substantial pull request with new features all over
the place.
dwc3 got a bit closer towards hibernation support with after
a few patches re-factoring code to be reused for hibernation.
Also in dwc3 two new workarounds for known silicon bugs have
been implemented, some randconfig build errors have been fixed,
and it was taught about the new generic phy layer.
MUSB on AM335x now supports isochronous transfers thanks to
George Cherian's work.
The atmel_usba driver got two crash fixes: one when no endpoint
was specified in DeviceTree data and another when stopping the UDC
in DEBUG builds.
Function FS got a much needed fix to ffs_epfile_io() which was
copying too much data to userspace in some cases.
The printer gadget got a fix for a possible deadlock and plugged
a memory leak.
Ethernet drivers now use NAPI for RX which gives improved throughput.
Other than that, the usual miscelaneous fixes, cleanups, and
the like.
Signed-of-by: Felipe Balbi <balbi@ti.com>
Greg Kroah-Hartman [Fri, 7 Mar 2014 20:53:41 +0000 (12:53 -0800)]
Merge tag 'for-usb-next-2014-03-06' of git://git./linux/kernel/git/sarah/xhci into usb-next
Sarah writes:
xhci: Streams and UAS cleanups, misc cleanups for 3.15
Hi Greg,
Here's 76 patches to queue to usb-next for 3.15.
The bulk of this rather large pull request is the UAS driver cleanup, the
xHCI streams fixes, and the new userspace API for usbfs to be able to use
and alloc/free bulk streams. I've hammered on these changes, and the UAS
driver seems solid. The performance numbers are pretty spiffy too:
root@xanatos:~# echo 3 > /proc/sys/vm/drop_caches; dd if=/dev/sdb of=/dev/null bs=4k count=1000M iflag=count_bytes
256000+0 records in
256000+0 records out
1048576000 bytes (1.0 GB) copied, 3.28557 s, 319 MB/s
That's about 100 MB/s faster than my fastest Bulk-only-Transport mass
storage drive.
There's a couple of miscellaneous cleanup patches and non-urgent bug fixes
in here as well:
7969943789df xhci: add the meaningful IRQ description if it is empty
bcffae7708eb xhci: Prevent runtime pm from autosuspending during initialization
e587b8b270d3 xhci: make warnings greppable
25cd2882e2fc usb/xhci: Change how we indicate a host supports Link PM.
Sarah Sharp
Thomas Pugliese [Thu, 6 Mar 2014 18:53:37 +0000 (12:53 -0600)]
usb: wusbcore: disable transfer notifications for Alereon HWAs
The HWA driver does not do anything with transfer notifications after
receiving the first one and the Alereon HWA allows them to be disabled
as a performance optimization. This patch sends a vendor specific
command to the Alereon HWA on startup to disable transfer notifications.
If the command is successful, the DTI system is started immediately
since that would normally be started upon the first reception of a
transfer notification which will no longer be sent.
Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Thomas Pugliese [Tue, 4 Mar 2014 17:24:56 +0000 (11:24 -0600)]
usb: wusbcore: don't mark WA_SEG_DTI_PENDING segs as done in urb_dequeue
Data for transfer segments in the WA_SEG_DTI_PENDING state is actively
being read by the driver. Let the buffer read callback handle the
transfer cleanup since cleaning it up in wa_urb_dequeue will cause the
read callback to access invalid memory if the transfer is completed.
Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Thomas Pugliese [Tue, 4 Mar 2014 17:24:55 +0000 (11:24 -0600)]
usb: wusbcore: fix potential double list_del on urb dequeue
This patch locks rpipe->seg_lock around the entire transfer segment
cleanup loop in wa_urb_dequeue instead of just one case of the switch
statement. This fixes a race between __wa_xfer_delayed_run and
wa_urb_dequeue where a transfer segment in the WA_SEG_DELAYED state
could be removed from the rpipe seg_list twice leading to memory
corruption. It also switches the spin_lock call to use the non-irqsave
version since the xfer->lock is already held and irqs already disabled.
Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Roger Quadros [Fri, 7 Mar 2014 10:15:03 +0000 (12:15 +0200)]
phy: ti-pipe3: Add SATA compatible to Documentation binding
SATA PHY needs a new compatible ID. Add it to the DT binding documentation.
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Roger Quadros [Fri, 7 Mar 2014 10:15:02 +0000 (12:15 +0200)]
phy: ti-pipe3: Add clocks to PIPE3 PHY Documentation binding
Add wakeup, system and reference clocks to DT binding documentation.
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Roger Quadros [Fri, 7 Mar 2014 10:15:01 +0000 (12:15 +0200)]
phy: omap-control: update dra7 and am437 usb2 Documentation bindings
The dra7-usb2 and am437-usb2 bindings have not yet been used.
Change them to be more elegant.
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Chuansheng Liu [Tue, 4 Mar 2014 07:34:57 +0000 (15:34 +0800)]
usb: gadget: return the right length in ffs_epfile_io()
When the request length is aligned to maxpacketsize, sometimes
the return length ret > the user space requested len.
At that time, we will use min_t(size_t, ret, len) to limit the
size in case of user data buffer overflow.
But we need return the min_t(size_t, ret, len) to tell the user
space rightly also.
[ balbi@ti.com: also fix comment's indentation ]
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Reviewed-by: David Cohen <david.a.cohen@linux.intel.com>
Signed-off-by: Chuansheng Liu <chuansheng.liu@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Li Jun [Wed, 26 Feb 2014 23:38:19 +0000 (07:38 +0800)]
usb: phy: fsm: update OTG HNP state transition conditions according to OTG and EH 2.0 spec.
According to:"On-The-Go and Embedded Host Supplement to the USB Revision 2.0
Specification July 27, 2012 Revision 2.0 version 1.1a"
- From a_host to a_wait_bcon if !b_conn
- Add transition from a_host to a_wait_vfall if id state is high or a_bus_drop
- From a_wait_vfall to a_idle if a_wait_vfall_tmout
Signed-off-by: Li Jun <b47624@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Weinn Jheng [Thu, 27 Feb 2014 09:49:00 +0000 (17:49 +0800)]
usb: gadget: u_ether: move hardware transmit to RX NAPI
In order to reduce the interrupt times in the embedded system,
a receiving workqueue is introduced.
This modification also enhanced the overall throughput as the
benefits of reducing interrupt occurrence.
This work was derived from previous work:
u_ether: move hardware transmit to RX workqueue.
Which should be base on codeaurora's work.
However, the benchmark on my platform shows the throughput
with workqueue is slightly better than NAPI.
Signed-off-by: Weinn Jheng <clanlab.proj@gmail.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: David S. Miller <davem@davemloft.net>
Cc: Stephen Hemminger <shemminger@vyatta.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Manu Gautam <mgautam@codeaurora.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Dan Carpenter [Fri, 7 Mar 2014 11:20:22 +0000 (14:20 +0300)]
usb: dwc3: gadget: remove known conditions
We know what "value" is and it upsets static checkers that we appear to
have doubts about it.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Dan Carpenter [Fri, 7 Mar 2014 11:19:57 +0000 (14:19 +0300)]
usb: dwc3: gadget: cut and paste fixups in suspend/resume
These were cut and paste from the ->disconnect function.
Fixes commit
30d577b9bcc4 ('usb: dwc3: gadget: call gadget driver's
->suspend/->resume')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Adrian Huang [Thu, 27 Feb 2014 11:26:03 +0000 (11:26 +0000)]
xhci: add the meaningful IRQ description if it is empty
When some xHCI host controllers fall back to use the legacy IRQ,
the member irq_descr of the usb_hcd structure will be empty. This
leads to the empty string of the xHCI host controller in
/proc/interrupts. Here is the example (The irq 19 is the xHCI host
controller):
CPU0
0: 91 IO-APIC-edge timer
8: 1 IO-APIC-edge rtc0
9: 7191 IO-APIC-fasteoi acpi
18: 104 IR-IO-APIC-fasteoi ehci_hcd:usb1, ehci_hcd:usb2
19: 473 IR-IO-APIC-fasteoi
After applying the patch, the name of the registered xHCI host
controller can be displayed correctly. Here is the example:
CPU0
0: 91 IO-APIC-edge timer
8: 1 IO-APIC-edge rtc0
9: 7191 IO-APIC-fasteoi acpi
18: 104 IR-IO-APIC-fasteoi ehci_hcd:usb1, ehci_hcd:usb2
19: 473 IR-IO-APIC-fasteoi xhci_hcd:usb3
Tested on v3.14-rc4.
Signed-off-by: Adrian Huang <ahuang12@lenovo.com>
Reviewed-by: Nagananda Chumbalkar <nchumbalkar@lenovo.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Mathias Nyman [Mon, 3 Mar 2014 17:30:17 +0000 (19:30 +0200)]
xhci: Prevent runtime pm from autosuspending during initialization
xHCI driver has its own pci probe function that will call usb_hcd_pci_probe
to register its usb-2 bus, and then continue to manually register the
usb-3 bus. usb_hcd_pci_probe does a pm_runtime_put_noidle at the end and
might thus trigger a runtime suspend before the usb-3 bus is ready.
Prevent the runtime suspend by increasing the usage count in the
beginning of xhci_pci_probe, and decrease it once the usb-3 bus is
ready.
xhci-platform driver is not using usb_hcd_pci_probe to set up
busses and should not need to have it's usage count increased during probe.
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Acked-by: Dan Williams <dan.j.williams@intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@vger.kernel.org
Roger Quadros [Thu, 6 Mar 2014 14:38:38 +0000 (16:38 +0200)]
phy: omap-control: Update DT binding information
Move omap-control binding information to the right location.
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Michal Nazarewicz [Fri, 28 Feb 2014 11:20:23 +0000 (16:50 +0530)]
usb: gadget: f_fs: Add flags to descriptors block
This reworks the way SuperSpeed descriptors are added and instead of
having a magic after full and high speed descriptors, it reworks the
whole descriptors block to include a flags field which lists which
descriptors are present and makes future extensions possible.
Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Manu Gautam [Fri, 28 Feb 2014 11:20:22 +0000 (16:50 +0530)]
usb: gadget: f_fs: Add support for SuperSpeed Mode
Allow userspace to pass SuperSpeed descriptors and
handle them in the driver accordingly.
This change doesn't modify existing desc_header and thereby
keeps the ABI changes backward compatible i.e. existing
userspace drivers compiled with old header (functionfs.h)
would continue to work with the updated kernel.
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Gregory CLEMENT [Mon, 3 Mar 2014 16:48:34 +0000 (17:48 +0100)]
usb: gadget: atmel_usba: fix crashed during stopping when DEBUG is enabled
commit 511f3c5 (usb: gadget: udc-core: fix a regression during gadget driver
unbinding) introduced a crash when DEBUG is enabled.
The debug trace in the atmel_usba_stop function made the assumption that the
driver pointer passed in parameter was not NULL, but since the commit above,
such assumption was no longer always true.
This commit now uses the driver pointer stored in udc which fixes this
issue.
[ balbi@ti.com : improved commit log a bit ]
Cc: <stable@vger.kernel.org> # v3.2+
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Alexandre Belloni [Thu, 27 Feb 2014 15:42:13 +0000 (16:42 +0100)]
usb: gadget: atmel_usba: fix crash when no endpoint are specified
If no endpoints are present in the device tree, the kernel will crash with the
following error:
Unable to handle kernel paging request at virtual address
00101008
[...]
[<
c0222ff4>] (composite_dev_prepare) from [<
c022326c>] (composite_bind+0x5c/0x190)
[<
c022326c>] (composite_bind) from [<
c021ff8c>] (udc_bind_to_driver+0x48/0xf0)
[<
c021ff8c>] (udc_bind_to_driver) from [<
c02208e0>] (usb_gadget_probe_driver+0x7c/0xa0)
[<
c02208e0>] (usb_gadget_probe_driver) from [<
c0008970>] (do_one_initcall+0x94/0x140)
[<
c0008970>] (do_one_initcall) from [<
c04b4b50>] (kernel_init_freeable+0xec/0x1b4)
[<
c04b4b50>] (kernel_init_freeable) from [<
c0376cc4>] (kernel_init+0x8/0xe4)
[<
c0376cc4>] (kernel_init) from [<
c0009590>] (ret_from_fork+0x14/0x24)
Code:
e5950014 e1a04001 e5902008 e3a010d0 (
e5922008)
---[ end trace
35c74bdd89b373d0 ]---
Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
This checks for that case and returns an error, not allowing the driver to be
loaded with no endpoints.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Peter Chen [Mon, 24 Feb 2014 02:21:04 +0000 (10:21 +0800)]
usb: phy: mxs: Add sync time after controller clear phcd
After clear portsc.phcd, PHY needs 200us stable time for switch
32K clock to AHB clock.
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Peter Chen [Mon, 24 Feb 2014 02:21:03 +0000 (10:21 +0800)]
usb: phy: mxs: Add system suspend/resume API
We need this to keep PHY's power on or off during the system
suspend mode. If we need to enable USB wakeup, then we
must keep PHY's power being on during the system suspend mode.
Otherwise, we need to keep PHY's power being off to save power.
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Peter Chen [Mon, 24 Feb 2014 02:21:02 +0000 (10:21 +0800)]
usb: phy: mxs: Add implementation of set_wakeup
When we need the PHY can be waken up by external signals,
we can call this API. Besides, we call mxs_phy_disconnect_line
at this API to close the connection between USB PHY and
controller, after that, the line state from controller is SE0.
Once the PHY is out of power, without calling mxs_phy_disconnect_line,
there are unknown wakeups due to dp/dm floating at device mode.
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Peter Chen [Mon, 24 Feb 2014 02:21:01 +0000 (10:21 +0800)]
usb: phy: Add set_wakeup API
This API is used to set wakeup enable at PHY registers, in that
case, the PHY can be waken up from suspend due to external events,
like vbus change, dp/dm change and id change.
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Peter Chen [Mon, 24 Feb 2014 02:21:00 +0000 (10:21 +0800)]
usb: phy: mxs: add controller id
It is used to access un-regulator registers according to
different controllers.
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Peter Chen [Mon, 24 Feb 2014 02:20:59 +0000 (10:20 +0800)]
usb: phy: mxs: Enable IC fixes for related SoCs
Two PHY bugs are fixed by IC logic, but these bits are not
enabled by default, so we enable them at driver.
The two bugs are: MXS_PHY_ABNORMAL_IN_SUSPEND and MXS_PHY_SENDING_SOF_TOO_FAST
which are described at code.
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Peter Chen [Mon, 24 Feb 2014 02:20:58 +0000 (10:20 +0800)]
usb: phy: mxs: change description of usb device speed
Change "high speed" to "HS"
Change "non-high speed" to "FS/LS"
Implementation of notify_suspend and notify_resume will be different
according to mxs_phy_data->flags.
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Peter Chen [Mon, 24 Feb 2014 02:20:57 +0000 (10:20 +0800)]
usb: phy: mxs: Add anatop regmap
It is needed by imx6 SoC series, but not for imx23 and imx28.
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Peter Chen [Mon, 24 Feb 2014 02:20:56 +0000 (10:20 +0800)]
usb: doc: phy-mxs: update binding for adding anatop phandle
Add anatop phandle which is used to access anatop registers to
control PHY's power and other USB operations.
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Peter Chen [Mon, 24 Feb 2014 02:20:55 +0000 (10:20 +0800)]
usb: phy: mxs: Add auto clock and power setting
The auto setting is used to open related power and clocks
automatically after receiving wakeup signal.
With this feature, the PHY's clock and power can be recovered
correctly from low power mode, it is guaranteed by IC logic.
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Peter Chen [Mon, 24 Feb 2014 02:20:54 +0000 (10:20 +0800)]
usb: phy: mxs: Add platform judgement code
The mxs-phy has several bugs and features at different
versions, the driver code can get it through of_device_id.data.
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Peter Chen [Mon, 24 Feb 2014 02:20:53 +0000 (10:20 +0800)]
usb: doc: phy-mxs: Add more compatible strings
Add "fsl,imx6q-usbphy" for imx6dq and imx6dl, add
"fsl,imx6sl-usbphy" for imx6sl, and "fsl,imx23-usbphy"
is still a fallback for other strings.
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Marek Szyprowski [Fri, 28 Feb 2014 12:06:11 +0000 (13:06 +0100)]
usb: gadget: s3c-hsotg: add proper suspend/resume support
This patch adds suspend/resume support to s3c-hsotg driver. It makes UDC
driver more power efficient.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
George Cherian [Thu, 27 Feb 2014 05:14:41 +0000 (10:44 +0530)]
usb: musb: musb_cppi41: Dont reprogram DMA if tear down is initiated
Reprogramming the DMA after tear down is initiated leads to warning.
This is mainly seen with ISOCH since we do a delayed completion for
ISOCH transfers. In ISOCH transfers dma_completion should not reprogram
if the channel tear down is initiated.
Signed-off-by: George Cherian <george.cherian@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Kishon Vijay Abraham I [Mon, 3 Mar 2014 11:38:11 +0000 (17:08 +0530)]
usb: dwc3: adapt dwc3 core to use Generic PHY Framework
Adapted dwc3 core to use the Generic PHY Framework. So for init, exit,
power_on and power_off the following APIs are used phy_init(), phy_exit(),
phy_power_on() and phy_power_off().
However using the old USB phy library wont be removed till the PHYs of all
other SoC's using dwc3 core is adapted to the Generic PHY Framework.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Kishon Vijay Abraham I [Mon, 3 Mar 2014 11:38:10 +0000 (17:08 +0530)]
usb: dwc3: core: support optional PHYs
Since PHYs for dwc3 is optional (not all SoCs having PHYs for DWC3
should be programmed), do not return from probe if the USB PHY library
returns -ENODEV as that indicates the platform does not have a
programmable PHY.
While this can be considered as a temporary fix, a long term solution
would be to add 'nop' PHY for platforms that does not have programmable
PHY.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Reviewed-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Kishon Vijay Abraham I [Mon, 25 Nov 2013 10:01:26 +0000 (15:31 +0530)]
Documentation: dt bindings: move ..usb/usb-phy.txt to ..phy/ti-phy.txt
Since now we have a separate folder for phy, move the PHY dt binding
documentation of TI to that folder.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Felipe Balbi [Tue, 4 Mar 2014 15:35:02 +0000 (09:35 -0600)]
usb: dwc3: define more revisions
few new revisions of the core have been released,
add them to our list of revisions so we can apply
workarounds if necessary.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Felipe Balbi [Tue, 4 Mar 2014 15:23:50 +0000 (09:23 -0600)]
usb: dwc3: fix randconfig build errors
commit 388e5c5 (usb: dwc3: remove dwc3 dependency
on host AND gadget.) created the possibility for
host-only and peripheral-only dwc3 builds but
left a possible randconfig build error when host-only
builds are selected.
Cc: <stable@vger.kernel.org> # v3.8+
Reported-by: Jim Davis <jim.epost@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Felipe Balbi [Thu, 26 Jul 2012 10:26:50 +0000 (13:26 +0300)]
usb: dwc3: gadget: pre-start Stream transfers when they're queued
we need to pre-start stream transfers otherwise we
will never know when to start them.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Felipe Balbi [Wed, 26 Feb 2014 16:17:07 +0000 (10:17 -0600)]
usb: dwc3: gadget: call gadget driver's ->suspend/->resume
When going into bus suspend/resume we _must_
call gadget driver's ->suspend/->resume callbacks
accordingly. This patch implements that very feature
which has been missing forever.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Paul Zimmerman [Fri, 27 Apr 2012 11:17:35 +0000 (14:17 +0300)]
usb: dwc3: gadget: add 'force' argument to stop_active_transfer
It's not always we need to force a transfer to be removed
from the core's internal cache. This extra argument will
help differentiating those two cases.
Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Felipe Balbi [Thu, 19 Dec 2013 22:37:05 +0000 (16:37 -0600)]
usb: dwc3: gadget: make sure HIRD threshold is 0 in superspeed
During superspeed, HIRD threshold should always
be zero. Curent driver wasn't making sure that
was the case.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Felipe Balbi [Thu, 19 Dec 2013 19:43:19 +0000 (13:43 -0600)]
usb: dwc3: gadget: set KEEP_CONNECT in case of hibernation
if we have hibernation configured, Databook
instructs us to set KEEP_CONNECT bit together
with RUN_STOP bit, in step 9 of section 12.3.6.1
Initialization for Hibernation Support.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Felipe Balbi [Thu, 19 Dec 2013 20:02:53 +0000 (14:02 -0600)]
usb: dwc3: core: fix indentation
no functional changes, just converting spaces
into tab.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Felipe Balbi [Thu, 19 Dec 2013 19:04:28 +0000 (13:04 -0600)]
usb: dwc3: core: allocate scratch buffers
We must read HWPARAMS4 register to figure out
how many scratch buffers we should allocate.
Later patch will use "Set Scratchpad Buffer
Array" command to pass the pointer to the
IP so it can be used during hibernation.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Paul Zimmerman [Thu, 19 Dec 2013 18:38:49 +0000 (12:38 -0600)]
usb: dwc3: gadget: add a 'restore' argument to set_ep_config
That argument will be used in later patches when we
have working hibernation support. For now, always
pass it as false.
The idea of this patch is to decrease to size of
following patches and slowly add hibernation building
blocks to the gadget side of dwc3 so that it becomes
very easy to review the actual hibernation code.
[ balbi@ti.com : rewrote patch on top of current
tree. Added commit log. ]
Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Paul Zimmerman [Fri, 27 Apr 2012 10:35:15 +0000 (13:35 +0300)]
usb: dwc3: gadget: implement dwc3_gadget_get_link_state
This function will be used during hibernation to get
the current link state. It will be needed at least
for Hibernation support.
Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Paul Zimmerman [Fri, 27 Apr 2012 10:56:23 +0000 (13:56 +0300)]
usb: dwc3: add 'saved_state' field to dwc3_ep structure
This extra field will save endpoint state when we're
about to enter hibernation. It will be used later
to restore the endpoint state when resuming.
Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Felipe Balbi [Thu, 19 Dec 2013 18:14:29 +0000 (12:14 -0600)]
usb: dwc3: add has_hibernation flag
this will tell driver that this version
of the core was configured with hibernation
feature enabled.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Felipe Balbi [Thu, 19 Dec 2013 18:12:37 +0000 (12:12 -0600)]
usb: dwc3: cleanup struct dwc3
move 1-bit flags to the bottom of the structure,
sort all bit flags alphabetically, add documentation
which was missing.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Felipe Balbi [Tue, 25 Feb 2014 20:47:54 +0000 (14:47 -0600)]
usb: dwc3: workaround: bogus hibernation events
Revision 2.20a of the core has a known issue
which would generate bogus hibernation events
_and_ random failures on USB CV TD.9.23 test
case.
The suggested workaround is to ignore hibernation
events which don't match currently connected
speed.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Felipe Balbi [Tue, 25 Feb 2014 20:00:13 +0000 (14:00 -0600)]
usb: dwc3: workaround: clock gating issues
Revisions between 2.10a and 2.50a (included) have
a known issue which may cause xHCI compliance tests
to fail and/or quality issues with Isochronous
transactions.
Note that this issue only impacts certain configurations
of those revisions, namely the ones which have clock
gating enabled.
The suggested workaround is to disable clock gating in
known broken revisions, make sure HW LPM is disabled
and set GCTL.SOFITPSYNC to 1.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Felipe Balbi [Tue, 25 Feb 2014 20:08:51 +0000 (14:08 -0600)]
usb: dwc3: core: define bit 10 of GCTL register
This bit is necessary for implemeting workaround
for known issue with some revisions of this core.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Felipe Balbi [Fri, 13 Dec 2013 20:19:33 +0000 (14:19 -0600)]
usb: dwc3: gadget: always enable IOC on bulk/interrupt transfers
by setting IOC always, we can recycle TRBs a
lot sooner at the expense of some increased
CPU load.
The extra load seems to be quite minimal on
OMAP5 devices (instead of 1 IRQ for one MSC
transfer, we get
CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS).
Signed-off-by: Felipe Balbi <balbi@ti.com>
Robert Baldyga [Thu, 20 Feb 2014 08:26:25 +0000 (09:26 +0100)]
usb: gadget: at91_udc: fix ep maxpacket initialisation
This patch fixes problem with unnecessary usb_ep_set_maxpacket_limit() usage.
It should not be used in at91udc_probe() function, where maxpacket values are
set for field "maxpacket" of struct at91_ep, which is representation of
endpoint in driver internals. Function usb_ep_set_maxpacket_limit() is called
in udc_reinit() function, where struct usb_ep instances are initialised with
values set previously in struct at91_ep instances. So it's very important to
initialise it properly.
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Geert Uytterhoeven [Fri, 21 Feb 2014 19:49:53 +0000 (20:49 +0100)]
usb: musb: USB_MUSB_DUAL_ROLE/USB_MUSB_GADGET should depend on HAS_DMA
If NO_DMA=y:
drivers/built-in.o: In function `txstate':
musb_gadget.c:(.text+0x35955a): undefined reference to `dma_unmap_single'
musb_gadget.c:(.text+0x35957e): undefined reference to `dma_sync_single_for_cpu'
drivers/built-in.o: In function `musb_g_giveback':
(.text+0x359672): undefined reference to `dma_mapping_error'
drivers/built-in.o: In function `musb_g_giveback':
(.text+0x3596ba): undefined reference to `dma_unmap_single'
drivers/built-in.o: In function `musb_g_giveback':
(.text+0x3596e0): undefined reference to `dma_sync_single_for_cpu'
drivers/built-in.o: In function `rxstate':
musb_gadget.c:(.text+0x3599d0): undefined reference to `dma_unmap_single'
musb_gadget.c:(.text+0x3599f6): undefined reference to `dma_sync_single_for_cpu'
drivers/built-in.o: In function `musb_gadget_queue':
musb_gadget.c:(.text+0x35a8c0): undefined reference to `dma_map_single'
musb_gadget.c:(.text+0x35a8d0): undefined reference to `dma_mapping_error'
musb_gadget.c:(.text+0x35a906): undefined reference to `dma_sync_single_for_cpu'
musb_gadget.c:(.text+0x35a9a0): undefined reference to `dma_unmap_single'
musb_gadget.c:(.text+0x35a9c8): undefined reference to `dma_sync_single_for_cpu'
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Sergei Shtylyov [Sat, 22 Feb 2014 01:29:15 +0000 (04:29 +0300)]
usb: phy: rcar-gen2-usb: always use 'dev' variable in probe() method
The probe() method has the 'dev' local variable declared and used but strangely
not in all cases where it should be...
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Felipe Balbi [Tue, 25 Feb 2014 16:58:43 +0000 (10:58 -0600)]
usb: musb: avoid NULL pointer dereference
instead of relying on the otg pointer, which
can be NULL in certain cases, we can use the
gadget and host pointers we already hold inside
struct musb.
Cc: <stable@vger.kernel.org>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Oliver Neukum [Tue, 11 Feb 2014 19:36:04 +0000 (20:36 +0100)]
storage: accept some UAS devices if streams are unavailable
On some older XHCIs streams are not supported and the UAS driver
will fail at probe time. For those devices storage should try
to bind to UAS devices.
This patch adds a flag for stream support to HCDs and evaluates
it.
[Note: Sarah fixed a bug where the USB 2.0 root hub, not USB 3.0 root
hub would get marked as being able to support streams.]
Signed-off-by: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Sarah Sharp [Fri, 21 Feb 2014 22:29:02 +0000 (14:29 -0800)]
xhci: Kill streams URBs when the host dies.
If the host controller stops responding to commands, we need to kill all
the URBs that were queued to all endpoints. The current code would only
kill URBs that had been queued to the endpoint rings. ep->ring is set
to NULL if streams has been enabled for the endpoint, which means URBs
submitted with a non-zero stream_id would never get killed. Fix this.
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Sarah Sharp [Fri, 21 Feb 2014 17:27:30 +0000 (09:27 -0800)]
xhci: Refactor command watchdog and fix split string.
In preparation for fixing this function for streams endpoints, refactor
code in the command watchdog timeout function into two new functions.
One kills all URBs on a ring (either stream or endpoint), the other
kills all URBs associated with an endpoint. Fix a split string while
we're at it.
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Tue, 29 Oct 2013 10:36:43 +0000 (11:36 +0100)]
uas: Remove comment about registering a uas scsi controller for each usb bus
Although an interesting concept, I don't think that this is a good idea:
-This will result in lots of "virtual" scsi controllers confusing users
-If we get a scsi-bus-reset we will now need to do a usb-device-reset of all
uas devices on the same usb bus, which is something to avoid if possible
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Mon, 28 Oct 2013 10:48:04 +0000 (10:48 +0000)]
uas: Add Hans de Goede as uas maintainer
At the kernel-summit Sarah Sharp asked me if I was willing to become the
uas maintainer. I said yes, and here is a patch to make this official.
Also remove Matthew Wilcox and Sarah Sharp as maintainers at their request.
I've also added myself to the module's author tag, so that if people look there
rather then in maintainers they will know they should bug me about uas too.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Gerd Hoffmann [Fri, 13 Sep 2013 11:27:15 +0000 (13:27 +0200)]
uas: remove BROKEN
xhci streams support is fixed, unblock usb attached scsi.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Fri, 15 Nov 2013 09:04:31 +0000 (10:04 +0100)]
uas: Make sure sg elements are properly aligned
Copy the sg alignment trick from the usb-storage driver, without this I'm
seeing intermittent errors when using uas devices with an ehci controller.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Fri, 15 Nov 2013 09:04:11 +0000 (10:04 +0100)]
uas: Add some data in/out ready iu sanity checks
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Thu, 7 Nov 2013 07:52:42 +0000 (08:52 +0100)]
uas: Improve error reporting
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Thu, 14 Nov 2013 13:27:27 +0000 (14:27 +0100)]
uas: Use the right error codes for different kinds of errors
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Thu, 14 Nov 2013 10:06:13 +0000 (11:06 +0100)]
uas: Clear cmdinfo on command queue-ing
The scsi error handling path re-uses previously queued up (and errored-out)
cmds. If such a re-used cmd had a data-phase then cmdinfo will have
data_in_urb / data_out_urb still set to the free-ed urbs from the errored-out
cmd, and they will get free-ed a second time when the error handling cmd
completes, corrupting the kernel heap.
Clearing cmdinfo on command queue-ing fixes this, and seems like a good idea
in general.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Wed, 13 Nov 2013 08:32:22 +0000 (09:32 +0100)]
uas: Fix memory management
The scsi-host structure is refcounted, scsi_remove_host tears down the
scsi-host but does not decrement the refcount, so we need to call
scsi_put_host on disconnect to get the underlying memory to be freed.
After calling scsi_remove_host, the scsi-core may still hold a reference to
the scsi-host, iow we may still get called after uas_disconnect, but we
do our own life cycle management of uas_devinfo, freeing it on disconnect,
and thus may end up using devinfo after it has been freed. Switch to letting
scsi_host_alloc allocate and manage the memory for us.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Wed, 13 Nov 2013 08:24:15 +0000 (09:24 +0100)]
uas: Fix command / task mgmt submission racing with disconnect
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Tue, 12 Nov 2013 13:02:12 +0000 (14:02 +0100)]
uas: cmdinfo: use only one list head
cmds are either on the inflight list or on the dead list, never both, so
we only need one list head.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Tue, 12 Nov 2013 12:57:24 +0000 (13:57 +0100)]
uas: add uas_mark_cmd_dead helper function
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Tue, 12 Nov 2013 12:44:20 +0000 (13:44 +0100)]
uas: Properly complete inflight commands on bus-reset or disconnect
Before this commit the uas driver would keep track of scsi commands which still
need to have some urbs submitted to the device, and complete this with an
ABORT result code on bus-reset or disconnect, but in flight scsi commands
which have all their urbs submitted, and thus are not part of the work list,
would never get their done callback called.
The problem is killed sense urbs don't have any tag info, so it is impossible
to tell which scsi cmd they belong to, so merely making sure all the urbs
have completed one way or the other is not enough.
This commit fixes this by changing the work list to an inflight list, which
keeps tracks of all inflight scsi cmnds, using the IS_IN_WORK_LIST flag to
determine if actual work needs to be done in uas_do_work(), and by moving
marking all inflight scsi commands as aborted and moving them to the dead list
on bus-reset or disconnect.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Tue, 12 Nov 2013 09:53:57 +0000 (10:53 +0100)]
uas: uas_alloc_data_urb: Remove unnecessary use_streams check
uas_alloc_data_urb always gets called with a stream_id value of 0 when not
using streams. Removing the check makes it consistent with uas_alloc_sense_urb.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Tue, 12 Nov 2013 09:51:33 +0000 (10:51 +0100)]
uas: Fix task-management not working when connected over USB-2
For USB-2 connections the stream-id must always be 0.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Mon, 11 Nov 2013 10:51:42 +0000 (11:51 +0100)]
uas: Reset device on reboot
Some BIOS-es will hang on reboot when an uas device is attached and left in
uas mode on reboot.
This commit adds a shutdown handler which on reboot puts the device back into
usb-storage mode, fixing the hang on reboot on these systems.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Thu, 7 Nov 2013 07:47:05 +0000 (08:47 +0100)]
uas: Add suspend/resume support
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Thu, 7 Nov 2013 07:35:55 +0000 (08:35 +0100)]
uas: Use GFP_NOIO rather then GFP_ATOMIC where possible
We can sleep in our own workqueue (which is the whole reason for having
it), and scsi error handlers are also always called from a context which
may sleep.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Tue, 29 Oct 2013 09:51:00 +0000 (10:51 +0100)]
uas: Don't allow more then one task to run at the same time
Since we use a fixed tag / stream for tasks we cannot allow more then one
to run at the same time. This could happen before this time if a task timed
out.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Tue, 29 Oct 2013 09:37:23 +0000 (10:37 +0100)]
uas: task_mgmt: Kill the sense-urb if we fail to submit the cmd urb
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Tue, 29 Oct 2013 09:23:26 +0000 (10:23 +0100)]
uas: Not being able to alloc streams when connected through usb-3 is an error
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Sat, 16 Nov 2013 10:37:41 +0000 (11:37 +0100)]
uas: Verify endpoint descriptors from uas_use_uas_driver()
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Tue, 29 Oct 2013 09:10:36 +0000 (10:10 +0100)]
uas: Drop fixed endpoint config handling
The fixed endpoint config code was only necessary to deal with an early
uas prototype which has never been released, so lets drop it and enforce
proper uas endpoint descriptors.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Tue, 29 Oct 2013 09:03:34 +0000 (10:03 +0100)]
uas: Move uas_find_endpoints to uas-detect.h
No changes, just the move.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Tue, 29 Oct 2013 08:06:54 +0000 (09:06 +0100)]
uas: Fix bounds check in uas_find_endpoints
The loop uses up to 3 bytes of the endpoint extra data.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Tue, 29 Oct 2013 07:54:48 +0000 (08:54 +0100)]
uas: Add uas_find_endpoints() helper function
This is a preparation patch for adding better descriptor validation.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Sat, 16 Nov 2013 11:19:36 +0000 (12:19 +0100)]
uas: Honor no-uas quirk set in usb-storage's quirks module parameter
Falling back from uas to usb-storage requires coordination between uas and
usb-storage, so use usb-storage's quirks module parameter, rather then
requiring the user to pass a param to 2 different modules.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Sat, 16 Nov 2013 11:09:39 +0000 (12:09 +0100)]
usb-storage: Modify and export adjust_quirks so that it can be used by uas
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Mon, 21 Oct 2013 08:40:48 +0000 (09:40 +0100)]
usb-storage: Don't bind to uas devices if the uas driver is enabled
uas devices have 2 alternative settings on their usb-storage interface,
one for usb-storage and one for uas. Using the uas driver is preferred, so if
the uas driver is enabled, and the device has an uas alt setting, don't bind.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Fri, 25 Oct 2013 16:04:33 +0000 (17:04 +0100)]
uas: Add the posibilty to blacklist uas devices from using the uas driver
Once we start supporting uas hardware, and as more and more uas devices
become available, we will likely start seeing broken devices. This patch
prepares for the inevitable need for blacklisting those devices from
using the uas driver (they will use usb-storage instead).
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Fri, 8 Nov 2013 12:41:05 +0000 (13:41 +0100)]
usb: Reset USB-3 devices on USB-3 link bounce
On disconnect USB3 protocol ports transit from U0 to SS.Inactive to Rx.Detect,
on a recoverable error, the port stays in SS.Inactive and we recover from it by
doing a warm-reset (through usb_device_reset if we have a udev for the port).
If this really is a disconnect we may end up trying the warm-reset anyways,
since khubd may run before the SS.Inactive to Rx.Detect transition, or it
may get skipped if the transition to Rx.Detect happens before khubd gets run.
With a loose connector, or in the case which actually led me to debugging this
bad ACPI firmware toggling Vbus off and on in quick succession, the port
may transition from Rx.Detect to U0 again before khubd gets run. In this case
the device state is unknown really, but khubd happily goes into the resuscitate
an existing device path, and the device driver never gets notified about the
device state being messed up.
If the above scenario happens with a streams using device, as soon as an urb
is submitted to an endpoint with streams, the following appears in dmesg:
ERROR Transfer event for disabled endpoint or incorrect stream ring
@
0000000036807420 00000000 00000000 04000000 04078000
Notice how the TRB address is all zeros. I've seen this both on Intel
Pantherpoint and Nec xhci hosts.
Luckily we can detect the U0 to SS.Inactive to Rx.Detect to U0 all having
happened before khubd runs case since the C_LINK_STATE bit gets set in the
portchange bits on the U0 -> SS.Inactive change. This bit will also be set on
suspend / resume, but then it gets cleared by port_hub_init before khubd runs.
So if the C_LINK_STATE bit is set and a warm-reset is not needed, iow the port
is not still in SS.Inactive, and the port still has a connection, then the
device needs to be reset to put it back in a known state.
I've verified that doing the device reset also fixes the transfer event with
all zeros address issue.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Fri, 8 Nov 2013 15:37:26 +0000 (16:37 +0100)]
usb: Clear host_endpoint->streams when implicitly freeing streams
If streams are still allocated on device-reset or set-interface then the hcd
code implictly frees the streams. Clear host_endpoint->streams in this case
so that if a driver later tries to re-allocate them it won't run afoul of the
device already having streams check in usb_alloc_streams().
Note normally streams still being allocated at reset / set-intf would be a
driver bug, but this can happen without it being a driver bug on reset-resume.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Fri, 15 Nov 2013 11:14:38 +0000 (12:14 +0100)]
xhci: Handle MaxPSASize == 0
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Tue, 5 Nov 2013 14:50:03 +0000 (15:50 +0100)]
xhci: The trb_address_map radix tree expects 1KB segment memory aligment
If we align segment dma pool memory to 64 bytes, then a segment can be located
at 0x10000040 - 0x1000043f, and a segment from another ring at 0x10000440 -
0x1000083f. The last trb in the first segment at 0x10000430 will then translate
to the same radix tree key as the first trb of the second segment, while they
are in different rings!
This patches fixes this by changing the alignment of the dma pool to be 1KB
rather then 64 bytes. An alternative fix would be to reduce the shift used
to calculate the radix tree keys, but that would (slighlty) grow the radix
trees so I believe this is the better fix.
Note this patch is mostly theoretical since in practice I've not seen
the dma_pool actually return not 1KB aligned memory.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Thu, 7 Nov 2013 07:19:45 +0000 (08:19 +0100)]
xhci: xhci_mem_cleanup: make sure cmd_ring_reserved_trbs really is 0
cmd_ring_reserved_trbs gets decremented by xhci_free_stream_info(), so set it
to 0 after freeing all rings, otherwise it wraps around to a very large value
when rings with streams are free-ed.
Before this patch the wrap-around could be triggered when xhci_resume
calls xhci_mem_cleanup if the controller resume fails.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Mon, 21 Oct 2013 07:53:31 +0000 (08:53 +0100)]
uas: Move uas detect code to uas-detect.h
This is a preparation patch for teaching usb-storage to not bind to
uas devices.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Hans de Goede [Mon, 21 Oct 2013 07:00:58 +0000 (08:00 +0100)]
uas: Add a uas_find_uas_alt_setting helper function
This is a preparation patch for teaching usb-storage to not bind to
uas devices.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>