From patchwork Thu Jul 11 02:34:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjian Song X-Patchwork-Id: 13729937 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 EDEDBC3DA41 for ; Thu, 11 Jul 2024 02:36:28 +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=duN7N9TURc9wnKlLcQJnw5LloNUvtgiA3EKnROioOoY=; b=AUHokzyKxQRu7/DeAWJW7EknF2 jdR22E0F3DqnyAmq/yJhwJ4xskVTwi+j1ZcTIKvT+5f+v1lrUdnOW5dmQQE3Z+mXfViabfxlX+Mpw iq5Le6EpGCIaRBrcLedrYhF1T4v+FFvHvsawHLR54lyjwp1T2skldjfUOpxNoIihGpSGdsKCYuwV4 KZkJpzICTHyOSBnP3ebNexVtyTUbixGR2NMBq5W/Afudy0+mmip7N08BCntQY5A/jJxLm2jyFhxYy saw30A+vgqyNshwMzjdB7eQ/9uWQEAdR7iurK/wEVwIt7joFRBPcV4Umi06s8Ps+KVspVSM2/j4w8 2ZHSr6Eg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRjfY-0000000CS88-2mzB; Thu, 11 Jul 2024 02:36:28 +0000 Received: from mail-tyzapc01on20701.outbound.protection.outlook.com ([2a01:111:f403:2011::701] helo=APC01-TYZ-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRjel-0000000CRmQ-0vXW; Thu, 11 Jul 2024 02:35:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JG8NT/m1VwWuRrn51nkNtIyCfpOaD6ApxRxMkYQ5T5KNF4BVP7ethK/+es/avLWyx2CavLlMiQBZ7mHGosqZaTTXqIKQHjgBuqGi+Pyh7SiO0W0DLiTiodxzQ1ziolHh15ezgGKVkvxnNfKkmDXl0Dcu810RBNkaoS+PkM9nrpakm+sc4CTkss1FP/gLr/N+6DkAc9jdHPr88Cf49AC1uUvAjZQxeYoUuQPKiLdrrk8HTyCw7RM/4lt7cZ0LUmUVj4E9IIf4zI1G4CQRfMosBJpRlcPweuZDjt108VPlh3tPFOktljNyqHmTIpaqvZGOod+JACJETewWfc67F60/Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=duN7N9TURc9wnKlLcQJnw5LloNUvtgiA3EKnROioOoY=; b=OCxtlg45k0iPYZ/91Nxor8tKFfVYgJvobxyvPdgZKEQg6IoospXVpY4i46qlIHSerJm/cO2iOlWJdBQSRSLF59IVVijDxgn2UQweO1rt082vjXUYjExj7Bk+sF8Hfg4trT1C6P8zI/KkuyMm+kGellR/MvqJrlIHw+oUJBsxW64UU0+O3M/hio0R0eNj2Px0NO5Q45YAH9Jm0J10viPaHOxjPxPV4ucGVzy0oVSCluuANcJ05ExmLm3EhPzwqIPpS+s+jEtzP+UTdSDdfITDLelU8TfNYKVaiYP6xdniZmPp/0+Wqwst5POwJZV8sJKsrawhjNf7OQ9mCCfwlXBKWQ== 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=duN7N9TURc9wnKlLcQJnw5LloNUvtgiA3EKnROioOoY=; b=Qt11Nua2/f9XTaZROnHG+FKxHukIavYPax8mOTKS6xGE/9uMK7c/UZLewxH6D6Yc0p3JEBy/tP6pIK3qiZ2See1zvVHhQOJtoVRY9PlaO9O+0Zu3/W5eZEEcrwEIcN9HOuYGuCHWAdClFKnkGa0FCrkRxPZZDi8eiYhnZF5fgQ0= 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 TYZPR02MB5713.apcprd02.prod.outlook.com (2603:1096:400:1c2::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Thu, 11 Jul 2024 02:35:20 +0000 Received: from TY0PR02MB5766.apcprd02.prod.outlook.com ([fe80::f53d:47b:3b04:9a8b]) by TY0PR02MB5766.apcprd02.prod.outlook.com ([fe80::f53d:47b:3b04:9a8b%7]) with mapi id 15.20.7741.033; Thu, 11 Jul 2024 02:35:20 +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, Jinjian Song Subject: [net-next v5 1/2] wwan: core: Add WWAN ADB and MIPC port type Date: Thu, 11 Jul 2024 10:34:59 +0800 Message-Id: <20240711023500.6972-2-jinjian.song@fibocom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240711023500.6972-1-jinjian.song@fibocom.com> References: <20240711023500.6972-1-jinjian.song@fibocom.com> X-ClientProxiedBy: TYAPR01CA0175.jpnprd01.prod.outlook.com (2603:1096:404:ba::19) To TY0PR02MB5766.apcprd02.prod.outlook.com (2603:1096:400:1b5::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TY0PR02MB5766:EE_|TYZPR02MB5713:EE_ X-MS-Office365-Filtering-Correlation-Id: e46f98dd-39b5-4c2c-9cce-08dca1521b48 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|52116014|366016|7416014|38350700014|921020; X-Microsoft-Antispam-Message-Info: uBspYi6uWrFVVWCQ5y/3RG1FqFgO6+OgthiQG2wWbe3tTKeO+nkbXa6gGVBVFogMkJiITucwiacQqGct5ic4mYlUinZJxaODJo9jT/mEY6amBHzkA+fiShIBDTS6ksc8C+7nHeW9W4F1oC7PnuQj8BAA4FjGSWsVLYQ70ZsmrXw0KKbgzfzumPVjmIslh7GFbChoIHkN6ITF7R1A7dr5FVkKxKiXjMZv7NkCGQ1phqkj3FXLGY58jPQIRASV9VP6mGxz0DfqYXdDHXErfFRQcOlvtLCyVKEE7rmU6UTzOiQfkEIuTXG69ZCTvwnA7C/+c7KhkAdG/5Um5sb1jQj8+nQbuQKPe2FiTjAy4HsudkQXfdf/U0Uv5SkjDFo4vwQIPhHMfdzajiNFt3VbW/8G4HzGYy7N/g8L1P3IuOLuVYE0kQRJT9sZy2LVTcqZVb3CBVbKikS9w6tOncokZTqzA0NVRfYHvnTWH2S4kOz3iTitVegzfbq813T6nHTiSk0SZmsnM2fRIamkPD6QT0j5722N72ZUdaflvtA6JY9g0zbG2DWBjRpuF8uXX93DyxtRtRVRSpkOsdrUu35uoZwtk5JarphqEoInX/7mb/PyeEHIhMNlgh6b1Li9dC8077rjZOZhniLN04OHWviRlTGUn/VBNCX+2qIgv5VlMMu93zAeKh5nRpU2FhC2/3Fs+dHoZxGPQj+T/VdAdJHKA2NNYy2/4uIazQmiNpLyQUC/pYHxQH1acMiMhUypLEQI6Pi5WX3S4AcHYYBZR+R+pMSXNKKj5WKYG5CMR0MrG+56Xn64kKnK2GMUhmvpc7LAhZsJdeqPWMSmyAzF+oc/zAQXOOT/yfvEOZDh+ZJTDOz2YUvi3Yl4afYBIJxJNEM2Cxytdj6+MR5JyCkA+OJHILxh7lgxFr80KeNk4mQ3BIGIBw2QiTQOSm40Qup8XVkKeEg+micN7TcSSidiUn6t5zcl1sp7/MH2+2el48ttN33QE/eKe87wF9HLqkvWrkH+A4dapIzwJFv+ybXQ5DodLSJlog7a1cjFQpCB5t4bRCLqjSjmPAOXI8KvWpKGH7BTjJQbba77AmThFEBvi5ZHsbm49gsO9Y++u4N2mazdhPqYZZTmitSChAX4XA2/lA3MJByWXE8FXLfD2l0oSvmtm+s4ewN2w9JZvWZPKAHPksJrFteTy2rrWZqYA9u4/pN2VnLi5M7MaY3Kg0W5XRi11U/WmsMnf5R7BAtDm3eUzZi4366BjsZAtxyOVbE5APy89mtEKdVb9aXwOgjPW8DnCswJ3djTHmAVmCqs++yd3kXCtG8oZplsaWTA7UHZJGALyh242oyZ8mlwMr3J7MFy/aBXGi2bBOk0TIPXqnVGJzcWbj6Yq7brvk8FIKH8BEnhXosaYrXeyQpNUaiKNFGh/QVH2ZaUUp6jiH3ku4JN4b4iOq8= 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)(376014)(52116014)(366016)(7416014)(38350700014)(921020);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: I0S9Y0RiCeFLFbiFZCoIrWpuOVVxGmavmoVsNTnviY20bAVeMVWztDSX4QD1s5nr2ohtXx520GQ2UIEyWi89eqD9jaS35wsu4T1hjTed1WwOrBLejGHgkYhlewY4kGI+yo21fN97VFhxvLj7kYUkvpzqieDmMJHx7NisWGamrjqb1yDQZsTOQbeJCq3lL+YGjJ4HfEiBzve/ArN6/mnhOBA6jGIdbQrptoedTHO3NaJVldaOej9U55gj3+wB+C3ugg93IZ2vy/UCycoEnzyP0QTaTgTWDCLAiShIBwGYzOMM0WifyvrnRPRNnAlaHjNliOONeZMAtegxMVhIZAthtap65ejCwiP981AFjDItOfBJn9hbrjvqozFXwGo7/lzuhZSehhJqT40I7Enovx3VyQCZGBQ1gAlo2B24P/AL9YK7ej7FNgF6j8FZfUjcTdHMg6g9dRskb/sn0pDSgiJGDd4Q4vGynq9ZVuA2ya78/ITVWwlJqEdCQTroFL+ZOrrWI9xy5EhHmAblHO/I7TceIS/n/Mm0Gw01B+n3ajkjCu8E26UFYtDWewJy1CBBM8/Eqm9JL0WNX70GFpJO0yc7RIsSZUj3gM2DtvOVUD/zt/vDKfNc4pfuZRF2h6IVD0W9hbYxrWBkeNW5RawiPPA2Ke2Qmt8g/CYGNfgT7q9l1OWTwHM0cKrM3IBzdmMPagscLv9FTZ0yHRGpeWSKhVWROYeWOFS9V+rf1BGZYGe1ACZvX/rShe+XHHDyjWvzSiFj0rRr4OO9OL4RjqywBbYK6siv4m9R/gRz1ABRQl47ObVHuaoHRYMbBEiCrUWHXS8NWGKuN2TaLJSmb0YIsUQQttBCJugoZ/lPeE49ibxr01ixHkXHRnGb8v9RC20TdtFFCVq8VoPTYGJ/dKigNR61V2WvIjzSk2oiKwaG1z5JF/pBEyUAtkjVBMDDQXkxiRMvhWRvMpn3rbs4jzYiSk1Vr8js11fExOnpXgLlv1q/ZjbriPIOGsY2JPqL7MevcTtH+3WlrPqVE75vG3IJ+9gKHlJJWfvHO+iMkRzlvJ7RaYBDFb7By422pF1CXct8WnL82GohxGKkBZlO5jMXbS9DkA3LENapWGtIDgqzOQDGW54Be31jp6zTITTT74Vp1x7w437Fx9Cal+EdeyGPa56MSliYuEhxEZumfqcyCu3MNuFR+T/opERxwvQasY7naAROYwZzDVQTO8E6PaHT2aHEyGL+HjG3MRQXdXeB5WbkKbRZ0x1Mhw8dyaQ4IFqrGTIQCdsUeOBIc3MW4ih0c5xYJo8p85dqLLWQp2gj9LPsLYVInqNJb9N/DcyComBIY6EIaTRUVXW1gFsZQ5z1aW3eChkI+iRnxMydq01rjhC3Io96my6FAR+B00ebKbG071/UZYw+3sl7Q8qVAlu6rb4BmsXDrX8wDU/rwLv2K8MxjipN9fQJntkCX9Wz4nrRoxiSRDA37qrpkb++qpjI+bPwP+aygr2ko7dn6k7pc3sVDPJYBdS2BMQ/1hI14mG3DdT9XmdfX9QcLHolMgII47nH/nZfJHDJn8uwODRVADpuLIAil/TMz+xuI5aAaFmbLmmuiOjkWr5FtkT3dqEJyTTYqA== X-OriginatorOrg: fibocom.com X-MS-Exchange-CrossTenant-Network-Message-Id: e46f98dd-39b5-4c2c-9cce-08dca1521b48 X-MS-Exchange-CrossTenant-AuthSource: TY0PR02MB5766.apcprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2024 02:35:19.9249 (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: oIwJnHREVZKxdK0co6+z18VJKoNp0wCgrlgW25Y2lNjCtm0qbEn0FnX/MCvP1dVt/dOSVhJJLm9qr4kcTq81tLyR9g5qMG0+5QkwBtw3klE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR02MB5713 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240710_193539_379499_EC7F3D23 X-CRM114-Status: UNSURE ( 9.98 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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 Thu Jul 11 02:35:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjian Song X-Patchwork-Id: 13729936 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 C3958C3DA41 for ; Thu, 11 Jul 2024 02:36:11 +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=NZTIlXFBMXbsYpmoUNS0lZqscPH099e7SC//Jpl8ni4=; b=kfphpxhmSfeeKpIRY3jPqr+Vfw bqMCwoy5lX3340I5cAFE5nWWGLwvOOiq001CH5oV06vbl6J25ej+fN/xQxI8R8f4rC3GwfFI5WVvn tsdD+gHPTmoGx9lAq159luPNhcR/KoiChB26e8jdqOaRv8MZ5PqP08zQ7+rPM/vLV96PON9a6doA8 IMDXItFmNGKrsG5zk22rSzYWeZi2Al0NoQrydFvagII5yBSFdZmOtBvV+CBwfc16X5NBkzWCTGpup UIJf4p43OF5xuaEOkPUINB44X0Gpt4H4hXL/4hdWVRPMbnUa3KezN31k8gHw/jj+qxKksPHuDA/Op toFcuTLA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRjfH-0000000CRzD-17oY; Thu, 11 Jul 2024 02:36:11 +0000 Received: from mail-psaapc01on2070b.outbound.protection.outlook.com ([2a01:111:f400:feae::70b] helo=APC01-PSA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRjej-0000000CRmP-28J8; Thu, 11 Jul 2024 02:35:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iUnSj59MwMykP2P9ipleZG3L3ErJIyVGVaeku9/VR0JeCEL9GA4PgM3K1k294YX16WT6tkNXarxzALTxEJPPRfcaou3tHldzFxvNHz2VZ2eeKVvD0cSRNX6wJqERC3/+fHcbgOKAWRY2IV72m1OpkoHT2Qsj7koDwkDJWNkgL7zVfig51dA1iFhdsoEefd38eX7er91BaazKrKkiZljJlunkobSzAtyMfuc1VD8r8Ahzk5V9vuzdbs/holWDCwvuTaq6QBmwrbrQNrkLtziBunMjBTREsAlLxPoM5M5YUWc6TcDeZqTTNojk1IxX43dSCkgc5SowWuE4Yl2bT6C6sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=NZTIlXFBMXbsYpmoUNS0lZqscPH099e7SC//Jpl8ni4=; b=GUFegy+fn8nqWbnkus5iHJI7CW701IhsqL/gqoYz/JP6vNksqhevVVyf5xzRv7/Toau02q6EISR044BWuLcgWFjIrrXnryj/2jsWA6Zk8lHDS3+gHsOWuy+7Ok4IFL23ixak5JXMRYtR/4uu9DWetEV8GbCW8UXh+qS6xFpEnprhDoir9tH9edX953H4OVZxHt086n8l6clrMWdpy5IgAbpRhduMSdfr/wZTZ7SSs5ND67nAeIDY8Hx031t9Bv/UiE9vuRek2hLCITuRuwvgGgInkggXHASND7zYwWvKP8fXIppA1dlkSQFxoMSDI4VVje39BvDFQ8lGa79yqJUO9Q== 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=NZTIlXFBMXbsYpmoUNS0lZqscPH099e7SC//Jpl8ni4=; b=p5SAVGSNW7f5wTUU2uQ86h3EAzs58Zt1oPe8B3XTkzTkyxLUSOnkE98xQ+YG1WVx0/AeJWVThgqwzz1hhtZ0/p+NRrRoHnhG2uP1SDq+p//N3YpC94Dzu/5rKRpzBgXVogIq16AFGKRVeFRVJhEbd+RyO+x08GCMIKeieb/f6WQ= 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 KL1PR02MB7168.apcprd02.prod.outlook.com (2603:1096:820:116::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Thu, 11 Jul 2024 02:35:24 +0000 Received: from TY0PR02MB5766.apcprd02.prod.outlook.com ([fe80::f53d:47b:3b04:9a8b]) by TY0PR02MB5766.apcprd02.prod.outlook.com ([fe80::f53d:47b:3b04:9a8b%7]) with mapi id 15.20.7741.033; Thu, 11 Jul 2024 02:35:23 +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, Jinjian Song Subject: [net-next v5 2/2] net: wwan: t7xx: Add debug port Date: Thu, 11 Jul 2024 10:35:00 +0800 Message-Id: <20240711023500.6972-3-jinjian.song@fibocom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240711023500.6972-1-jinjian.song@fibocom.com> References: <20240711023500.6972-1-jinjian.song@fibocom.com> X-ClientProxiedBy: TYAPR01CA0175.jpnprd01.prod.outlook.com (2603:1096:404:ba::19) To TY0PR02MB5766.apcprd02.prod.outlook.com (2603:1096:400:1b5::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TY0PR02MB5766:EE_|KL1PR02MB7168:EE_ X-MS-Office365-Filtering-Correlation-Id: ac7a1673-8408-447c-61f7-08dca1521db3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|376014|1800799024|52116014|38350700014|921020; X-Microsoft-Antispam-Message-Info: dWGRDgYkhk67Bw3pjQKgMVxy660v/kHzRVWNRlnVExJLlZXYiQcq5APxX2hwp5R38KNEEZlKQDJZ+89xhEzwZFJWwDHgWZOFFuoJ0g4rAgTX6dzwdsUQlU6IaQPxNba1o5kG9C7pKPMyarOtQBw3ulPw5jfmO5+K2pq+92pXmYbM92XoNoMGqbHRcTvWDMPkqdvElGVdaeGoAIvrGHkVGX3WQXOXtTMBEREdtTRg5J0M/EBh8tcBjixLBSX2PGPZ2dLSiylQGAdP/YW7xr4RMf3/TCfkcLRsYjM0A8zvuKgEYuai4woHN0r+hbSHYv4MSDnqtrYaIYlHz2a16lKPbLEBajg3Nu8ZRp7PULdEuOC8uHdXSfk9AxpPBGAxCPxDVROcVXbU7W3VESLzbN/htgY/9KMoih9gU3lDHv0NZw8bqktiAnioHGrK95Db2Jt3wIorv4Xpy3HEN8DwJz9iGswa8jyaKhWMPt4imL71f7y/sQPRFZ1fHe3yxyfte1bnnZh1WbFfShajtqBTZc5Olx/eo8qH2vGxRPOmX5rt9zu15BxPmghuFrLzkDy6bRW5WPv4gciZkBDTqaFuk583pq0a5I6UtWPETiIgJYtSnJ/ghp3yxGZOITy3JKdjtAZ8F6A9F703RAR1hCxdh3LT5saMuxRa9EIfV6xenEvXzTJMGODKdzNjXR8+zQA11NmWEF0rMvAWRs67CF0EWJZvyJ/nQxe8HzUTNotfYai5YTokIpQ11b/KwZYy+JN9TZqO3ajTQckT08rNCz/pADwpEMZvthsKTswfqNEbBe+CvEflOhcm85R2umWtcWRh7yvz8770ox5osNlToSe0rafqCfO0I203WqxsaNvxBqYgr01X9+MLra0Jl2vEaR8P/aewf6QQUMWAfcYBkhFDv2Np3j7tswmSbfyYtyujtSJm49vfTY8cagxw5CtLy7Tsk0jaRhEoa5/UuOSu8hgfVYBT08CachFkEcTyw3S/GC1dlYgQ01ILObXg8y9Ux/4Qw2apSSHBKgabnxDN35XhH5lFOIbPBY9m5sE0rQkbQXSfa1zlRdGIl3i2dFk2YQxavQ1g15s0+6u5q83hElY7bagEqx9qzPDu7maziF2gaWKTCLrvbk5EOc0Ik2OkWolPF+gw/STSQT1SzwXemQja3lXzh7UR5z+C2zRaQI/lTDzG+Wd7lnRZ6A27zMuSaXr0o3eWQ8vhho0XMNHd1wLCr2rY1fn8Hsr5VqRQwsOr9jPFXDSeENc29vUVdsssk5LaQn737RoquYMfVOCRp71YQAsKfDKgCWsb3fxy96WoAmn+pEaT5zjqSB0qZHIQJNCWzco0H1lgkc+LXum3f/Rha0HMmPuQWHCKGvzWgZsLGVc2pJQ= 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)(366016)(7416014)(376014)(1800799024)(52116014)(38350700014)(921020);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: S12Iky+oOuXtP4mAhyNb+nyx2V+X+FvN8awQYihVG0ne5YoSumTX8Q9JOPne4ed9BQLDWbPX8WaFFRvwGcdIs9rLr4UVguJuGUXgzXD3usf30TwhE/nrBsKvWwMVoC27EDbkM4+94CtwrvdK/5CleTTG+wV22f57OgdE4h/UdGYBp0fqpXAT4O3MjiItTBElXlG0UFWzH14RrpjvoP9WpR/1TjJN6qz0AL63aGx3DV4X2/XHEe+vBiKxjTJTZiUGEWGInzhGjsogKNWxJNISt0qqY2Q1q+k8lbU5J2P4u4FZAm7mJDnQn5+DQmMHqsFodCP4kOFey6pOUZGYzJZ5nVCkgwlgKrkPdmYRzT1OV9LjBfBusOlOq1+u5BZ6XTlKS8yh+J6fYpaHhYls/Qhl0pQ/WpA5AZbyrFsTo0qOZw/knl6EyaNx2uX0/oyoILklg5Js/UFcUR2nh+DhMPcrB3VIBCkJifcYEexTVNt/GQTuNkTlYdNIceL7hn5WvXi1U+u0fWbHiZRHYbhp4HG/wiUUFMB6pv04QSiV1a27bO66DEZoA6z/A4Ruh/Y+RCOmWF0i/ioHZTcoE/FxXVONU/IgIREnJAfPJ9uXGOP0mHH29+pHyoDpmPVZt202gUdmSGq6tk4T8DuvkvIh373IhjSx0HqChWe3PbxwVhX2auerzVhJcrfTgl29n0sFrCZVg0arx+t0RPyjcs/QWeYNeShcTdUZ/O/Vya5T57/WlDgdIgzgacHBD8G1MsCD6ZiEyk3Ci0aHVYoNVZGpVXotH/Ks/LFNInLUDgzKHOsywN4avun2i1g8crVST+UjE8PkPpCLwesJu/ZxzgnBbxn32x/EiXByfMizy0ZcCkSRLcMlO/VXujhBiYOo7gXYlfrjK0ekH8pYFxQhvscXY0/devQAzAZp+1dw+/XtDcRp0wbN1XfVUX0ob5HAgUXWB63H/R4ZGkJ4Mto8EaV+Qx+PEpc8ROmgL+lfOZeZrE9nwwrQVBduqxsuOFoNEI3XmkLlXVC9n3lo8GYpiWd8ydl3l89F5B8U6w1Uhvu0gs1TUElaLs2s97zovVB7FRCf3pG8MnHtrkz60TN0KKcdujDh8sjwP/JCsY/Ul9byvbFmW4GJ/lDj0UgKGBmhQmSKOuGhdDUEH2bJU2u8CJXGpL8IF5mCc480lFh8Z1TzQqkdmqPwnZktr0icLgxXIyR6KshmK2BFSarrI/H7BItgVRVWmsIhq2wjilgGMEpx7IZA5suWohTAX6CV0IOKON8qfk3VpkHZPvqZrRIiIGULAUUaKZA+f5Np6xSWrLtJp3UACTBnf/h3CKfmqNvA1pJzsHfyMzEbM2KhSLtrwRuGhQURiXSQ+YTvnEFXGzy3NZh7Lr1dA2qkpdwic4xknwZgYvmwoQtRXWfnu/ndTBml4EVXJBkVZpvResuJY69tmbl2Gie91TBuq2+ZI8vYkL+tzfX+SFdkg6DLZZZtLDJIKpXmgdg4iUit6f7OhuLz2QrsfJ+huh9hCj2sQnzMDinPWD3Yojw8yPfVUs+qADIFZf4eFmgWlOTRGL5XYAaOX5Wwj1gRKv3UefIla9V007OV6tTUuDJL8zKXQwqjO93P29SEXw== X-OriginatorOrg: fibocom.com X-MS-Exchange-CrossTenant-Network-Message-Id: ac7a1673-8408-447c-61f7-08dca1521db3 X-MS-Exchange-CrossTenant-AuthSource: TY0PR02MB5766.apcprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2024 02:35:23.8306 (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: 3U0gLyvSAwSSXU7GpAcrh+jh3Y+4hrJVtT9fVTje6DLXPhrnt5EmdejiaA0PFtyCRtqBrCIppAxlFtg6bBzh123Z2Dt1OBhF8bShWPbZhTY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR02MB7168 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240710_193537_987644_803E12EE X-CRM114-Status: GOOD ( 18.99 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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 Debg 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 tunner 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_port_mode Switch off debug port: - normal: 'echo normal > /sys/bus/pci/devices/${bdf}/t7xx_port_mode Signed-off-by: Jinjian Song --- 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 | 47 +++++++++++++ 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 | 45 ++++++++++++- drivers/net/wwan/t7xx/t7xx_port_proxy.h | 1 + drivers/net/wwan/t7xx/t7xx_port_wwan.c | 8 ++- 7 files changed, 168 insertions(+), 10 deletions(-) diff --git a/Documentation/networking/device_drivers/wwan/t7xx.rst b/Documentation/networking/device_drivers/wwan/t7xx.rst index f346f5f85f15..02c8a47c2328 100644 --- a/Documentation/networking/device_drivers/wwan/t7xx.rst +++ b/Documentation/networking/device_drivers/wwan/t7xx.rst @@ -67,6 +67,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 +161,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 +205,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 e0b1e7a616ca..b15c470acd3c 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, @@ -109,13 +116,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) @@ -806,7 +861,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; @@ -822,7 +877,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); @@ -837,7 +892,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 49a11586d8d8..973d0f1f8f9a 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 7d6388bf1d7c..0b1640ceff71 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,32 @@ 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)