linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: dwc2: gadget: On disconnect reset device address to zero
@ 2017-07-10 13:38 Minas Harutyunyan
  2017-07-10 14:05 ` Felipe Balbi
  0 siblings, 1 reply; 8+ messages in thread
From: Minas Harutyunyan @ 2017-07-10 13:38 UTC (permalink / raw)
  To: John Youn, Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel
  Cc: Minas Harutyunyan

USB CV driver stack doesn't perform USB RESET after device disconnect/
connect, so need to reset to zero DEVADDR field in DCFG to pass
enumeration again.

Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
---
 drivers/usb/dwc2/gadget.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 98a4a79e7f6e..deb3d901b99d 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3174,6 +3174,9 @@ void dwc2_hsotg_disconnect(struct dwc2_hsotg *hsotg)
 		return;
 
 	hsotg->connected = 0;
+	/* On disconnect reset device address to zero */
+	__bic32(hsotg->regs + DCFG, DCFG_DEVADDR_MASK);
+
 	hsotg->test_mode = 0;
 
 	for (ep = 0; ep < hsotg->num_of_eps; ep++) {
-- 
2.11.0

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

* Re: [PATCH] usb: dwc2: gadget: On disconnect reset device address to zero
  2017-07-10 13:38 [PATCH] usb: dwc2: gadget: On disconnect reset device address to zero Minas Harutyunyan
@ 2017-07-10 14:05 ` Felipe Balbi
  2017-07-10 14:14   ` Felipe Balbi
  2017-07-10 14:57   ` Minas Harutyunyan
  0 siblings, 2 replies; 8+ messages in thread
From: Felipe Balbi @ 2017-07-10 14:05 UTC (permalink / raw)
  To: Minas Harutyunyan, John Youn, Greg Kroah-Hartman, linux-usb,
	linux-kernel
  Cc: Minas Harutyunyan

[-- Attachment #1: Type: text/plain, Size: 30710 bytes --]


Hi,

Minas Harutyunyan <Minas.Harutyunyan@synopsys.com> writes:
> USB CV driver stack doesn't perform USB RESET after device disconnect/
> connect, so need to reset to zero DEVADDR field in DCFG to pass
> enumeration again.
>
> Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
> ---
>  drivers/usb/dwc2/gadget.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
> index 98a4a79e7f6e..deb3d901b99d 100644
> --- a/drivers/usb/dwc2/gadget.c
> +++ b/drivers/usb/dwc2/gadget.c
> @@ -3174,6 +3174,9 @@ void dwc2_hsotg_disconnect(struct dwc2_hsotg *hsotg)
>  		return;
>  
>  	hsotg->connected = 0;
> +	/* On disconnect reset device address to zero */
> +	__bic32(hsotg->regs + DCFG, DCFG_DEVADDR_MASK);
> +

Which of the tests are you talking about? Which particular USB CV are
you running?

I don't remember ever seeing this with dwc3. How should I go about
triggering this problem? If this was really the case, then we would have
this on *all* UDCs.

I just did a fresh install of USB 3 Gen X CV (that I just download from
usb.org). Ran Chapter 9 tests against a HS dwc3 board I have around and
I can't see the problem you're talking about.

Here are all my non-endpoint interrupt events in order. Test passes
fine. If disconnect, reconnect and run the tests again, then Reset will
be driven on the bus which will cause address to be reset.

Can you share more details about the problem you're facing?

events
=======

     irq/34-dwc3-1609  [001] d..1 13907.710095: dwc3_event: event (00000001): Disconnect: [U0]
     irq/34-dwc3-1609  [001] d..1 13958.860840: dwc3_event: event (00000001): Disconnect: [U0]
     irq/34-dwc3-1609  [001] d..1 14161.547651: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14161.602254: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14163.314174: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14163.368819: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14168.706773: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14168.758551: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14190.027840: dwc3_event: event (00000401): WakeUp [U0]
     irq/34-dwc3-1609  [001] d..1 14203.428377: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14203.479869: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14203.739212: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14203.790550: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14204.025838: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14204.077335: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14204.329353: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14204.380840: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14204.629167: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14204.680503: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14204.941740: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14204.993141: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14205.233103: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14205.285111: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14205.543597: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14205.595033: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14205.840592: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14205.892126: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14206.139094: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14206.190724: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14206.442184: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14206.493527: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14206.739330: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14206.790758: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14207.040100: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14207.091497: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14207.343450: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14207.394870: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14207.653100: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14207.704221: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14207.938064: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14207.989841: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14208.234897: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14208.286199: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14208.538133: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14208.589355: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14208.848383: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14208.899797: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14209.145656: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14209.197060: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14209.442077: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14209.493347: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14209.739882: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14209.791251: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14210.037410: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14210.088828: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14210.336013: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14210.387416: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14210.644393: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14210.696190: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14211.555025: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14211.606674: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14211.847822: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14211.899306: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14212.144729: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14212.196084: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14212.441109: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14212.492435: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14212.739504: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14212.791105: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14213.039853: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14213.091340: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14213.332226: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14213.383630: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14213.617101: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14213.668391: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14213.914697: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14213.966131: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14214.215719: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14214.267105: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14214.512551: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14214.564086: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14214.808705: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14214.860095: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14215.106058: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14215.157500: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14215.402811: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14215.454246: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14215.710442: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14215.762377: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14216.002358: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14216.053724: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14216.296653: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14216.348134: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14216.593719: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14216.645133: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14216.888180: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14216.939577: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14217.181821: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14217.233643: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14217.479090: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14217.530482: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14217.763399: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14217.814702: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14218.054158: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14218.105828: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14218.362221: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14218.413731: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14218.659194: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14218.710711: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14218.946158: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14218.997547: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14219.239555: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14219.291055: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14219.537137: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14219.588398: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14219.840715: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14219.892177: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14220.137093: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14220.188395: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14220.434013: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14220.485432: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14220.734432: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14220.785891: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14221.039605: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14221.091160: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14221.331759: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14221.383440: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14221.633100: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14221.684482: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14221.931987: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14221.983683: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14222.235234: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14222.286641: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14222.528900: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14222.580520: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14222.828325: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14222.879805: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14223.131616: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14223.183110: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14223.435747: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14223.487219: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14223.732681: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14223.784141: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14224.019898: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14224.071385: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14224.316589: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14224.368457: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14224.613781: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14224.665195: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14224.901417: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14224.952861: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14225.198505: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14225.249898: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14225.504044: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14225.555363: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14225.793173: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14225.844556: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14226.090177: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14226.141554: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14226.387277: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14226.438710: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14226.692249: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14226.743659: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14227.002026: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14227.053507: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14227.296403: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14227.347727: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14227.589019: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14227.640448: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14227.893008: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14227.944285: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14228.197246: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14228.248620: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14228.499243: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14228.550732: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14228.798596: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14228.850149: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14229.099854: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14229.151267: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14229.388277: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14229.439802: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14229.674101: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14229.725439: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14229.970849: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14230.022275: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14230.272691: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14230.324166: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14230.569302: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14230.620903: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14230.867107: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14230.918396: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14231.163804: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14231.215313: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14231.452381: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14231.503726: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14231.749813: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14231.801252: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14232.049058: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14232.100533: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14232.354602: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14232.406097: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14232.651808: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14232.703314: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14232.938659: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14232.990012: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14233.235815: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14233.287199: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14233.520574: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14233.572337: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14233.808197: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14233.859483: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14234.101118: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14234.152451: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14234.395222: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14234.446685: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14234.692159: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14234.743528: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14235.003600: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14235.055048: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14235.299910: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14235.351307: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14235.597139: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14235.648483: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14235.889132: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14235.940638: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [001] d..1 14236.177203: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [001] d..1 14236.228587: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14236.465794: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14236.517182: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14236.762888: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14236.814331: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14237.054055: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14237.105468: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14237.351639: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14237.403097: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14237.639128: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14237.690572: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14237.935542: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14237.987160: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14238.224246: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14238.275579: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14238.527999: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14238.579331: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14238.821876: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14238.873338: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14239.107855: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14239.159316: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14239.404879: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14239.456284: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14239.692251: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14239.743634: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14239.989123: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14240.040565: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14240.286100: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14240.337404: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14240.595622: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14240.647103: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14240.886711: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14240.938157: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14241.188104: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14241.239317: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14241.474848: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14241.526166: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14241.759199: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14241.810738: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14242.050736: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14242.102135: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14242.345102: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14242.396589: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14242.641689: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14242.693143: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14242.938584: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14242.990183: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14243.239563: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14243.291019: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14243.534422: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14243.585880: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14243.831778: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14243.883247: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14244.131694: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14244.183170: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14244.438565: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14244.490084: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14244.739035: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14244.790464: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14245.054595: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14245.106125: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14245.351572: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14245.402993: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14245.652267: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14245.703726: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14245.948601: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14246.000099: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14246.245847: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14246.297370: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14246.542663: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14246.594085: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14246.839612: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14246.891111: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14247.138382: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14247.189864: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14247.435299: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14247.486699: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14247.738871: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14247.790184: dwc3_event: event (00000201): Connection Done [U0]
     irq/34-dwc3-1609  [000] d..1 14248.552117: dwc3_event: event (00000101): Reset [U0]
     irq/34-dwc3-1609  [000] d..1 14248.606741: dwc3_event: event (00000201): Connection Done [U0]


-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: [PATCH] usb: dwc2: gadget: On disconnect reset device address to zero
  2017-07-10 14:05 ` Felipe Balbi
@ 2017-07-10 14:14   ` Felipe Balbi
  2017-07-10 14:59     ` Minas Harutyunyan
  2017-07-10 14:57   ` Minas Harutyunyan
  1 sibling, 1 reply; 8+ messages in thread
From: Felipe Balbi @ 2017-07-10 14:14 UTC (permalink / raw)
  To: Minas Harutyunyan, John Youn, Greg Kroah-Hartman, linux-usb,
	linux-kernel
  Cc: Minas Harutyunyan

[-- Attachment #1: Type: text/plain, Size: 3870 bytes --]


Hi again,

Felipe Balbi <balbi@kernel.org> writes:
> Hi,
>
> Minas Harutyunyan <Minas.Harutyunyan@synopsys.com> writes:
>> USB CV driver stack doesn't perform USB RESET after device disconnect/
>> connect, so need to reset to zero DEVADDR field in DCFG to pass
>> enumeration again.
>>
>> Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
>> ---
>>  drivers/usb/dwc2/gadget.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
>> index 98a4a79e7f6e..deb3d901b99d 100644
>> --- a/drivers/usb/dwc2/gadget.c
>> +++ b/drivers/usb/dwc2/gadget.c
>> @@ -3174,6 +3174,9 @@ void dwc2_hsotg_disconnect(struct dwc2_hsotg *hsotg)
>>  		return;
>>  
>>  	hsotg->connected = 0;
>> +	/* On disconnect reset device address to zero */
>> +	__bic32(hsotg->regs + DCFG, DCFG_DEVADDR_MASK);
>> +
>
> Which of the tests are you talking about? Which particular USB CV are
> you running?
>
> I don't remember ever seeing this with dwc3. How should I go about
> triggering this problem? If this was really the case, then we would have
> this on *all* UDCs.
>
> I just did a fresh install of USB 3 Gen X CV (that I just download from
> usb.org). Ran Chapter 9 tests against a HS dwc3 board I have around and
> I can't see the problem you're talking about.
>
> Here are all my non-endpoint interrupt events in order. Test passes
> fine. If disconnect, reconnect and run the tests again, then Reset will
> be driven on the bus which will cause address to be reset.
>
> Can you share more details about the problem you're facing?

I've been looking at dwc2 for a while and I think this is a bug in
dwc2_hsotg_irq() on the branch for GINTSTS_USBRST. I don't have docs for
dwc2.

Nowhere in that function is driver making sure DCFG_DEVADDR is cleared
to 0. In fact, there nowhere at all in the driver where you're making
sure to reset device address:

$ git --no-pager grep --color -nH -e DCFG_DEVADDR_ -- drivers/usb/dwc2/
drivers/usb/dwc2/gadget.c:1837:			dcfg &= ~DCFG_DEVADDR_MASK;
drivers/usb/dwc2/gadget.c:1839:				 DCFG_DEVADDR_SHIFT) & DCFG_DEVADDR_MASK;
drivers/usb/dwc2/hw.h:426:#define DCFG_DEVADDR_MASK		(0x7f << 4)
drivers/usb/dwc2/hw.h:427:#define DCFG_DEVADDR_SHIFT		4
drivers/usb/dwc2/hw.h:428:#define DCFG_DEVADDR_LIMIT		0x7f

If we look into gadget.c on those lines, here's what we have:

static void dwc2_hsotg_process_control(struct dwc2_hsotg *hsotg,
				       struct usb_ctrlrequest *ctrl)
{

[...]

	struct dwc2_hsotg_ep *ep0 = hsotg->eps_out[0];
	int ret = 0;
	u32 dcfg;

	dev_dbg(hsotg->dev,
		"ctrl Type=%02x, Req=%02x, V=%04x, I=%04x, L=%04x\n",
		ctrl->bRequestType, ctrl->bRequest, ctrl->wValue,
		ctrl->wIndex, ctrl->wLength);

	if (ctrl->wLength == 0) {
		ep0->dir_in = 1;
		hsotg->ep0_state = DWC2_EP0_STATUS_IN;
	} else if (ctrl->bRequestType & USB_DIR_IN) {
		ep0->dir_in = 1;
		hsotg->ep0_state = DWC2_EP0_DATA_IN;
	} else {
		ep0->dir_in = 0;
		hsotg->ep0_state = DWC2_EP0_DATA_OUT;
	}

	if ((ctrl->bRequestType & USB_TYPE_MASK) == USB_TYPE_STANDARD) {
		switch (ctrl->bRequest) {
		case USB_REQ_SET_ADDRESS:
			hsotg->connected = 1;
			dcfg = dwc2_readl(hsotg->regs + DCFG);
			dcfg &= ~DCFG_DEVADDR_MASK;
			dcfg |= (le16_to_cpu(ctrl->wValue) <<
				 DCFG_DEVADDR_SHIFT) & DCFG_DEVADDR_MASK;
			dwc2_writel(dcfg, hsotg->regs + DCFG);

			dev_info(hsotg->dev, "new address %d\n", ctrl->wValue);

			ret = dwc2_hsotg_send_reply(hsotg, ep0, NULL, 0);
			return;

[...]
}

So you only touch DEVADDR from SetAddress. That's clearly a bug
elsewhere in the driver and is *NOT* related to USB CV at all. Please
fix this driver properly instead of hacking around unrelated functions.

Disconnect IRQ is *NOT* supposed to clear device address. That's a job
for Reset IRQ.

-- 
pbalbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: [PATCH] usb: dwc2: gadget: On disconnect reset device address to zero
  2017-07-10 14:05 ` Felipe Balbi
  2017-07-10 14:14   ` Felipe Balbi
@ 2017-07-10 14:57   ` Minas Harutyunyan
  2017-07-11  7:34     ` Felipe Balbi
  1 sibling, 1 reply; 8+ messages in thread
From: Minas Harutyunyan @ 2017-07-10 14:57 UTC (permalink / raw)
  To: Felipe Balbi, Minas Harutyunyan, John Youn, Greg Kroah-Hartman,
	linux-usb, linux-kernel

Hi Filipe,

On 7/10/2017 6:06 PM, Felipe Balbi wrote:
>
> Hi,
>
> Minas Harutyunyan <Minas.Harutyunyan@synopsys.com> writes:
>> USB CV driver stack doesn't perform USB RESET after device disconnect/
>> connect, so need to reset to zero DEVADDR field in DCFG to pass
>> enumeration again.
>>
>> Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
>> ---
>>  drivers/usb/dwc2/gadget.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
>> index 98a4a79e7f6e..deb3d901b99d 100644
>> --- a/drivers/usb/dwc2/gadget.c
>> +++ b/drivers/usb/dwc2/gadget.c
>> @@ -3174,6 +3174,9 @@ void dwc2_hsotg_disconnect(struct dwc2_hsotg *hsotg)
>>  		return;
>>
>>  	hsotg->connected = 0;
>> +	/* On disconnect reset device address to zero */
>> +	__bic32(hsotg->regs + DCFG, DCFG_DEVADDR_MASK);
>> +
>
> Which of the tests are you talking about? Which particular USB CV are
> you running?
>
I used USB 3 Gen X CV (downloaded from usb.org 1-2 week ago). Tests are:
1. "Device Summary" - after 1st pass, disconnect then connect again test 
failed. Actually it show as "test passed" but not able to enumerate 
device again.
2. MSC "USB Mass Storage Power Up Test". After disconnect, by suite 
request, and then connect test failed (pass, if reloading driver).

> I don't remember ever seeing this with dwc3. How should I go about
> triggering this problem? If this was really the case, then we would have
> this on *all* UDCs.
>
dwc2 driver resetting DEVADDR in DCFG register only in function 
dwc2_hsotg_core_init_disconnected() by soft reset. This function not 
called on disconnect/connect with CV SW stack (function call not seen in 
dmesg).
This issue not seen with any other EHCI/XHCI hosts either on 
Linux/Windows because these hosts issuing USB RESET, as result called 
dwc2_hsotg_core_init_disconnected().

In dwc3 per my understanding same stuff done in function 
dwc3_gadget_reset_interrupt(), am I right?

> I just did a fresh install of USB 3 Gen X CV (that I just download from
> usb.org). Ran Chapter 9 tests against a HS dwc3 board I have around and
> I can't see the problem you're talking about.
>
Yes, this issue not seen with dwc3.

> Here are all my non-endpoint interrupt events in order. Test passes
> fine. If disconnect, reconnect and run the tests again, then Reset will
> be driven on the bus which will cause address to be reset.
>
> Can you share more details about the problem you're facing?
>
> events
> =======
>
>      irq/34-dwc3-1609  [001] d..1 13907.710095: dwc3_event: event (00000001): Disconnect: [U0]
>      irq/34-dwc3-1609  [001] d..1 13958.860840: dwc3_event: event (00000001): Disconnect: [U0]
>      irq/34-dwc3-1609  [001] d..1 14161.547651: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14161.602254: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14163.314174: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14163.368819: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14168.706773: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14168.758551: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14190.027840: dwc3_event: event (00000401): WakeUp [U0]
>      irq/34-dwc3-1609  [001] d..1 14203.428377: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14203.479869: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14203.739212: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14203.790550: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14204.025838: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14204.077335: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14204.329353: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14204.380840: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14204.629167: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14204.680503: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14204.941740: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14204.993141: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14205.233103: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14205.285111: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14205.543597: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14205.595033: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14205.840592: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14205.892126: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14206.139094: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14206.190724: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14206.442184: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14206.493527: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14206.739330: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14206.790758: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14207.040100: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14207.091497: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14207.343450: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14207.394870: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14207.653100: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14207.704221: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14207.938064: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14207.989841: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14208.234897: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14208.286199: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14208.538133: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14208.589355: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14208.848383: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14208.899797: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14209.145656: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14209.197060: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14209.442077: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14209.493347: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14209.739882: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14209.791251: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14210.037410: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14210.088828: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14210.336013: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14210.387416: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14210.644393: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14210.696190: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14211.555025: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14211.606674: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14211.847822: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14211.899306: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14212.144729: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14212.196084: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14212.441109: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14212.492435: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14212.739504: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14212.791105: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14213.039853: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14213.091340: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14213.332226: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14213.383630: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14213.617101: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14213.668391: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14213.914697: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14213.966131: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14214.215719: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14214.267105: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14214.512551: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14214.564086: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14214.808705: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14214.860095: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14215.106058: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14215.157500: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14215.402811: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14215.454246: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14215.710442: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14215.762377: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14216.002358: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14216.053724: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14216.296653: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14216.348134: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14216.593719: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14216.645133: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14216.888180: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14216.939577: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14217.181821: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14217.233643: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14217.479090: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14217.530482: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14217.763399: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14217.814702: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14218.054158: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14218.105828: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14218.362221: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14218.413731: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14218.659194: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14218.710711: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14218.946158: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14218.997547: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14219.239555: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14219.291055: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14219.537137: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14219.588398: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14219.840715: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14219.892177: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14220.137093: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14220.188395: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14220.434013: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14220.485432: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14220.734432: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14220.785891: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14221.039605: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14221.091160: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14221.331759: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14221.383440: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14221.633100: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14221.684482: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14221.931987: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14221.983683: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14222.235234: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14222.286641: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14222.528900: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14222.580520: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14222.828325: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14222.879805: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14223.131616: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14223.183110: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14223.435747: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14223.487219: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14223.732681: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14223.784141: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14224.019898: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14224.071385: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14224.316589: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14224.368457: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14224.613781: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14224.665195: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14224.901417: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14224.952861: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14225.198505: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14225.249898: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14225.504044: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14225.555363: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14225.793173: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14225.844556: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14226.090177: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14226.141554: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14226.387277: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14226.438710: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14226.692249: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14226.743659: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14227.002026: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14227.053507: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14227.296403: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14227.347727: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14227.589019: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14227.640448: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14227.893008: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14227.944285: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14228.197246: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14228.248620: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14228.499243: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14228.550732: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14228.798596: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14228.850149: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14229.099854: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14229.151267: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14229.388277: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14229.439802: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14229.674101: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14229.725439: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14229.970849: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14230.022275: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14230.272691: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14230.324166: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14230.569302: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14230.620903: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14230.867107: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14230.918396: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14231.163804: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14231.215313: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14231.452381: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14231.503726: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14231.749813: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14231.801252: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14232.049058: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14232.100533: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14232.354602: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14232.406097: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14232.651808: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14232.703314: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14232.938659: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14232.990012: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14233.235815: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14233.287199: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14233.520574: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14233.572337: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14233.808197: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14233.859483: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14234.101118: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14234.152451: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14234.395222: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14234.446685: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14234.692159: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14234.743528: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14235.003600: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14235.055048: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14235.299910: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14235.351307: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14235.597139: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14235.648483: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14235.889132: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14235.940638: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [001] d..1 14236.177203: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [001] d..1 14236.228587: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14236.465794: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14236.517182: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14236.762888: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14236.814331: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14237.054055: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14237.105468: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14237.351639: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14237.403097: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14237.639128: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14237.690572: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14237.935542: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14237.987160: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14238.224246: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14238.275579: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14238.527999: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14238.579331: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14238.821876: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14238.873338: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14239.107855: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14239.159316: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14239.404879: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14239.456284: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14239.692251: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14239.743634: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14239.989123: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14240.040565: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14240.286100: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14240.337404: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14240.595622: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14240.647103: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14240.886711: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14240.938157: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14241.188104: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14241.239317: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14241.474848: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14241.526166: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14241.759199: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14241.810738: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14242.050736: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14242.102135: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14242.345102: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14242.396589: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14242.641689: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14242.693143: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14242.938584: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14242.990183: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14243.239563: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14243.291019: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14243.534422: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14243.585880: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14243.831778: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14243.883247: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14244.131694: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14244.183170: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14244.438565: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14244.490084: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14244.739035: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14244.790464: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14245.054595: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14245.106125: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14245.351572: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14245.402993: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14245.652267: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14245.703726: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14245.948601: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14246.000099: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14246.245847: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14246.297370: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14246.542663: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14246.594085: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14246.839612: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14246.891111: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14247.138382: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14247.189864: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14247.435299: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14247.486699: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14247.738871: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14247.790184: dwc3_event: event (00000201): Connection Done [U0]
>      irq/34-dwc3-1609  [000] d..1 14248.552117: dwc3_event: event (00000101): Reset [U0]
>      irq/34-dwc3-1609  [000] d..1 14248.606741: dwc3_event: event (00000201): Connection Done [U0]
>
>

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

* Re: [PATCH] usb: dwc2: gadget: On disconnect reset device address to zero
  2017-07-10 14:14   ` Felipe Balbi
@ 2017-07-10 14:59     ` Minas Harutyunyan
  2017-07-11  7:31       ` Felipe Balbi
  0 siblings, 1 reply; 8+ messages in thread
From: Minas Harutyunyan @ 2017-07-10 14:59 UTC (permalink / raw)
  To: Felipe Balbi, Minas Harutyunyan, John Youn, Greg Kroah-Hartman,
	linux-usb, linux-kernel

Hi Filipe,



On 7/10/2017 6:14 PM, Felipe Balbi wrote:
>
> Hi again,
>
> Felipe Balbi <balbi@kernel.org> writes:
>> Hi,
>>
>> Minas Harutyunyan <Minas.Harutyunyan@synopsys.com> writes:
>>> USB CV driver stack doesn't perform USB RESET after device disconnect/
>>> connect, so need to reset to zero DEVADDR field in DCFG to pass
>>> enumeration again.
>>>
>>> Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
>>> ---
>>>  drivers/usb/dwc2/gadget.c | 3 +++
>>>  1 file changed, 3 insertions(+)
>>>
>>> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
>>> index 98a4a79e7f6e..deb3d901b99d 100644
>>> --- a/drivers/usb/dwc2/gadget.c
>>> +++ b/drivers/usb/dwc2/gadget.c
>>> @@ -3174,6 +3174,9 @@ void dwc2_hsotg_disconnect(struct dwc2_hsotg *hsotg)
>>>  		return;
>>>
>>>  	hsotg->connected = 0;
>>> +	/* On disconnect reset device address to zero */
>>> +	__bic32(hsotg->regs + DCFG, DCFG_DEVADDR_MASK);
>>> +
>>
>> Which of the tests are you talking about? Which particular USB CV are
>> you running?
>>
>> I don't remember ever seeing this with dwc3. How should I go about
>> triggering this problem? If this was really the case, then we would have
>> this on *all* UDCs.
>>
>> I just did a fresh install of USB 3 Gen X CV (that I just download from
>> usb.org). Ran Chapter 9 tests against a HS dwc3 board I have around and
>> I can't see the problem you're talking about.
>>
>> Here are all my non-endpoint interrupt events in order. Test passes
>> fine. If disconnect, reconnect and run the tests again, then Reset will
>> be driven on the bus which will cause address to be reset.
>>
>> Can you share more details about the problem you're facing?
>
> I've been looking at dwc2 for a while and I think this is a bug in
> dwc2_hsotg_irq() on the branch for GINTSTS_USBRST. I don't have docs for
> dwc2.
>

USB RESET not issuing by CV host stack after connect. Below dmesg:

Disconnect

[23984.039199] dwc2 dwc2.1.auto: dwc2_hsotg_irq: 04008428 00000400 
(d0bc3cc4) retry 8
[23984.039204] dwc2 dwc2.1.auto: GINTSTS_ErlySusp
[23984.042235] dwc2 dwc2.1.auto: gintsts=04008828  gintmsk=d0bc3cc4
[23984.042240] dwc2 dwc2.1.auto: USB SUSPEND
[23984.042247] dwc2 dwc2.1.auto: DSTS=0x5f4c01
[23984.042250] dwc2 dwc2.1.auto: DSTS.Suspend Status=1 HWCFG4.Power 
Optimize=0
[23984.042260] dwc2 dwc2.1.auto: dwc2_hsotg_irq: 04008028 00000000 
(d0bc3cc4) retry 8
[23984.272308] dwc2 dwc2.1.auto: gintsts=0480902c  gintmsk=d0bc3cc4
[23984.272318] dwc2 dwc2.1.auto: ++OTG Interrupt gotgint=4 [b_peripheral]
[23984.272321] dwc2 dwc2.1.auto:  ++OTG Interrupt: Session End 
Detected++ (b_peripheral)
[23984.272331] dwc2 dwc2.1.auto: complete: ep ffff880401a31b28 ep0, req 
ffff8803e495ef00, -108 => ffffffffa00541da
[23984.272336] dwc2 dwc2.1.auto: dwc2_hsotg_complete_setup: failed -108
[23984.272346] dwc2 dwc2.1.auto: complete: ep ffff880401a30328 ep1out, 
req ffff88040b6d7c80, -108 => ffffffffa008865c
[23984.272435] dwc2 dwc2.1.auto: dwc2_hsotg_irq: 04809028 00801000 
(d0bc3cc4) retry 8
[23984.272437] dwc2 dwc2.1.auto: dwc2_hsotg_irq: USBRstDet
[23984.272442] dwc2 dwc2.1.auto: dwc2_hsotg_irq: USBRst
[23984.272446] dwc2 dwc2.1.auto: GNPTXSTS=00040300
[23984.272473] dwc2 dwc2.1.auto: dwc2_hsotg_ep_disable(ep ffff880401a30528)
[23984.272478] dwc2 dwc2.1.auto: dwc2_hsotg_ep_disable: DxEPCTL=0x084a0200
[23984.272485] dwc2 dwc2.1.auto: dwc2_hsotg_ep_disable(ep ffff880401a30328)
[23984.272490] dwc2 dwc2.1.auto: dwc2_hsotg_ep_stop_xfr: stopping 
transfer on ep1out
[23984.272513] dwc2 dwc2.1.auto: dwc2_hsotg_ep_disable: DxEPCTL=0x08080200
[23984.272540] dwc2 dwc2.1.auto: dwc2_hsotg_irq: 04008028 00000000 
(d0bc3cc4) retry 8

Connect

[24010.664017] dwc2 dwc2.1.auto: gintsts=44008028  gintmsk=d0bc3cc4
[24010.664023] dwc2 dwc2.1.auto: Session request interrupt - lx_state=0
[24010.664035] dwc2 dwc2.1.auto: dwc2_hsotg_irq: 04008028 00000000 
(d0bc3cc4) retry 8

Run test

First try to enumerate

[24021.649528] dwc2 dwc2.1.auto: dwc2_hsotg_irq: 0400a028 00002000 
(d0bc3cc4) retry 8
[24021.649536] dwc2 dwc2.1.auto: EnumDone (DSTS=0x0043e902)
[24021.649539] dwc2 dwc2.1.auto: new device is full-speed
[24021.649618] dwc2 dwc2.1.auto: dwc2_hsotg_enqueue_setup: queueing 
setup request
[24021.649623] dwc2 dwc2.1.auto: ep0: req ffff8803e495ef00: 
8@ffff88040ad1d228, noi=0, zero=0, snok=0
[24021.649631] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: 
DxEPCTL=0x80028000, ep 0, dir out
[24021.649636] dwc2 dwc2.1.auto: ureq->length:8 ureq->actual:0
[24021.649640] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: 1@8/8, 0x00080008 
=> 0x00000b10
[24021.649643] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: 
0x00000000d9858800 => 0x00000b14
[24021.649645] dwc2 dwc2.1.auto: ep0 state:0
[24021.649648] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: DxEPCTL=0x80028000
[24021.649654] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: DXEPCTL=0x80028000
[24021.649664] dwc2 dwc2.1.auto: EP0: DIEPCTL0=0x00008000, 
DOEPCTL0=0x80028000
[24021.849430] dwc2 dwc2.1.auto: dwc2_hsotg_irq: 04088028 00080000 
(d0bc3cc4) retry 8
[24021.849439] dwc2 dwc2.1.auto: dwc2_hsotg_irq: daint=00010000
[24021.849452] dwc2 dwc2.1.auto: dwc2_hsotg_epint: ep0(out) 
DxEPINT=0x00008009
[24021.849455] dwc2 dwc2.1.auto: dwc2_hsotg_epint: Setup/Timeout
[24021.849462] dwc2 dwc2.1.auto: complete: ep ffff880401a31b28 ep0, req 
ffff8803e495ef00, 0 => ffffffffa00541da
[24021.849468] dwc2 dwc2.1.auto: ctrl Type=80, Req=06, V=0100, I=0000, 
L=0008
[24021.849474] dwc2 dwc2.1.auto: ep0: req ffff88040d7c9b80: 
8@ffff8803e9af6000, noi=0, zero=0, snok=0
[24021.849481] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: 
DxEPCTL=0x00028000, ep 0, dir in
[24021.849486] dwc2 dwc2.1.auto: ureq->length:8 ureq->actual:0
[24021.849490] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: 1@8/8, 0x00080008 
=> 0x00000910
[24021.849493] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: 
0x00000000d9859000 => 0x00000914
[24021.849495] dwc2 dwc2.1.auto: ep0 state:1
[24021.849498] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: DxEPCTL=0x84028000
[24021.849504] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: DXEPCTL=0x80008000
[24021.849560] dwc2 dwc2.1.auto: dwc2_hsotg_irq: 04048028 00040000 
(d0bc3cc4) retry 8
[24021.849567] dwc2 dwc2.1.auto: dwc2_hsotg_irq: daint=00000001
[24021.849578] dwc2 dwc2.1.auto: dwc2_hsotg_epint: ep0(in) 
DxEPINT=0x00000001
[24021.849585] dwc2 dwc2.1.auto: dwc2_hsotg_epint: XferCompl: 
DxEPCTL=0x00008000, DXEPTSIZ=00000000
[24021.849590] dwc2 dwc2.1.auto: dwc2_hsotg_complete_in: adjusting size 
done 0 => 8
[24021.849593] dwc2 dwc2.1.auto: req->length:8 req->actual:8 req->zero:0
[24021.849596] dwc2 dwc2.1.auto: Receiving zero-length packet on ep0
[24021.849629] dwc2 dwc2.1.auto: dwc2_hsotg_irq: 04088028 00080000 
(d0bc3cc4) retry 8
[24021.849635] dwc2 dwc2.1.auto: dwc2_hsotg_irq: daint=00010000
[24021.849647] dwc2 dwc2.1.auto: dwc2_hsotg_epint: ep0(out) 
DxEPINT=0x00000001
[24021.849654] dwc2 dwc2.1.auto: dwc2_hsotg_epint: XferCompl: 
DxEPCTL=0x00028000, DXEPTSIZ=20000000
[24021.849658] dwc2 dwc2.1.auto: zlp packet received
[24021.849661] dwc2 dwc2.1.auto: complete: ep ffff880401a31b28 ep0, req 
ffff88040d7c9b80, 0 => ffffffffa0076da7
[24021.849665] dwc2 dwc2.1.auto: dwc2_hsotg_enqueue_setup: queueing 
setup request
[24021.849669] dwc2 dwc2.1.auto: ep0: req ffff8803e495ef00: 
8@ffff88040ad1d228, noi=0, zero=0, snok=0
[24021.849674] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: 
DxEPCTL=0x00028000, ep 0, dir out
[24021.849679] dwc2 dwc2.1.auto: ureq->length:8 ureq->actual:0
[24021.849682] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: 1@8/8, 0x00080008 
=> 0x00000b10
[24021.849685] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: 
0x00000000d9859800 => 0x00000b14
[24021.849687] dwc2 dwc2.1.auto: ep0 state:0
[24021.849689] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: DxEPCTL=0x80028000
[24021.849696] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: DXEPCTL=0x80028000


Second try to enumerate

[24022.203534] dwc2 dwc2.1.auto: dwc2_hsotg_irq: 04008428 00000400 
(d0bc3cc4) retry 8
[24022.203539] dwc2 dwc2.1.auto: GINTSTS_ErlySusp
[24022.206591] dwc2 dwc2.1.auto: gintsts=04008828  gintmsk=d0bc3cc4
[24022.206595] dwc2 dwc2.1.auto: USB SUSPEND
[24022.206602] dwc2 dwc2.1.auto: DSTS=0x426203
[24022.206605] dwc2 dwc2.1.auto: DSTS.Suspend Status=1 HWCFG4.Power 
Optimize=0
[24022.206615] dwc2 dwc2.1.auto: dwc2_hsotg_irq: 04008028 00000000 
(d0bc3cc4) retry 8
[24022.432686] dwc2 dwc2.1.auto: dwc2_hsotg_irq: 04809028 00801000 
(d0bc3cc4) retry 8
[24022.432691] dwc2 dwc2.1.auto: dwc2_hsotg_irq: USBRstDet
[24022.432695] dwc2 dwc2.1.auto: dwc2_hsotg_irq: USBRst
[24022.432700] dwc2 dwc2.1.auto: GNPTXSTS=00040300
[24022.487557] dwc2 dwc2.1.auto: dwc2_hsotg_irq: 0400a028 00002000 
(d0bc3cc4) retry 8
[24022.487564] dwc2 dwc2.1.auto: EnumDone (DSTS=0x00131000)
[24022.487566] dwc2 dwc2.1.auto: new device is high-speed
[24022.487645] dwc2 dwc2.1.auto: dwc2_hsotg_enqueue_setup: queueing 
setup request
[24022.487647] dwc2 dwc2.1.auto: dwc2_hsotg_enqueue_setup already queued???
[24022.487654] dwc2 dwc2.1.auto: EP0: DIEPCTL0=0x00008000, 
DOEPCTL0=0x80028000
[24022.688563] dwc2 dwc2.1.auto: dwc2_hsotg_irq: 04088028 00080000 
(d0bc3cc4) retry 8
[24022.688572] dwc2 dwc2.1.auto: dwc2_hsotg_irq: daint=00010000
[24022.688584] dwc2 dwc2.1.auto: dwc2_hsotg_epint: ep0(out) 
DxEPINT=0x00008009
[24022.688587] dwc2 dwc2.1.auto: dwc2_hsotg_epint: Setup/Timeout
[24022.688593] dwc2 dwc2.1.auto: complete: ep ffff880401a31b28 ep0, req 
ffff8803e495ef00, 0 => ffffffffa00541da
[24022.688598] dwc2 dwc2.1.auto: ctrl Type=80, Req=06, V=0100, I=0000, 
L=0012
[24022.688604] dwc2 dwc2.1.auto: ep0: req ffff88040d7c9b80: 
18@ffff8803e9af6000, noi=0, zero=0, snok=0
[24022.688611] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: 
DxEPCTL=0x00028000, ep 0, dir in
[24022.688615] dwc2 dwc2.1.auto: ureq->length:18 ureq->actual:0
[24022.688619] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: 1@18/18, 
0x00080012 => 0x00000910
[24022.688622] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: 
0x00000000d985a000 => 0x00000914
[24022.688625] dwc2 dwc2.1.auto: ep0 state:1
[24022.688627] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: DxEPCTL=0x84028000
[24022.688634] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: DXEPCTL=0x80008000
[24022.688676] dwc2 dwc2.1.auto: dwc2_hsotg_irq: 04048028 00040000 
(d0bc3cc4) retry 8
[24022.688682] dwc2 dwc2.1.auto: dwc2_hsotg_irq: daint=00000001
[24022.688694] dwc2 dwc2.1.auto: dwc2_hsotg_epint: ep0(in) 
DxEPINT=0x00000001
[24022.688701] dwc2 dwc2.1.auto: dwc2_hsotg_epint: XferCompl: 
DxEPCTL=0x00008000, DXEPTSIZ=00000000
[24022.688706] dwc2 dwc2.1.auto: dwc2_hsotg_complete_in: adjusting size 
done 0 => 18
[24022.688709] dwc2 dwc2.1.auto: req->length:18 req->actual:18 req->zero:0
[24022.688711] dwc2 dwc2.1.auto: Receiving zero-length packet on ep0
[24022.688755] dwc2 dwc2.1.auto: dwc2_hsotg_irq: 04088028 00080000 
(d0bc3cc4) retry 8
[24022.688762] dwc2 dwc2.1.auto: dwc2_hsotg_irq: daint=00010000
[24022.688773] dwc2 dwc2.1.auto: dwc2_hsotg_epint: ep0(out) 
DxEPINT=0x00000001
[24022.688781] dwc2 dwc2.1.auto: dwc2_hsotg_epint: XferCompl: 
DxEPCTL=0x00028000, DXEPTSIZ=20000000
[24022.688785] dwc2 dwc2.1.auto: zlp packet received
[24022.688788] dwc2 dwc2.1.auto: complete: ep ffff880401a31b28 ep0, req 
ffff88040d7c9b80, 0 => ffffffffa0076da7
[24022.688791] dwc2 dwc2.1.auto: dwc2_hsotg_enqueue_setup: queueing 
setup request
[24022.688795] dwc2 dwc2.1.auto: ep0: req ffff8803e495ef00: 
8@ffff88040ad1d228, noi=0, zero=0, snok=0
[24022.688801] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: 
DxEPCTL=0x00028000, ep 0, dir out
[24022.688805] dwc2 dwc2.1.auto: ureq->length:8 ureq->actual:0
[24022.688808] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: 1@8/8, 0x00080008 
=> 0x00000b10
[24022.688811] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: 
0x00000000d985a800 => 0x00000b14
[24022.688813] dwc2 dwc2.1.auto: ep0 state:0
[24022.688816] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: DxEPCTL=0x80028000
[24022.688822] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: DXEPCTL=0x80028000


> Nowhere in that function is driver making sure DCFG_DEVADDR is cleared
> to 0. In fact, there nowhere at all in the driver where you're making
> sure to reset device address:
>
> $ git --no-pager grep --color -nH -e DCFG_DEVADDR_ -- drivers/usb/dwc2/
> drivers/usb/dwc2/gadget.c:1837:			dcfg &= ~DCFG_DEVADDR_MASK;
> drivers/usb/dwc2/gadget.c:1839:				 DCFG_DEVADDR_SHIFT) & DCFG_DEVADDR_MASK;
> drivers/usb/dwc2/hw.h:426:#define DCFG_DEVADDR_MASK		(0x7f << 4)
> drivers/usb/dwc2/hw.h:427:#define DCFG_DEVADDR_SHIFT		4
> drivers/usb/dwc2/hw.h:428:#define DCFG_DEVADDR_LIMIT		0x7f
>
> If we look into gadget.c on those lines, here's what we have:
>
> static void dwc2_hsotg_process_control(struct dwc2_hsotg *hsotg,
> 				       struct usb_ctrlrequest *ctrl)
> {
>
> [...]
>
> 	struct dwc2_hsotg_ep *ep0 = hsotg->eps_out[0];
> 	int ret = 0;
> 	u32 dcfg;
>
> 	dev_dbg(hsotg->dev,
> 		"ctrl Type=%02x, Req=%02x, V=%04x, I=%04x, L=%04x\n",
> 		ctrl->bRequestType, ctrl->bRequest, ctrl->wValue,
> 		ctrl->wIndex, ctrl->wLength);
>
> 	if (ctrl->wLength == 0) {
> 		ep0->dir_in = 1;
> 		hsotg->ep0_state = DWC2_EP0_STATUS_IN;
> 	} else if (ctrl->bRequestType & USB_DIR_IN) {
> 		ep0->dir_in = 1;
> 		hsotg->ep0_state = DWC2_EP0_DATA_IN;
> 	} else {
> 		ep0->dir_in = 0;
> 		hsotg->ep0_state = DWC2_EP0_DATA_OUT;
> 	}
>
> 	if ((ctrl->bRequestType & USB_TYPE_MASK) == USB_TYPE_STANDARD) {
> 		switch (ctrl->bRequest) {
> 		case USB_REQ_SET_ADDRESS:
> 			hsotg->connected = 1;
> 			dcfg = dwc2_readl(hsotg->regs + DCFG);
> 			dcfg &= ~DCFG_DEVADDR_MASK;
> 			dcfg |= (le16_to_cpu(ctrl->wValue) <<
> 				 DCFG_DEVADDR_SHIFT) & DCFG_DEVADDR_MASK;
> 			dwc2_writel(dcfg, hsotg->regs + DCFG);
>
> 			dev_info(hsotg->dev, "new address %d\n", ctrl->wValue);
>
> 			ret = dwc2_hsotg_send_reply(hsotg, ep0, NULL, 0);
> 			return;
>
> [...]
> }
>
> So you only touch DEVADDR from SetAddress. That's clearly a bug
> elsewhere in the driver and is *NOT* related to USB CV at all. Please
> fix this driver properly instead of hacking around unrelated functions.
>
> Disconnect IRQ is *NOT* supposed to clear device address. That's a job
> for Reset IRQ.
>

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

* Re: [PATCH] usb: dwc2: gadget: On disconnect reset device address to zero
  2017-07-10 14:59     ` Minas Harutyunyan
@ 2017-07-11  7:31       ` Felipe Balbi
  0 siblings, 0 replies; 8+ messages in thread
From: Felipe Balbi @ 2017-07-11  7:31 UTC (permalink / raw)
  To: Minas Harutyunyan, Minas Harutyunyan, John Youn,
	Greg Kroah-Hartman, linux-usb, linux-kernel


Hi,

Minas Harutyunyan <Minas.Harutyunyan@synopsys.com> writes:
>>> Minas Harutyunyan <Minas.Harutyunyan@synopsys.com> writes:
>>>> USB CV driver stack doesn't perform USB RESET after device disconnect/
>>>> connect, so need to reset to zero DEVADDR field in DCFG to pass
>>>> enumeration again.
>>>>
>>>> Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
>>>> ---
>>>>  drivers/usb/dwc2/gadget.c | 3 +++
>>>>  1 file changed, 3 insertions(+)
>>>>
>>>> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
>>>> index 98a4a79e7f6e..deb3d901b99d 100644
>>>> --- a/drivers/usb/dwc2/gadget.c
>>>> +++ b/drivers/usb/dwc2/gadget.c
>>>> @@ -3174,6 +3174,9 @@ void dwc2_hsotg_disconnect(struct dwc2_hsotg *hsotg)
>>>>  		return;
>>>>
>>>>  	hsotg->connected = 0;
>>>> +	/* On disconnect reset device address to zero */
>>>> +	__bic32(hsotg->regs + DCFG, DCFG_DEVADDR_MASK);
>>>> +
>>>
>>> Which of the tests are you talking about? Which particular USB CV are
>>> you running?
>>>
>>> I don't remember ever seeing this with dwc3. How should I go about
>>> triggering this problem? If this was really the case, then we would have
>>> this on *all* UDCs.
>>>
>>> I just did a fresh install of USB 3 Gen X CV (that I just download from
>>> usb.org). Ran Chapter 9 tests against a HS dwc3 board I have around and
>>> I can't see the problem you're talking about.
>>>
>>> Here are all my non-endpoint interrupt events in order. Test passes
>>> fine. If disconnect, reconnect and run the tests again, then Reset will
>>> be driven on the bus which will cause address to be reset.
>>>
>>> Can you share more details about the problem you're facing?
>>
>> I've been looking at dwc2 for a while and I think this is a bug in
>> dwc2_hsotg_irq() on the branch for GINTSTS_USBRST. I don't have docs for
>> dwc2.
>>
>
> USB RESET not issuing by CV host stack after connect. Below dmesg:
>
> Disconnect
>
> [23984.039199] dwc2 dwc2.1.auto: dwc2_hsotg_irq: 04008428 00000400 
> (d0bc3cc4) retry 8
> [23984.039204] dwc2 dwc2.1.auto: GINTSTS_ErlySusp
> [23984.042235] dwc2 dwc2.1.auto: gintsts=04008828  gintmsk=d0bc3cc4
> [23984.042240] dwc2 dwc2.1.auto: USB SUSPEND
> [23984.042247] dwc2 dwc2.1.auto: DSTS=0x5f4c01
> [23984.042250] dwc2 dwc2.1.auto: DSTS.Suspend Status=1 HWCFG4.Power 
> Optimize=0
> [23984.042260] dwc2 dwc2.1.auto: dwc2_hsotg_irq: 04008028 00000000 
> (d0bc3cc4) retry 8
> [23984.272308] dwc2 dwc2.1.auto: gintsts=0480902c  gintmsk=d0bc3cc4
> [23984.272318] dwc2 dwc2.1.auto: ++OTG Interrupt gotgint=4 [b_peripheral]
> [23984.272321] dwc2 dwc2.1.auto:  ++OTG Interrupt: Session End 
> Detected++ (b_peripheral)
> [23984.272331] dwc2 dwc2.1.auto: complete: ep ffff880401a31b28 ep0, req 
> ffff8803e495ef00, -108 => ffffffffa00541da
> [23984.272336] dwc2 dwc2.1.auto: dwc2_hsotg_complete_setup: failed -108
> [23984.272346] dwc2 dwc2.1.auto: complete: ep ffff880401a30328 ep1out, 
> req ffff88040b6d7c80, -108 => ffffffffa008865c
> [23984.272435] dwc2 dwc2.1.auto: dwc2_hsotg_irq: 04809028 00801000 
> (d0bc3cc4) retry 8
> [23984.272437] dwc2 dwc2.1.auto: dwc2_hsotg_irq: USBRstDet
> [23984.272442] dwc2 dwc2.1.auto: dwc2_hsotg_irq: USBRst

here it is.

> [23984.272446] dwc2 dwc2.1.auto: GNPTXSTS=00040300
> [23984.272473] dwc2 dwc2.1.auto: dwc2_hsotg_ep_disable(ep ffff880401a30528)
> [23984.272478] dwc2 dwc2.1.auto: dwc2_hsotg_ep_disable: DxEPCTL=0x084a0200
> [23984.272485] dwc2 dwc2.1.auto: dwc2_hsotg_ep_disable(ep ffff880401a30328)
> [23984.272490] dwc2 dwc2.1.auto: dwc2_hsotg_ep_stop_xfr: stopping 
> transfer on ep1out
> [23984.272513] dwc2 dwc2.1.auto: dwc2_hsotg_ep_disable: DxEPCTL=0x08080200
> [23984.272540] dwc2 dwc2.1.auto: dwc2_hsotg_irq: 04008028 00000000 
> (d0bc3cc4) retry 8
>
> Connect
>
> [24010.664017] dwc2 dwc2.1.auto: gintsts=44008028  gintmsk=d0bc3cc4
> [24010.664023] dwc2 dwc2.1.auto: Session request interrupt - lx_state=0
> [24010.664035] dwc2 dwc2.1.auto: dwc2_hsotg_irq: 04008028 00000000 
> (d0bc3cc4) retry 8
>
> Run test
>
> First try to enumerate
>
> [24021.649528] dwc2 dwc2.1.auto: dwc2_hsotg_irq: 0400a028 00002000 
> (d0bc3cc4) retry 8
> [24021.649536] dwc2 dwc2.1.auto: EnumDone (DSTS=0x0043e902)
> [24021.649539] dwc2 dwc2.1.auto: new device is full-speed
> [24021.649618] dwc2 dwc2.1.auto: dwc2_hsotg_enqueue_setup: queueing 
> setup request
> [24021.649623] dwc2 dwc2.1.auto: ep0: req ffff8803e495ef00: 
> 8@ffff88040ad1d228, noi=0, zero=0, snok=0
> [24021.649631] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: 
> DxEPCTL=0x80028000, ep 0, dir out
> [24021.649636] dwc2 dwc2.1.auto: ureq->length:8 ureq->actual:0
> [24021.649640] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: 1@8/8, 0x00080008 
> => 0x00000b10
> [24021.649643] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: 
> 0x00000000d9858800 => 0x00000b14
> [24021.649645] dwc2 dwc2.1.auto: ep0 state:0
> [24021.649648] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: DxEPCTL=0x80028000
> [24021.649654] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: DXEPCTL=0x80028000
> [24021.649664] dwc2 dwc2.1.auto: EP0: DIEPCTL0=0x00008000, 
> DOEPCTL0=0x80028000
> [24021.849430] dwc2 dwc2.1.auto: dwc2_hsotg_irq: 04088028 00080000 
> (d0bc3cc4) retry 8
> [24021.849439] dwc2 dwc2.1.auto: dwc2_hsotg_irq: daint=00010000
> [24021.849452] dwc2 dwc2.1.auto: dwc2_hsotg_epint: ep0(out) 
> DxEPINT=0x00008009
> [24021.849455] dwc2 dwc2.1.auto: dwc2_hsotg_epint: Setup/Timeout
> [24021.849462] dwc2 dwc2.1.auto: complete: ep ffff880401a31b28 ep0, req 
> ffff8803e495ef00, 0 => ffffffffa00541da
> [24021.849468] dwc2 dwc2.1.auto: ctrl Type=80, Req=06, V=0100, I=0000, 
> L=0008
> [24021.849474] dwc2 dwc2.1.auto: ep0: req ffff88040d7c9b80: 
> 8@ffff8803e9af6000, noi=0, zero=0, snok=0
> [24021.849481] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: 
> DxEPCTL=0x00028000, ep 0, dir in
> [24021.849486] dwc2 dwc2.1.auto: ureq->length:8 ureq->actual:0
> [24021.849490] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: 1@8/8, 0x00080008 
> => 0x00000910
> [24021.849493] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: 
> 0x00000000d9859000 => 0x00000914
> [24021.849495] dwc2 dwc2.1.auto: ep0 state:1
> [24021.849498] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: DxEPCTL=0x84028000
> [24021.849504] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: DXEPCTL=0x80008000
> [24021.849560] dwc2 dwc2.1.auto: dwc2_hsotg_irq: 04048028 00040000 
> (d0bc3cc4) retry 8
> [24021.849567] dwc2 dwc2.1.auto: dwc2_hsotg_irq: daint=00000001
> [24021.849578] dwc2 dwc2.1.auto: dwc2_hsotg_epint: ep0(in) 
> DxEPINT=0x00000001
> [24021.849585] dwc2 dwc2.1.auto: dwc2_hsotg_epint: XferCompl: 
> DxEPCTL=0x00008000, DXEPTSIZ=00000000
> [24021.849590] dwc2 dwc2.1.auto: dwc2_hsotg_complete_in: adjusting size 
> done 0 => 8
> [24021.849593] dwc2 dwc2.1.auto: req->length:8 req->actual:8 req->zero:0
> [24021.849596] dwc2 dwc2.1.auto: Receiving zero-length packet on ep0
> [24021.849629] dwc2 dwc2.1.auto: dwc2_hsotg_irq: 04088028 00080000 
> (d0bc3cc4) retry 8
> [24021.849635] dwc2 dwc2.1.auto: dwc2_hsotg_irq: daint=00010000
> [24021.849647] dwc2 dwc2.1.auto: dwc2_hsotg_epint: ep0(out) 
> DxEPINT=0x00000001
> [24021.849654] dwc2 dwc2.1.auto: dwc2_hsotg_epint: XferCompl: 
> DxEPCTL=0x00028000, DXEPTSIZ=20000000
> [24021.849658] dwc2 dwc2.1.auto: zlp packet received
> [24021.849661] dwc2 dwc2.1.auto: complete: ep ffff880401a31b28 ep0, req 
> ffff88040d7c9b80, 0 => ffffffffa0076da7
> [24021.849665] dwc2 dwc2.1.auto: dwc2_hsotg_enqueue_setup: queueing 
> setup request
> [24021.849669] dwc2 dwc2.1.auto: ep0: req ffff8803e495ef00: 
> 8@ffff88040ad1d228, noi=0, zero=0, snok=0
> [24021.849674] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: 
> DxEPCTL=0x00028000, ep 0, dir out
> [24021.849679] dwc2 dwc2.1.auto: ureq->length:8 ureq->actual:0
> [24021.849682] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: 1@8/8, 0x00080008 
> => 0x00000b10
> [24021.849685] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: 
> 0x00000000d9859800 => 0x00000b14
> [24021.849687] dwc2 dwc2.1.auto: ep0 state:0
> [24021.849689] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: DxEPCTL=0x80028000
> [24021.849696] dwc2 dwc2.1.auto: dwc2_hsotg_start_req: DXEPCTL=0x80028000
>
>
> Second try to enumerate
>
> [24022.203534] dwc2 dwc2.1.auto: dwc2_hsotg_irq: 04008428 00000400 
> (d0bc3cc4) retry 8
> [24022.203539] dwc2 dwc2.1.auto: GINTSTS_ErlySusp
> [24022.206591] dwc2 dwc2.1.auto: gintsts=04008828  gintmsk=d0bc3cc4
> [24022.206595] dwc2 dwc2.1.auto: USB SUSPEND
> [24022.206602] dwc2 dwc2.1.auto: DSTS=0x426203
> [24022.206605] dwc2 dwc2.1.auto: DSTS.Suspend Status=1 HWCFG4.Power 
> Optimize=0
> [24022.206615] dwc2 dwc2.1.auto: dwc2_hsotg_irq: 04008028 00000000 
> (d0bc3cc4) retry 8
> [24022.432686] dwc2 dwc2.1.auto: dwc2_hsotg_irq: 04809028 00801000 
> (d0bc3cc4) retry 8
> [24022.432691] dwc2 dwc2.1.auto: dwc2_hsotg_irq: USBRstDet
> [24022.432695] dwc2 dwc2.1.auto: dwc2_hsotg_irq: USBRst

Here it is again.

If you implement reset correctly, then the problem will go away. Clear
DEVADDR from Reset, not Disconnect.

-- 
balbi

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

* Re: [PATCH] usb: dwc2: gadget: On disconnect reset device address to zero
  2017-07-10 14:57   ` Minas Harutyunyan
@ 2017-07-11  7:34     ` Felipe Balbi
  2017-07-11 10:29       ` Minas Harutyunyan
  0 siblings, 1 reply; 8+ messages in thread
From: Felipe Balbi @ 2017-07-11  7:34 UTC (permalink / raw)
  To: Minas Harutyunyan, Minas Harutyunyan, John Youn,
	Greg Kroah-Hartman, linux-usb, linux-kernel


Hi,

Minas Harutyunyan <Minas.Harutyunyan@synopsys.com> writes:
>> Minas Harutyunyan <Minas.Harutyunyan@synopsys.com> writes:
>>> USB CV driver stack doesn't perform USB RESET after device disconnect/
>>> connect, so need to reset to zero DEVADDR field in DCFG to pass
>>> enumeration again.
>>>
>>> Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
>>> ---
>>>  drivers/usb/dwc2/gadget.c | 3 +++
>>>  1 file changed, 3 insertions(+)
>>>
>>> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
>>> index 98a4a79e7f6e..deb3d901b99d 100644
>>> --- a/drivers/usb/dwc2/gadget.c
>>> +++ b/drivers/usb/dwc2/gadget.c
>>> @@ -3174,6 +3174,9 @@ void dwc2_hsotg_disconnect(struct dwc2_hsotg *hsotg)
>>>  		return;
>>>
>>>  	hsotg->connected = 0;
>>> +	/* On disconnect reset device address to zero */
>>> +	__bic32(hsotg->regs + DCFG, DCFG_DEVADDR_MASK);
>>> +
>>
>> Which of the tests are you talking about? Which particular USB CV are
>> you running?
>>
> I used USB 3 Gen X CV (downloaded from usb.org 1-2 week ago). Tests are:
> 1. "Device Summary" - after 1st pass, disconnect then connect again test 
> failed. Actually it show as "test passed" but not able to enumerate 
> device again.
> 2. MSC "USB Mass Storage Power Up Test". After disconnect, by suite 
> request, and then connect test failed (pass, if reloading driver).

I'll try these tests tomorrow next time I'm in the office. Woke up sick,
working from home today :-s

>> I don't remember ever seeing this with dwc3. How should I go about
>> triggering this problem? If this was really the case, then we would have
>> this on *all* UDCs.
>>
> dwc2 driver resetting DEVADDR in DCFG register only in function 
> dwc2_hsotg_core_init_disconnected() by soft reset. This function not 
> called on disconnect/connect with CV SW stack (function call not seen in 
> dmesg).

right, this is a bug in dwc2. You should clear DEVADDR from your Reset
handler, not disconnect.

> This issue not seen with any other EHCI/XHCI hosts either on 
> Linux/Windows because these hosts issuing USB RESET, as result called 
> dwc2_hsotg_core_init_disconnected().
>
> In dwc3 per my understanding same stuff done in function 
> dwc3_gadget_reset_interrupt(), am I right?

right, as it should. If dwc3_gadget_reset_interrupt() runs, this means
the host *is* issuing USB reset signalling.

>> I just did a fresh install of USB 3 Gen X CV (that I just download from
>> usb.org). Ran Chapter 9 tests against a HS dwc3 board I have around and
>> I can't see the problem you're talking about.
>>
> Yes, this issue not seen with dwc3.

because we clear DEVADDR on Reset.

-- 
balbi

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

* Re: [PATCH] usb: dwc2: gadget: On disconnect reset device address to zero
  2017-07-11  7:34     ` Felipe Balbi
@ 2017-07-11 10:29       ` Minas Harutyunyan
  0 siblings, 0 replies; 8+ messages in thread
From: Minas Harutyunyan @ 2017-07-11 10:29 UTC (permalink / raw)
  To: Felipe Balbi, Minas Harutyunyan, John Youn, Greg Kroah-Hartman,
	linux-usb, linux-kernel

Hi Felipe,

On 7/11/2017 11:34 AM, Felipe Balbi wrote:
>
> Hi,
>
> Minas Harutyunyan <Minas.Harutyunyan@synopsys.com> writes:
>>> Minas Harutyunyan <Minas.Harutyunyan@synopsys.com> writes:
>>>> USB CV driver stack doesn't perform USB RESET after device disconnect/
>>>> connect, so need to reset to zero DEVADDR field in DCFG to pass
>>>> enumeration again.
>>>>
>>>> Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
>>>> ---
>>>>  drivers/usb/dwc2/gadget.c | 3 +++
>>>>  1 file changed, 3 insertions(+)
>>>>
>>>> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
>>>> index 98a4a79e7f6e..deb3d901b99d 100644
>>>> --- a/drivers/usb/dwc2/gadget.c
>>>> +++ b/drivers/usb/dwc2/gadget.c
>>>> @@ -3174,6 +3174,9 @@ void dwc2_hsotg_disconnect(struct dwc2_hsotg *hsotg)
>>>>  		return;
>>>>
>>>>  	hsotg->connected = 0;
>>>> +	/* On disconnect reset device address to zero */
>>>> +	__bic32(hsotg->regs + DCFG, DCFG_DEVADDR_MASK);
>>>> +
>>>
>>> Which of the tests are you talking about? Which particular USB CV are
>>> you running?
>>>
>> I used USB 3 Gen X CV (downloaded from usb.org 1-2 week ago). Tests are:
>> 1. "Device Summary" - after 1st pass, disconnect then connect again test
>> failed. Actually it show as "test passed" but not able to enumerate
>> device again.
>> 2. MSC "USB Mass Storage Power Up Test". After disconnect, by suite
>> request, and then connect test failed (pass, if reloading driver).
>
> I'll try these tests tomorrow next time I'm in the office. Woke up sick,
> working from home today :-s
>
>>> I don't remember ever seeing this with dwc3. How should I go about
>>> triggering this problem? If this was really the case, then we would have
>>> this on *all* UDCs.
>>>
>> dwc2 driver resetting DEVADDR in DCFG register only in function
>> dwc2_hsotg_core_init_disconnected() by soft reset. This function not
>> called on disconnect/connect with CV SW stack (function call not seen in
>> dmesg).
>
> right, this is a bug in dwc2. You should clear DEVADDR from your Reset
> handler, not disconnect.
>
>> This issue not seen with any other EHCI/XHCI hosts either on
>> Linux/Windows because these hosts issuing USB RESET, as result called
>> dwc2_hsotg_core_init_disconnected().
>>
>> In dwc3 per my understanding same stuff done in function
>> dwc3_gadget_reset_interrupt(), am I right?
>
> right, as it should. If dwc3_gadget_reset_interrupt() runs, this means
> the host *is* issuing USB reset signalling.
>
>>> I just did a fresh install of USB 3 Gen X CV (that I just download from
>>> usb.org). Ran Chapter 9 tests against a HS dwc3 board I have around and
>>> I can't see the problem you're talking about.
>>>
>> Yes, this issue not seen with dwc3.
>
> because we clear DEVADDR on Reset.
>

Thank you for review and feedback.
New patch "[PATCH] usb: dwc2: gadget: On USB RESET reset device address 
to zero" sent for review.

Thanks,
Minas

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

end of thread, other threads:[~2017-07-11 10:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-10 13:38 [PATCH] usb: dwc2: gadget: On disconnect reset device address to zero Minas Harutyunyan
2017-07-10 14:05 ` Felipe Balbi
2017-07-10 14:14   ` Felipe Balbi
2017-07-10 14:59     ` Minas Harutyunyan
2017-07-11  7:31       ` Felipe Balbi
2017-07-10 14:57   ` Minas Harutyunyan
2017-07-11  7:34     ` Felipe Balbi
2017-07-11 10:29       ` Minas Harutyunyan

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).