From patchwork Fri Nov 6 09:46:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Macpaul Lin X-Patchwork-Id: 11886685 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AFC2C697 for ; Fri, 6 Nov 2020 09:57:41 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4A5E520B80 for ; Fri, 6 Nov 2020 09:57:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="3aL32Kq+"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="nkoqy+XQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4A5E520B80 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ti62H0MWUf2sCd681jvJdw8jhBRA4evNt8NMl/XtPoA=; b=3aL32Kq+c7aP9meWyyhxztZil 4tkrXILrc+c5GglaJ8RLNcOvfXNq9X8EwZ2B/Q/OTTb1VWnrp3AOQKRDOL1F5eHxfZ9UYDr6PBUjf b/9Kdnuym5M8P1vDCVQC2EmtJv4F9ka5/kODcJlE8Cme4YEZzIU+TcPevrL3ZOxrySwHRM/R4VOVj D0QQ4dbVarlpUdO4bFfH2zgr6Ju/dR/EGc6Pb561dKtvcsKI6s7DxnH4tMpdPYLBTGQ6sPRQHrHc0 VWGumMIPUS7Y2e+AMofmQpMvixaGCuXQUURJvlcpcYaQ2V213QHt/ci8Y3Vt1cRUDsR1VsKtKBEyl n3jOr2emg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kayUs-0002hJ-Fj; Fri, 06 Nov 2020 09:57:30 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kayTq-0002F5-7X; Fri, 06 Nov 2020 09:56:47 +0000 X-UUID: 3012c31663724dc88955e3436355c3ef-20201106 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=nZF0DdsIJwxWtcW9KIrcWb3w3fQkXokXC3HEVud4yEk=; b=nkoqy+XQf4ZiCEDiql0f1zL2xvnaBwr+gSkITYsqhZpxXnh6ktFJVtTzKwRVjZyODQsj/CPFxl/rb5RlT1SZQtDBZV+7EYYy4l20G/s69aaG3X/kEL1DW0Inbt1IZoth8rRnIcEubq3IY0FROzaCP2OGQOtbGZ7jqZrlc/br7OE=; X-UUID: 3012c31663724dc88955e3436355c3ef-20201106 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1975537601; Fri, 06 Nov 2020 01:56:23 -0800 Received: from mtkmbs05n2.mediatek.inc (172.21.101.140) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 6 Nov 2020 01:46:21 -0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs05n2.mediatek.inc (172.21.101.140) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 6 Nov 2020 17:46:18 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 6 Nov 2020 17:46:18 +0800 From: Macpaul Lin To: Rob Herring , Greg Kroah-Hartman , Matthias Brugger , Mathias Nyman , Chunfeng Yun Subject: [PATCH v2 1/2] dt-bindings: usb: mediatek,mtk-xhci: add str-clock-on Date: Fri, 6 Nov 2020 17:46:04 +0800 Message-ID: <1604655965-22418-1-git-send-email-macpaul.lin@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1604301530-31546-1-git-send-email-macpaul.lin@mediatek.com> References: <1604301530-31546-1-git-send-email-macpaul.lin@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201106_045626_516058_2DD33F3E X-CRM114-Status: GOOD ( 12.89 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-usb@vger.kernel.org, Mediatek WSD Upstream , Eddie Hung , linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, Macpaul Lin , Macpaul Lin , linux-arm-kernel@lists.infradead.org, Ainge Hsu Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org Option "mediatek,str-clock-on" means to keep clock on during system suspend and resume. Some platform will flush register settings if clock has been disabled when system is suspended. Set this option to avoid clock off. Change-Id: Id841f58e9d7fb3656511072b3eb14d0d355e2dd5 Signed-off-by: Macpaul Lin --- Changes for v2: - Rename "mediatek,keep-clock-on" to "mediatek,str-clock-on" which implies this option related to STR functions. - After discussion with Chunfeng, resend dt-bindings descritption based on mediatek,mtk-xhci.txt instead of yaml format. .../devicetree/bindings/usb/mediatek,mtk-xhci.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt index 42d8814..fc93bcf 100644 --- a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt +++ b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.txt @@ -37,6 +37,9 @@ Required properties: Optional properties: - wakeup-source : enable USB remote wakeup; + - mediatek,str-clock-on: Keep clock on during system suspend and resume. + Some platform will flush register settings if clock has been disabled + when system is suspended. - mediatek,syscon-wakeup : phandle to syscon used to access the register of the USB wakeup glue layer between xHCI and SPM; it depends on "wakeup-source", and has two arguments: From patchwork Fri Nov 6 09:46:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Macpaul Lin X-Patchwork-Id: 11886585 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 267A3697 for ; Fri, 6 Nov 2020 09:46:33 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A5AB620825 for ; Fri, 6 Nov 2020 09:46:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bCOI+MFb"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="YHdNex5N" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A5AB620825 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=adYjAWZYzjkPSd3sGKuVJWXpP3KptN/ANJa3dZna1yI=; b=bCOI+MFbWacvl/kGaHWhOQunB LLiNhNHcf/zMhs/68YpDfsmeuNBEk+H2AQdSFCCq6ThHUqCVODv/xlgGy5Dcy7pXAp4ym3gbaZhTX /CU/nNihB4rDbWHwRuPHSXpbFdhwo2Ag1VHV6xWBBto9wW/36p/QJkTM3FxCzSa2xwwQTQLggA8Ci U8P1//CubscSD38TMtJS2o2wpNO+LFqbcQRISmywC0HteE/0pOCOF3cQwCiynMkMEqNHKoyQmm/SB j+DOK+W94mthG/u6zGy7Nz2AoQxr2l2hDcYPvUieUxOAmoP2IDzHqhwmwiBvkZwXs4GPRbIb6artj 7QdOodHnw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kayKE-0005fp-9R; Fri, 06 Nov 2020 09:46:30 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kayKB-0005eQ-65; Fri, 06 Nov 2020 09:46:28 +0000 X-UUID: 748b3209b36340c8ac32750e33c09118-20201106 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=JLMjlxdQ+Z3IqZg0YF6HxtlU5irzOHZAHkWTRRiog7Q=; b=YHdNex5N2VwSYDbAOCqRkSrms/ghyWcNqmkW352plOb3MZ7GWzDZ1UbHHB+X0nBiPoiaWVGNG2/8WCpNDNMrZASqz667MLRM+uOuky1Pg6T5DG1gJRCbpqmqzPYSQnHLhDwsYj0nAQiN07h+3BL77gXnqZbS7HyF+oZ9Rld+C+U=; X-UUID: 748b3209b36340c8ac32750e33c09118-20201106 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1915446009; Fri, 06 Nov 2020 01:46:24 -0800 Received: from mtkmbs05n1.mediatek.inc (172.21.101.15) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 6 Nov 2020 01:46:22 -0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs05n1.mediatek.inc (172.21.101.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 6 Nov 2020 17:46:20 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 6 Nov 2020 17:46:20 +0800 From: Macpaul Lin To: Rob Herring , Greg Kroah-Hartman , Matthias Brugger , Mathias Nyman , Chunfeng Yun Subject: [PATCH v2 2/2] usb: host: XHCI: xhci-mtk.c: support mediatek, str-clock-on Date: Fri, 6 Nov 2020 17:46:05 +0800 Message-ID: <1604655965-22418-2-git-send-email-macpaul.lin@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1604655965-22418-1-git-send-email-macpaul.lin@mediatek.com> References: <1604301530-31546-1-git-send-email-macpaul.lin@mediatek.com> <1604655965-22418-1-git-send-email-macpaul.lin@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201106_044627_421852_693FFACD X-CRM114-Status: GOOD ( 16.56 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-usb@vger.kernel.org, Mediatek WSD Upstream , Eddie Hung , linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, Macpaul Lin , Macpaul Lin , linux-arm-kernel@lists.infradead.org, Ainge Hsu Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org Some platform dose not support turn off clock when system suspending. We add an option "mediatek,str-clock-on" for distinquish these platforms. When "mediatek,str-clock-on" has been set, xhci-mtk driver will skip turning clock on and off during system suspend and resume. Signed-off-by: Macpaul Lin --- Changes for v2: - Replace "mediatek,keep-clock-on" to "mediatek,str-clock-on" which implies this option related to STR functions. drivers/usb/host/xhci-mtk.c | 9 +++++++-- drivers/usb/host/xhci-mtk.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c index 4311d4c..77b0d7a 100644 --- a/drivers/usb/host/xhci-mtk.c +++ b/drivers/usb/host/xhci-mtk.c @@ -464,6 +464,9 @@ static int xhci_mtk_probe(struct platform_device *pdev) of_property_read_u32(node, "mediatek,u3p-dis-msk", &mtk->u3p_dis_msk); + /* STR: keep clock on when suspending on some platform */ + mtk->str_clk_on = of_property_read_bool(node, "mediatek,str-clock-on"); + ret = usb_wakeup_of_property_parse(mtk, node); if (ret) { dev_err(dev, "failed to parse uwk property\n"); @@ -624,7 +627,8 @@ static int __maybe_unused xhci_mtk_suspend(struct device *dev) del_timer_sync(&xhci->shared_hcd->rh_timer); xhci_mtk_host_disable(mtk); - xhci_mtk_clks_disable(mtk); + if (!mtk->str_clk_on) + xhci_mtk_clks_disable(mtk); usb_wakeup_set(mtk, true); return 0; } @@ -636,7 +640,8 @@ static int __maybe_unused xhci_mtk_resume(struct device *dev) struct xhci_hcd *xhci = hcd_to_xhci(hcd); usb_wakeup_set(mtk, false); - xhci_mtk_clks_enable(mtk); + if (!mtk->str_clk_on) + xhci_mtk_clks_enable(mtk); xhci_mtk_host_enable(mtk); xhci_dbg(xhci, "%s: restart port polling\n", __func__); diff --git a/drivers/usb/host/xhci-mtk.h b/drivers/usb/host/xhci-mtk.h index a93cfe8..4039b025 100644 --- a/drivers/usb/host/xhci-mtk.h +++ b/drivers/usb/host/xhci-mtk.h @@ -152,6 +152,7 @@ struct xhci_hcd_mtk { struct regmap *uwk; u32 uwk_reg_base; u32 uwk_vers; + bool str_clk_on; }; static inline struct xhci_hcd_mtk *hcd_to_mtk(struct usb_hcd *hcd)