Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp295258pxu; Thu, 15 Oct 2020 04:18:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpd/n/ALageXJoWWqNdfu1NlYc3mJxIybUkBoKBpFMZDOacICoo1it/Plz1Ksx2wJlc1mF X-Received: by 2002:a50:85c6:: with SMTP id q6mr3926622edh.126.1602760738540; Thu, 15 Oct 2020 04:18:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602760738; cv=none; d=google.com; s=arc-20160816; b=h7VhtwvRjYzoe69gkAXy/YKPAtsyCIStq5yfiAo1ux+9GvIiYtSW/DFm7uEKc66do6 9h2Xb/4KWNB2S6yQUcNmjfZPoFT95HHgB1dFf4UQnZO0sBibD9dZZSsoX6ZkCk00njxZ 1PQL6kBwIvm5FdFZnD3A081vg5CfkGF14EhQ3o74ku6jXm/qRCkfrIWMgTNK1l7WROXH xZXnOI6kUcpNOoQyC9Ye+OhoE88jKwC6qgp495+LgYuotGoktu4P9Is8e52S33v5uH4F jmL2Epm5/l8RLADkkJpieJY3Iy2Sus2/TZfrnFIduFgePWQ31bEopFfUQmMKNgOLZ4cN TCGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=6PqcFwgSJ+dhMzTW5dj7WOiueaJtj942uzt9t8W6JAk=; b=S0JQOh6JOxxfIS8ftKup/DQlCicEf++fir4qOdioVRYh39VcbmdLo6UjhTkNq8URM2 cdZg484EtrKRO+vTJpJTJ462AKU9+H0hQFyqsDaAArB5Xnm92ZD9RWcLkfcvBEeLlLPF irdaqaWrl4i36rN2iuX2Nca7a955+kc6KezChGua3P8itMsT6hWbYnwYHhOsz4Xq+ixo tOaYwgDPw+U1vLfN0dIIs71/YvXlK89HadEDH7SZs7V0+xFTLmAPyNZPlVgRUtgCO1tN BLNGfrv4SQCK1rldySb0y88J3tOifXgw6AqKOX0yi4PMz+UR6bd/1n63CSkU2Nq7whxO B92A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=kNLITBVk; 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=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bt21si37790ejb.368.2020.10.15.04.18.35; Thu, 15 Oct 2020 04:18:58 -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=@nvidia.com header.s=n1 header.b=kNLITBVk; 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=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388015AbgJOIMn (ORCPT + 99 others); Thu, 15 Oct 2020 04:12:43 -0400 Received: from hqnvemgate26.nvidia.com ([216.228.121.65]:17519 "EHLO hqnvemgate26.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728283AbgJOIMm (ORCPT ); Thu, 15 Oct 2020 04:12:42 -0400 Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Thu, 15 Oct 2020 01:12:29 -0700 Received: from [10.19.101.17] (172.20.13.39) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 15 Oct 2020 08:12:36 +0000 Subject: Re: [PATCH v3 15/15] xhci: tegra: Enable ELPG for runtime/system PM To: Thierry Reding CC: , , , , , , , , References: <20200909081041.3190157-1-jckuo@nvidia.com> <20200909081041.3190157-16-jckuo@nvidia.com> <20200928140653.GO3065790@ulmo> X-Nvconfidentiality: public From: JC Kuo Message-ID: Date: Thu, 15 Oct 2020 16:12:34 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200928140653.GO3065790@ulmo> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [172.20.13.39] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1602749549; bh=6PqcFwgSJ+dhMzTW5dj7WOiueaJtj942uzt9t8W6JAk=; h=Subject:To:CC:References:X-Nvconfidentiality:From:Message-ID:Date: User-Agent:MIME-Version:In-Reply-To:Content-Type:Content-Language: Content-Transfer-Encoding:X-Originating-IP:X-ClientProxiedBy; b=kNLITBVk6U2GLyLLHIureiAdLBNtU9LXHo6GXPSBRzelmlZjpfqugnQWM/VvKLJsP 9keay22ksDEazKstTbrUwk2IZH0jSkxM2zAQDnYa7GVfTve7bWs/lShzbArq2JyJXX LcpEBR93/fGPokAajQIXfrzlnWFb5R69rKNAI+PJPOmcVQIzG27l2OmHDpm+1Y2dUg xa+mkBV1F20v5/kjIJDucHnEo6TAgxk0rLtflieniEudoWEabAJ429zmGUrLVHTROF FIouBG/IeYx3kNAU6FhZJ2iEa8Gv4+RUSlEc4WfF/VPGgPo0MOzehPaLuJBbnv1lBh BnX6hyu2TNSjA== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I will amend accordingly and submit new patch. Thanks for review. JC On 9/28/20 10:06 PM, Thierry Reding wrote: > 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. >> >> 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). >> >> 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. >> >> 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. >> >> 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. >> >> The same ELPG enter/exit procedure will be performed for system >> suspend/resume path so USB devices can remain connected across SC7. >> >> 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() >> >> drivers/usb/host/xhci-tegra.c | 389 +++++++++++++++++++++++++++++++--- >> 1 file changed, 360 insertions(+), 29 deletions(-) >> >> 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 { >> >> int xhci_irq; >> int mbox_irq; >> + int padctl_irq; >> >> void __iomem *ipfs_base; >> void __iomem *fpci_base; >> @@ -269,10 +272,13 @@ struct tegra_xusb { >> dma_addr_t phys; >> } fw; >> >> + bool suspended; >> struct tegra_xusb_context context; >> }; >> >> 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 >