Hi Pavel, On 11/2/2019 1:52 PM, Pavel Hofman wrote: > Hi Minas, > Dne 24. 10. 19 v 14:47 Minas Harutyunyan napsal(a): >> >> Sorry for delay. I haven't enough time to investigate deeper. > > I apologize for the delay. > >> This type of issue depend on timings: packet sizes and board DMA >> performance. >> Anyway, could you please elaborate: >> 1. 960 bytes case. Is it high bandwidth transfer? I mean how many >> packets sending in 1 (u)frame? > > It is HS (480Mbps). There is only one device (the RPi gadget) connected > to the USB host port. Frame interval is 1ms (i.e. every 8th uframe, > bInterval = 4). > > USB tree on the host machine shows 480M: > > pavel@precision:~/tools/arm-bcm2708$ lsusb -t > /: Bus 08.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M > /: Bus 07.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M > /: Bus 06.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M > /: Bus 05.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M > /: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M > /: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M > /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M > /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M > |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M > |__ Port 1: Dev 3, If 0, Class=Human Interface Device, > Driver=usbhid, 1.5M > |__ Port 4: Dev 4, If 0, Class=Human Interface Device, > Driver=usbhid, 1.5M > |__ Port 4: Dev 4, If 1, Class=Human Interface Device, > Driver=usbhid, 1.5M > |__ Port 2: Dev 23, If 2, Class=Audio, Driver=snd-usb-audio, 480M > |__ Port 2: Dev 23, If 0, Class=Audio, Driver=snd-usb-audio, 480M > |__ Port 2: Dev 23, If 1, Class=Audio, Driver=snd-usb-audio, 480M <-- > > > > >> 2. Could you please print hsotg->frame_number in function >> dwc2_gadget_handle_out_token_ep_disabled(). > > I added the printout to the beginning of the function: > > --- a/drivers/usb/dwc2/gadget.c > +++ b/drivers/usb/dwc2/gadget.c > @@ -2856,6 +2856,8 @@ static void > dwc2_gadget_handle_out_token_ep_disabled(struct dwc2_hsotg_ep *ep) > if (dir_in || !ep->isochronous) > return; > > + dev_dbg(hsotg->dev, "%s: frame_number: %d\n",__func__, > hsotg->frame_number); > > if (using_desc_dma(hsotg)) { > if (ep->target_frame == TARGET_FRAME_INITIAL) { > /* Start first ISO Out */ > > The dmesg.log is attached. It includes everything from start of playback > on host side. The printout (frame_number) was called only once shortly > after the begining, when zero-length packet was received (only one zlp > during the whole playback). > > >> 3. No any chance to record USB trace? > > I am afraid not, I have no access to any HW USB analyzer. > > I am enclosing wireshark screenshots for the (nonworking) 960bytes case > - list of the URBs, detail of the 5-frame request and of its > corresponding response (URBs as either 5 frames or 4 frames). IMO they > look OK. Two different USB hosts result in the same problem, I think the > host side is OK. > > > > Thanks a lot, > > Pavel. Could you please perform follow 3 tests: 1. Test#1. Disable all debug prints for dwc2 driver and test again 960 bytes mps. 2. Test#2. If not help above then re-enable debug prints and apply below patch, test again and provide me full dmesg. diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c index 6af6add3d4c0..bb5859739663 100644 --- a/drivers/usb/dwc2/core_intr.c +++ b/drivers/usb/dwc2/core_intr.c @@ -798,6 +798,10 @@ irqreturn_t dwc2_handle_common_intr(int irq, void *dev) hsotg->frame_number = (dwc2_readl(hsotg, HFNUM) & HFNUM_FRNUM_MASK) >> HFNUM_FRNUM_SHIFT; + dev_dbg(hsotg->dev, "%s: frame_number: %d\n", __func__, + hsotg->frame_number); + + gintsts = dwc2_read_common_intr(hsotg); if (gintsts & ~GINTSTS_PRTINT) retval = IRQ_HANDLED; diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 6be10e496e10..8c1b0ff0fe2f 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -2856,6 +2856,9 @@ static void dwc2_gadget_handle_out_token_ep_disabled(struct dwc2_hsotg_ep *ep) if (dir_in || !ep->isochronous) return; + dev_dbg(hsotg->dev, "%s: frame_number: %d\n", __func__, + hsotg->frame_number); + if (using_desc_dma(hsotg)) { if (ep->target_frame == TARGET_FRAME_INITIAL) { /* Start first ISO Out */ @@ -3613,6 +3616,10 @@ static void dwc2_gadget_handle_incomplete_isoc_out(struct dwc2_hsotg *hsotg) if ((BIT(idx) & ~daintmsk) || !hs_ep->isochronous) continue; + dev_dbg(hsotg->dev, "ep%d current_frame=%d, target_frame=%d\n", idx, + (dwc2_readl(hsotg, DSTS) & DSTS_SOFFN_MASK) + >> DSTS_SOFFN_SHIFT, hs_ep->target_frame); + epctrl = dwc2_readl(hsotg, DOEPCTL(idx)); if ((epctrl & DXEPCTL_EPENA) && dwc2_gadget_target_frame_elapsed(hs_ep)) { 3. Test#3. Try to increase Periodic Frame Interval (PerFInt) by using follow patch in gadget.c: @@ -3383,6 +3386,8 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg, if (hsotg->params.ipg_isoc_en) dcfg |= DCFG_IPG_ISOC_SUPPORDED; + dcfg |= DCFG_PERFRINT(3); + dwc2_writel(hsotg, dcfg, DCFG); /* Clear any pending OTG interrupts */ Thanks, Minas