From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80C66C43461 for ; Thu, 15 Apr 2021 05:40:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 609F2613CE for ; Thu, 15 Apr 2021 05:40:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230451AbhDOFlP (ORCPT ); Thu, 15 Apr 2021 01:41:15 -0400 Received: from smtprelay-out1.synopsys.com ([149.117.73.133]:56494 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230442AbhDOFlH (ORCPT ); Thu, 15 Apr 2021 01:41:07 -0400 Received: from mailhost.synopsys.com (mdc-mailhost1.synopsys.com [10.225.0.209]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 19C25400CB; Thu, 15 Apr 2021 05:40:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1618465245; bh=RxiBBUBDNJeCPKVTcE/c2kcOM6ahrlbWIsZdYFTZEpw=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=cd42AV5DkcZas4dLhQ6VXTrlXG/v1z9yl3WWbPeIqtEqwlFSlN9LX8Qy0FelV9bj3 H+a49mQN/kSM5dilth0dIEtlqZ9SCICobzImal2QDOHMffvUI3HKpWE377GSpOusgm XJKRutOfRroZSWqLEbrErIvrJ0EwlB/sqYwg/BxO+MLvZYjt/VLtFBaTQNolIqVeH+ xu902MjNn1cXhVA178i+NopUWba0Hauw3RC5eZeGYFHJZklYzUuFu0LK+emISbZvt7 cKB7i+2/v7Brlj7sctf8pF8CL/zVjqdzER6eHRoCN1Sq/jad1LAy8bdIlD7je3vRgn rkuc5PqaNBsfg== Received: from razpc-HP (razpc-hp.internal.synopsys.com [10.116.126.207]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by mailhost.synopsys.com (Postfix) with ESMTPSA id 1CDB1A005C; Thu, 15 Apr 2021 05:40:42 +0000 (UTC) Received: by razpc-HP (sSMTP sendmail emulation); Thu, 15 Apr 2021 09:40:40 +0400 Date: Thu, 15 Apr 2021 09:40:40 +0400 Message-Id: <65daa916b29e0009083702cb4584c8274e58ddac.1618464534.git.Arthur.Petrosyan@synopsys.com> In-Reply-To: References: X-SNPS-Relay: synopsys.com From: Artur Petrosyan Subject: [PATCH 10/15] usb: dwc2: Allow exit hibernation in urb enqueue To: Felipe Balbi , Greg Kroah-Hartman , Minas Harutyunyan , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: John Youn , Artur Petrosyan Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When core is in hibernation state and an external hub is connected, upper layer sends URB enqueue request, which results in port reset issue. - Added exit from hibernation state to avoid port reset issue and process upper layer request properly. Signed-off-by: Artur Petrosyan --- drivers/usb/dwc2/hcd.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index cc9ad6cf02d9..3b03b2d73aaa 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -4631,12 +4631,29 @@ static int _dwc2_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, struct dwc2_qh *qh; bool qh_allocated = false; struct dwc2_qtd *qtd; + struct dwc2_gregs_backup *gr; + + gr = &hsotg->gr_backup; if (dbg_urb(urb)) { dev_vdbg(hsotg->dev, "DWC OTG HCD URB Enqueue\n"); dwc2_dump_urb_info(hcd, urb, "urb_enqueue"); } + if (hsotg->hibernated) { + if (gr->gotgctl & GOTGCTL_CURMODE_HOST) { + retval = dwc2_exit_hibernation(hsotg, 0, 0, 1); + if (retval) + dev_err(hsotg->dev, + "exit hibernation failed.\n"); + } else { + retval = dwc2_exit_hibernation(hsotg, 0, 0, 0); + if (retval) + dev_err(hsotg->dev, + "exit hibernation failed.\n"); + } + } + if (hsotg->in_ppd) { retval = dwc2_exit_partial_power_down(hsotg, 0, true); if (retval) -- 2.25.1