> -----Original Message----- > From: Dinh Nguyen [mailto:dinguyen@xxxxxxxxxxxxxxxxxxxxx] > Sent: Thursday, January 8, 2015 5:34 PM > To: Kaukab, Yousaf; 'Paul Zimmerman'; 'linux-usb@xxxxxxxxxxxxxxx'; > 'balbi@xxxxxx' > Cc: Herrero, Gregory; 'sergei.shtylyov@xxxxxxxxxxxxxxxxxx'; > 'r.baldyga@xxxxxxxxxxx' > Subject: Re: [PATCH v2 00/30] usb: updates for dwc2 gadget driver > > Hi Yousaf, > > On 01/08/2015 08:27 AM, Kaukab, Yousaf wrote: > > Hi, > > > >> -----Original Message----- > >> From: Kaukab, Yousaf > >> Sent: Wednesday, January 7, 2015 7:55 PM > >> To: Dinh Nguyen; Paul Zimmerman; linux-usb@xxxxxxxxxxxxxxx; > >> balbi@xxxxxx > >> Cc: Herrero, Gregory; sergei.shtylyov@xxxxxxxxxxxxxxxxxx; > >> r.baldyga@xxxxxxxxxxx > >> Subject: RE: [PATCH v2 00/30] usb: updates for dwc2 gadget driver > >> > >> Hi Dinh, > >> > >>> -----Original Message----- > >>> From: Dinh Nguyen [mailto:dinguyen@xxxxxxxxxxxxxxxxxxxxx] > >>> Sent: Wednesday, January 7, 2015 5:26 PM > >>> To: Kaukab, Yousaf; Paul Zimmerman; linux-usb@xxxxxxxxxxxxxxx; > >>> balbi@xxxxxx > >>> Cc: Herrero, Gregory; sergei.shtylyov@xxxxxxxxxxxxxxxxxx; > >>> r.baldyga@xxxxxxxxxxx > >>> Subject: Re: [PATCH v2 00/30] usb: updates for dwc2 gadget driver > >>> > >>> Hi Yousaf, > >>> > >>> > >>> I've also attached a text file of the log. > >>> > >>> > >>> > >>> root@socfpga_cyclone5:~# insmod g_mass_storage.ko > >>> file=/dev/mmcblk0p1 [ 144.084933] Number of LUNs=8 [ 144.087817] > >>> Mass Storage Function, > >> version: > >>> 2009/09/11 [ 144.092936] LUN: removable file: (no medium) [ > >>> 144.097228] Number of LUNs=1 [ 144.100217] LUN: file: > >>> /dev/mmcblk0p1 [ 144.103867] Number of LUNs=1 [ 144.106941] > g_mass_storage gadget: > >>> Mass Storage Gadget, version: > >>> 2009/09/11 > >>> [ 144.113874] g_mass_storage gadget: userspace failed to provide > >>> iSerialNumber [ 144.120922] g_mass_storage gadget: g_mass_storage > >>> ready > >>> > >>> [ 144.129387] dwc2 ffb40000.usb: bound driver g_mass_storage > >>> > >>> root@socfpga_cyclone5:~# > >>> > >>> root@socfpga_cyclone5:~# [ 144.353610] dwc2 ffb40000.usb: new > >>> device is high-speed [ 144.527612] dwc2 ffb40000.usb: new device is > >>> high-speed > >>> > >>> [ 149.595802] ------------[ cut here ]------------ > >>> > >>> [ 149.600420] WARNING: CPU: 0 PID: 0 at > >>> drivers/usb/dwc2/gadget.c:1352 > >>> s3c_hsotg_rx_data+0xcc/0x144() > >>> [ 149.609423] Modules linked in: g_mass_storage usb_f_mass_storage > >>> libcomposite [ 149.616582] CPU: 0 PID: 0 Comm: swapper/0 Not > >>> tainted > >>> 3.19.0-rc1-00090-g4864f14 #14 > >>> [ 149.624202] Hardware name: Altera SOCFPGA > >>> > >>> [ 149.628222] [<c00165e4>] (unwind_backtrace) from [<c00124f0>] > >>> (show_stack+0x20/0x24) > >>> [ 149.635941] [<c00124f0>] (show_stack) from [<c04c7374>] > >>> (dump_stack+0x7c/0x98) > >>> [ 149.643147] [<c04c7374>] (dump_stack) from [<c0023ec4>] > >>> (warn_slowpath_common+0x88/0xc4) > >>> [ 149.651208] [<c0023ec4>] (warn_slowpath_common) from [<c0023f2c>] > >>> (warn_slowpath_null+0x2c/0x34) > >>> [ 149.659961] [<c0023f2c>] (warn_slowpath_null) from [<c034ccc4>] > >>> (s3c_hsotg_rx_data+0xcc/0x144) > >>> [ 149.668542] [<c034ccc4>] (s3c_hsotg_rx_data) from [<c034f884>] > >>> (s3c_hsotg_irq+0x3e0/0x708) > >>> [ 149.676777] [<c034f884>] (s3c_hsotg_irq) from [<c0060d30>] > >>> (handle_irq_event_percpu+0x68/0x204) > >>> [ 149.685442] [<c0060d30>] (handle_irq_event_percpu) from > >>> [<c0060f20>] > >>> (handle_irq_event+0x54/0x74) > >>> [ 149.694280] [<c0060f20>] (handle_irq_event) from [<c0063e2c>] > >>> (handle_fasteoi_irq+0xb8/0x190) > >>> [ 149.702771] [<c0063e2c>] (handle_fasteoi_irq) from [<c0060548>] > >>> (generic_handle_irq+0x30/0x40) > >>> [ 149.711348] [<c0060548>] (generic_handle_irq) from [<c0060694>] > >>> (__handle_domain_irq+0x64/0xc4) > >>> [ 149.720012] [<c0060694>] (__handle_domain_irq) from [<c00086bc>] > >>> (gic_handle_irq+0x30/0x6c) > >>> [ 149.728333] [<c00086bc>] (gic_handle_irq) from [<c00130c0>] > >>> (__irq_svc+0x40/0x54) > >>> [ 149.735781] Exception stack(0xc06fbf38 to 0xc06fbf80) [ > >>> 149.740811] > >> bf20: > >>> 00000000 00000000 > >>> [ 149.748953] bf40: c06fbf90 c001f600 c0702c60 c0733560 c0702498 > >>> c04cf08c > >>> c0732d73 413fc090 [ 149.757096] bf60: c0733560 c06fbf8c c06fbf90 > >>> c06fbf80 > >>> c000f934 > >>> c000f938 60000013 ffffffff > >>> [ 149.765243] [<c00130c0>] (__irq_svc) from [<c000f938>] > >>> (arch_cpu_idle+0x40/0x4c) > >>> [ 149.772616] [<c000f938>] (arch_cpu_idle) from [<c0057670>] > >>> (cpu_startup_entry+0x144/0x22c) > >>> [ 149.780857] [<c0057670>] (cpu_startup_entry) from [<c04c2bc4>] > >>> (rest_init+0x70/0x88) > >>> [ 149.788581] [<c04c2bc4>] (rest_init) from [<c069bc60>] > >>> (start_kernel+0x310/0x368) > >>> [ 149.796030] ---[ end trace 05bdb288fcc8864d ]--- [ 155.793924] > random: > >>> nonblocking pool is initialized > >>> > >> > >> I don't see any debug messages. Did you enable > CONFIG_USB_DWC2_DEBUG? > >> If so, then perhaps you need to set the log level in your console > >> (/proc/sys/kernel/printk)? > >> > >> What about Values of following registers GSNPSID, GHWCFG1-GHWCFG4? Is > >> it possible for you to print them as well? > >> > > > > Without the debug log it's difficult to conclude why you are seeing this > behavior. One probable reason could be that your revision of the dwc2 core > does not generate GRXSTS_PKTSTS_OUTDONE on setup packets. Rev 3.0a > generates both GRXSTS_PKTSTS_OUTDONE and GRXSTS_PKTSTS_SETUPDONE > on setup packets. If that's the case, then following patch might fix the problem: > > > > diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c > > index 20613db..7800384 100644 > > --- a/drivers/usb/dwc2/gadget.c > > +++ b/drivers/usb/dwc2/gadget.c > > @@ -1525,7 +1525,9 @@ static void s3c_hsotg_handle_rx(struct dwc2_hsotg > *hsotg) > > "SetupDone (Frame=0x%08x, DOPEPCTL=0x%08x)\n", > > s3c_hsotg_read_frameno(hsotg), > > readl(hsotg->regs + DOEPCTL(0))); > > - /* OutDone is used to complete the transfers */ > > + > > + if (hsotg->ep0_state == DWC2_EP0_SETUP) > > + s3c_hsotg_handle_outdone(hsotg, epnum); > > break; > > > > case GRXSTS_PKTSTS_OUTRX: > > The above does fix the error that I'm seeing with your patch series. [...] Thank you for testing this. I will squash this change in "usb: dwc2: gadget: manage ep0 state in software" patch. > [...] I'm also > attaching an updated log with more debug outputs and the values of GSNPSID > and GHWCFG1-4. I see that your dwc2 have 15 IN and 15 OUT device endpoints. All of them can be used after applying this series :) > > My core's revision is 2.93a. > > So with the above patch included, for the series: > > Tested-by: Dinh Nguyen <dinguyen@xxxxxxxxxxxxxxxxxxxxx> Thank you again. I will send a new revision of this series after fixing this and another comment. > > Dinh BR, Yousaf -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html