summaryrefslogtreecommitdiff
path: root/drivers/usb/cdns3/gadget.h
diff options
context:
space:
mode:
authorPeter Chen <peter.chen@nxp.com>2020-09-10 17:11:27 +0800
committerFelipe Balbi <balbi@kernel.org>2020-10-02 09:57:45 +0300
commit249f0a25e8becebe351e0f70e00fc84f47d6584d (patch)
tree10bd09c0ba5c3c0b10e169caa295ce34fde94202 /drivers/usb/cdns3/gadget.h
parent87e1dcd48970ea1cf2d2ce368eb70a46c2eff3ee (diff)
downloadlwn-249f0a25e8becebe351e0f70e00fc84f47d6584d.tar.gz
lwn-249f0a25e8becebe351e0f70e00fc84f47d6584d.zip
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>
Diffstat (limited to 'drivers/usb/cdns3/gadget.h')
-rw-r--r--drivers/usb/cdns3/gadget.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/usb/cdns3/gadget.h b/drivers/usb/cdns3/gadget.h
index 52765b098b9e..9f8bd452847e 100644
--- a/drivers/usb/cdns3/gadget.h
+++ b/drivers/usb/cdns3/gadget.h
@@ -1030,6 +1030,11 @@ struct cdns3_trb {
* When set to '1', the device will toggle its interpretation of the Cycle bit
*/
#define TRB_TOGGLE BIT(1)
+/*
+ * The controller will set it if OUTSMM (OUT size mismatch) is detected,
+ * this bit is for normal TRB
+ */
+#define TRB_SMM BIT(1)
/*
* Short Packet (SP). OUT EPs at DMULT=1 only. Indicates if the TRB was
@@ -1215,6 +1220,8 @@ struct cdns3_aligned_buf {
* this endpoint
* @flags: flag specifying special usage of request
* @list: used by internally allocated request to add to wa2_descmiss_req_list.
+ * @finished_trb: number of trb has already finished per request
+ * @num_of_trb: how many trbs in this request
*/
struct cdns3_request {
struct usb_request request;
@@ -1230,6 +1237,8 @@ struct cdns3_request {
#define REQUEST_UNALIGNED BIT(4)
u32 flags;
struct list_head list;
+ int finished_trb;
+ int num_of_trb;
};
#define to_cdns3_request(r) (container_of(r, struct cdns3_request, request))