Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4026256pxf; Tue, 23 Mar 2021 00:06:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwO9TIvYGl74oBki3mllxQlCIrJRGFUPVuj17KWlQP8HCtraME67Mv8jPBFYuySvvfk0ypM X-Received: by 2002:a05:6402:34c4:: with SMTP id w4mr3186903edc.367.1616483218660; Tue, 23 Mar 2021 00:06:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616483218; cv=none; d=google.com; s=arc-20160816; b=gdMtSW7Z1Lp3+AG1WnRW5Fa4dXp5jJsAUqZ/2JAQT9HdJlIbHpQeS75juoaVIyY0tK EtsjuX3d5Pl0oVSXjffLZRJtNALjla9T5xwIrtmYEIAXBidP1nxZHBzXEndYp3JN0CaE aYgOJO/VjoHBRixJ0yiEYPtwOfi+ds8BaJWxC/onxu8TFGm7OxXL4NDMD25nENNK63CN HUH/oH+XsurxXVLe+9eLy99MSm0661PYMvBD9zwsl16RUE+HRIYKswBcFp+IWuZ8Gnfc VCvDWb/QIwdwqXfP6w2nUUarIZwjesaq8E0IFb934mQyevdZltAawT/1YJVe4Jl2Byt/ HSnQ== 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=O8JCFFYLeV1wVSLonhJZ3pHc10ZsqbcRc+B7VDsDV70=; b=h/d5KOmDK0/gXjuKeV6VuJ+8jLKYervxpnpMxc2Gie7FSFzsn5PE6G1IAZ5oq/GDAb uKkmVSVSVDrPwOEYDlzFIlHXdQQRQxmz4ZNmOeiPMoSJi3Yp2fJFHQPaUCUiQKj5DK2m ckFkbblB8lcFdmvVfpjd1DJ8Zkr/MrUX0A4xHQefF9n5HZvDqV2zOPANxoCMWvIXB9Kz KKZsJ1Qwa/yxbgmKFuMhrlZZcfnjKRzSQ4nNCIHKs7H5rwqj32K2TcqEJr2nDarOYCFU VmdEqg7XaNw+G+WiwezdVSOYyCU0k6IWQiON1bbV2yEI3WLMrhwRahO68NVBVeWBg6SK TrXw== 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 bc10si13055842edb.235.2021.03.23.00.06.36; Tue, 23 Mar 2021 00:06:58 -0700 (PDT) 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 S230294AbhCWHEJ (ORCPT + 99 others); Tue, 23 Mar 2021 03:04:09 -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 S230085AbhCWHDm (ORCPT ); Tue, 23 Mar 2021 03:03:42 -0400 X-UUID: 01e84b5eadc24a42a9974ac69b4e7da1-20210323 X-UUID: 01e84b5eadc24a42a9974ac69b4e7da1-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 1710061512; 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:17 +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:16 +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 10/13] usb: mtu3: support ip-sleep wakeup for MT8183 Date: Tue, 23 Mar 2021 15:02:52 +0800 Message-ID: <1616482975-17841-10-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 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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/mtu3/mtu3_host.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/usb/mtu3/mtu3_host.c b/drivers/usb/mtu3/mtu3_host.c index c871b94f3e6f..398ce0014606 100644 --- a/drivers/usb/mtu3/mtu3_host.c +++ b/drivers/usb/mtu3/mtu3_host.c @@ -24,6 +24,12 @@ #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) @@ -32,6 +38,7 @@ enum ssusb_uwk_vers { SSUSB_UWK_V1 = 1, SSUSB_UWK_V2, + SSUSB_UWK_V1_1 = 101, /* specific revision 1.01 */ }; /* @@ -48,6 +55,11 @@ static void ssusb_wakeup_ip_sleep_set(struct ssusb_mtk *ssusb, 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 = ssusb->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 = ssusb->uwk_reg_base + PERI_SSUSB_SPM_CTRL; msk = SSC_IP_SLEEP_EN | SSC_SPM_INT_EN; -- 2.18.0