Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp498682pxb; Wed, 14 Apr 2021 22:41:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMCs2yde0h0XfX8f7jvkCOpn//pz3cZoq96b/zrE0yeVjqd13jnhrpc79iNdbiNB7K+H31 X-Received: by 2002:aa7:938f:0:b029:244:d335:fb8f with SMTP id t15-20020aa7938f0000b0290244d335fb8fmr1579129pfe.52.1618465318325; Wed, 14 Apr 2021 22:41:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618465318; cv=none; d=google.com; s=arc-20160816; b=wkC+xVjUKiYfyDygcsh2yQXjIiUDT5hkJd52DNFg1uU0zCqstMudejkJ7nQShBCyvu kBsW/wTOpoRzDvy5JvhxGD3rEvV4l/tXahlMPCYPWGEKdRTmujynUjI2OQATK89peLx4 5UUSoUznOt91mW/lkM6hURDoTS26393lG2h+TrE0pW4AekolzsBztS2BMyFPXN/kfJXq frdIzcQjRQxkQwu+AetVLX7QCkzRzmjKxM3sNQXIoYXuTsAWpiR3o9nw9xuC5Njb2j9W dLYwhzuXmazapmznVJpvh9vkGaQflhWw01OAFRaPYDgV7yQLHrPIcPA/987WVYbJ/IyI EXYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:from:references:in-reply-to :message-id:date:dkim-signature; bh=STA3vSGM/eb+u9J7XlUt/MzC/TnOaOHtUN3Zax5/htE=; b=fNcuPA2qFpfzw9jtCOdPJuHtdaMJ8P3/mBlbqsDyvBempzgvPaqoy2UBUfywz2XcJB jSfEw5Yz4m1w+42UaeNUxccneME1GieFg9NFfAyexJg96ohL2xOzOjgMptf0F5bQJRpp qOqDUTNXn2c+gn8p7PpQ5mtxt6T0R7NUbvJrgsefwZEvQOpPimvfrCgTIjjzZWB00o7n eJJDhEX1f4DaEEL6hgNzsDPzDqpN8tKweapbTtd66nP/A0Ro9wNmzT5YwoTIiL+P2Qyh n9Xb1ey63I7ddmlm/o/+L9SwFrIr8iMutpVoPlKQBZxrezhoy9ihQjiYzMGIQf0SuNiF QPpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=cd42AV5D; 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 t16si2036927pgu.405.2021.04.14.22.41.46; Wed, 14 Apr 2021 22:41: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=cd42AV5D; 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 S230464AbhDOFlO (ORCPT + 99 others); Thu, 15 Apr 2021 01:41:14 -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