Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp609095pxb; Thu, 15 Apr 2021 02:13:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNeZnsX4CmUW2W0Qdyybrglj8lN+DAY+aQPig9onXoBhY0mcUlrLI1pRdg6pEFEU8mfwkH X-Received: by 2002:aa7:cb89:: with SMTP id r9mr2954082edt.245.1618478023809; Thu, 15 Apr 2021 02:13:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618478023; cv=none; d=google.com; s=arc-20160816; b=WMTkUWNCnEM6X8Cjay+/exd1UVvTRqIJILzEL3+6p9Rxw2RAAgNPr35FV1/4iK/SHC yAzbgjjxNA3q/GdJk0qGx4gydcSEu7nbYSmq2Zq/JwqqGNbNx+mvCNvrMhNM1BM51HM7 IVwVhPUycyvgEJdexenRmwzyzFoDwatDpPRyjYRzN2L6ZtK00C1fnPzR2aAx4ZNc5tae ffiPKFlNCtB8isZlYWVlnK9B6pTvCF0QZ7idJFcOYP21vfLQkxoryXJy3sZ6LupO5XCC 40IRXKEAe+VFPeAjDkkzCdSj9ibADy20WhuqrnpwfYAlXnDIgK/G49+dx7tkRBmqEfBQ 1OGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:dkim-signature; bh=yWvqsI9bDP94NFY7a0CrpSrstBZeg9rVyS+9OHcqvYk=; b=hzRkwMsWpLj9ltrGJi9nZpa5sey+Vba1xTEggS5RYoRhgy0amzp3/0LS3WHXptHGdI NYZC9k6kxQdVkZrAezwzYhg3rXV3Q00IBYwfHmv924O0HH540LTjp0OCjyugYAHbmRaG QVmXCrCIedgy0h96rB47YCn+sYE+kuN5LD3RaK6KKL+9D6PDpEzfvMBEGPkerXDxTfVF 3DhvZjhO9wwFUijxC2eIjjXXnCKwf5XzMKrArk5eePS8AlzthZX4mZ/dTq/ZufTdrbKI r2MaYDHDTSkhmRpP8eUYtz1CIdHZEjf76w1D+ScwbLfDYhx2cc8ZhQzVSZZTInSiFYoX j1lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QZ2HATli; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z10si1864117edd.211.2021.04.15.02.13.20; Thu, 15 Apr 2021 02:13:43 -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=@gmail.com header.s=20161025 header.b=QZ2HATli; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231843AbhDOJMu (ORCPT + 99 others); Thu, 15 Apr 2021 05:12:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231732AbhDOJMr (ORCPT ); Thu, 15 Apr 2021 05:12:47 -0400 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DB96C061574; Thu, 15 Apr 2021 02:12:23 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id r22so15583841ljc.5; Thu, 15 Apr 2021 02:12:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:organization:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=yWvqsI9bDP94NFY7a0CrpSrstBZeg9rVyS+9OHcqvYk=; b=QZ2HATlif07v0vjr7jZHCGM4yPRG0TAKJdfLgZDVZPHgUJE9qyNsZKPZfAiNq+pIcn GOEsP8IBJ+2yaNC5A0/W0fL1W2aJbA+98FUSFEwfd202y7A51DeMaNdbdcYOewId53nG +Rqs2eRrsrSnlAo6c9TM0yDNg7yx7zdmi1S7zh8BPUD8QJt1d8Mg6ZAepeN+odaXwYKh s3n76Oa5FXsyTWxQfPxxQQNqgxDkAA/a6emxmP+Ud51hDVH5wGhLxw3kDlP/Olnf+90C yAu7HvxP6KLbv0jitb2MpknYM8GLRmi7NjegJWSqNtdseYNe7s5qnAG+5lLGbYK6r/Uu taMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=yWvqsI9bDP94NFY7a0CrpSrstBZeg9rVyS+9OHcqvYk=; b=CuHQfO0WXSGqYZCqt8ndVRHxsPoWhKNTACQ3v1BICYI2cyFWz5Ww54EFqJg1HJSSRd +WdB2nVji/tKO8cPd3UHvRCNPuzPQKvp5dRl/lXTU6k/7Z1YfvdoIyGEa56ZYcLRHTXj Vugxe/K0yHnkQw35SGpCP6VosxLncxr4NE1YUkzIDA2AX8gxz6THtVhRhXJSvddEIYEW 0cTe8v53NPSPoLGjXJ47jf9tSP1zKr7UOGyeCLQA1LGG40AozeVyQ5lxHUO0jMjpwCOa rRyKGVOHZhAbicsufsPXg0pHj7cD5heqyjWif6NlnVOO9gpiZELyg+AemXADnfYgIPCL OmqA== X-Gm-Message-State: AOAM531uJg2EjycbdW6jg+Ma4ogdoG0FtJrV32n9dt5EiBKSkphXCuO4 bfqQ185TJDPaVMcTH3C3dxQ= X-Received: by 2002:a2e:9041:: with SMTP id n1mr1196553ljg.127.1618477942094; Thu, 15 Apr 2021 02:12:22 -0700 (PDT) Received: from [192.168.1.100] ([31.173.84.170]) by smtp.gmail.com with ESMTPSA id d15sm598649lfs.277.2021.04.15.02.12.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 15 Apr 2021 02:12:21 -0700 (PDT) Subject: Re: [PATCH 10/15] usb: dwc2: Allow exit hibernation in urb enqueue To: Artur Petrosyan , Felipe Balbi , Greg Kroah-Hartman , Minas Harutyunyan , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: John Youn References: <65daa916b29e0009083702cb4584c8274e58ddac.1618464534.git.Arthur.Petrosyan@synopsys.com> From: Sergei Shtylyov Organization: Brain-dead Software Message-ID: <8b16e1ea-b8bb-b3fd-29ce-a997579f92eb@gmail.com> Date: Thu, 15 Apr 2021 12:12:13 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: <65daa916b29e0009083702cb4584c8274e58ddac.1618464534.git.Arthur.Petrosyan@synopsys.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15.04.2021 8:40, Artur Petrosyan wrote: > 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"); Why not put these identical *if*s outside the the outer *if*? > + } > + } > + > if (hsotg->in_ppd) { > retval = dwc2_exit_partial_power_down(hsotg, 0, true); > if (retval) MBR, Sergei