From patchwork Mon Nov 2 07:18:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Macpaul Lin X-Patchwork-Id: 11873069 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 DDA231130 for ; Mon, 2 Nov 2020 07:19:21 +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 66F24208A9 for ; Mon, 2 Nov 2020 07:19:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="TE/wujXD"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="j5/ZmuF5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 66F24208A9 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: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:In-Reply-To:References:List-Owner; bh=tw6C1hBQt4w1ElSYz8sbq1fOpUtvBLZ+S11G8q7PWRk=; b=TE/wujXDDRJ/fWcorJ1oGu6Gdy ICPwZfN0HTKl1wDlFpXOjsEThSgdvAb8NL84nHCbMwwLiA2sjv2yfzwlsF6tgFvSzWWAr2E5Mmkvn S/SGcf5Syugea75PmZeSHONQ3BuQAto0WrCg3E6pvdkkryMKG9BVjo6TcjoZ+g2/P3ijkuUnOAGOh 74o75HGkaxnkmockuWjaWnXqMXoXBsqWKSDjdy9g9aRxFT6NBse+C8PcVBMu7tXO9so8D9VPJDTnA F5Acnz5eTx8m+3cbMyksRDZVPEDmiFZv7O3VCAZ1ws7V6cs6FGmC/YMdPDBEgTzcMfpWOAnBkxgRz IqlMeBBw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZU7b-0005ki-6y; Mon, 02 Nov 2020 07:19:19 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZU7R-0005jw-AS; Mon, 02 Nov 2020 07:19:11 +0000 X-UUID: 24cd0558220e4600ad10159ea18e2447-20201101 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:Message-ID:Date:Subject:CC:To:From; bh=kZvapf7pIFQLgezOg35dcW/H2iGzgefNvWKVVQEly1I=; b=j5/ZmuF50d8JHesImRH2jBA+mZd/ht5Y8U1Cez2CcM6b80bna/nyXWJ3EQF9cFMDB16i1CgQTT8hWzE5axsoNolJOBBp7YpO/sc/NpqS+cD6IUQKKnJWlqOYlodilVz8ruiOuLx1R7kIH7macdeWzKrc927Jg/s1UoaaBB6i35g=; X-UUID: 24cd0558220e4600ad10159ea18e2447-20201101 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 17905647; Sun, 01 Nov 2020 23:19:02 -0800 Received: from mtkmbs08n1.mediatek.inc (172.21.101.55) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 1 Nov 2020 23:19:00 -0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 2 Nov 2020 15:18:59 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 2 Nov 2020 15:18:59 +0800 From: Macpaul Lin To: Greg Kroah-Hartman , Rob Herring , Matthias Brugger , "Mathias Nyman" , Chunfeng Yun , , , , , Subject: [PATCH 1/2] dt-bindings: usb: mediatek,mtk-xhci: add keep-clock-on Date: Mon, 2 Nov 2020 15:18:48 +0800 Message-ID: <1604301530-31546-1-git-send-email-macpaul.lin@mediatek.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201102_021910_180486_E31CD21B X-CRM114-Status: GOOD ( 11.53 ) 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_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's 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: Macpaul Lin , Eddie Hung , Ainge Hsu , Mediatek WSD Upstream , Macpaul Lin Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org Option "mediatek,keep-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. Signed-off-by: Macpaul Lin --- .../devicetree/bindings/usb/mediatek,mtk-xhci.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml index ea696c8..a956dde 100644 --- a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml +++ b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml @@ -104,6 +104,12 @@ properties: description: enable USB remote wakeup, see power/wakeup-source.txt type: boolean + mediatek,keep-clock-on: + description: | + Keep clock on during system suspend and resume. Some platform will flush + register settings if clock has been disabled when system is suspended. + type: boolean + mediatek,syscon-wakeup: $ref: /schemas/types.yaml#/definitions/phandle-array maxItems: 1 @@ -175,6 +181,7 @@ examples: imod-interval-ns = <10000>; mediatek,syscon-wakeup = <&pericfg 0x400 1>; wakeup-source; + mediatek,keep-clock-on; usb3-lpm-capable; }; ... From patchwork Mon Nov 2 07:18:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Macpaul Lin X-Patchwork-Id: 11873081 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 D037D1130 for ; Mon, 2 Nov 2020 07:29:22 +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 96D442223C for ; Mon, 2 Nov 2020 07:29:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="R43p+X4s"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="nu+upCVj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 96D442223C 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=dcq90Uj38ABZ1aiOjTncu1Mhzej4JHzs3+mX21PGw9Q=; b=R43p+X4s2QVzUcPHVVxVirtwe t4lirHTi4+iwJ0VGaWHUqubLbZ05uGeRNN6Y8bpMDSnV0zt3HKGSb94gdB9aLy/vjm1uTprJUd0as 8THNWQr0oPJJr5QTAfULrqQDHzU7febDhDZUYcY7q7MrY4sGFZScVGvJYPokDstY0HRJpmhstmv6u 75gio0RdqNnTMfkq87/wGR5wcmGQrQuS2QcAN1RXbRGdn91U/kQ9LbNWk5ORSCiNMk0mS/01lQ+lN kVVYsnl7YZACpNPWxtP+pQQRGa5rm6bng/Q+PuDdsQpszWvHksKNrBnQi/pINjxaYbC5E6kyDLw/y DBwycckGQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZUHI-0006xa-Hn; Mon, 02 Nov 2020 07:29:20 +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 1kZUH9-0006vT-2j; Mon, 02 Nov 2020 07:29:12 +0000 X-UUID: 3768573719884031af51396bdc5b3a52-20201101 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=EwMAk6C90zx3ggLjTVwBgHjheE+if1MCBTaw2ieul20=; b=nu+upCVjds1Cak5WzFXnaNZZ4SGOkexCPn0TFEszSMJ+Aq7MwHH27WfjLbdy07NKhmo4oNvwFjL+r4SqAeO9JdW8yGrmzAYQ24VtLgQ7W4QrLxKC7VBQj+Tr4DSe2Gds3VqhwFkacmRADwD48fC/UId0/RncII+ins3G0XTzFx4=; X-UUID: 3768573719884031af51396bdc5b3a52-20201101 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 122083116; Sun, 01 Nov 2020 23:29:05 -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; Sun, 1 Nov 2020 23:19:02 -0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs05n2.mediatek.inc (172.21.101.140) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 2 Nov 2020 15:19:01 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 2 Nov 2020 15:19:01 +0800 From: Macpaul Lin To: Greg Kroah-Hartman , Rob Herring , Matthias Brugger , "Mathias Nyman" , Chunfeng Yun , , , , , Subject: [PATCH 2/2] usb: host: XHCI: xhci-mtk.c: support mediatek, keep-clock-on Date: Mon, 2 Nov 2020 15:18:49 +0800 Message-ID: <1604301530-31546-2-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-20201102_022911_374773_282C3B49 X-CRM114-Status: GOOD ( 16.27 ) 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_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's 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: Macpaul Lin , Eddie Hung , Ainge Hsu , Mediatek WSD Upstream , Macpaul Lin 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,keep-clock-on" for distinquish these platforms. When "mediatek,keep-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 --- 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..c6c2804 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); + /* keep clock on when suspending on some platform */ + mtk->keep_clk_on = of_property_read_bool(node, "mediatek,keep-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->keep_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->keep_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..37639c5 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 keep_clk_on; }; static inline struct xhci_hcd_mtk *hcd_to_mtk(struct usb_hcd *hcd)