From patchwork Tue Mar 23 07:02:43 2021 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: 407325 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8193DC433E3 for ; Tue, 23 Mar 2021 07:04:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 571CE619BB for ; Tue, 23 Mar 2021 07:04:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230104AbhCWHDr (ORCPT ); Tue, 23 Mar 2021 03:03:47 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:52446 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S230045AbhCWHDO (ORCPT ); Tue, 23 Mar 2021 03:03:14 -0400 X-UUID: 3f500fdb6c69468fa657cf43a21cb5fa-20210323 X-UUID: 3f500fdb6c69468fa657cf43a21cb5fa-20210323 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] 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 1194524314; Tue, 23 Mar 2021 15:03:11 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs06n2.mediatek.inc (172.21.101.130) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 23 Mar 2021 15:03:09 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 23 Mar 2021 15:03:08 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman , Rob Herring , Mathias Nyman CC: Chunfeng Yun , Matthias Brugger , , , , , , Sergei Shtylyov , Eddie Hung , Nicolas Boichat Subject: [PATCH v2 01/13] dt-bindings: usb: mtk-xhci: support property usb2-lpm-disable Date: Tue, 23 Mar 2021 15:02:43 +0800 Message-ID: <1616482975-17841-1-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty MIME-Version: 1.0 X-TM-SNTS-SMTP: 6BAD75C4FD4F36F94A318E365A514E122BC97291D6295AB56703BF5B33020AF82000:8 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Add support common property usb2-lpm-disable Signed-off-by: Chunfeng Yun Reviewed-by: Rob Herring Reviewed-by: Rob Herring --- v2: no changes --- Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml index 14f40efb3b22..2246d29a5e4e 100644 --- a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml +++ b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml @@ -103,6 +103,10 @@ properties: description: supports USB3.0 LPM type: boolean + usb2-lpm-disable: + description: disable USB2 HW LPM + type: boolean + imod-interval-ns: description: Interrupt moderation interval value, it is 8 times as much as that From patchwork Tue Mar 23 07:02:46 2021 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: 407324 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58967C433DB for ; Tue, 23 Mar 2021 07:04:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 18F80619BB for ; Tue, 23 Mar 2021 07:04:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230139AbhCWHDt (ORCPT ); Tue, 23 Mar 2021 03:03:49 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:40147 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S230057AbhCWHDR (ORCPT ); Tue, 23 Mar 2021 03:03:17 -0400 X-UUID: a9aab06c83aa4df482b0fef13ac9fd41-20210323 X-UUID: a9aab06c83aa4df482b0fef13ac9fd41-20210323 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw01.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 2101752130; Tue, 23 Mar 2021 15:03:13 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs06n1.mediatek.inc (172.21.101.129) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 23 Mar 2021 15:03:12 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 23 Mar 2021 15:03:11 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman , Rob Herring , Mathias Nyman CC: Chunfeng Yun , Matthias Brugger , , , , , , Sergei Shtylyov , Eddie Hung , Nicolas Boichat Subject: [PATCH v2 04/13] usb: xhci-mtk: fix broken streams issue on 0.96 xHCI Date: Tue, 23 Mar 2021 15:02:46 +0800 Message-ID: <1616482975-17841-4-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1616482975-17841-1-git-send-email-chunfeng.yun@mediatek.com> References: <1616482975-17841-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The MediaTek 0.96 xHCI controller on some platforms does not support bulk stream even HCCPARAMS says supporting, due to MaxPSASize is set a default value 1 by mistake, here use XHCI_BROKEN_STREAMS quirk to fix it. Fixes: 94a631d91ad3 ("usb: xhci-mtk: check hcc_params after adding primary hcd") Signed-off-by: Chunfeng Yun --- v2: no changes --- drivers/usb/host/xhci-mtk.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c index 57bcfdfa0465..1b9f10048fe0 100644 --- a/drivers/usb/host/xhci-mtk.c +++ b/drivers/usb/host/xhci-mtk.c @@ -388,6 +388,13 @@ static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci) xhci->quirks |= XHCI_SPURIOUS_SUCCESS; if (mtk->lpm_support) xhci->quirks |= XHCI_LPM_SUPPORT; + + /* + * MTK xHCI 0.96: PSA is 1 by default even if doesn't support stream, + * and it's 3 when support it. + */ + if (xhci->hci_version < 0x100 && HCC_MAX_PSA(xhci->hcc_params) == 4) + xhci->quirks |= XHCI_BROKEN_STREAMS; } /* called during probe() after chip reset completes */ @@ -549,7 +556,8 @@ static int xhci_mtk_probe(struct platform_device *pdev) if (ret) goto put_usb3_hcd; - if (HCC_MAX_PSA(xhci->hcc_params) >= 4) + if (HCC_MAX_PSA(xhci->hcc_params) >= 4 && + !(xhci->quirks & XHCI_BROKEN_STREAMS)) xhci->shared_hcd->can_do_streams = 1; ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED); From patchwork Tue Mar 23 07:02:48 2021 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: 407322 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C24B3C43446 for ; Tue, 23 Mar 2021 07:04:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8A4EF619CD for ; Tue, 23 Mar 2021 07:04:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230217AbhCWHDy (ORCPT ); Tue, 23 Mar 2021 03:03:54 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:52778 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S230080AbhCWHDl (ORCPT ); Tue, 23 Mar 2021 03:03:41 -0400 X-UUID: becfb29289564dd198c664aebd3e5ac3-20210323 X-UUID: becfb29289564dd198c664aebd3e5ac3-20210323 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1348556983; Tue, 23 Mar 2021 15:03:36 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs06n1.mediatek.inc (172.21.101.129) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 23 Mar 2021 15:03:13 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 23 Mar 2021 15:03:13 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman , Rob Herring , Mathias Nyman CC: Chunfeng Yun , Matthias Brugger , , , , , , Sergei Shtylyov , Eddie Hung , Nicolas Boichat Subject: [PATCH v2 06/13] usb: xhci-mtk: support ip-sleep wakeup for MT8183 Date: Tue, 23 Mar 2021 15:02:48 +0800 Message-ID: <1616482975-17841-6-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1616482975-17841-1-git-send-email-chunfeng.yun@mediatek.com> References: <1616482975-17841-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Add support ip-sleep wakeup for MT8183, it's similar to MT8173, and it's also a specific one, but not following IPM rule. Due to the index 2 already used by many DTS, it's better to keep it unchanged for backward compatibility, treat specific ones without following IPM rule as revision 1.x, meanwhile reserve 3~10 for later revision that follows the IPM rule. Signed-off-by: Chunfeng Yun --- v2: 1. fix typo suggested by Sergei 2. fix build warning - Woverflow 3. modify revision format --- drivers/usb/host/xhci-mtk.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c index 09f2ddbfe8b9..ef2c74281ab4 100644 --- a/drivers/usb/host/xhci-mtk.c +++ b/drivers/usb/host/xhci-mtk.c @@ -57,12 +57,19 @@ #define CTRL_U2_FORCE_PLL_STB BIT(28) /* usb remote wakeup registers in syscon */ + /* mt8173 etc */ #define PERI_WK_CTRL1 0x4 #define WC1_IS_C(x) (((x) & 0xf) << 26) /* cycle debounce */ #define WC1_IS_EN BIT(25) #define WC1_IS_P BIT(6) /* polarity for ip sleep */ +/* mt8183 */ +#define PERI_WK_CTRL0 0x0 +#define WC0_IS_C(x) ((u32)(((x) & 0xf) << 28)) /* cycle debounce */ +#define WC0_IS_P BIT(12) /* polarity */ +#define WC0_IS_EN BIT(6) + /* mt2712 etc */ #define PERI_SSUSB_SPM_CTRL 0x0 #define SSC_IP_SLEEP_EN BIT(4) @@ -71,6 +78,7 @@ enum ssusb_uwk_vers { SSUSB_UWK_V1 = 1, SSUSB_UWK_V2, + SSUSB_UWK_V1_1 = 101, /* specific revision 1.01 */ }; static int xhci_mtk_host_enable(struct xhci_hcd_mtk *mtk) @@ -300,6 +308,11 @@ static void usb_wakeup_ip_sleep_set(struct xhci_hcd_mtk *mtk, bool enable) msk = WC1_IS_EN | WC1_IS_C(0xf) | WC1_IS_P; val = enable ? (WC1_IS_EN | WC1_IS_C(0x8)) : 0; break; + case SSUSB_UWK_V1_1: + 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_V2: reg = mtk->uwk_reg_base + PERI_SSUSB_SPM_CTRL; msk = SSC_IP_SLEEP_EN | SSC_SPM_INT_EN; From patchwork Tue Mar 23 07:02:50 2021 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: 407320 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37239C43460 for ; Tue, 23 Mar 2021 07:04:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 27732619BB for ; Tue, 23 Mar 2021 07:04:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230227AbhCWHD4 (ORCPT ); Tue, 23 Mar 2021 03:03:56 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:52807 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S230081AbhCWHDl (ORCPT ); Tue, 23 Mar 2021 03:03:41 -0400 X-UUID: 5915a65f03f1420ba25d8def557bfab2-20210323 X-UUID: 5915a65f03f1420ba25d8def557bfab2-20210323 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 2122046747; Tue, 23 Mar 2021 15:03:36 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs06n1.mediatek.inc (172.21.101.129) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 23 Mar 2021 15:03:15 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 23 Mar 2021 15:03:14 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman , Rob Herring , Mathias Nyman CC: Chunfeng Yun , Matthias Brugger , , , , , , Sergei Shtylyov , Eddie Hung , Nicolas Boichat Subject: [PATCH v2 08/13] usb: xhci-mtk: drop CONFIG_OF Date: Tue, 23 Mar 2021 15:02:50 +0800 Message-ID: <1616482975-17841-8-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1616482975-17841-1-git-send-email-chunfeng.yun@mediatek.com> References: <1616482975-17841-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The driver can match only the devices created by the OF core via the DT table, so the table should be always used. Signed-off-by: Chunfeng Yun --- v2: no changes --- drivers/usb/host/xhci-mtk.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c index 24342112cd1d..832c5b8bb8a8 100644 --- a/drivers/usb/host/xhci-mtk.c +++ b/drivers/usb/host/xhci-mtk.c @@ -689,14 +689,12 @@ static const struct dev_pm_ops xhci_mtk_pm_ops = { }; #define DEV_PM_OPS IS_ENABLED(CONFIG_PM) ? &xhci_mtk_pm_ops : NULL -#ifdef CONFIG_OF static const struct of_device_id mtk_xhci_of_match[] = { { .compatible = "mediatek,mt8173-xhci"}, { .compatible = "mediatek,mtk-xhci"}, { }, }; MODULE_DEVICE_TABLE(of, mtk_xhci_of_match); -#endif static struct platform_driver mtk_xhci_driver = { .probe = xhci_mtk_probe, @@ -704,7 +702,7 @@ static struct platform_driver mtk_xhci_driver = { .driver = { .name = "xhci-mtk", .pm = DEV_PM_OPS, - .of_match_table = of_match_ptr(mtk_xhci_of_match), + .of_match_table = mtk_xhci_of_match, }, }; MODULE_ALIAS("platform:xhci-mtk"); From patchwork Tue Mar 23 07:02:53 2021 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: 407323 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FC81C433FC for ; Tue, 23 Mar 2021 07:04:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2861C619E2 for ; Tue, 23 Mar 2021 07:04:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230027AbhCWHDw (ORCPT ); Tue, 23 Mar 2021 03:03:52 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:52761 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S230062AbhCWHDi (ORCPT ); Tue, 23 Mar 2021 03:03:38 -0400 X-UUID: 3273c2e502344ae8a90d2c9c366cdc60-20210323 X-UUID: 3273c2e502344ae8a90d2c9c366cdc60-20210323 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1262951997; Tue, 23 Mar 2021 15:03:35 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs06n2.mediatek.inc (172.21.101.130) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 23 Mar 2021 15:03:18 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 23 Mar 2021 15:03:17 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman , Rob Herring , Mathias Nyman CC: Chunfeng Yun , Matthias Brugger , , , , , , Sergei Shtylyov , Eddie Hung , "Nicolas Boichat" Subject: [PATCH v2 11/13] usb: mtu3: add support ip-sleep wakeup for MT8192 Date: Tue, 23 Mar 2021 15:02:53 +0800 Message-ID: <1616482975-17841-11-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1616482975-17841-1-git-send-email-chunfeng.yun@mediatek.com> References: <1616482975-17841-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: 02F9C87FB8E8A7A7065AB363ECCD9788151B206C18A17FA37E66208E14F3C6CD2000:8 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Add add support ip-sleep wakeup for MT8192, it's a specific revision, not following IPM rule. Signed-off-by: Chunfeng Yun --- v2: 1. fix typo suggested by Sergei 2. modify revision format --- drivers/usb/mtu3/mtu3_host.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/usb/mtu3/mtu3_host.c b/drivers/usb/mtu3/mtu3_host.c index 398ce0014606..e3c923e6529f 100644 --- a/drivers/usb/mtu3/mtu3_host.c +++ b/drivers/usb/mtu3/mtu3_host.c @@ -30,6 +30,10 @@ #define WC0_IS_P BIT(12) /* polarity */ #define WC0_IS_EN BIT(6) +/* mt8192 */ +#define WC0_SSUSB0_CDEN BIT(6) +#define WC0_IS_SPM_EN BIT(1) + /* mt2712 etc */ #define PERI_SSUSB_SPM_CTRL 0x0 #define SSC_IP_SLEEP_EN BIT(4) @@ -39,6 +43,7 @@ enum ssusb_uwk_vers { SSUSB_UWK_V1 = 1, SSUSB_UWK_V2, SSUSB_UWK_V1_1 = 101, /* specific revision 1.01 */ + SSUSB_UWK_V1_2, /* specific revision 1.02 */ }; /* @@ -60,6 +65,11 @@ static void ssusb_wakeup_ip_sleep_set(struct ssusb_mtk *ssusb, bool enable) 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_2: + reg = ssusb->uwk_reg_base + PERI_WK_CTRL0; + msk = WC0_SSUSB0_CDEN | WC0_IS_SPM_EN; + val = enable ? msk : 0; + break; case SSUSB_UWK_V2: reg = ssusb->uwk_reg_base + PERI_SSUSB_SPM_CTRL; msk = SSC_IP_SLEEP_EN | SSC_SPM_INT_EN; From patchwork Tue Mar 23 07:02:54 2021 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: 407321 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2EF5C4345A for ; Tue, 23 Mar 2021 07:04:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9F044619C2 for ; Tue, 23 Mar 2021 07:04:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230203AbhCWHDy (ORCPT ); Tue, 23 Mar 2021 03:03:54 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:52807 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S230076AbhCWHDk (ORCPT ); Tue, 23 Mar 2021 03:03:40 -0400 X-UUID: 9e10be57bd57471ea97c09abcb264c25-20210323 X-UUID: 9e10be57bd57471ea97c09abcb264c25-20210323 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1381701376; Tue, 23 Mar 2021 15:03:36 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs06n1.mediatek.inc (172.21.101.129) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 23 Mar 2021 15:03:19 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 23 Mar 2021 15:03:18 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman , Rob Herring , Mathias Nyman CC: Chunfeng Yun , Matthias Brugger , , , , , , Sergei Shtylyov , Eddie Hung , Nicolas Boichat Subject: [PATCH v2 12/13] usb: mtu3: drop CONFIG_OF Date: Tue, 23 Mar 2021 15:02:54 +0800 Message-ID: <1616482975-17841-12-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1616482975-17841-1-git-send-email-chunfeng.yun@mediatek.com> References: <1616482975-17841-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The driver can match only the devices created by the OF core via the DT table, so the table should be always used. Signed-off-by: Chunfeng Yun --- v2: no changes --- drivers/usb/mtu3/mtu3_plat.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c index d44d5417438d..7786a95a874e 100644 --- a/drivers/usb/mtu3/mtu3_plat.c +++ b/drivers/usb/mtu3/mtu3_plat.c @@ -502,25 +502,20 @@ static const struct dev_pm_ops mtu3_pm_ops = { #define DEV_PM_OPS (IS_ENABLED(CONFIG_PM) ? &mtu3_pm_ops : NULL) -#ifdef CONFIG_OF - static const struct of_device_id mtu3_of_match[] = { {.compatible = "mediatek,mt8173-mtu3",}, {.compatible = "mediatek,mtu3",}, {}, }; - MODULE_DEVICE_TABLE(of, mtu3_of_match); -#endif - static struct platform_driver mtu3_driver = { .probe = mtu3_probe, .remove = mtu3_remove, .driver = { .name = MTU3_DRIVER_NAME, .pm = DEV_PM_OPS, - .of_match_table = of_match_ptr(mtu3_of_match), + .of_match_table = mtu3_of_match, }, }; module_platform_driver(mtu3_driver);