UPSTREAM: usb: dwc2: host: Add a delay before releasing periodic bandwidth
authorDouglas Anderson <dianders@chromium.org>
Fri, 29 Jan 2016 02:19:59 +0000 (18:19 -0800)
committerHuang, Tao <huangtao@rock-chips.com>
Tue, 3 Jan 2017 10:48:12 +0000 (18:48 +0800)
commitc28b62a22f7ad52e8ce6f43557a7ad07e82763a8
tree4fdf6700fbac46d36b87c1298f9fa55366f099f2
parentceb05ec68646b41d07b21a611c5c5697f97bd955
UPSTREAM: usb: dwc2: host: Add a delay before releasing periodic bandwidth

We'd like to be able to use HCD_BH in order to speed up the dwc2 host
interrupt handler quite a bit.  However, according to the kernel doc for
usb_submit_urb() (specifically the part about "Reserved Bandwidth
Transfers"), we need to keep a reservation active as long as a device
driver keeps submitting.  That was easy to do when we gave back the URB
in the interrupt context: we just looked at when our queue was empty and
released the reserved bandwidth then.  ...but now we need a little more
complexity.

We'll follow EHCI's lead in commit 9118f9eb4f1e ("USB: EHCI: improve
interrupt qh unlink") and add a 5ms delay.  Since we don't have a whole
timer infrastructure in dwc2, we'll just add a timer per QH.  The
overhead for this is very small.

Note that the dwc2 scheduler is pretty broken (see future patches to fix
it).  This patch attempts to replicate all old behavior and just add the
proper delay.

Change-Id: I051d768b1cefdbe8990a2dfae9c68c61ec9eedf0
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
(cherry picked from commit 17dd5b642d836ff7e12a780c2ec71a4be9bf9546)
drivers/usb/dwc2/hcd.h
drivers/usb/dwc2/hcd_queue.c