For sg use cases, there will be serveral TRBs in TD, and the short transfer may occur during the TD, current code doesn't handle it well, improve it through this series. Tested by Android MTP and ADB use case. Changes for v2: - Fix some coding style and typo issues. [Patch 1, 2, 3, 5] - Improve the comments [Patch 6,8] Peter Chen (8): usb: cdns3: gadget: using correct sg operations usb: cdns3: gadget: improve the dump TRB operation at cdns3_ep_run_transfer usb: cdns3: gadget: calculate TDL correctly usb: cdns3: gadget: add CHAIN and ISP bit for sg list use case usb: cdns3: gadget: handle sg list use case at completion correctly usb: cdns3: gadget: need to handle sg case for workaround 2 case usb: cdns3: gadget: sg_support is only for DEV_VER_V2 or above usb: cdns3: gadget: enlarge the TRB ring length drivers/usb/cdns3/gadget.c | 202 +++++++++++++++++++++++++------------ drivers/usb/cdns3/gadget.h | 11 +- 2 files changed, 149 insertions(+), 64 deletions(-) -- 2.17.1