Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2639217pxb; Tue, 13 Apr 2021 06:49:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiIU+CsT3gsQvaoorRfZoFSe/Z3eg4975xB4YNM4BxHF6+CfKzjMNeRAPLjhFOiApj+vys X-Received: by 2002:a17:90a:4b4e:: with SMTP id o14mr90154pjl.199.1618321766457; Tue, 13 Apr 2021 06:49:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618321766; cv=none; d=google.com; s=arc-20160816; b=HBBrneKI0ior02KosdLMeeRI3fkYriMAOjTATKK8zXHCDqAGDHdymVRdu3Peg0WFqW cc6G+mxZe7G3lV5e22qj4pgNXHfvkvVF6HaXh6TQlgPy9uzI0sKkIVSCCwLt/x0ywsJv mQeFo4QHg/9IzleXQHoBh7F78FN8YQKQeCvDeRWsfnPKHhWyoA+mUY7vNTKkJkkiPWHR s8C9PCcQJ68pz90zC2SP/nfwULcgSzPFKV+UZkVXsud37K1Ie5j6B9dkMFC9zWbqEZzM W3X9mGaNZh9eTrJRVaD8yb8fZE/3KQ5PkhSQ/eeoU08iKD1yR1vpyEz4e9OzxZzEQUHF uC2Q== 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=xN+km4QeLvtIEq9l73kyi7YrxVDE3V7OJ2Zu+4mTRxY=; b=IYVhHshm+xKQgx/Pnpvtgh5Gk+MM1t/DYVG1riobZW+8al8McidlsWNyDmW2EVCSvA nuDHTJIYwRrX0jYRwfk4KBc7y9gr15WXiVra4X1Fwyau1gBE8t1anhdzMB9lpflTtmM1 EKbBtqLfKezOuczl1RoAuoic9We4Xsrl17UjJvIO6kXhfVEkCvQ/EGaTfTA2g6TyrNAF MVAgybFHvPUDSgyfrrs5sTcv/F2uqhLCrieJYWg9J3nl7agwZnCr++pnBzKkdvCdpRjm fIlYjUQvSxBaAUWlM9lZ8y4OruQ1/hOvWwx3tQlOZBULZBeKwHI1orK2LF3dRvCfptfE FeZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=jzhJyLzu; 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 t11si17171632pgl.74.2021.04.13.06.49.13; Tue, 13 Apr 2021 06:49:26 -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=jzhJyLzu; 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 S240974AbhDMHhQ (ORCPT + 99 others); Tue, 13 Apr 2021 03:37:16 -0400 Received: from smtprelay-out1.synopsys.com ([149.117.73.133]:36492 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240890AbhDMHhP (ORCPT ); Tue, 13 Apr 2021 03:37:15 -0400 Received: from mailhost.synopsys.com (mdc-mailhost2.synopsys.com [10.225.0.210]) (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 5D6AE40162; Tue, 13 Apr 2021 07:36:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1618299416; bh=8Wm8ArFTDkXMAZMgFkFQMI2XRAMfTrV/2W6Sg9JcQCs=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=jzhJyLzu+Kn9s+Gr7rk8yTQmW9xewZsssP+0tgHceDntnhrGmYZ1bVo51GrJoVfXq BZnjHc+Bw7jKWbSvcDahYw1ebY/mijsRUBWLZyg60GuK3Sm2VCSI2bLcw9qi5JKrtP bptuzk5TqWZbc16cZjcywAJGszKJN6X7gf3kb/jWimIEI2bvZhuqqvORSEPHmwScwh jWiRsyHLQUIDW4qpFLufzRi3epC1I8tLEQuS0hyGXisJHIxPv0HcH67ocNz6NOZv25 H0sRMxDzBDbBg2v95fScxhWeh4q4xfVQ4UKIPWlKDEisXeKxsyq1cFoq8/IOUUNxjT NU6qbvEbhdK+w== 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 9F493A0094; Tue, 13 Apr 2021 07:36:53 +0000 (UTC) Received: by razpc-HP (sSMTP sendmail emulation); Tue, 13 Apr 2021 11:36:52 +0400 Date: Tue, 13 Apr 2021 11:36:52 +0400 In-Reply-To: References: X-SNPS-Relay: synopsys.com From: Artur Petrosyan Subject: [PATCH v2 07/12] usb: dwc2: Update enter clock gating when port is suspended 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: <20210413073653.9F493A0094@mailhost.synopsys.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Updates the implementation of entering clock gating mode when core receives port suspend. Instead of setting the required bit fields of the registers inline, called the "dwc2_host_enter_clock_gating()" function. Signed-off-by: Artur Petrosyan --- Changes in v2: - None drivers/usb/dwc2/hcd.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index 27f030d5de54..e1225fe6c61a 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -3298,7 +3298,6 @@ static int dwc2_host_is_b_hnp_enabled(struct dwc2_hsotg *hsotg) int dwc2_port_suspend(struct dwc2_hsotg *hsotg, u16 windex) { unsigned long flags; - u32 hprt0; u32 pcgctl; u32 gotgctl; int ret = 0; @@ -3323,22 +3322,12 @@ int dwc2_port_suspend(struct dwc2_hsotg *hsotg, u16 windex) break; case DWC2_POWER_DOWN_PARAM_HIBERNATION: case DWC2_POWER_DOWN_PARAM_NONE: - default: - hprt0 = dwc2_read_hprt0(hsotg); - hprt0 |= HPRT0_SUSP; - dwc2_writel(hsotg, hprt0, HPRT0); - hsotg->bus_suspended = true; /* - * If power_down is supported, Phy clock will be suspended - * after registers are backuped. + * If not hibernation nor partial power down are supported, + * clock gating is used to save power. */ - if (!hsotg->params.power_down) { - /* Suspend the Phy Clock */ - pcgctl = dwc2_readl(hsotg, PCGCTL); - pcgctl |= PCGCTL_STOPPCLK; - dwc2_writel(hsotg, pcgctl, PCGCTL); - udelay(10); - } + dwc2_host_enter_clock_gating(hsotg); + break; } /* For HNP the bus must be suspended for at least 200ms */ -- 2.25.1