From patchwork Fri Jan 12 13:32:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 187736 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2614:b0:101:6a76:bbe3 with SMTP id mm20csp173909dyc; Fri, 12 Jan 2024 05:33:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IEDFZatvINvLrUmhjV0wehgSjUfAgBewvqAy6SS00Y78NRdA450G/u5QMNLy1WcLVKtDe3d X-Received: by 2002:a05:6e02:168a:b0:360:6bd2:ddc0 with SMTP id f10-20020a056e02168a00b003606bd2ddc0mr1449717ila.28.1705066403472; Fri, 12 Jan 2024 05:33:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705066403; cv=none; d=google.com; s=arc-20160816; b=LALeBo1SprD5bezMOHTSJ6sIJjWrdCpvKLpCB3g8gxDUmgYMbI/QNK4b6/d/5Rrn5y chiwPtfQxDvae1+nXS5/T88Ybk1Louq04ZNVtEapRcpjpjfp4D3OQAAPlrz87oMjWLqJ YAigbpItMOt+jw410cc22zDyCjndPcd57zmn5qailCczqRrmnZlHP1dtrnwezrqjIcfR y/tlxBvamZXNWF4OCjC9ddBUtOZ5vKPtOgD83KjPGq3oOS1uvylUTmeescJkttwTKAK5 y2J5+yOFw0CEzPP5ht/PBc8xh51zi7DDyMjv6ZrAgpgSG8sFJFQIcJ1X+UEjuCC90KPI fOfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=QFA3/mQhLy7fgYMGLPprlm0hS1YDC7NiRtX/q+sS5cU=; fh=tMs0Qcgrzgfxx2ekVp3zTFmwxuyr8gWjWxhPfdVHbp4=; b=nYfcVIAd9rGzRLl+UDFr33g7fwkaaufcB2RfgSZPLjNamqQtpFGS4QybKwYrB3lVrY hV0ksxo81Mf99q8pxhy6uJOdfYxOdGEveHeFJnvA1PM4m/dkjAy7dAJ28uL6Rn4rEKo9 EdUwBizxNpeU7n/fQHhIzlZysDFE2Z9ARLaN9wAH3ND2Qzilrw+0pK5YOOdKDEtNmZw+ h0NNci531R8lgX1SNki6kJ3OtyUVsCiePRrwz7ZgpmC8iCDmwGVZegHFLfD6SFfTaL4+ SKHvXn3KxsofA6xsT/AyhnEGzBX3MYSMhKvXH70sYbCNkJSIpZmE5o6o1B2geDD6CCWX i1rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=d8e8vYat; spf=pass (google.com: domain of linux-kernel+bounces-24692-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24692-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 36-20020a631664000000b005cdf7b74d05si3107486pgw.291.2024.01.12.05.33.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 05:33:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-24692-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=d8e8vYat; spf=pass (google.com: domain of linux-kernel+bounces-24692-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24692-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 81371B23A16 for ; Fri, 12 Jan 2024 13:33:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 25AA26D1DF; Fri, 12 Jan 2024 13:32:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="d8e8vYat" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 274ED5D91A; Fri, 12 Jan 2024 13:32:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1705066350; bh=a3smX73X/DO4mpCygf5S67DyKKn/F9+tabtj3srXY1o=; h=From:To:Cc:Subject:Date:From; b=d8e8vYat6IVxhJU0Nb1ligWNmsdgMgpmSW4Ig5CFnXPLLC/dxKs/kRFHjU3rF5WrJ AQSIUPLG4cWI6M1Boj1UttPt+XvcuUe69jfWbxVj48PXRLqrJSBNo8ehDnCsDt4jNG Cxd6SKa/5zOkhWqIaQoht8O/XzisZwFHrPhFXcSM9x14SgGiVPgqgD3yVjC/abrKHr lGfxygNCxRZOnvgtVJWz/ebCmLUhsciRF9IMFhuRDu81oDJkT5JxfQVJgjmVIwIqoO oWXGQQfDNkx2X0hGUK+pnx2YYt7A1qfud8lobobtNsEeVJjSvxw3EgHtVzFgpJ1nji HMivCm+jberMA== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 939E53781FE5; Fri, 12 Jan 2024 13:32:29 +0000 (UTC) From: AngeloGioacchino Del Regno To: chunfeng.yun@mediatek.com Cc: gregkh@linuxfoundation.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@collabora.com Subject: [PATCH 1/2] dt-bindings: usb: mtu3: Add MT8195 MTU3 ip-sleep support Date: Fri, 12 Jan 2024 14:32:21 +0100 Message-ID: <20240112133222.240038-1-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787891708955689601 X-GMAIL-MSGID: 1787891708955689601 Of the four USB controllers present on the MediaTek MT8195 SoC, three of them (0, 2 and 3) are behind MTU3: add wakeup controls for them. Signed-off-by: AngeloGioacchino Del Regno Acked-by: Conor Dooley Reviewed-by: Matthias Brugger --- Documentation/devicetree/bindings/usb/mediatek,mtu3.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/usb/mediatek,mtu3.yaml b/Documentation/devicetree/bindings/usb/mediatek,mtu3.yaml index a59d91243ac8..d4e187c78a0b 100644 --- a/Documentation/devicetree/bindings/usb/mediatek,mtu3.yaml +++ b/Documentation/devicetree/bindings/usb/mediatek,mtu3.yaml @@ -185,7 +185,10 @@ properties: 2 - used by mt2712 etc, revision 2 with following IPM rule; 101 - used by mt8183, specific 1.01; 102 - used by mt8192, specific 1.02; - enum: [1, 2, 101, 102] + 103 - used by mt8195, IP0, specific 1.03; + 105 - used by mt8195, IP2, specific 1.05; + 106 - used by mt8195, IP3, specific 1.06; + enum: [1, 2, 101, 102, 103, 105, 106] mediatek,u3p-dis-msk: $ref: /schemas/types.yaml#/definitions/uint32 From patchwork Fri Jan 12 13:32:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 187737 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2614:b0:101:6a76:bbe3 with SMTP id mm20csp174026dyc; Fri, 12 Jan 2024 05:33:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IE5AZNO4oFVaryZ5aa5iqChHNGPmjd4IGJUxvGn/FIls+uaJs9lQXJn9yejCrCGXH+ZqT0f X-Received: by 2002:a05:6a20:1596:b0:19a:625f:96ee with SMTP id h22-20020a056a20159600b0019a625f96eemr1051472pzj.3.1705066414528; Fri, 12 Jan 2024 05:33:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705066414; cv=none; d=google.com; s=arc-20160816; b=ycBc8nTAn0ckybCkFwWtsMJ2SBzAgyb2wQtYNmd3Ngv6NziwgysdQbJ5xWo+4R5Bd6 PAJqRGI33iGNFVc/uU1x+v9vXETTTXXBNA6hB0lNBiU+AxCjLAKzJxqfeJjg6EXSZTXB 0yHpzxz1axSrlN1bwacuPdHgV64ItFBvA6kDKMhgxC3RL/X528P+G4WUABt+T2qVWolT r0n6Pw4mEtukT4ULDgr5D1qFG3FpuDNgOVfd7XgUdvAwO+nj9HcPk1Xsof/yLnPPSQ7Z h0anA5ajM7aQQrCDU+wAKs62f0AdweEeN8YmVLh12lenymsEOpzo4VVBEwa1ZIH7l8y6 qyDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=tgrbQMGfEsmd3EnXwYIw9vWmsd0N/cHRzr8V8gh7YC4=; fh=tMs0Qcgrzgfxx2ekVp3zTFmwxuyr8gWjWxhPfdVHbp4=; b=kgXRzzORvP+uOueGzwCQfJzKS3/rBKCUoQsJ2f/3ELnQF92w2FEcm8I3n20rY/zWLL kZQnppmyqqGEGQH8196wtqAKiMK57dgtb7abJeE14vDY1klrkUAVzyUca3uBPPmmE3Sg od8vMueIv/PAGYJaIz70OprAtkhEf4YSG9YqALBlT765bqrs21fxQdg/FZYztP0FDcVp dNnmspHyNTowe8O0w/OTA4cSYuR7WWVaGQmFryLGX5FRJBnsrm+RtKxeD5tKOQFXLvVr u04OsYlGHIz+0EnJXGXg7yP7NKtlrTqZGibeFGoCi6tjLWygB+k7tQ8rcHUDypBwHIH4 ItKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=GEe1UDMM; spf=pass (google.com: domain of linux-kernel+bounces-24693-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24693-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id bd6-20020a056a00278600b006cbd8179b4csi3372236pfb.108.2024.01.12.05.33.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 05:33:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-24693-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=GEe1UDMM; spf=pass (google.com: domain of linux-kernel+bounces-24693-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24693-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 86D12B23ECB for ; Fri, 12 Jan 2024 13:33:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 171C96DCEE; Fri, 12 Jan 2024 13:32:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="GEe1UDMM" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F9BE6BB49; Fri, 12 Jan 2024 13:32:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1705066351; bh=YkdDpomM6xgjjZT3f/VDi2h3qQuEYm1oWG/yoqw8ImM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GEe1UDMM/w79byImu60YnSiFe36p0UL+qBsPTpVtNNWtfFBqLiyvIan0nNcIPoyqT cr6WFujt7CCY5y14VrOsh6zMUtQTUW5opwob9x15/70A+SPwIhmb7mErsOlOJ3yFYT a9+QQMd+U7LawYmjrY//yHHkhWs6gCZBGnnz33LZzim/4oXyeMZqipqoVoHablgw+q JWmjNIiKWDssKe2Wz1+PHC9vb+RolyZqBjPY+HBCYPBsEkFHikirS5tnstnld+RPCm LEAgVIEzm4ffPAHZUfMN4q7GNtAYGySgWB7FbxWFUTxoAKd/NP3crBw+vdiFNkMPvL Ri5D+h10mpRYg== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 8D8E73782031; Fri, 12 Jan 2024 13:32:30 +0000 (UTC) From: AngeloGioacchino Del Regno To: chunfeng.yun@mediatek.com Cc: gregkh@linuxfoundation.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@collabora.com Subject: [PATCH 2/2] usb: mtu3: Add MT8195 MTU3 ip-sleep wakeup support Date: Fri, 12 Jan 2024 14:32:22 +0100 Message-ID: <20240112133222.240038-2-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240112133222.240038-1-angelogioacchino.delregno@collabora.com> References: <20240112133222.240038-1-angelogioacchino.delregno@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787891720702079691 X-GMAIL-MSGID: 1787891720702079691 Add support for the ip-sleep wakeup functionality on the three MTU3 controllers found on the MT8195 SoC. Signed-off-by: AngeloGioacchino Del Regno --- drivers/usb/mtu3/mtu3_host.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/usb/mtu3/mtu3_host.c b/drivers/usb/mtu3/mtu3_host.c index 9f2be22af844..85f49e00e8db 100644 --- a/drivers/usb/mtu3/mtu3_host.c +++ b/drivers/usb/mtu3/mtu3_host.c @@ -34,6 +34,19 @@ #define WC0_SSUSB0_CDEN BIT(6) #define WC0_IS_SPM_EN BIT(1) +/* mt8195 */ +#define PERI_WK_CTRL0_8195 0x04 +#define WC0_IS_P_95 BIT(30) /* polarity */ +#define WC0_IS_C_95(x) ((u32)(((x) & 0x7) << 27)) +#define WC0_IS_EN_P3_95 BIT(26) +#define WC0_IS_EN_P2_95 BIT(25) +#define WC0_IS_EN_P1_95 BIT(24) + +#define PERI_WK_CTRL1_8195 0x20 +#define WC1_IS_C_95(x) ((u32)(((x) & 0xf) << 28)) +#define WC1_IS_P_95 BIT(12) +#define WC1_IS_EN_P0_95 BIT(6) + /* mt2712 etc */ #define PERI_SSUSB_SPM_CTRL 0x0 #define SSC_IP_SLEEP_EN BIT(4) @@ -44,6 +57,9 @@ enum ssusb_uwk_vers { SSUSB_UWK_V2, SSUSB_UWK_V1_1 = 101, /* specific revision 1.01 */ SSUSB_UWK_V1_2, /* specific revision 1.02 */ + SSUSB_UWK_V1_3, /* mt8195 IP0 */ + SSUSB_UWK_V1_5 = 105, /* mt8195 IP2 */ + SSUSB_UWK_V1_6, /* mt8195 IP3 */ }; /* @@ -70,6 +86,21 @@ static void ssusb_wakeup_ip_sleep_set(struct ssusb_mtk *ssusb, bool enable) msk = WC0_SSUSB0_CDEN | WC0_IS_SPM_EN; val = enable ? msk : 0; break; + case SSUSB_UWK_V1_3: + reg = ssusb->uwk_reg_base + PERI_WK_CTRL1_8195; + msk = WC1_IS_EN_P0_95 | WC1_IS_C_95(0xf) | WC1_IS_P_95; + val = enable ? (WC1_IS_EN_P0_95 | WC1_IS_C_95(0x1)) : 0; + break; + case SSUSB_UWK_V1_5: + reg = ssusb->uwk_reg_base + PERI_WK_CTRL0_8195; + msk = WC0_IS_EN_P2_95 | WC0_IS_C_95(0x7) | WC0_IS_P_95; + val = enable ? (WC0_IS_EN_P2_95 | WC0_IS_C_95(0x1)) : 0; + break; + case SSUSB_UWK_V1_6: + reg = ssusb->uwk_reg_base + PERI_WK_CTRL0_8195; + msk = WC0_IS_EN_P3_95 | WC0_IS_C_95(0x7) | WC0_IS_P_95; + val = enable ? (WC0_IS_EN_P3_95 | WC0_IS_C_95(0x1)) : 0; + break; case SSUSB_UWK_V2: reg = ssusb->uwk_reg_base + PERI_SSUSB_SPM_CTRL; msk = SSC_IP_SLEEP_EN | SSC_SPM_INT_EN;