<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/usb/dwc2/hcd.c, branch linux-4.5.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.5.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.5.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2015-12-22T17:52:08Z</updated>
<entry>
<title>usb: dwc2: Avoid double-reset at boot time</title>
<updated>2015-12-22T17:52:08Z</updated>
<author>
<name>Douglas Anderson</name>
</author>
<published>2015-12-17T19:14:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0fe239bc190453fe82252c6d41a74e685730cd93'/>
<id>urn:sha1:0fe239bc190453fe82252c6d41a74e685730cd93</id>
<content type='text'>
In (usb: dwc2: reset dwc2 core before dwc2_get_hwparams()) we added an
extra reset to the probe path for the dwc2 USB controllers.  This
allowed proper detection of parameters even if the firmware had already
used the USB part.

Unfortunately, this extra reset is quite slow and is affecting boot
speed.  We can avoid the double-reset by skipping the extra reset that
would happen just after the one we added.  Logic that explains why this
is safe:

* As of the CL mentioned above, we now always call dwc2_core_reset() in
  dwc2_driver_probe() before dwc2_hcd_init().

* The only caller of dwc2_hcd_init() is dwc2_driver_probe(), so we're
  guaranteed that dwc2_core_reset() was called before dwc2_hdc_init().

* dwc2_hdc_init() is the only caller that passes an irq other than -1 to
  dwc2_core_init().  Thus if dwc2_core_init() is called with an irq
  other than -1 we're guaranteed that dwc2_core_reset was called before
  dwc2_core_init().

...this allows us to remove the dwc2_core_reset() in dwc2_core_init() if
irq is not &lt; 0.

Note that since "irq" wasn't used in the function dwc2_core_init()
anyway and since select_phy was always set at exactly the same times we
could avoid the reset, we remove "irq" and rename "select_phy" to
"initial_setup" and adjust the callers accordingly.

Signed-off-by: Douglas Anderson &lt;dianders@chromium.org&gt;
Signed-off-by: John Youn &lt;johnyoun@synopsys.com&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
</content>
</entry>
<entry>
<title>usb: dwc2: host: Add missing spinlock in dwc2_hcd_reset_func()</title>
<updated>2015-12-15T15:12:41Z</updated>
<author>
<name>Douglas Anderson</name>
</author>
<published>2015-11-20T17:06:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4a065c7bdbec9536f7b899241b125b9c3b5ba97a'/>
<id>urn:sha1:4a065c7bdbec9536f7b899241b125b9c3b5ba97a</id>
<content type='text'>
The dwc2_hcd_reset_func() function is only ever called directly by a
delayed work function.  As such no locks are already held when the
function is called.

Doing a read-modify-write of CPU registers and setting fields in the
main hsotg data structure is a bad idea without locks.  Let's add
locks.

The bug was found by code inspection only.  It turns out that the
dwc2_hcd_reset_func() is only ever called today if the
"host_support_fs_ls_low_power" parameter is enabled and no code in
mainline enables that parameter.  Thus no known issues in mainline are
fixed by this patch, but it's still probably wise to fix the function.

Signed-off-by: Douglas Anderson &lt;dianders@chromium.org&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
</content>
</entry>
<entry>
<title>usb: dwc2: host: Fix missing device insertions</title>
<updated>2015-12-15T15:12:41Z</updated>
<author>
<name>Douglas Anderson</name>
</author>
<published>2015-11-19T21:23:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6a6595318ac2dd169d2931a1d9431a64f4ada75c'/>
<id>urn:sha1:6a6595318ac2dd169d2931a1d9431a64f4ada75c</id>
<content type='text'>
If you've got your interrupt signals bouncing a bit as you insert your
USB device, you might end up in a state when the device is connected but
the driver doesn't know it.

Specifically, the observed order is:
 1. hardware sees connect
 2. hardware sees disconnect
 3. hardware sees connect
 4. dwc2_port_intr() - clears connect interrupt
 5. dwc2_handle_common_intr() - calls dwc2_hcd_disconnect()

Now you'll be stuck with the cable plugged in and no further interrupts
coming in but the driver will think we're disconnected.

We'll fix this by checking for the missing connect interrupt and
re-connecting after the disconnect is posted.  We don't skip the
disconnect because if there is a transitory disconnect we really want to
de-enumerate and re-enumerate.

Notes:
1. As part of this change we add a "force" parameter to
   dwc2_hcd_disconnect() so that when we're unloading the module we
   avoid the new behavior.  The need for this was pointed out by John
   Youn.
2. The bit of code needed at the end of dwc2_hcd_disconnect() is
   exactly the same bit of code from dwc2_port_intr().  To avoid
   duplication, we refactor that code out into a new function
   dwc2_hcd_connect().

Signed-off-by: Douglas Anderson &lt;dianders@chromium.org&gt;
Acked-by: John Youn &lt;johnyoun@synopsys.com&gt;
Tested-by: John Youn &lt;johnyoun@synopsys.com&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
</content>
</entry>
<entry>
<title>usb: dwc2: host: use kmem cache to allocate descriptors</title>
<updated>2015-12-15T15:12:41Z</updated>
<author>
<name>Gregory Herrero</name>
</author>
<published>2015-11-20T10:49:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3b5fcc9ac2f4453a5609cc89ac7618b1b27ccb01'/>
<id>urn:sha1:3b5fcc9ac2f4453a5609cc89ac7618b1b27ccb01</id>
<content type='text'>
Kmem caches help to get correct boundary for descriptor buffers
which need to be 512 bytes aligned for dwc2 controller.
Two kmem caches are needed for generic descriptors and for
hs isochronous descriptors which doesn't have same size.

Acked-by: John Youn &lt;johnyoun@synopsys.com&gt;
Signed-off-by: Gregory Herrero &lt;gregory.herrero@intel.com&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
</content>
</entry>
<entry>
<title>usb: dwc2: host: avoid usage of dma_alloc_coherent with irqs disabled</title>
<updated>2015-12-15T15:12:41Z</updated>
<author>
<name>Gregory Herrero</name>
</author>
<published>2015-11-20T10:49:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=95105a998dff0747327f11708ea24480ee0eca54'/>
<id>urn:sha1:95105a998dff0747327f11708ea24480ee0eca54</id>
<content type='text'>
Use Streaming DMA mappings to handle cache coherency of frame list and
descriptor list. Cache are always flushed before controller access it
or before cpu access it.

Acked-by: John Youn &lt;johnyoun@synopsys.com&gt;
Signed-off-by: Gregory Herrero &lt;gregory.herrero@intel.com&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
</content>
</entry>
<entry>
<title>usb: dwc2: host: enable descriptor dma for fs devices</title>
<updated>2015-12-15T15:12:41Z</updated>
<author>
<name>Mian Yousaf Kaukab</name>
</author>
<published>2015-11-20T10:49:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fbb9e22b15ad3c9a98c66bad801b4d1366e8bf20'/>
<id>urn:sha1:fbb9e22b15ad3c9a98c66bad801b4d1366e8bf20</id>
<content type='text'>
As descriptor dma mode does not support split transfers, it can't be
enabled for high speed devices. Add a core parameter to enable it for
full speed devices.

Ensure frame list and descriptor list are correctly freed during
disconnect.

Acked-by: John Youn &lt;johnyoun@synopsys.com&gt;
Signed-off-by: Mian Yousaf Kaukab &lt;yousaf.kaukab@intel.com&gt;
Signed-off-by: Gregory Herrero &lt;gregory.herrero@intel.com&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
</content>
</entry>
<entry>
<title>usb: dwc2: host: Fix remote wakeup when not in DWC2_L2</title>
<updated>2015-11-17T17:35:38Z</updated>
<author>
<name>Douglas Anderson</name>
</author>
<published>2015-10-22T20:05:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1fb7f12d5bec1b0a699c85d724bd5184a01fa2dd'/>
<id>urn:sha1:1fb7f12d5bec1b0a699c85d724bd5184a01fa2dd</id>
<content type='text'>
In commit 734643dfbdde ("usb: dwc2: host: add flag to reflect bus
state") we changed dwc2_port_suspend() not to set the lx_state
anymore (instead it sets the new bus_suspended variable).  This
introduced a bug where we would fail to detect device insertions if:

1. Plug empty hub into dwc2
2. Plug USB flash drive into the empty hub.
3. Wait a few seconds
4. Unplug USB flash drive
5. Less than 2 seconds after step 4, plug the USB flash drive in again.

The dwc2_hcd_rem_wakeup() function should have been changed to look at
the new bus_suspended variable.

Let's fix it.  Since commit b46146d59fda ("usb: dwc2: host: resume root
hub on remote wakeup") talks about needing the root hub resumed if the
bus was suspended, we'll include it in our test.

It appears that the "port_l1_change" should only be set to 1 if we were
in DWC2_L1 (the driver currently never sets this), so we'll update the
former "else" case based on this test.

Fixes: 734643dfbdde ("usb: dwc2: host: add flag to reflect bus state")
Acked-by: John Youn &lt;johnyoun@synopsys.com&gt;
Tested-by: Gregory Herrero &lt;gregory.herrero@intel.com&gt;
Reviewed-by: Heiko Stuebner &lt;heiko@sntech.de&gt;
Signed-off-by: Douglas Anderson &lt;dianders@chromium.org&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
</content>
</entry>
<entry>
<title>usb: dwc2: host: Protect PCGCTL with lock in dwc2_port_resume()</title>
<updated>2015-10-16T19:44:15Z</updated>
<author>
<name>Douglas Anderson</name>
</author>
<published>2015-10-14T22:58:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4d273c2af0fe4fdc84eef27e4521694dc7992065'/>
<id>urn:sha1:4d273c2af0fe4fdc84eef27e4521694dc7992065</id>
<content type='text'>
From code inspection, it appears to be unsafe to do a read-modify-write
of PCGCTL in dwc2_port_resume().  Let's make sure the spinlock is held
around this operation.

Acked-by: John Youn &lt;johnyoun@synopsys.com&gt;
Signed-off-by: Douglas Anderson &lt;dianders@chromium.org&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
</content>
</entry>
<entry>
<title>usb: dwc2: gadget: kill ep0 requests before reinitializing core</title>
<updated>2015-10-01T17:40:26Z</updated>
<author>
<name>Mian Yousaf Kaukab</name>
</author>
<published>2015-09-29T10:08:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5390d438e6f4aaf3555acc72aff155660a48cd28'/>
<id>urn:sha1:5390d438e6f4aaf3555acc72aff155660a48cd28</id>
<content type='text'>
Make sure there are no requests pending on ep0 before reinitializing
core. Otherwise, dwc2_hsotg_enqueue_setup will fail afterwards.

Also, take hsotg-&gt;lock before calling
dwc2_hsotg_core_init_disconnected() from dwc2_conn_id_status_change()
as dwc2_hsotg_complete_request() expect lock to be held.

Signed-off-by: Mian Yousaf Kaukab &lt;yousaf.kaukab@intel.com&gt;
Tested-by: Robert Baldyga &lt;r.baldyga@samsung.com&gt;
Tested-by: Dinh Nguyen &lt;dinguyen@opensource.altera.com&gt;
Tested-by: John Youn &lt;johnyoun@synopsys.com&gt;
Acked-by: John Youn &lt;johnyoun@synopsys.com&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
</content>
</entry>
<entry>
<title>usb: dwc2: host: kill remaining urbs using -ECONNRESET status</title>
<updated>2015-10-01T17:40:18Z</updated>
<author>
<name>Gregory Herrero</name>
</author>
<published>2015-09-22T13:16:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2e84da6e340a652e942c3513703020976b28190b'/>
<id>urn:sha1:2e84da6e340a652e942c3513703020976b28190b</id>
<content type='text'>
On a disconnect, dwc2 will kill all remaining urbs from qh list.
urbs are given back to hcd with -ETIMEDOUT status.
Some usb device driver, like mass storage, will unlink all urbs
using usb_hcd_unlink_urb when receiving a negative status different
from -ECONNRESET.
The following flow will then happen:
dwc2_hcd_disconnect()
-&gt; dwc2_kill_all_urbs() try to kill first pending urb.
-&gt; dwc2_host_complete(-ETIMEDOUT)
-&gt; usb_hcd_giveback_urb(-ETIMEDOUT)
-&gt; sg_complete()
-&gt; usb_unlink_urb()
	-&gt; usb_put_dev(urb-&gt;dev)
-&gt; dwc2_kill_all_urbs() try to kill next pending urb.
-&gt; dwc2_host_complete(-ETIMEDOUT)
-&gt; usb_hcd_giveback_urb(-ETIMEDOUT)
-&gt; NULL pointer dereferencing because urb-&gt;dev has been freed for all
urbs of this device.

The root cause of this NULL pointer is to call call usb_unlink_urb()
while we are killing all urbs. To avoid this return urb with
-ECONNRESET status

This issue usually happens while removing mass storage device during
transfer.

Signed-off-by: Gregory Herrero &lt;gregory.herrero@intel.com&gt;
Signed-off-by: Mian Yousaf Kaukab &lt;yousaf.kaukab@intel.com&gt;
Tested-by: Robert Baldyga &lt;r.baldyga@samsung.com&gt;
Tested-by: Dinh Nguyen &lt;dinguyen@opensource.altera.com&gt;
Tested-by: John Youn &lt;johnyoun@synopsys.com&gt;
Acked-by: John Youn &lt;johnyoun@synopsys.com&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
</content>
</entry>
</feed>
