From patchwork Wed Aug 28 06:20:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Q2h1bmZlbmcgWXVuICjkupHmmKXls7Ap?= X-Patchwork-Id: 11117815 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 09E8C1399 for ; Wed, 28 Aug 2019 06:21:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E7D0722CF8 for ; Wed, 28 Aug 2019 06:21:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726474AbfH1GVh (ORCPT ); Wed, 28 Aug 2019 02:21:37 -0400 Received: from mailgw02.mediatek.com ([1.203.163.81]:30905 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726146AbfH1GVg (ORCPT ); Wed, 28 Aug 2019 02:21:36 -0400 X-UUID: f1c313b323af4f9ba027f00d1a0f30d0-20190828 X-UUID: f1c313b323af4f9ba027f00d1a0f30d0-20190828 Received: from mtkcas35.mediatek.inc [(172.27.4.253)] by mailgw02.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 920444855; Wed, 28 Aug 2019 14:21:34 +0800 Received: from mtkcas09.mediatek.inc (172.21.101.178) by MTKMBS31DR.mediatek.inc (172.27.6.102) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 28 Aug 2019 14:21:32 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 28 Aug 2019 14:21:32 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman , Rob Herring CC: Mark Rutland , Matthias Brugger , Mathias Nyman , Chunfeng Yun , , , , , Subject: [PATCH 4/6] usb: mtk-xhci: support ip-sleep wakeup for MT8183 Date: Wed, 28 Aug 2019 14:20:59 +0800 Message-ID: <1566973261-21677-5-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1566973261-21677-1-git-send-email-chunfeng.yun@mediatek.com> References: <1566973261-21677-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: 7024DF7F1485941F27536402F8768AC8AF5041008723D7F1DEBF715E13014A412000:8 X-MTK: N Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Support USB wakeup by ip-sleep mode for MT8183, it's similar to MT8173 Signed-off-by: Chunfeng Yun --- 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;