Re: [PATCH] USB: DWC3: Fix missed isoc IN transaction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

On 5/21/2012 2:25 PM, Felipe Balbi wrote:
On Mon, May 21, 2012 at 12:53:28PM +0530, Pratyush Anand wrote:
On 5/18/2012 7:24 PM, Pratyush Anand wrote:
On 5/18/2012 7:00 PM, Felipe Balbi wrote:

On Tue, May 15, 2012 at 07:49:52PM +0530, Pratyush Anand wrote:
If an IN transfer is missed on isoc endpoint, then driver must insure
that next ep_queue is properly handled.
This patch fixes this issue by starting a new transfer for next queued
Only limitation is that, gadget will have to submit a request within 4
uf time, which dwc3 driver considers safe enough for staring a new

Signed-off-by: Pratyush Anand<pratyush.anand@xxxxxx>
drivers/usb/dwc3/core.h | 3 +++
drivers/usb/dwc3/gadget.c | 36 +++++++++++++++++++++++++++++++-----
2 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 2a920f8..c3f61f6 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -352,6 +352,7 @@ struct dwc3_event_buffer {
* @number: endpoint number (1 - 15)
* @type: set to bmAttributes&  USB_ENDPOINT_XFERTYPE_MASK
* @res_trans_idx: Resource transfer index
+ * @event: pointer to event struct received during missed isoc
* @interval: the intervall on which the ISOC transfer is started
* @name: a human readable name e.g. ep1out-bulk
* @direction: true for TX, false for RX
@@ -376,6 +377,7 @@ struct dwc3_ep {
#define DWC3_EP_WEDGE (1<<  2)
#define DWC3_EP_BUSY (1<<  4)
#define DWC3_EP_PENDING_REQUEST (1<<  5)
+#define DWC3_EP_MISSED_ISOC (1<<  6)

/* This last one is specific to EP0 */
#define DWC3_EP0_DIR_IN (1<<  31)
@@ -385,6 +387,7 @@ struct dwc3_ep {
u8 number;
u8 type;
u8 res_trans_idx;
+ const struct dwc3_event_depevt *event;

please don't do this... (see more below)

I see, some issue here. May be I will also write to synopsys to clarify it.

frame no coming from event->parameters is of 16 bit.
frame no coming from DSTS is of 13 bits. So, for some cases they
might have different values.

For ex, in my test:

bInterval is 1.

mask = ~(dep->interval - 1);
cur_uf = event->parameters&  mask;

gives me cur_uf as 0x791f

cur_uf = __dwc3_gadget_get_frame(dwc);
gives me cur_uf as 0x191F

If I call
dwc3_gadget_start_isoc_uf(dwc, dep, cur_uf)

with cur_uf obtained from __dwc3_gadget_get_frame(dwc) , it does not work.

I guess you have already this bug :-)

even if we correct the mask, there would be issue.
So frame number from DSTS is of 14 bits.
Correct value of DSTS was 0x3C8FC.
After correction of mask it will give uf as 0x391F which is not 0x791F coming from event->parameter.

To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at

B and H Foto and Electronics Corp.

[Linux Media]     [Video for Linux]     [Linux Input]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Free Online Dating]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]     [More Archives]

Add to Google Powered by Linux