Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp290459pxb; Fri, 16 Apr 2021 05:55:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxL1o0ypjh9sGp5MduCfx8e/gOZt4aizeFYSXoh0oXshhkOv4uOPPzX4GwhtyCkUBKLIFJ3 X-Received: by 2002:a17:906:80d6:: with SMTP id a22mr8142667ejx.277.1618577758563; Fri, 16 Apr 2021 05:55:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618577758; cv=none; d=google.com; s=arc-20160816; b=j/7oRYW5M/oX3hls0nF94WOJBOgY2q/AleJwKBx3EWQqckEHyStKMFsDRgZV8TNvZ6 UD/Dq3br7KA/YUh7gcvuyuUlY11Y4mznHxcyS6szFhxG9BM8ai6UoLfoGlZX6G1ZKzAj 5Bp3hT5R6S/Zj8lMCLTMv25v5a2+BUSppltdImEIDkeefnW3fgsFft5bs/ZdyEzrUw8L bax61r51uxDxzdsTVjRLYp7K1yW7vpDFClNLyzLOalcjj1Dmikzv5M9BAxPUqxia5Dzt IR6DfCu9GX35wVNJBEGSLZLh92au9kNSZrmuHH5XXM6OR/77XrVnu4Zxy48GBMhtWtzq 3qjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:cc:to:subject:from:references :in-reply-to:date:dkim-signature; bh=TLzbbByV0F4DtufSEz+yG58MrDKPJ0YKKiSA2YtADJk=; b=nmQ9sfWF+NFZNeIhuOShE44GMTbnhx+8exE/5sujvCq2K/odK4VIAayoZ3c9Mlv23N mk+OFCra8RNVxs7xDmyhicyGWwlYkJdvF1/1F3aceqS6mko6ZcQjNV+Q5j3IfBlNVfG7 srewwfKhBq2cwQtmKLJXkcqtWxqkNfc/LZSdpzovHuzDmzhgcty2/CmTbxWwb1HsZvO5 31oSOv51OgXBgmGuO5/+45qUif+nKp8ajHOS23WS1NxHe/PWcGSFexYYqqEX43hoLLD0 dDT/OTxtk8l7un+oqxqUez+2Dv9Ve0NjsgwD4FTSpeyk+hI5rsBnJSszxrpf8BxTlUvi kpdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=iUcJP97k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t20si1695235ejd.62.2021.04.16.05.55.35; Fri, 16 Apr 2021 05:55:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=iUcJP97k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235523AbhDPMsc (ORCPT + 99 others); Fri, 16 Apr 2021 08:48:32 -0400 Received: from smtprelay-out1.synopsys.com ([149.117.73.133]:38460 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243264AbhDPMsb (ORCPT ); Fri, 16 Apr 2021 08:48:31 -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 C544440E1C; Fri, 16 Apr 2021 12:48:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1618577287; bh=VKvv7dpBu3/bQP8SJp7mAnHTwS9nd0ZI6IQSnKfwHEI=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=iUcJP97kDJ2VV6qTwOK47VqSL5Qkj8Q3vnaNRPVAf2+pF9++4xD4fkY/pdZLBXrPZ pdjyTtQxPl4caRJD7LO0zz9oLshuWJwmw3CTxJ1hvG7+aZtnH1h/2zcko2kQFtoKFJ iML8omcCqw64sXe7HazajMiwAlHZ0BH98rvwZyZLP16e+fMqsGUO3vz82qP0f1XTjS cLPcBXuStAI2+t9aVljXlStD5kesxhISbrEFueKPcW4weA+XYfpms0EKBV2+L8ZT5L imtlTfwlx9k0B3LECYxTE3W0DD7M5IMrrcYhlzzm4keLMbcta4GWJbo8KEmjAZG2BF zFDeXvWu8mHOg== 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 D1C1FA005F; Fri, 16 Apr 2021 12:48:03 +0000 (UTC) Received: by razpc-HP (sSMTP sendmail emulation); Fri, 16 Apr 2021 16:48:02 +0400 Date: Fri, 16 Apr 2021 16:48:02 +0400 In-Reply-To: References: X-SNPS-Relay: synopsys.com From: Artur Petrosyan Subject: [PATCH v2 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 Message-Id: <20210416124803.D1C1FA005F@mailhost.synopsys.com> 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 --- Changes in v2: - Moved duplicated error checking *if* conditions from innermost to outside if. drivers/usb/dwc2/hcd.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index cc9ad6cf02d9..093b1717df01 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -4631,12 +4631,26 @@ 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); + 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