linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* dwc3 inconsistent gadget connection state?
@ 2020-07-02 21:44 John Stultz
  2020-07-03  2:55 ` Jun Li
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: John Stultz @ 2020-07-02 21:44 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Tejas Joglekar, Yang Fei, Anurag Kumar Vulisha, YongQin Liu,
	Andrzej Pietrasiewicz, Thinh Nguyen, Linux USB List

Hey Felipe,

  I've been tripping over an issue on my HiKey960 where with the usb-c
gadget cable connected, the gadget code doesn't consistently seem to
initialize properly. I had rarely seen this behavior previously, but
more recently it has become more frequent and annoying.

Usually, unplugging and replugging the USB-C cable would get things
working again (but that's not helpful in test labs).

I annotated a bunch of code trying to understand what was going on and
I narrowed down the difference in the good and bad case to a dwc3
reset interrupts happening after usb_gadget_probe_driver() completes.
In the good case, we see the reset interrupts, and in the failed case
we don't.

[   16.491953] JDB: usb_gadget_probe_driver
[   16.495938] JDB: udc_bind_to_driver
[   16.499555] JDB: dwc3_gadget_start irq: 65 revision: 1429417994
[   16.503803] JDB: __dwc3_gadget_ep_enable
[   16.507791] JDB: __dwc3_gadget_ep_enable
[   16.511715] JDB: dwc3_gadget_enable_irq
[   16.515582] JDB: usb_udc_connect_control
[   16.519510] JDB: usb_gadget_connect
<in the bad case, this is all we see, the gadget device doesn't come up>
[   16.811010] JDB: dwc3_gadget_interrupt
[   16.814783] JDB: dwc3_gadget_reset_interrupt
[   16.819047] JDB: dwc3_reset_gadget
[   16.823935] JDB: dwc3_gadget_interrupt
[   16.827686] JDB: __dwc3_gadget_ep_enable
[   16.831611] JDB: __dwc3_gadget_ep_enable
[   16.994477] JDB: dwc3_gadget_interrupt
[   16.998246] JDB: dwc3_gadget_reset_interrupt
[   17.002519] JDB: dwc3_reset_gadget
[   17.005922] JDB: usb_gadget_udc_reset
[   17.062422] JDB: usb_gadget_set_state  state: 5
[   17.067069] JDB: dwc3_gadget_interrupt
[   17.070823] JDB: __dwc3_gadget_ep_enable
[   17.074745] JDB: __dwc3_gadget_ep_enable
[   17.170898] JDB: usb_gadget_set_state  state: 6
[   17.195605] JDB: usb_gadget_set_state  state: 7
[   17.200179] JDB: __dwc3_gadget_ep_enable
[   17.204118] JDB: __dwc3_gadget_ep_enable
[   17.208057] JDB: usb_gadget_vbus_draw
[   17.211721] JDB: usb_gadget_set_state  state: 7
<in the good case everything is happy here>


This sounds a bit like the issue in the comment here:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/dwc3/gadget.c?h=v5.8-rc3#n3143

However, I've tried calling dwc3_gadget_reset_interrupt() and
dwc3_reset_gadget() at the tail end of dwc3_gadget_start() but that
doesn't seem to help.

I was curious if you or anyone else had any thoughts on how to debug
this further?

thanks
-john

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-08-05  5:33 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-02 21:44 dwc3 inconsistent gadget connection state? John Stultz
2020-07-03  2:55 ` Jun Li
2020-07-03  3:08   ` John Stultz
2020-07-03  7:46     ` Jun Li
2020-07-03  6:15 ` John Stultz
2020-07-03  7:57   ` Anurag Kumar Vulisha
2020-08-05  5:32     ` John Stultz
2020-07-03  9:54 ` Felipe Balbi
2020-07-04  5:51   ` John Stultz
2020-07-04 14:38     ` Felipe Balbi
2020-07-07  3:56       ` John Stultz
2020-07-07 10:43         ` Felipe Balbi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).