Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3046394pxk; Mon, 28 Sep 2020 07:08:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7o0GhBa+6EPZiKzQ3B96AYPwgKor7lrurSIAVaCqMj5GwUE2/ZhoZe9HOTn946g7UcJ+m X-Received: by 2002:a05:6402:1b1d:: with SMTP id by29mr1958576edb.96.1601302102479; Mon, 28 Sep 2020 07:08:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601302102; cv=none; d=google.com; s=arc-20160816; b=YAsjXBKyJfp95d5n5Nt3g0W1VNGET7xBtioeu9ei1Hh1zSg59zWGKMcUTME6fTk1A9 sqFcYebgMtszUGFgiICsVodGxQ2mHpL3LkzwgnCyNX2GTXUTmgxB1uIMw88VmfShsyMs nqpCLUfdnBRsaDKS/wSWpoRp/jTbil9B1iNEBvQZv0VDxHwf0XcYzJiU/J9rzuSRGomh r8/3BRc+ZWqWOFNWJkGmS1jBq8hXnCwxRLpKIru4wQ/RVtrP/VhhtCsugRfjBmMyUtMH bbU6J3zTCAM6l1C0smRmqeuriGYnRraVPzNhkdPoiBZ0GVNaNOCkYDjuZtNVfedMXUuV 6YUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=WfJczYERUFdenR05uGVZr/+UQWZo6E3KWcw73dbx8xM=; b=g87REV0n1O7mngn9Vub3erlpRNK87I51gxmb1F95LGazSdwzzftWG5uDISYK/JGsFP 3mCChH/bJDFGF0NQ58Hd5SebsHgEXT38bLG6M6o7vjImzdst8E8TXxO0s6ZOBQUs6a1X gIRHVQ4C6UNty3K7p3hgQkxayY0DT0+0bOqqF98tbDRNvIATL95vDzSy4ggo3Q7lPkh0 +tFcHoEQJfsiTb/2jlHG5qotlShQc09wPyrhxMhUHK7+UjriRAOr0UW9zvQEV9Wzj4r4 XamQdXrqMlpFVk9S3rpQk7EXZ24J/c7Tt0QJUreKc5SFCb0F9uSkPhM50YCs4UedQtwZ D+lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OVAG3tfR; 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 a25si647990ejx.145.2020.09.28.07.07.58; Mon, 28 Sep 2020 07:08:22 -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=OVAG3tfR; 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 S1726578AbgI1OG7 (ORCPT + 99 others); Mon, 28 Sep 2020 10:06:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726291AbgI1OG7 (ORCPT ); Mon, 28 Sep 2020 10:06:59 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0838CC061755; Mon, 28 Sep 2020 07:06:59 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id z1so1515027wrt.3; Mon, 28 Sep 2020 07:06:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=WfJczYERUFdenR05uGVZr/+UQWZo6E3KWcw73dbx8xM=; b=OVAG3tfRnVO4B91UkFjR+7WYJqkELHiarMMp3PY6hV+bBupz6+vAcNn1oBz9H8aa9P aO5OzLuQSvWI+LiK5LtxNB3gJ4Am2mVLcwqE5/k3A5TTYNCdWfGwSC17ZJbkIfM03RJk hvaBHbuq8OBcAeUWE/5SDacrET0I2vv73woA9EUN/i9/o1c3xHW4tQfNDnopMIxs8z++ 2QMv9VK6s3nYpioVqctmu0zh7WOnf5YNE7jx0vA2eMMQDOhATzM5styAGJsy/hMTjqqB B6fGIg95y1YYxs3PfvrFt5iOqVm1A52ZIHcBSVJhRndXCPNpXBDaUO+/kPEw2bhths2e tsYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=WfJczYERUFdenR05uGVZr/+UQWZo6E3KWcw73dbx8xM=; b=cN/heeAIDvUIeSX/FKhAsa1V8XM6Gutau96N3mRrIZttu920EB6ycI66FqdrvLIr6f 0fESUY10rRxOu78BLfpe4CIVfh6S5K5xqNtWscUgpzGTmyszbbHJQM0WPxNd/sAb5Kbj cwpK6/XSozJ9WBhF5X5xuKholdefyAjKc72LgmhD0Yxnu0T2x9LgiSskGs1DZhrZC/9q GbVER/OYTHGAcB5l92A4EQKYkgUk2GXRKr++WytqMQMV0fPNfyH7ZxZ7In4i5DEQJpv8 zQGvGdaiEdq22580xdyFgp95ZK7m3J0lT9j6uHFhpKzbAaRQ/MVvsMic09uNjKFyWOVH OfwA== X-Gm-Message-State: AOAM5310XTlqmtjx2/siX5NeypWB2Yi9Gm0DYjZJwO4tuhTEYAjH5f+U JphSx6+frdNxwZ4eZJuOjLA= X-Received: by 2002:a5d:4a4b:: with SMTP id v11mr1965571wrs.36.1601302017616; Mon, 28 Sep 2020 07:06:57 -0700 (PDT) Received: from localhost ([217.111.27.204]) by smtp.gmail.com with ESMTPSA id k5sm1496343wmb.19.2020.09.28.07.06.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 07:06:56 -0700 (PDT) Date: Mon, 28 Sep 2020 16:06:53 +0200 From: Thierry Reding To: JC Kuo Cc: gregkh@linuxfoundation.org, robh@kernel.org, jonathanh@nvidia.com, kishon@ti.com, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, nkristam@nvidia.com Subject: Re: [PATCH v3 15/15] xhci: tegra: Enable ELPG for runtime/system PM Message-ID: <20200928140653.GO3065790@ulmo> References: <20200909081041.3190157-1-jckuo@nvidia.com> <20200909081041.3190157-16-jckuo@nvidia.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="BuBclajtnfx5hylj" Content-Disposition: inline In-Reply-To: <20200909081041.3190157-16-jckuo@nvidia.com> User-Agent: Mutt/1.14.7 (2020-08-29) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --BuBclajtnfx5hylj Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 09, 2020 at 04:10:41PM +0800, JC Kuo wrote: > This commit implements the complete programming sequence for ELPG > entry and exit. >=20 > 1. At ELPG entry, invokes tegra_xusb_padctl_enable_phy_sleepwalk() > and tegra_xusb_padctl_enable_phy_wake() to configure XUSB PADCTL > sleepwalk and wake detection circuits to maintain USB lines level > and respond to wake events (wake-on-connect, wake-on-disconnect, > device-initiated-wake). >=20 > 2. At ELPG exit, invokes tegra_xusb_padctl_disable_phy_sleepwalk() > and tegra_xusb_padctl_disable_phy_wake() to disarm sleepwalk and > wake detection circuits. >=20 > At runtime suspend, XUSB host controller can enter ELPG to reduce > power consumption. When XUSB PADCTL wake detection circuit detects > a wake event, an interrupt will be raised. xhci-tegra driver then > will invoke pm_runtime_resume() for xhci-tegra. >=20 > Runtime resume could also be triggered by protocol drivers, this is > the host-initiated-wake event. At runtime resume, xhci-tegra driver > brings XUSB host controller out of ELPG to handle the wake events. >=20 > The same ELPG enter/exit procedure will be performed for system > suspend/resume path so USB devices can remain connected across SC7. >=20 > Signed-off-by: JC Kuo > --- > v3: > use 'unsigned int' for PHY index > remove unnecessary 'else' > drop IRQF_TRIGGER_HIGH when invokes devm_request_threaded_irq() > =20 > drivers/usb/host/xhci-tegra.c | 389 +++++++++++++++++++++++++++++++--- > 1 file changed, 360 insertions(+), 29 deletions(-) >=20 > diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c > index aabff8ee0bb3..ba3f40e78171 100644 > --- a/drivers/usb/host/xhci-tegra.c > +++ b/drivers/usb/host/xhci-tegra.c > @@ -15,9 +15,11 @@ > #include > #include > #include > +#include > #include > #include > #include > +#include > #include > #include > #include > @@ -224,6 +226,7 @@ struct tegra_xusb { > =20 > int xhci_irq; > int mbox_irq; > + int padctl_irq; > =20 > void __iomem *ipfs_base; > void __iomem *fpci_base; > @@ -269,10 +272,13 @@ struct tegra_xusb { > dma_addr_t phys; > } fw; > =20 > + bool suspended; > struct tegra_xusb_context context; > }; > =20 > static struct hc_driver __read_mostly tegra_xhci_hc_driver; > +static int tegra_xusb_exit_elpg(struct tegra_xusb *tegra, bool runtime); > +static int tegra_xusb_enter_elpg(struct tegra_xusb *tegra, bool runtime); Can we reshuffle the code to avoid these predeclarations? Looks like they're only used in tegra_xusb_runtime_{suspend,resume}(), so perhaps move the implementations right before those? Thierry --BuBclajtnfx5hylj Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAl9x7fsACgkQ3SOs138+ s6GviA//bArY95N26kWGSQkCddCGbNVfmaKT8ob441Ff3cYz0E84EhyFK4NbKXiW SnK9nz92bD36pEOq4zHqrt3Fr/oxawBu7nUKn9EhQzabPUNT8u85MH9W5CopwhU4 tJrLWmfiyJbX390CXU2jUW3rRs6sIZ6q7Cg8duX3J5cDZtijcJ6yZ5GFlqtEmwMq YwRlrVxm2yYo/jYvkmnYUDxwK/DT5KvX6cblQ69eh20DPL5e7J57uBEPNnum2n88 5hFkNFjBjfy0lb1MhGq6mpSjXNzqWOUxS6CPNbi6VYahaIZjYbLqQljGobuuKQXQ J9Ri0zGLO46+4T3Rog6o4Rpm123Kuxl9EkyO/6WOQpMpIrw3KwJsZWmd3xMLBqNx WshobHLSIKXRaIm/Mng3QTFyOe2EqXbnItNlLlzCV68z3hF25GUUpmelSLfK+ltW Ywrh3xDEgUz/vVduW6AxYwpF1fKCNEtPS41VLn8vzwJ5C+Sy5AMhJWH/qoilFLZi aGt+jovRHfXaltxhUU8djloEjHIe57nflEcNnqTfzCHDP9oqhI3krU2QIt2t5xGB lxXOj/ZXC6DVDdcyHEfOxOk5siGvkf4vM871deQACPRthyb84UYqGVz91ztdz6+l sJnOIxr5fxqxSr8tz4COZFEr+LwrmWAhDC8ZriUo8GjvAW5DTp0= =ieLj -----END PGP SIGNATURE----- --BuBclajtnfx5hylj--