Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755579AbdGKK3z convert rfc822-to-8bit (ORCPT ); Tue, 11 Jul 2017 06:29:55 -0400 Received: from us01smtprelay-2.synopsys.com ([198.182.47.9]:49320 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753246AbdGKK3x (ORCPT ); Tue, 11 Jul 2017 06:29:53 -0400 From: Minas Harutyunyan To: Felipe Balbi , Minas Harutyunyan , John Youn , "Greg Kroah-Hartman" , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] usb: dwc2: gadget: On disconnect reset device address to zero Thread-Topic: [PATCH] usb: dwc2: gadget: On disconnect reset device address to zero Thread-Index: AQHS+YHTrvN+Vv7VDU6i+iB/EOmV5A== Date: Tue, 11 Jul 2017 10:29:20 +0000 Message-ID: <410670D7E743164D87FA6160E7907A56FDAC053D@am04wembxa.internal.synopsys.com> References: <87d19875fc.fsf@linux.intel.com> <410670D7E743164D87FA6160E7907A56FDABFD84@am04wembxa.internal.synopsys.com> <87shi31l6c.fsf@linux.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.116.104.159] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2894 Lines: 79 Hi Felipe, On 7/11/2017 11:34 AM, Felipe Balbi wrote: > > Hi, > > Minas Harutyunyan writes: >>> Minas Harutyunyan 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 >>>> --- >>>> 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