Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2636477pxb; Tue, 13 Apr 2021 06:45:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNcLe0vfrZP0/DVvBjKThFwwcBWAtyyH2Z6JXjyTNUxFVdzBnkk86v5B+DUrDQoPS6rXu+ X-Received: by 2002:a63:5fc6:: with SMTP id t189mr31404004pgb.17.1618321556424; Tue, 13 Apr 2021 06:45:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618321556; cv=none; d=google.com; s=arc-20160816; b=dtP4mo952VpSagB4hv6j/vHQkKmuGIsoeQ59ZNYIrO/X85zaF6/GIYW23wChsyeUdR Mme282wICGHprshrD/WycgCor6W5vh3s0yYIjPYOTVbUmqy7Lne8uw8XN0iqJCWkMZhi 8/BIP9HN6D8tVjNHk7AyGt+AxCP/ZXnPFiT3zB8KQULw13McJkkuPwY//DM1YGanOOH2 AMBe0jFj4bWArbxzC4QJkG601hZNmg2qfBgWsTRMrXCbuU+UfPR/knrB/K2SuZC/mXxN bcnWDBwJ4z8jYL2//ISXHxXTrdc5vJCxqdhbqexNRKUviDdRS4qdH8CvDmYBgohlpZIo jCRw== 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=h8zDz+9Qf0c8syO0Ya3Oif8C5AZznfWppIfwCM6S6+Y=; b=GnN6ZO5xtRpetDsE6Y4xhA7LeLhXKLxB2Ep3h3vD1GRlLRByYIjSBZ/Zwy6rBU9dEu 8J8Qdzf4Mq7wCisGRINcxrTyVbdZvX0yHQSJWKEv8A1kYUamV5SuGxwvxE0RQ/21vS3H oEow3u+hW7RYfZtTxLwVNYrmGXi7KixevagB6zveYqvNRO1fUiXpoo+bQZCz5TLgnxjK UO4gE1bgRqamWz0f1x/J5IVAtJwxEyOY1VmQ8idKwGkN4HG6Pb0ayBP1A+hW7erXoBWg 6eGvovLSWHnlnRC3HyO+Kwgwl8t48I+zYHJZsKoav8RluaiHOOGUqa9o/XqeMAPt/yvY hihw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=mBh6MUwn; 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 33si10020613pla.46.2021.04.13.06.45.44; Tue, 13 Apr 2021 06:45:56 -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=mBh6MUwn; 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 S238842AbhDMHR7 (ORCPT + 99 others); Tue, 13 Apr 2021 03:17:59 -0400 Received: from smtprelay-out1.synopsys.com ([149.117.87.133]:59754 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238676AbhDMHRz (ORCPT ); Tue, 13 Apr 2021 03:17:55 -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 178C3C00E6; Tue, 13 Apr 2021 07:17:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1618298256; bh=Aq7sYQKiih3aGixqOw8/h3Bi7Ry2yotivKMTMAHf/lo=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=mBh6MUwnFffM1WY7WV6ZqBndeoj1wcGol05uxP4pvqE1fZM9g7xzSa9C/RoI4yN73 zLn+kPbVmw408NTKS3hjvyWMUjCkzyWCYFECdiLNrTBs3Rz6DLxIakx8R1euQ78+CM BBUAlFH9Jf1PnK9hukwcAt3B5fOfJLTLcFp3cJ8kJzPTheKQct2dsgEtBIxGVXjkjA iLWETchq8UeVKjTOcBqxTuT8u7koqFh9USfOcCkyKnmQhubMcCVQmIZIxwCxUx8Yqs JgFCMZTlL3H1yy8F0Ox/jCElIncfb5grLup83ZQO7Jlj+zj+M7NVc4Oph/Ij5dEnP0 5ukhTr8c9FtsQ== 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 5B1C9A022E; Tue, 13 Apr 2021 07:17:33 +0000 (UTC) Received: by razpc-HP (sSMTP sendmail emulation); Tue, 13 Apr 2021 11:17:32 +0400 Date: Tue, 13 Apr 2021 11:17:32 +0400 Message-Id: <149265dd7416633cbfed33f2d61a996cb1947f4c.1618297800.git.Arthur.Petrosyan@synopsys.com> In-Reply-To: References: X-SNPS-Relay: synopsys.com From: Artur Petrosyan Subject: [PATCH 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 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 --- 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