From patchwork Wed Dec 12 11:43:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minas Harutyunyan X-Patchwork-Id: 10726163 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 134B914E2 for ; Wed, 12 Dec 2018 11:43:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2C17283D1 for ; Wed, 12 Dec 2018 11:43:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E43042844E; Wed, 12 Dec 2018 11:43:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 60734283D1 for ; Wed, 12 Dec 2018 11:43:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726970AbeLLLng (ORCPT ); Wed, 12 Dec 2018 06:43:36 -0500 Received: from us01smtprelay-2.synopsys.com ([198.182.47.9]:38660 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726869AbeLLLng (ORCPT ); Wed, 12 Dec 2018 06:43:36 -0500 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id DE72924E094E; Wed, 12 Dec 2018 03:43:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1544615016; bh=EBQhvBOPj5FD2X9EQPNu4rSngHyYobbtM4G/IAv5/eQ=; h=Date:From:Subject:To:CC:From; b=CtAkup5H10F4AiBMA2uagy/t071SOK7vDDVCOvOZi15pUnOH5bIsh/66nBKaxx9fh SUrUiKZ3bkQwJH5SxRLGLXpaDOpxYhKrDIQ/GH2DWn+a3r4gIBHIX8LBzteVXGrISt tr+VSyAk3g4fmNyoJDxu3scKB+pFI32jIx3SmVTADxriUv46kd41vhAAdsUOkXtWg3 QU3L/Cgwjqe6vCwg2SVHM3HB9TZxdmoAcj4jKQY3jDvYznpcvUmw6jOI88Y5eMUqNC 9M1raLMYJzWIwxX2vkh6BCKPVO2kOMWAoJFKrtZFRq620/LVk9Yw1oZi1AVJRANucS 9lH432pKEXViw== Received: from US01WEHTC3.internal.synopsys.com (us01wehtc3.internal.synopsys.com [10.15.84.232]) by mailhost.synopsys.com (Postfix) with ESMTP id C74353CC9; Wed, 12 Dec 2018 03:43:35 -0800 (PST) Received: from US01WEHTC1.internal.synopsys.com (10.12.239.236) by US01WEHTC3.internal.synopsys.com (10.15.84.232) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 12 Dec 2018 03:43:35 -0800 Received: from hminas-z420 (10.13.184.20) by us01wehtc1.internal.synopsys.com (10.12.239.236) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 12 Dec 2018 03:43:34 -0800 Received: by hminas-z420 (sSMTP sendmail emulation); Wed, 12 Dec 2018 15:43:29 +0400 Date: Wed, 12 Dec 2018 15:43:29 +0400 Message-ID: <7920088e6620bd0b7739657c2bd8b703c2b43bb9.1544614809.git.hminas@synopsys.com> From: Minas Harutyunyan Subject: [PATCH] usb: dwc2: Reset device address on EnumDone To: Felipe Balbi , Greg Kroah-Hartman , Minas Harutyunyan , CC: John Youn MIME-Version: 1.0 X-Originating-IP: [10.13.184.20] Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Initially resetting device address was done in USB RESET interrupt handler. In case, when power saving mode enabled (hibernation) USB RESET interrupt handled in dwc2_handle_gpwrdn_intr() and then it not seen in dwc2_hsotg_irq() handler. This is why reset device address to zero moved from USB RESET handler to EnumDone handler. Signed-off-by: Minas Harutyunyan --- drivers/usb/dwc2/gadget.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 68ad75a7460d..7f922f19f8e1 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -3072,6 +3072,9 @@ static void dwc2_hsotg_irq_enumdone(struct dwc2_hsotg *hsotg) dev_dbg(hsotg->dev, "EnumDone (DSTS=0x%08x)\n", dsts); + /* Reset device address to zero */ + dwc2_clear_bit(hsotg, DCFG, DCFG_DEVADDR_MASK); + /* * note, since we're limited by the size of transfer on EP0, and * it seems IN transfers must be a even number of packets we do @@ -3614,9 +3617,6 @@ static irqreturn_t dwc2_hsotg_irq(int irq, void *pw) /* Report disconnection if it is not already done. */ dwc2_hsotg_disconnect(hsotg); - /* Reset device address to zero */ - dwc2_clear_bit(hsotg, DCFG, DCFG_DEVADDR_MASK); - if (usb_status & GOTGCTL_BSESVLD && connected) dwc2_hsotg_core_init_disconnected(hsotg, true); }