usb: cdns3: gadget: handle sg list use case at completion correctly
authorPeter Chen <peter.chen@nxp.com>
Thu, 10 Sep 2020 09:11:27 +0000 (17:11 +0800)
committerFelipe Balbi <balbi@kernel.org>
Fri, 2 Oct 2020 06:57:45 +0000 (09:57 +0300)
commit249f0a25e8becebe351e0f70e00fc84f47d6584d
tree10bd09c0ba5c3c0b10e169caa295ce34fde94202
parent87e1dcd48970ea1cf2d2ce368eb70a46c2eff3ee
usb: cdns3: gadget: handle sg list use case at completion correctly

- Judge each TRB has been handled at cdns3_trb_handled, since
the DMA pointer may be at the middle of the TD, we can't consider
this TD has finished at that time.
- Calculate req->actual according to finished TRBs.
- Handle short transfer for sg list use case correctly. When the
short transfer occurs, we check OUT_SMM at TRB to see if it is
the last TRB.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
drivers/usb/cdns3/gadget.c
drivers/usb/cdns3/gadget.h