Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932327AbdGKHfH (ORCPT ); Tue, 11 Jul 2017 03:35:07 -0400 Received: from mga01.intel.com ([192.55.52.88]:49974 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932283AbdGKHfF (ORCPT ); Tue, 11 Jul 2017 03:35:05 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,345,1496127600"; d="scan'208";a="125640792" From: Felipe Balbi To: Minas Harutyunyan , 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 In-Reply-To: <410670D7E743164D87FA6160E7907A56FDABFD84@am04wembxa.internal.synopsys.com> References: <87d19875fc.fsf@linux.intel.com> <410670D7E743164D87FA6160E7907A56FDABFD84@am04wembxa.internal.synopsys.com> Date: Tue, 11 Jul 2017 10:34:35 +0300 Message-ID: <87shi31l6c.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2630 Lines: 71 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. -- balbi