linux-stable/drivers/usb/dwc3
Pratham Pratap dad2aff3e8 usb: dwc3: gadget: Update chain bit correctly when using sg list
If scatter-gather operation is allowed, a large USB request is split
into multiple TRBs. For preparing TRBs for sg list, driver iterates
over the list and creates TRB for each sg and mark the chain bit to
false for the last sg. The current IOMMU driver is clubbing the list
of sgs which shares a page boundary into one and giving it to USB driver.
With this the number of sgs mapped it not equal to the the number of sgs
passed. Because of this USB driver is not marking the chain bit to false
since it couldn't iterate to the last sg. This patch addresses this issue
by marking the chain bit to false if it is the last mapped sg.

At a practical level, this patch resolves USB transfer stalls
seen with adb on dwc3 based db845c, pixel3 and other qcom
hardware after functionfs gadget added scatter-gather support
around v4.20.

Credit also to Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
who implemented a very similar fix to this issue.

Cc: Felipe Balbi <balbi@kernel.org>
Cc: Yang Fei <fei.yang@intel.com>
Cc: Thinh Nguyen <thinhn@synopsys.com>
Cc: Tejas Joglekar <tejas.joglekar@synopsys.com>
Cc: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Cc: Jack Pham <jackp@codeaurora.org>
Cc: Todd Kjos <tkjos@google.com>
Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: Linux USB List <linux-usb@vger.kernel.org>
Cc: stable <stable@vger.kernel.org> #4.20+
Signed-off-by: Pratham Pratap <prathampratap@codeaurora.org>
[jstultz: Slight tweak to remove sg_is_last() usage, reworked
          commit message, minor comment tweak]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Link: https://lore.kernel.org/r/20200302214443.55783-1-john.stultz@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-04 10:58:16 +01:00
..
core.c usb: dwc3: turn off VBUS when leaving host mode 2020-01-15 10:39:22 +01:00
core.h usb: dwc3: gadget: Delay starting transfer 2020-01-15 10:39:23 +01:00
debug.h usb: dwc3: debug: fix string position formatting mixup with ret and len 2020-02-11 08:45:45 +02:00
debugfs.c usb: dwc3: create debugfs directory under usb root 2019-11-14 11:14:54 +08:00
drd.c usb: dwc3: Remove dev_err() on platform_get_irq() failure 2019-10-07 12:52:44 +02:00
dwc3-exynos.c usb: exynos: Rename Samsung and Exynos to lowercase 2020-01-09 10:53:38 +01:00
dwc3-haps.c usb: dwc3: haps: Workaround matching VID PID 2019-02-07 13:17:19 +02:00
dwc3-keystone.c USB: Changes for v5.4 merge window 2019-09-02 19:20:57 +02:00
dwc3-meson-g12a.c usb: dwc3: meson-g12a: fix suspend resume regulator unbalanced disables 2019-08-28 13:04:59 +03:00
dwc3-of-simple.c usb: dwc3: of-simple: add a shutdown 2019-10-29 12:56:11 +02:00
dwc3-omap.c USB: Changes for v5.4 merge window 2019-09-02 19:20:57 +02:00
dwc3-pci.c usb: dwc3: pci: add ID for the Intel Comet Lake -V variant 2020-01-22 10:11:41 +01:00
dwc3-qcom.c usb: dwc3: qcom: Use of_clk_get_parent_count() 2019-06-18 11:58:29 +03:00
dwc3-st.c usb: dwc3: st: Add of_dev_put() in probe function 2019-08-28 13:04:58 +03:00
ep0.c usb: dwc3: gadget: Check END_TRANSFER completion 2020-01-15 10:39:23 +01:00
gadget.c usb: dwc3: gadget: Update chain bit correctly when using sg list 2020-03-04 10:58:16 +01:00
gadget.h usb: dwc3: gadget: Don't send unintended link state change 2020-01-15 10:39:19 +01:00
host.c usb: dwc3: use proper initializers for property entries 2020-01-09 10:28:52 +01:00
io.h USB: dwc3: Remove redundant license text 2017-11-07 15:45:01 +01:00
Kconfig usb: dwc3: Fix Kconfig indentation 2019-11-21 14:39:39 +01:00
Makefile usb: dwc3: Add Amlogic G12A DWC3 glue 2019-05-03 09:13:47 +03:00
trace.c USB: dwc3: Remove redundant license text 2017-11-07 15:45:01 +01:00
trace.h usb: common: Separated decoding functions from dwc3 driver. 2019-08-29 10:52:27 +03:00
ulpi.c USB: dwc3: Remove redundant license text 2017-11-07 15:45:01 +01:00