Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp488238ybl; Wed, 28 Aug 2019 00:37:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqxN2lNz7ybEHTQWzqnRJFEqminnT96dB2eFfxxn9iEd/xwbAKOz2gYM/rdnM1xBegFVCGey X-Received: by 2002:a63:c246:: with SMTP id l6mr2325033pgg.210.1566977875747; Wed, 28 Aug 2019 00:37:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566977875; cv=none; d=google.com; s=arc-20160816; b=0dmcEJEAjIGRgpsudh3qOQtpdDSA/ritRfhM77bVYTD+x0yeuy2jV+32K6WNrID0Ge YkInvepdM0ifwvjkt5/YjRKmlkv6hRf+frxHEubxPd8f+y1cBgvd9MFEZO3GeiBssKH0 hSQbGC177BlSWAUAjTxKH1uvfIejdH1CBSEvNdy384jRunSllS/eCnQm8Y7c8j9SMPJB 1Q8W6izRx1HAo4ad9hEBn5HqWZMZ0/DHPD0huFN8q8mpf4d/3PJ/Z2qJ4h4cx7u/gEEU rlPYSFbBTnnZAX6YHhwF7Gpk67KCB6AnluJXfBRFmeiAM8lI3NL/UDvc0fO7RDODUexy 7zgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=65cltaDRS9RKY0UTeHNYwe4QvRFR+icIwJ8CxspVNxQ=; b=Luss7ISQ5Q6BEKml9+pogR/coV0L3pGJehEysvN8abWl+mJwxU78UqhGYk233z+VXO OK5PE2752yYnREh0/bv1peoaXgTNMVpYDOFNJ9Q0LB6YyVAilwylPIu2El/EJYFQR0CD 7MTkYu0EAKwNHuse4sHPF3GlBFjecxBV+lDMUHDDq8qlWQfmA0eSdvussLlVykMa3Ty7 csaRH9PWZ+LQBtAj+P+Fp7eJFyKtD9HT8mwNk2XcyCTSNWJffMatAslVH2OYppIWybT/ SNkfpP71/vDHh+wHVe9wHA34qQXYWKAeW+Eihh37mBf50w0j6UwErg0fxpW+t5ZX+vla 7G1w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id k8si1503869pgt.548.2019.08.28.00.37.40; Wed, 28 Aug 2019 00:37:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726599AbfH1HfU (ORCPT + 99 others); Wed, 28 Aug 2019 03:35:20 -0400 Received: from mailgw02.mediatek.com ([1.203.163.81]:45153 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726395AbfH1HfT (ORCPT ); Wed, 28 Aug 2019 03:35:19 -0400 X-UUID: 9b742425ff6241cd89ad9afadc695588-20190828 X-UUID: 9b742425ff6241cd89ad9afadc695588-20190828 Received: from mtkcas34.mediatek.inc [(172.27.4.253)] by mailgw02.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 1884125678; Wed, 28 Aug 2019 15:34:40 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by MTKMBS31N1.mediatek.inc (172.27.4.69) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 28 Aug 2019 15:34:45 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 28 Aug 2019 15:34:44 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman , Rob Herring CC: Mark Rutland , Matthias Brugger , Mathias Nyman , Chunfeng Yun , , , , , Subject: [PATCH v2 4/7] usb: mtk-xhci: support ip-sleep wakeup for MT8183 Date: Wed, 28 Aug 2019 15:34:28 +0800 Message-ID: <1566977671-22191-5-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1566977671-22191-1-git-send-email-chunfeng.yun@mediatek.com> References: <1566977671-22191-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: 3E76496D948A34D0FB0F9D8D4E935CFC13EE2BE8EA6B56F920518B44536F2D7B2000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Support USB wakeup by ip-sleep mode for MT8183, it's similar to MT8173 Signed-off-by: Chunfeng Yun --- v2: no changes --- drivers/usb/host/xhci-mtk.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c index 026fe18972d3..4b59f2978954 100644 --- a/drivers/usb/host/xhci-mtk.c +++ b/drivers/usb/host/xhci-mtk.c @@ -57,6 +57,12 @@ #define CTRL_U2_FORCE_PLL_STB BIT(28) /* usb remote wakeup registers in syscon */ +/* mt8183 etc */ +#define PERI_WK_CTRL0 0x20 +#define WC0_IS_C(x) (((x) & 0xf) << 28) /* cycle debounce */ +#define WC0_IS_EN BIT(12) +#define WC0_IS_P BIT(6) /* polarity for ip sleep */ + /* mt8173 etc */ #define PERI_WK_CTRL1 0x4 #define WC1_IS_C(x) (((x) & 0xf) << 26) /* cycle debounce */ @@ -69,7 +75,8 @@ #define SSC_SPM_INT_EN BIT(1) enum ssusb_uwk_vers { - SSUSB_UWK_V1 = 1, + SSUSB_UWK_V0 = 0, + SSUSB_UWK_V1, SSUSB_UWK_V2, }; @@ -282,6 +289,11 @@ static void usb_wakeup_ip_sleep_set(struct xhci_hcd_mtk *mtk, bool enable) u32 reg, msk, val; switch (mtk->uwk_vers) { + case SSUSB_UWK_V0: + reg = mtk->uwk_reg_base + PERI_WK_CTRL0; + msk = WC0_IS_EN | WC0_IS_C(0xf) | WC0_IS_P; + val = enable ? (WC0_IS_EN | WC0_IS_C(0x8)) : 0; + break; case SSUSB_UWK_V1: reg = mtk->uwk_reg_base + PERI_WK_CTRL1; msk = WC1_IS_EN | WC1_IS_C(0xf) | WC1_IS_P; -- 2.23.0