aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3
diff options
context:
space:
mode:
authorThinh Nguyen <thinh.nguyen@synopsys.com>2018-11-15 22:03:27 -0500
committerFelipe Balbi <felipe.balbi@linux.intel.com>2018-12-05 04:14:15 -0500
commit6abfa0f5bb7cce98c89e2c28fcea31c17200890e (patch)
tree790176b78ed31fb51fa11b732678722c7504d9d7 /drivers/usb/dwc3
parent6b69753fa0078c5222d6b4aeb5017c5503e0dc8e (diff)
usb: dwc3: gadget: Report isoc transfer frame number
Implement the new frame_number API to report the isochronous interval frame number. This patch checks and reports the interval in which the isoc transfer was transmitted or received via the Isoc-First TRB SOF number field. Signed-off-by: Thinh Nguyen <thinhn@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb/dwc3')
-rw-r--r--drivers/usb/dwc3/core.h1
-rw-r--r--drivers/usb/dwc3/gadget.c13
2 files changed, 14 insertions, 0 deletions
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 15c07b2b5866..df876418cb78 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -784,6 +784,7 @@ enum dwc3_link_state {
784#define DWC3_TRB_CTRL_ISP_IMI BIT(10) 784#define DWC3_TRB_CTRL_ISP_IMI BIT(10)
785#define DWC3_TRB_CTRL_IOC BIT(11) 785#define DWC3_TRB_CTRL_IOC BIT(11)
786#define DWC3_TRB_CTRL_SID_SOFN(n) (((n) & 0xffff) << 14) 786#define DWC3_TRB_CTRL_SID_SOFN(n) (((n) & 0xffff) << 14)
787#define DWC3_TRB_CTRL_GET_SID_SOFN(n) (((n) & (0xffff << 14)) >> 14)
787 788
788#define DWC3_TRBCTL_TYPE(n) ((n) & (0x3f << 4)) 789#define DWC3_TRBCTL_TYPE(n) ((n) & (0x3f << 4))
789#define DWC3_TRBCTL_NORMAL DWC3_TRB_CTRL_TRBCTL(1) 790#define DWC3_TRBCTL_NORMAL DWC3_TRB_CTRL_TRBCTL(1)
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 38d6df98e9ce..e2caf9eec30a 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2340,6 +2340,19 @@ static int dwc3_gadget_ep_reclaim_completed_trb(struct dwc3_ep *dep,
2340 trb->ctrl &= ~DWC3_TRB_CTRL_HWO; 2340 trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
2341 2341
2342 /* 2342 /*
2343 * For isochronous transfers, the first TRB in a service interval must
2344 * have the Isoc-First type. Track and report its interval frame number.
2345 */
2346 if (usb_endpoint_xfer_isoc(dep->endpoint.desc) &&
2347 (trb->ctrl & DWC3_TRBCTL_ISOCHRONOUS_FIRST)) {
2348 unsigned int frame_number;
2349
2350 frame_number = DWC3_TRB_CTRL_GET_SID_SOFN(trb->ctrl);
2351 frame_number &= ~(dep->interval - 1);
2352 req->request.frame_number = frame_number;
2353 }
2354
2355 /*
2343 * If we're dealing with unaligned size OUT transfer, we will be left 2356 * If we're dealing with unaligned size OUT transfer, we will be left
2344 * with one TRB pending in the ring. We need to manually clear HWO bit 2357 * with one TRB pending in the ring. We need to manually clear HWO bit
2345 * from that TRB. 2358 * from that TRB.