Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1156745pxb; Fri, 6 Nov 2020 02:26:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJx3BJAc27ge8+wAxXZpiLBJieGfx1kGhmGNUjOkQmd9uxVRH3OfaqmgwBMSF2Ooxs1VFj9p X-Received: by 2002:aa7:d9c2:: with SMTP id v2mr1234815eds.95.1604658363748; Fri, 06 Nov 2020 02:26:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604658363; cv=none; d=google.com; s=arc-20160816; b=cpKyCWuPbwJIsahUDlRzh7qGcV9adLHIyO9s9dAbmQdYdk0MF8bMTkXhSPqdA6OaA5 Y2iAwtjIeRrOS02ieNQB9sFkOmVTzJsoJ8ly/3WWwNDFxASNtYFWxKbZUWYWgrJzW20J xlGYrMZvpLIKEg8F+ybTu9kKxzHqqOQpjdbkypulW+1ewjnxxcflBh6RWDNe3Zltkzmv 2ZQOYXAgASCrlb1eRwWLKaVZIIPeyl/FGJBsUKIaa4D1V4CpNyYQsIwglSdDB++cs7nk i4AuquzemGmP6F/p88ItCW+yZE/TInZqBRjcQqnrnCp5REBdw6FcGOZtu9d6xfb1BWa8 AnRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=SfYPHQSH7hNvrAmPclGARf/OPk8LcanjErl21xCZpO8=; b=0fmBx09mO13Q+amCVadIjK92rY+Y5Oa6UYa2Vvz/kP0V2OXFpnwQ5b0p7SclhyWjVw SwCu2i9YNZ1yPztANx/mLL77aPyFkUmsASb5UBA4I9lcrsrqeypmkQHzeUqBThYXiEv4 Q7kj7lx3dutYkkqOM1xNkqLmyNHCWd7XZgW3orc+iaay12Io8IC0rhJZmuvFiojYVFz6 53MDa+Oy6AB8HLpb1DGCGzwncmvMBXtqE/NPKwyi1raZVedVIQwwzWyTvTtpZ7H8lis/ W9JBBC7xKNbLDwVvNGEaFGSjXqU+kqT7AtBtCBobr9xU+biQLN8rujSezG/Vurwe/oPM w2Ow== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q17si636678edg.162.2020.11.06.02.25.40; Fri, 06 Nov 2020 02:26:03 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726954AbgKFKWA (ORCPT + 99 others); Fri, 6 Nov 2020 05:22:00 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:41502 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726832AbgKFKWA (ORCPT ); Fri, 6 Nov 2020 05:22:00 -0500 X-UUID: d3225b862b624616881e03d3eb86a970-20201106 X-UUID: d3225b862b624616881e03d3eb86a970-20201106 Received: from mtkexhb02.mediatek.inc [(172.21.101.103)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 489818813; Fri, 06 Nov 2020 18:21:53 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 6 Nov 2020 18:21:48 +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 18:21:48 +0800 From: Macpaul Lin To: Rob Herring , Greg Kroah-Hartman , Matthias Brugger , Mathias Nyman , Chunfeng Yun CC: Ainge Hsu , Eddie Hung , Chunfeng Yun , Mediatek WSD Upstream , Macpaul Lin , "Macpaul Lin" , , , , , Subject: [PATCH v3 2/2] usb: host: XHCI: xhci-mtk.c: support mediatek,str-clock-on Date: Fri, 6 Nov 2020 18:21:37 +0800 Message-ID: <1604658097-5127-2-git-send-email-macpaul.lin@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1604658097-5127-1-git-send-email-macpaul.lin@mediatek.com> References: <1604301530-31546-1-git-send-email-macpaul.lin@mediatek.com> <1604658097-5127-1-git-send-email-macpaul.lin@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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. Fixes: 0cbd4b34cda9 ("xhci: mediatek: support MTK xHCI host controller") Signed-off-by: Macpaul Lin Cc: stable@vger.kernel.org --- Changes for v3: - Add "Fixes" tag as a bug fix on phone system. 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) -- 1.7.9.5