From patchwork Sat Oct 26 09:09:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjian Song X-Patchwork-Id: 13852157 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BDC1DD10BEC for ; Sat, 26 Oct 2024 09:13:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=2CVB7DGPsHwnsQCoXB7SBZjklEmEnihl9vo2LqNcsog=; b=QDs+czssdoFBarJ6UkIS/hefoz 1q3HPqZ0QPJcGhKpupg3i2hbdIJ07IXXcoS/rrDLetaVQH8IheRpt0vyMgo3G8/YDZtSYWuynPunK x/m4ck8s82jY3jB7CdIGhufpm1xeIuAdaIKvayBqTKxVRdw1/wlpQaN3zBg7WeqlgKspnGJumQF1W yhqCXSrMXaGMNLf9tk1UYcytFEEX/hTHp7Kup04ARTAateVkiBQuA7MN/sjM9JdUth+nnH0rU9ZZp 1wxmHqAP78Na+XxdHhYGePW/WKq82aQSgjzZlDUalkkYkOisE8UuVKBSA0drTqnMeWBubObW6N8hA 2e/457YA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t4crI-00000006Hai-2CaC; Sat, 26 Oct 2024 09:13:20 +0000 Received: from mail-psaapc01on20726.outbound.protection.outlook.com ([2a01:111:f403:200e::726] helo=APC01-PSA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t4coB-00000006Gx4-1faG; Sat, 26 Oct 2024 09:10:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VCXJz4+gNErGrMTtjA2x1zFZbQJVSKB12+dnGDthRDmTnfcOLB3P5avGjTLl2fKuF3l6Fs9HQAQabncGDjmlZlnLdDy6w9mFdDrZU/7X04fSFbY+pgEiIVaR3/dIMZ8PTOmaG7d4bBKtpUZd4/uard2/MgFQX2sEvLO1jCgpigDssyBop4RymcGaRDuzPUEMtUoloWm4/7lBPoMpRimR1ghxI2rePRjNSCMSddCs9UudJIWZybsDKVHYSrPdgThWF7SzlT+MxfioKaMKTkWGwI3K4fUTmuomb5c1sdsh9FciSQMRxaHp6fZcof8KKzw2adtcfbWMdbtHqn/9kGRgpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2CVB7DGPsHwnsQCoXB7SBZjklEmEnihl9vo2LqNcsog=; b=kNJfnGfDeTIsMMKmWdpbdZqB9qAPXHkKcg4GVFp8gZkFF69naM0pyAGwNtaoLE/eqha5zM72uyFG5xHVU0tgx9GK9bfg1XUNlgPMfUIuQQYcIMKBULWVVR3NMGRZbfsnjIheRwBUZtswe8j1cj1lDdtuBOJxH5kvNsmkpC81dh3QTeyM9Wxu9hsDsb8i/SB37AZXYBbfT7DxMInzDBnvuuq+seylIjjGgA8cDIZ5C/fqe+R1nD9T5rVGMFkiSAFiIy+2BvsLB5T/mPHKmb8PpJ1TE0bjEe6bL9RI+ueGHIavFBtOYHDuIDyT8nLIPfM9QLps6W0ible0VMK8ILcb0g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=fibocom.com; dmarc=pass action=none header.from=fibocom.com; dkim=pass header.d=fibocom.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fibocomcorp.onmicrosoft.com; s=selector1-fibocomcorp-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2CVB7DGPsHwnsQCoXB7SBZjklEmEnihl9vo2LqNcsog=; b=s8mNrATXjk/zZkYXAjsrryB2krhrWC5de2M8PRQJ9mwdYB0uozBcAGGerEEW4ZJ1zOHfsCQfIe4x89HIgq/FmHegB940DtE8/QF3BttszxBvBCwcjML+UmkgzsD9+TXDYZ0KazrRTASrPvnxdat4h4+09fimwRRZRBKV4cogJa8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=fibocom.com; Received: from TY0PR02MB5766.apcprd02.prod.outlook.com (2603:1096:400:1b5::6) by SEZPR02MB5864.apcprd02.prod.outlook.com (2603:1096:101:73::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16; Sat, 26 Oct 2024 09:09:49 +0000 Received: from TY0PR02MB5766.apcprd02.prod.outlook.com ([fe80::f53d:47b:3b04:9a8b]) by TY0PR02MB5766.apcprd02.prod.outlook.com ([fe80::f53d:47b:3b04:9a8b%4]) with mapi id 15.20.8093.018; Sat, 26 Oct 2024 09:09:49 +0000 From: Jinjian Song To: chandrashekar.devegowda@intel.com, chiranjeevi.rapolu@linux.intel.com, haijun.liu@mediatek.com, m.chetan.kumar@linux.intel.com, ricardo.martinez@linux.intel.com, loic.poulain@linaro.org, ryazanov.s.a@gmail.com, johannes@sipsolutions.net, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-doc@vger.kernel.org, angelogioacchino.delregno@collabora.com, linux-arm-kernel@lists.infradead.org, matthias.bgg@gmail.com, corbet@lwn.net, linux-mediatek@lists.infradead.org, helgaas@kernel.org, danielwinkler@google.com, korneld@google.com, andrew+netdev@lunn.ch, horms@kernel.org, Jinjian Song Subject: [net-next v7 1/2] wwan: core: Add WWAN ADB and MIPC port type Date: Sat, 26 Oct 2024 17:09:20 +0800 Message-Id: <20241026090921.8008-2-jinjian.song@fibocom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241026090921.8008-1-jinjian.song@fibocom.com> References: <20241026090921.8008-1-jinjian.song@fibocom.com> X-ClientProxiedBy: SG2PR04CA0186.apcprd04.prod.outlook.com (2603:1096:4:14::24) To TY0PR02MB5766.apcprd02.prod.outlook.com (2603:1096:400:1b5::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TY0PR02MB5766:EE_|SEZPR02MB5864:EE_ X-MS-Office365-Filtering-Correlation-Id: 915198c9-c44c-45f6-da2a-08dcf59df185 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|7416014|52116014|38350700014|921020; X-Microsoft-Antispam-Message-Info: +c6l/jxl7NYaw5AU53/xRYzdwn6u5WSHDCqUI4LnUWMexIDF1BH3o4t28UqfxTuMWlezHbt2rTCzTo4/1uFjg8ZNMAJta9ZuHcd8NvJo0Dm+wduTDvfF6TExltOz73abh+uXgjAZoYRZT9O8VVdrhfgLUuIt9lHRDmkiMGbZ7GuPCQezb3J9ZKj026Ucw+DTnYJShU8x7OlMMSWCZYGklPPnLeiC6oDO7X0thOSfeHtAO89Twy/sacXWIISqdq5pt0wjvORMjfVzz8sL6bKr5OVOmgLhGwZqtxOOz8wzFrgdRRCX78oq9myPBzyDLMWQYLSRhJwJpUguv4qVUOgdwZ+dv8QCG5z1HrxDQU9i3d/amK1gIIhOU03WGAsO+qIXsvt4OGcHtBd5fLw2EBVNG/U+oXacoDYOLzBsyiORqO9DWC8xeq4oGdQjZIy2mBU0QQzyyBpBUZB8tsY+gb5RsGxX11vf2IxLUcCdyeMf2HaU3GzcUV6XiBr+jV92XB7Ge7OaQARaV34fxHU8FE89PqSwZWRrJlkXGjzyaQKz0ztBM7oPnynFdUn9gapMp9zmgM3gDQ2LI06ZBM0yfu2hNgujILIPRD5m60zUaKphaSo+PZ/pfHF3A2x/a+/YuOKHQhuygejQeA3FNiSMmS/+ue618/hf0LPXNhAqvr0tyX0c63EaZmDRjC0jtKJ0UZYJSaUGXuO6I64WBGse44mTUN58BcRfJmhy8rLB6Uv183F7DvjW0trAJUkGZHkFJXm5/NJMAWYNUFESgqRqSQDR5kaKDv2s+Y8GLh5GoHJYrr17oTFn0iqnuxNhz3Jwxoqvwyy74BR80k8xZI1w0TAZnGH6K/Wkd4VkBIQMtbR/3xa/J0xmVuWw1UTs+5CUb/upzyoza/H0q2+RVAU8ExpHym7/XQPs9okUKTftXDaGDr8fmvtlRse3WEjS9f1bB0NhtJSQwuH3jq8qruR0L4Fp18YbA1WXqG791AP5pmi3AVTbaH9onB5GwSF/xcpAh1tR7Jamsj+6xiv2efSgPCu3Zzx7EG+Wi22+PXjV3T0254OZhThIE007ZVAJy7yke5owXKsIGIKbDAiTe0+O67cy7itfs6oGO6+EfEEDaMCzSwZftQ6Nw40met7VDzADkzwxdxP0WmAQpgcleBzFZXDH9almZkiQXXcwizOVulRx5l8Fj8IVvTZ0Yo6KqwajABlMD8hkQJ9dZD8lNLJ23SjzKNqj1TRT+J8Sw8S+5OZf+inmkf6I+z/ju1PNpp9mvYm/MSKbDWFTe6J+hZMqQ0UNu+i9wC1BdnwGU+mWG/ReDG3Zt3Qku6gOn274BkP+6q5O4q3p9qKSd8H5VUUdVfNaQedf2BEZq7oCcWa0ErB9lebYtUHbIx/xfdDIlzhyetY3 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TY0PR02MB5766.apcprd02.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(376014)(7416014)(52116014)(38350700014)(921020);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jK55PTZNGOnY/1iyymzPOKzSYcVbOnYiqRlUQKKmzSv8TKs+D5ZoD6Pom6oYY8fKL5B/Knbtvj0hkKf2CCuhxvn2Ig9BUv1rZWNJE83Zwo1qZRCAfq5Vm76E+g3tH1HBeeJblC5xdWAKqn12bTStN+RUxGRRxQITlzu4uHcA68P1sjtQx41RgtOJR0urg/E+ZSAVv7H1AKn0G8zkwQo3s+AWt9Wrf/SN9BJ2w1oB5E/6jkDso48szgVTFXqHEGbhhy+YnXk9dNNFglzSQfPEaYRvjLpnGLhACq8xnQr51dON/WiPYsVsGgDPegrV9bBMbQRrcUEXlmFIlHc6soPMa6j+5F8+h604grgXxZubuE/0BveEcUhy083ngaAG0Y8Pr/hccATKHGOPlsJWRDtjoH6zH+jz1hsZZL+r+c/ARIqA+3/jH/HTdE75wJvltmNdVcOiN2B8MkHK70VauwNOFjDxfArRzhuLYDMWygwxVTPXADIrKatTconk9LN5IlM0TNuE2jPUA9Ujae5MXno0LVBkCXtqacX9gPVcjwWJBCnQ5a3APhrebfQaKRltazbgah+YXU+aWOLliAtic8cg2w0yaxg7aJnVTIdQcwirupT94DceOFr55hcKZyy+k9WZ/MIJ1mcQhDRWDqSn0qserGvo2kGO4IycH536kKbtl51LmJEs4ATp/wrLyQgdGwpn+mshWdQrytY0GcAy/49TKa6vuiwcuJdzTaSn77JV8KnEAZkCRpXZs8GlhOPP17F5e4R+/skq3s1fbm/hngE7G3EmaTZgNZeWsV/MC9H3n/5G/Lw4YlH/ex89CN2p0GDhl4tfOepsEhnKYTamGNqiMvFKsd04OLxEhYOgV8aHSzYNeHf4u9DzZqbKvGLZ8PAjNz494qt4Sri2dgVfGAXUwOcbbUgy6aUlENoW/q2rDpnWnF2D8xrCzHGBYYjYzd2R21SVQVIDL3LM0+ro23f8I3134twFe1J/J7xlFIGLXvH8vKbFV2iVLcgEzsBBrqOl3q63PSwYQJZxBqgI0LzfOOL5CsTvdIikTtXySfJ5aU6p5MTp6M3knRRsN8q5EH2txJ9rygYug+xnfal61QRDlLhJPcGnj+SbXw+l1efNfX8NBk6p/c/eMhCnZ11mUzNcl7u7/lNZ0agol6U7N7wrD8Y9LMUU+jRwySlj1XpQw0BLqWQzhd11Vq8DeCFUvXB58wRZvtT5nlYvxxlOUTA7B0o98AtGD3gEZGaQBRRjV5qSQs3cJq/ekn/4gqtsfHXea13OjUtnnancz2jfBdFKlCg5qTvfkWBUqDZy0LJ30wHu4cUB93zk6zc3/JjgxZQWLAT2Hpn0lMlZLz6vzdGXpc90a1wei/w0Dd3AZDs7OMhC/oYEuH5LLoGim2kd7E5vynkwQRHhV16bgrREvbyjP9yBpDZ0NqjSOYsURvK71K1039fO5qIg0pRDs5zu4rAdDj0nMfby72xQKsyY7e3/OK19vFqWfq1LUdY1UgI8eFoBrZjY/ogmrFWa+xyB4cOVavD8DmTGCLwLCSN4AviT9DAFVRfKxPjbQpwhR2dGulBRvyEgiBaT1HqwGrd/L+y1pvUspZOaR77/09VY1b/0KQ== X-OriginatorOrg: fibocom.com X-MS-Exchange-CrossTenant-Network-Message-Id: 915198c9-c44c-45f6-da2a-08dcf59df185 X-MS-Exchange-CrossTenant-AuthSource: TY0PR02MB5766.apcprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Oct 2024 09:09:49.5459 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 889bfe61-8c21-436b-bc07-3908050c8236 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xtmjRcFsBN5lDuEwQFEME3T8nPTMyEsXWnhL3aWlYqPr84rWapOZNhcXcF0s4wHjga+3gRIDESWxC+PMZqgrXZvDsKaCSCFUpvZAusp+TB4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR02MB5864 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241026_021007_468887_7B733CCC X-CRM114-Status: UNSURE ( 9.61 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add new WWAN ports that connect to the device's ADB protocol interface and MTK MIPC diagnostic interface. Signed-off-by: Jinjian Song Reviewed-by: Sergey Ryazanov --- drivers/net/wwan/wwan_core.c | 8 ++++++++ include/linux/wwan.h | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/drivers/net/wwan/wwan_core.c b/drivers/net/wwan/wwan_core.c index 17431f1b1a0c..5ffa70d5de85 100644 --- a/drivers/net/wwan/wwan_core.c +++ b/drivers/net/wwan/wwan_core.c @@ -334,6 +334,14 @@ static const struct { .name = "FASTBOOT", .devsuf = "fastboot", }, + [WWAN_PORT_ADB] = { + .name = "ADB", + .devsuf = "adb", + }, + [WWAN_PORT_MIPC] = { + .name = "MIPC", + .devsuf = "mipc", + }, }; static ssize_t type_show(struct device *dev, struct device_attribute *attr, diff --git a/include/linux/wwan.h b/include/linux/wwan.h index 170fdee6339c..79c781875c09 100644 --- a/include/linux/wwan.h +++ b/include/linux/wwan.h @@ -17,6 +17,8 @@ * @WWAN_PORT_FIREHOSE: XML based command protocol * @WWAN_PORT_XMMRPC: Control protocol for Intel XMM modems * @WWAN_PORT_FASTBOOT: Fastboot protocol control + * @WWAN_PORT_ADB: ADB protocol control + * @WWAN_PORT_MIPC: MTK MIPC diagnostic interface * * @WWAN_PORT_MAX: Highest supported port types * @WWAN_PORT_UNKNOWN: Special value to indicate an unknown port type @@ -30,6 +32,8 @@ enum wwan_port_type { WWAN_PORT_FIREHOSE, WWAN_PORT_XMMRPC, WWAN_PORT_FASTBOOT, + WWAN_PORT_ADB, + WWAN_PORT_MIPC, /* Add new port types above this line */ From patchwork Sat Oct 26 09:09:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjian Song X-Patchwork-Id: 13852158 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 446D9D10BEC for ; Sat, 26 Oct 2024 09:15:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=wy9BRyDS/YI4u1/9O8lxo91aDjncgEt3P5B9sg3TsrE=; b=bLGWGLgzsXedsvzIgZ4i3bfhGy Pg/Y6YL04c14m20s/MGa5j8ENMlH/lTpXPbmP1TtcgvJ4YtgxwDvLvOGVF1yGAerLuNlGMvRXjfQB lRwu56B53CjpZWToPMK7T4zzsICUKIsbb/LDYsRmgvV7dVKeDjltULM0SSBKZs+zSHjJF8eHBU4dl TkCCGUa5vdh6baUsuKv90oYD/wfkSbu/x79QHmTIqlOKC+KWRnUej0YkKl6HVt8s9r4vGvEsbT9wY fwHMz9OQe7yr7mDvPNOGm2GZ+0tRGt7HnwpNua9XWiw4JECt2NPoN8SGN9jCbwaWFOaqAtvrtHBHH 6Bg3JZaw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t4csq-00000006Hny-2Crk; Sat, 26 Oct 2024 09:14:56 +0000 Received: from mail-psaapc01on20726.outbound.protection.outlook.com ([2a01:111:f403:200e::726] helo=APC01-PSA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t4coD-00000006Gx4-058b; Sat, 26 Oct 2024 09:10:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tqXfVMXW9fdUaUmiSjIa2CkezU4wPeOVFTjB1BPcypCQoqGLVG6jXyWCsgz++5dfkbam85vQ6AfZB4CCO/JAndBvoAJLwKOW/bKJz0qUuF70K+tPJxLFwsRwgzq2jHuYtdiHYsEzMIDXzSRZ4yFgpKGsTnbPXzhD9tFxc9FzWtNSsIGLzeGj3/W+z6eGT2g0ZoHbdMyJDafSA+GokPO6htmewGQtbyBpW/fyZcwHlwaP+e9+2U9zcNYTZpCdGlJgm+a1eObuqYUCTiVVVpy10O/eEguE1I3/05ifDwKHh/2C3Wm5Pw4HgW0mF2NlZt4OsJWn3uW8RiXcLUb2v9CO2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wy9BRyDS/YI4u1/9O8lxo91aDjncgEt3P5B9sg3TsrE=; b=fDCvfq8zKi4538+IFZgGycMB/DqLY82X9F8/KBBqKGOZ2Kq49YDqufAz8TZbCODd1AdDjOrfOmC2jgj8e0PLeDJYhYOBRonkIWP41IpDL07LazaZHAe0aBUaI9HDuOi7Xx7FlAoXZyhGMMOtU2xEWcsLcigXNm6x8+bm7ROJdjVxjBBUvUCEHW5K08BA4aNsRWWAYoVnDCE9tI5eRCnLy3Y/RwiOe/66oAD+EsSYSYlo3bzq488URCzb6UZVlGOxl5lrlQV+AAch3OXDk6Zhq6ls9ecb2RyWXWBpfc1cbxog3HdiTyKv6LRQqy6YXFsjMkXnxdzVBARCY/GMWxTIMA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=fibocom.com; dmarc=pass action=none header.from=fibocom.com; dkim=pass header.d=fibocom.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fibocomcorp.onmicrosoft.com; s=selector1-fibocomcorp-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wy9BRyDS/YI4u1/9O8lxo91aDjncgEt3P5B9sg3TsrE=; b=kWfRnlwqKkgJemJpEYIas3PPO0+uwNcIbYySxJ2ZYVjY3yL78doZ2EeHOYkOQ/dTYZHqoMPHPxO/ah/NWnWb80LSGkH5mRFMRr6sLQyoCl9kAE92nMr92bz40alZlyKRPXlfe6r7qzm1zYBn07M8UtQSBSl/gAyItCigMVlJOcI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=fibocom.com; Received: from TY0PR02MB5766.apcprd02.prod.outlook.com (2603:1096:400:1b5::6) by SEZPR02MB5864.apcprd02.prod.outlook.com (2603:1096:101:73::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16; Sat, 26 Oct 2024 09:09:59 +0000 Received: from TY0PR02MB5766.apcprd02.prod.outlook.com ([fe80::f53d:47b:3b04:9a8b]) by TY0PR02MB5766.apcprd02.prod.outlook.com ([fe80::f53d:47b:3b04:9a8b%4]) with mapi id 15.20.8093.018; Sat, 26 Oct 2024 09:09:58 +0000 From: Jinjian Song To: chandrashekar.devegowda@intel.com, chiranjeevi.rapolu@linux.intel.com, haijun.liu@mediatek.com, m.chetan.kumar@linux.intel.com, ricardo.martinez@linux.intel.com, loic.poulain@linaro.org, ryazanov.s.a@gmail.com, johannes@sipsolutions.net, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-doc@vger.kernel.org, angelogioacchino.delregno@collabora.com, linux-arm-kernel@lists.infradead.org, matthias.bgg@gmail.com, corbet@lwn.net, linux-mediatek@lists.infradead.org, helgaas@kernel.org, danielwinkler@google.com, korneld@google.com, andrew+netdev@lunn.ch, horms@kernel.org, Jinjian Song Subject: [net-next v7 2/2] net: wwan: t7xx: Add debug port Date: Sat, 26 Oct 2024 17:09:21 +0800 Message-Id: <20241026090921.8008-3-jinjian.song@fibocom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241026090921.8008-1-jinjian.song@fibocom.com> References: <20241026090921.8008-1-jinjian.song@fibocom.com> X-ClientProxiedBy: SG2PR04CA0186.apcprd04.prod.outlook.com (2603:1096:4:14::24) To TY0PR02MB5766.apcprd02.prod.outlook.com (2603:1096:400:1b5::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TY0PR02MB5766:EE_|SEZPR02MB5864:EE_ X-MS-Office365-Filtering-Correlation-Id: bcbf3138-4db8-49ae-91cb-08dcf59df6f4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|7416014|52116014|38350700014|921020; X-Microsoft-Antispam-Message-Info: HW/mKyTiTp2KnC2xdaGKy3WjksWBgrDfVK81joSP+uEztlbeD986nfoxmem9gaaMAEm1ze1feS5J5XKBF9QKGLYz4xGtx097Qe6VCVkRK9PxDlrcAezSo8CJ2Stj9gjfKK/XioX50FY44gf8xfPBuwzj05/vVam1dfW9M5FVhFeucra2TkNIKPy0kKt/lThHZELDXdga0R0zlzHTFhUoD/hRTlmx7fbhKbq58bTDmr9Q+qnok8axRbEBhsAvNIY019Z5ytInPlSH8ka+OOjglmxe36YJtaLLNvghuXWU9dt3OYbIoid/dohi/wVZVRhtijdrQn/QlEQ80Q/CtJyO/GmQXtTIh8x90UTBTFydwuLh6uS9dGrqegJ4zmmPtclcyIwIcigwMruaWr/sHacSiUmRc3UhK25SZq1mcedmzlwTQAMXNZ6YVvRTxYZl2JI+RmflL7qBDp6Eds8y6RsEhM+Ei4H7NuJqkY78oXmzsiv3+TI5vZO8TUcbz47zmOvJABgQPwsXXs2cMX1S1P/ZCyVmfFmvjqwIm7LvNM5uNeFnrffNDuWwfQfvE5GIfC5n0Sbi1hXriFowsnlyO+WW+ERBCQV7YRPuUI4CRgp20JuN+dEd4NKXgmpFtKBHekjQP/6FGY4Chadtws1oM+uVCPnaZDDEKWzN36ntqv2hinODpScam7F0/9qi2j6C1eoG00SRDZCWQGNInp2iP6HEmb6/c2mDP5RwdeVVdjfw9bkvKxJ4uBtVXovRng94ELy44RK2bqtHsuQGkrN7ZIC8Khk6f49kcsReMgILUcksdTLUwSCjt46XJgpSbHVHWoHDMQ+hplCTOR8oSR/xVc8ARZk8ThNhBtCiWsce9Cl3xcBQLR3PrLzpM/jtWqya9ltTeRWNZPk3ppAF34mUqXUUnhNFzH+ViM71/eCZRthsI5SE6OGw6QcaltUz6rvYzOlINmNHz4Uuy9hk0nxN98WV12T/4Zv5l0LNTZTE7tzV46ZxoZZ6Xfj/gQWWNvNmProIwyEr+2uWMDql2WhC7si8fipcotufhmxEYt2PoRoy5T/6X/DKYAiJyCre6qanjJm/dhP9NWsMlCl0uw9/OPz7b+fmjv+fDztx17M1EO4z6wFkG/5h4TRGCf2JISTKqu98SFRvVSKqgiAuqjGd+dHdg3HtoY9munbkGKx2ngmUvpuMlPsdK/jeVBT8/g1AAUzmTCOjBu32D5KeYpdwnzz7f1Eya3RS91uPtC528Wtct9lgdZxisoTikd6CltQfq0fj6xMaSEuK9GtItjMPKvZyyHq1H7vSzYwddTKZzBBZPZuDMiyxeI6KAeoEI1xlqqVvEZoexoDzD1+jeat31lWhYg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TY0PR02MB5766.apcprd02.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(376014)(7416014)(52116014)(38350700014)(921020);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0iq67ST0x576d39J0z8tE5owNXcdTBML2hU3LfY0fQjloSeGF+mae3iDFvGKxg9VWPBztjSrnqNUupcQQiwkfpRY2fn43tpS4nuYqOYU7xdE137zv9Q0BDg2OCLPbIx9zdpcFVmc6jY8SPIZ6eXWqdUt2daKoUsDDUEc9WVEk9EWl2Y5vy55IdJnyf9TwQvHINnnYKP1IysHzpJ6uSQzcwP5vb1/G6IezphwivebiiJ+UFTOOrN5noYFbAmnb7LfaAo5SorJWlOT88ijNl3a2aBzQ2BWC8HVSnsqIcOXBUNCSs49m+sIwR91y3T4Kwz8o1PtijHzDePGJZalP7MDmbcwotrd9c1EE0oXw4ateAMmPOFxYb0H/JJ5F4KGpPTFiPynfM3KTyFKnW/6E+EJZMGSUvzMEU7nqa/mwiALdlv+Q10/ynCu6M50TrlTDkcw2D2EbVNJphp1e6tORPdg5zi02mm2oRc2bFPZlXZL/jWTvp8vBXIshJF3Wx6Nl5gmLycC7CY1wEyRXuvkYJqJUL7ctwPoN3SAp4TpktPLV3dpAbd0SReVZE7BOB7sp8ZosMZXQsiD2dmkdQ8xLVgWd0D3zRP7QlKLxQYYTNxwGfjdlnNrMg6CMdRQFOVCj6ILAiXhKEX6VI3YLh2dKGraLrKfWyD+ulD+fwTfM6NA+08dN+9S6Q+iz3lGNo/bxg9kzWJX6CN8VWvuVw/+l0tjrLe4APvZoegguXMEmSJL6kIYSq+ZTLJ2NtEkfjr9mFTF78KKhbwgrIf8idXvVHkx6/dRRbH7GYYXOouNsxQqr4NDSHs70EmxEOeZvHpukTi1hGRGBgM4xCGJ/Q1FbKVkEVN1rMYWlpr55hhqk2mVXHQ1uHgozblv3sUHodWsaKnjzSyL6/pAyjMtmMaXBfJ4TV8Do0GcaLj3VKtGftWVU3hnUyy+zgbFji13Y1j2op/wv4WmgQJsnnDmzuiDFIr2WxAj8tQ3D64W8BCj9vmOyLxirUaHCkpecilwDQFzwIprYJXmGMv0ESsVg2LKmmPRMlY0B6itWFQM2FbsAlHAvgWTdXKvZPt6r4yIbQdrDaExeC9Is7TfPmPPFNWH/0kcoEMG1wANzTpNpP0JTt2lBGtPdQ1RjzamslUQzVNRnenYV0A06PtrgIXifZEu2hc4fPuiohEs4xdsVkfVr9DsSUcvqw77fiVEo3AdVEYK6YzFaobOMlQcx4sxi2ry67N/KMhxhrxTkC28vcqUkdKrJmssHG25nYn4/RNrCKMGmQjXgggeU1c3Ags4Ot8H5NQsU38Wdbfb7EXP3x/h/Oqxk4PDxQVCXlyt2nwUOkwTKxi/q3tkTYEcZYwKkxLbPoqIZE5RENw2nfiqHuQg1hrZhTvk4vrvS307vkEafwaMP94gPU9/n9aw0q9MvMEPShnBQklym0Xaln2K50iHThxptXDvpQ/ezcLyZN0AjXmgG51gwB992CZyFsTD9//hNmfVsL895XrOc1dufH7giL31KyaRqnj9uGbQbWT0AlhEWyPl3NUyDBarzCS/1YOeCO+s0T4REbZIO+67T9QaaZiRjYwyee+fcJOgHzR4d0LFRxKmNT7RMgXm9sJXZrexn8Dm9A== X-OriginatorOrg: fibocom.com X-MS-Exchange-CrossTenant-Network-Message-Id: bcbf3138-4db8-49ae-91cb-08dcf59df6f4 X-MS-Exchange-CrossTenant-AuthSource: TY0PR02MB5766.apcprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Oct 2024 09:09:58.9402 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 889bfe61-8c21-436b-bc07-3908050c8236 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rGFpLP46Spc3G/Dnr+z2mjHObqSvgoFB6613A68BCOMbFvsx9WTSihAakZtIMilX3B4GMsyCA5JU/GU/d78tHq7r7duZxgktN6onuNK9a94= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR02MB5864 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241026_021009_111058_978B078B X-CRM114-Status: GOOD ( 15.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add support for userspace to switch on the debug port(ADB,MIPC). - ADB port: /dev/wwan0adb0 - MIPC port: /dev/wwan0mipc0 Application can use ADB (Android Debug Bridge) port to implement functions (shell, pull, push ...) by ADB protocol commands. E.g., ADB commands: - A_OPEN: OPEN(local-id, 0, "destination") - A_WRTE: WRITE(local-id, remote-id, "data") - A_OKEY: READY(local-id, remote-id, "") - A_CLSE: CLOSE(local-id, remote-id, "") Link: https://android.googlesource.com/platform/packages/modules/adb/+/refs/heads/main/README.md Application can use MIPC (Modem Information Process Center) port to debug antenna tuner or noise profiling through this MTK modem diagnostic interface. By default, debug ports are not exposed, so using the command to enable or disable debug ports. Switch on debug port: - debug: 'echo debug > /sys/bus/pci/devices/${bdf}/t7xx_mode Switch off debug port: - normal: 'echo normal > /sys/bus/pci/devices/${bdf}/t7xx_mode Signed-off-by: Jinjian Song --- v7: * Adjust t7xx.rst columns and word spelling in commit message v5: * modify line length warning in t7xx_proxy_port_debug() v4: * modify commit message t7xx_mode to t7xx_port_mode v3: * add sysfs interface t7xx_port_mode * delete spin_lock_init in t7xx_proxy_port_debug() * modify document t7xx.rst v2: * add WWAN ADB and MIPC port --- .../networking/device_drivers/wwan/t7xx.rst | 64 +++++++++++++++--- drivers/net/wwan/t7xx/t7xx_pci.c | 67 +++++++++++++++++-- drivers/net/wwan/t7xx/t7xx_pci.h | 7 ++ drivers/net/wwan/t7xx/t7xx_port.h | 3 + drivers/net/wwan/t7xx/t7xx_port_proxy.c | 44 +++++++++++- drivers/net/wwan/t7xx/t7xx_port_proxy.h | 1 + drivers/net/wwan/t7xx/t7xx_port_wwan.c | 8 ++- 7 files changed, 176 insertions(+), 18 deletions(-) diff --git a/Documentation/networking/device_drivers/wwan/t7xx.rst b/Documentation/networking/device_drivers/wwan/t7xx.rst index f346f5f85f15..6071dee8c186 100644 --- a/Documentation/networking/device_drivers/wwan/t7xx.rst +++ b/Documentation/networking/device_drivers/wwan/t7xx.rst @@ -7,12 +7,13 @@ ============================================ t7xx driver for MTK PCIe based T700 5G modem ============================================ -The t7xx driver is a WWAN PCIe host driver developed for linux or Chrome OS platforms -for data exchange over PCIe interface between Host platform & MediaTek's T700 5G modem. -The driver exposes an interface conforming to the MBIM protocol [1]. Any front end -application (e.g. Modem Manager) could easily manage the MBIM interface to enable -data communication towards WWAN. The driver also provides an interface to interact -with the MediaTek's modem via AT commands. +The t7xx driver is a WWAN PCIe host driver developed for linux or Chrome OS +platforms for data exchange over PCIe interface between Host platform & +MediaTek's T700 5G modem. +The driver exposes an interface conforming to the MBIM protocol [1]. Any front +end application (e.g. Modem Manager) could easily manage the MBIM interface to +enable data communication towards WWAN. The driver also provides an interface +to interact with the MediaTek's modem via AT commands. Basic usage =========== @@ -45,8 +46,8 @@ The driver provides sysfs interfaces to userspace. t7xx_mode --------- -The sysfs interface provides userspace with access to the device mode, this interface -supports read and write operations. +The sysfs interface provides userspace with access to the device mode, this +interface supports read and write operations. Device mode: @@ -67,6 +68,28 @@ Write from userspace to set the device mode. :: $ echo fastboot_switching > /sys/bus/pci/devices/${bdf}/t7xx_mode +t7xx_port_mode +-------------- +The sysfs interface provides userspace with access to the port mode, this +interface supports read and write operations. + +Port mode: + +- ``normal`` represents switching off debug ports +- ``debug`` represents switching on debug ports + +Currently supported debug ports (ADB/MIPC). + +Read from userspace to get the current port mode. + +:: + $ cat /sys/bus/pci/devices/${bdf}/t7xx_port_mode + +Write from userspace to set the port mode. + +:: + $ echo debug > /sys/bus/pci/devices/${bdf}/t7xx_port_mode + Management application development ================================== The driver and userspace interfaces are described below. The MBIM protocol is @@ -139,6 +162,25 @@ Please note that driver needs to be reloaded to export /dev/wwan0fastboot0 port, because device needs a cold reset after enter ``fastboot_switching`` mode. +ADB port userspace ABI +---------------------- + +/dev/wwan0adb0 character device +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The driver exposes a ADB protocol interface by implementing ADB WWAN Port. +The userspace end of the ADB channel pipe is a /dev/wwan0adb0 character device. +Application shall use this interface for ADB protocol communication. + +MIPC port userspace ABI +----------------------- + +/dev/wwan0mipc0 character device +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The driver exposes a diagnostic interface by implementing MIPC (Modem +Information Process Center) WWAN Port. The userspace end of the MIPC channel +pipe is a /dev/wwan0mipc0 character device. +Application shall use this interface for MTK modem diagnostic communication. + The MediaTek's T700 modem supports the 3GPP TS 27.007 [4] specification. References @@ -164,3 +206,9 @@ speak the Mobile Interface Broadband Model (MBIM) protocol"* [5] *fastboot "a mechanism for communicating with bootloaders"* - https://android.googlesource.com/platform/system/core/+/refs/heads/main/fastboot/README.md + +[6] *ADB (Android Debug Bridge) "a mechanism to keep track of Android devices +and emulators instances connected to or running on a given host developer +machine with ADB protocol"* + +- https://android.googlesource.com/platform/packages/modules/adb/+/refs/heads/main/README.md diff --git a/drivers/net/wwan/t7xx/t7xx_pci.c b/drivers/net/wwan/t7xx/t7xx_pci.c index 4f89a353588b..687a5e73508a 100644 --- a/drivers/net/wwan/t7xx/t7xx_pci.c +++ b/drivers/net/wwan/t7xx/t7xx_pci.c @@ -41,6 +41,7 @@ #include "t7xx_pcie_mac.h" #include "t7xx_reg.h" #include "t7xx_state_monitor.h" +#include "t7xx_port_proxy.h" #define T7XX_PCI_IREG_BASE 0 #define T7XX_PCI_EREG_BASE 2 @@ -61,7 +62,13 @@ static const char * const t7xx_mode_names[] = { [T7XX_FASTBOOT_DUMP] = "fastboot_dump", }; +static const char * const t7xx_port_mode_names[] = { + [T7XX_DEBUG] = "debug", + [T7XX_NORMAL] = "normal", +}; + static_assert(ARRAY_SIZE(t7xx_mode_names) == T7XX_MODE_LAST); +static_assert(ARRAY_SIZE(t7xx_port_mode_names) == T7XX_PORT_MODE_LAST); static ssize_t t7xx_mode_store(struct device *dev, struct device_attribute *attr, @@ -120,13 +127,61 @@ static ssize_t t7xx_mode_show(struct device *dev, static DEVICE_ATTR_RW(t7xx_mode); -static struct attribute *t7xx_mode_attr[] = { +static ssize_t t7xx_port_mode_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct t7xx_pci_dev *t7xx_dev; + struct pci_dev *pdev; + int index = 0; + + pdev = to_pci_dev(dev); + t7xx_dev = pci_get_drvdata(pdev); + if (!t7xx_dev) + return -ENODEV; + + index = sysfs_match_string(t7xx_port_mode_names, buf); + if (index == T7XX_DEBUG) { + t7xx_proxy_port_debug(t7xx_dev, true); + WRITE_ONCE(t7xx_dev->port_mode, T7XX_DEBUG); + } else if (index == T7XX_NORMAL) { + t7xx_proxy_port_debug(t7xx_dev, false); + WRITE_ONCE(t7xx_dev->port_mode, T7XX_NORMAL); + } + + return count; +}; + +static ssize_t t7xx_port_mode_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + enum t7xx_port_mode port_mode = T7XX_NORMAL; + struct t7xx_pci_dev *t7xx_dev; + struct pci_dev *pdev; + + pdev = to_pci_dev(dev); + t7xx_dev = pci_get_drvdata(pdev); + if (!t7xx_dev) + return -ENODEV; + + port_mode = READ_ONCE(t7xx_dev->port_mode); + if (port_mode < T7XX_PORT_MODE_LAST) + return sysfs_emit(buf, "%s\n", t7xx_port_mode_names[port_mode]); + + return sysfs_emit(buf, "%s\n", t7xx_port_mode_names[T7XX_NORMAL]); +} + +static DEVICE_ATTR_RW(t7xx_port_mode); + +static struct attribute *t7xx_attr[] = { &dev_attr_t7xx_mode.attr, + &dev_attr_t7xx_port_mode.attr, NULL }; -static const struct attribute_group t7xx_mode_attribute_group = { - .attrs = t7xx_mode_attr, +static const struct attribute_group t7xx_attribute_group = { + .attrs = t7xx_attr, }; void t7xx_mode_update(struct t7xx_pci_dev *t7xx_dev, enum t7xx_mode mode) @@ -843,7 +898,7 @@ static int t7xx_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) t7xx_pcie_mac_interrupts_dis(t7xx_dev); ret = sysfs_create_group(&t7xx_dev->pdev->dev.kobj, - &t7xx_mode_attribute_group); + &t7xx_attribute_group); if (ret) goto err_md_exit; @@ -859,7 +914,7 @@ static int t7xx_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) err_remove_group: sysfs_remove_group(&t7xx_dev->pdev->dev.kobj, - &t7xx_mode_attribute_group); + &t7xx_attribute_group); err_md_exit: t7xx_md_exit(t7xx_dev); @@ -874,7 +929,7 @@ static void t7xx_pci_remove(struct pci_dev *pdev) t7xx_dev = pci_get_drvdata(pdev); sysfs_remove_group(&t7xx_dev->pdev->dev.kobj, - &t7xx_mode_attribute_group); + &t7xx_attribute_group); t7xx_md_exit(t7xx_dev); for (i = 0; i < EXT_INT_NUM; i++) { diff --git a/drivers/net/wwan/t7xx/t7xx_pci.h b/drivers/net/wwan/t7xx/t7xx_pci.h index cd8ea17c2644..1d632405c89b 100644 --- a/drivers/net/wwan/t7xx/t7xx_pci.h +++ b/drivers/net/wwan/t7xx/t7xx_pci.h @@ -53,6 +53,12 @@ enum t7xx_mode { T7XX_MODE_LAST, /* must always be last */ }; +enum t7xx_port_mode { + T7XX_NORMAL, + T7XX_DEBUG, + T7XX_PORT_MODE_LAST, /* must always be last */ +}; + /* struct t7xx_pci_dev - MTK device context structure * @intr_handler: array of handler function for request_threaded_irq * @intr_thread: array of thread_fn for request_threaded_irq @@ -94,6 +100,7 @@ struct t7xx_pci_dev { struct dentry *debugfs_dir; #endif u32 mode; + u32 port_mode; }; enum t7xx_pm_id { diff --git a/drivers/net/wwan/t7xx/t7xx_port.h b/drivers/net/wwan/t7xx/t7xx_port.h index f74d3bab810d..9f5d6d288c97 100644 --- a/drivers/net/wwan/t7xx/t7xx_port.h +++ b/drivers/net/wwan/t7xx/t7xx_port.h @@ -42,6 +42,8 @@ enum port_ch { /* to AP */ PORT_CH_AP_CONTROL_RX = 0x1000, PORT_CH_AP_CONTROL_TX = 0x1001, + PORT_CH_AP_ADB_RX = 0x100a, + PORT_CH_AP_ADB_TX = 0x100b, /* to MD */ PORT_CH_CONTROL_RX = 0x2000, @@ -100,6 +102,7 @@ struct t7xx_port_conf { struct port_ops *ops; char *name; enum wwan_port_type port_type; + bool debug; }; struct t7xx_port { diff --git a/drivers/net/wwan/t7xx/t7xx_port_proxy.c b/drivers/net/wwan/t7xx/t7xx_port_proxy.c index 35743e7de0c3..26d3f57732cc 100644 --- a/drivers/net/wwan/t7xx/t7xx_port_proxy.c +++ b/drivers/net/wwan/t7xx/t7xx_port_proxy.c @@ -39,6 +39,8 @@ #define Q_IDX_CTRL 0 #define Q_IDX_MBIM 2 +#define Q_IDX_MIPC 2 +#define Q_IDX_ADB 3 #define Q_IDX_AT_CMD 5 #define INVALID_SEQ_NUM GENMASK(15, 0) @@ -100,7 +102,27 @@ static const struct t7xx_port_conf t7xx_port_conf[] = { .path_id = CLDMA_ID_AP, .ops = &ctl_port_ops, .name = "t7xx_ap_ctrl", - }, + }, { + .tx_ch = PORT_CH_AP_ADB_TX, + .rx_ch = PORT_CH_AP_ADB_RX, + .txq_index = Q_IDX_ADB, + .rxq_index = Q_IDX_ADB, + .path_id = CLDMA_ID_AP, + .ops = &wwan_sub_port_ops, + .name = "adb", + .port_type = WWAN_PORT_ADB, + .debug = true, + }, { + .tx_ch = PORT_CH_MIPC_TX, + .rx_ch = PORT_CH_MIPC_RX, + .txq_index = Q_IDX_MIPC, + .rxq_index = Q_IDX_MIPC, + .path_id = CLDMA_ID_MD, + .ops = &wwan_sub_port_ops, + .name = "mipc", + .port_type = WWAN_PORT_MIPC, + .debug = true, + } }; static const struct t7xx_port_conf t7xx_early_port_conf[] = { @@ -505,13 +527,31 @@ static void t7xx_proxy_init_all_ports(struct t7xx_modem *md) spin_lock_init(&port->port_update_lock); port->chan_enable = false; - if (port_conf->ops && port_conf->ops->init) + if (!port_conf->debug && port_conf->ops && port_conf->ops->init) port_conf->ops->init(port); } t7xx_proxy_setup_ch_mapping(port_prox); } +void t7xx_proxy_port_debug(struct t7xx_pci_dev *t7xx_dev, bool show) +{ + struct port_proxy *port_prox = t7xx_dev->md->port_prox; + struct t7xx_port *port; + int i; + + for_each_proxy_port(i, port, port_prox) { + const struct t7xx_port_conf *port_conf = port->port_conf; + + if (port_conf->debug && port_conf->ops && port_conf->ops->init) { + if (show) + port_conf->ops->init(port); + else + port_conf->ops->uninit(port); + } + } +} + void t7xx_port_proxy_set_cfg(struct t7xx_modem *md, enum port_cfg_id cfg_id) { struct port_proxy *port_prox = md->port_prox; diff --git a/drivers/net/wwan/t7xx/t7xx_port_proxy.h b/drivers/net/wwan/t7xx/t7xx_port_proxy.h index 7f5706811445..a9c19c1253e6 100644 --- a/drivers/net/wwan/t7xx/t7xx_port_proxy.h +++ b/drivers/net/wwan/t7xx/t7xx_port_proxy.h @@ -98,6 +98,7 @@ extern struct port_ops ctl_port_ops; extern struct port_ops t7xx_trace_port_ops; #endif +void t7xx_proxy_port_debug(struct t7xx_pci_dev *t7xx_dev, bool show); void t7xx_port_proxy_reset(struct port_proxy *port_prox); void t7xx_port_proxy_uninit(struct port_proxy *port_prox); int t7xx_port_proxy_init(struct t7xx_modem *md); diff --git a/drivers/net/wwan/t7xx/t7xx_port_wwan.c b/drivers/net/wwan/t7xx/t7xx_port_wwan.c index 4b23ba693f3f..7fc569565ff9 100644 --- a/drivers/net/wwan/t7xx/t7xx_port_wwan.c +++ b/drivers/net/wwan/t7xx/t7xx_port_wwan.c @@ -169,7 +169,9 @@ static int t7xx_port_wwan_init(struct t7xx_port *port) { const struct t7xx_port_conf *port_conf = port->port_conf; - if (port_conf->port_type == WWAN_PORT_FASTBOOT) + if (port_conf->port_type == WWAN_PORT_FASTBOOT || + port_conf->port_type == WWAN_PORT_ADB || + port_conf->port_type == WWAN_PORT_MIPC) t7xx_port_wwan_create(port); port->rx_length_th = RX_QUEUE_MAXLEN; @@ -224,7 +226,9 @@ static void t7xx_port_wwan_md_state_notify(struct t7xx_port *port, unsigned int { const struct t7xx_port_conf *port_conf = port->port_conf; - if (port_conf->port_type == WWAN_PORT_FASTBOOT) + if (port_conf->port_type == WWAN_PORT_FASTBOOT || + port_conf->port_type == WWAN_PORT_ADB || + port_conf->port_type == WWAN_PORT_MIPC) return; if (state != MD_STATE_READY)