From: Felipe Balbi <balbi@kernel.org>
To: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>,
Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>,
John Youn <John.Youn@synopsys.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"linux-usb\@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel\@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] usb: dwc2: gadget: On disconnect reset device address to zero
Date: Tue, 11 Jul 2017 10:31:45 +0300 [thread overview]
Message-ID: <87vamz1lb2.fsf@linux.intel.com> (raw)
In-Reply-To: <410670D7E743164D87FA6160E7907A56FDABFDBC@am04wembxa.internal.synopsys.com>
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
next prev parent reply other threads:[~2017-07-11 7:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2017-07-10 14:57 ` Minas Harutyunyan
2017-07-11 7:34 ` Felipe Balbi
2017-07-11 10:29 ` Minas Harutyunyan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87vamz1lb2.fsf@linux.intel.com \
--to=balbi@kernel.org \
--cc=John.Youn@synopsys.com \
--cc=Minas.Harutyunyan@synopsys.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.