public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
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:34:35 +0300	[thread overview]
Message-ID: <87shi31l6c.fsf@linux.intel.com> (raw)
In-Reply-To: <410670D7E743164D87FA6160E7907A56FDABFD84@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 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

  reply	other threads:[~2017-07-11  7:35 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
2017-07-10 14:57   ` Minas Harutyunyan
2017-07-11  7:34     ` Felipe Balbi [this message]
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=87shi31l6c.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox