Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2464180pxb; Tue, 13 Apr 2021 02:31:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHJTFvK9edestELkCxziumKkuMqLM+WB+5zM4LAQ/MuaXmqUuMvCjmS3tnhxGSBf1NphAc X-Received: by 2002:a17:906:4913:: with SMTP id b19mr9625736ejq.439.1618306287524; Tue, 13 Apr 2021 02:31:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618306287; cv=none; d=google.com; s=arc-20160816; b=EdBQCA4sEbmaI7kt0A2F8bbYhNk8Xd/u/nueDvzDaaFzmyrSIO8cy8vHh1DH5qZs0Y DMhbjbItUaZOxOn47AbkE4eYZPhHD2RWw3/9g1Rt2o9LSPS/1sbtt//1E9rtS7byjMv/ 8QO+Zph4svzkKtdhaAlojmDvoGlzMuJdsRF5mNO6Fw0yExEQenZpU5dc8DfCIW1g1FfA vtxmKV6wi9SB9+gMwVnYtqnCsMOZ8X4G9xod2SpjfmomGrQYrl+2Z40ltV+FK+FEtW2S v7lpmr2kuF2v3gZIGJdCBvOHISYbMgj0Cf9fQKld1R+/D1c93T0ZP1k/gncw5F8rN0Oq qyCg== 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=HchvZkn4v9Fvp+Sz6Kwd/zsiGmX4tjBuBuzjrdwO2nc=; b=wibuEYRF0y15r8J/MnJXGpkCK8kYcnhOpxwFRaf84ArRoJKWrLwduSzT1dFu71aAZm opwvGMZmjaCxZyysK8xjqnq++/j4cdS7i4vzZVguNlfjuyplTem+3KufH5dAWEi0Hzbe HzQXi03vcDLWYDYta0M53dV7K4vPjut9vnQTcypnHWNty8v80YEcZiu9VrQOJP7vecP8 t4sIdja41WPkwECffS+GA3BxivKBWB3DJVDaOF4SIHpS3V6UbOoZYh1g7bXk1C/M1akH VwSC6y2064XW/sxpkUK1JqsXFjah/qMSSq1Zg4liPIA+iKGOUojXLw0X4gIthdOg2s7i LRYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=Iyx+kiIB; 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 u23si2839263ejx.579.2021.04.13.02.31.03; Tue, 13 Apr 2021 02:31:27 -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=Iyx+kiIB; 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 S242560AbhDMHiD (ORCPT + 99 others); Tue, 13 Apr 2021 03:38:03 -0400 Received: from smtprelay-out1.synopsys.com ([149.117.87.133]:60574 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241950AbhDMHhp (ORCPT ); Tue, 13 Apr 2021 03:37:45 -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 6FCA7C0114; Tue, 13 Apr 2021 07:37:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1618299446; bh=AZ/oQOAeGT0gsqZk0VXwMupD/Fhho98Hy6eZwRCpkz0=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=Iyx+kiIBne9EeIjR6YIIHTDTIzTwoRI3PSH7rvBliaVc1H3lUlVBYYgvgKoSGmDf+ si8D2RRxrUHtPd2AR/jdNWBw7ieO8Nc7sJZM+FWWmFxNu7w9YOHq44M/x9jvHV47YZ oq/LegX19fAHFOR65pVwR6MAd0YlhOrc5Thyho/oCQzG+2Xu4SEjFpgT3ALjRE81Qf 8uKOA2SNDNA8NALgRSPW0g8zofQfRcHNGrnbZqNU3UwRahj5rqOhV8sl8hhyi+A/EF 7DZeJRhRNvEiqcZMyONFXYtQFnyJwg9U6MgyZ1AyAz/XWzynUI1FcSsC/LgrBGad8E W2eLadOsxakMQ== 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 BA0FEA022E; Tue, 13 Apr 2021 07:37:23 +0000 (UTC) Received: by razpc-HP (sSMTP sendmail emulation); Tue, 13 Apr 2021 11:37:22 +0400 Date: Tue, 13 Apr 2021 11:37:22 +0400 In-Reply-To: References: X-SNPS-Relay: synopsys.com From: Artur Petrosyan Subject: [PATCH v2 11/12] usb: dwc2: Add clock gating exiting flow by system resume 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: <20210413073723.BA0FEA022E@mailhost.synopsys.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If not hibernation nor partial power down are supported, port resume is done using the clock gating programming flow. Adds a new flow of exiting clock gating when PC is resumed. Signed-off-by: Artur Petrosyan --- Changes in v2: - None drivers/usb/dwc2/hcd.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index 09dcd37b9ef8..04a1b53d65af 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -4445,6 +4445,28 @@ static int _dwc2_hcd_resume(struct usb_hcd *hcd) break; case DWC2_POWER_DOWN_PARAM_HIBERNATION: case DWC2_POWER_DOWN_PARAM_NONE: + /* + * If not hibernation nor partial power down are supported, + * port resume is done using the clock gating programming flow. + */ + spin_unlock_irqrestore(&hsotg->lock, flags); + dwc2_host_exit_clock_gating(hsotg, 0); + + /* + * Initialize the Core for Host mode, as after system resume + * the global interrupts are disabled. + */ + dwc2_core_init(hsotg, false); + dwc2_enable_global_interrupts(hsotg); + dwc2_hcd_reinit(hsotg); + spin_lock_irqsave(&hsotg->lock, flags); + + /* + * Set HW accessible bit before powering on the controller + * since an interrupt may rise. + */ + set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); + break; default: hsotg->lx_state = DWC2_L0; goto unlock; -- 2.25.1