From patchwork Sat Jun 29 04:28:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjian Song X-Patchwork-Id: 13716781 X-Patchwork-Delegate: kuba@kernel.org Received: from AUS01-ME3-obe.outbound.protection.outlook.com (mail-me3aus01olkn2184.outbound.protection.outlook.com [40.92.63.184]) (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 F3E262BAF3; Sat, 29 Jun 2024 04:29:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.63.184 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719635378; cv=fail; b=WsuTO3wx4CdCpfixRofY8JxjvgqSlHz2bsW0pPFRV22ZyakbJ7QmR59jy2HD53Vfm6LCIKo9NxmCMPvPVTcr75Hrn8CntQ7gTyDmUo4Udxe21uHRduGWRmap+Vz3lNFUfg3tPspY4uxLPnlJ+m9+WlYgmId0AeHoW8OL71CZTrg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719635378; c=relaxed/simple; bh=J1plKoMwwnIohPlg9IprBwDzk1FbuN9SOg0Pbrfi6dE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=auRrmkdBHpYz8f44XzgdR1OjaBshIleIJ4S6LxgGVS+1OwUqfw6OHkpRGImDFObWJzVNEnu7JxzfqaXfENnHBxBT2JEryvcQ8surQUTkO0m9sQn0xmNjD4d9rta81S4GySWDDS5jphXO6IGLT4Zlz1B/eRf/DI3Hz5nUfKt0GF0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hotmail.com; spf=pass smtp.mailfrom=hotmail.com; dkim=pass (2048-bit key) header.d=hotmail.com header.i=@hotmail.com header.b=i7yajGSm; arc=fail smtp.client-ip=40.92.63.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hotmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=hotmail.com header.i=@hotmail.com header.b="i7yajGSm" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iY4tXb7noDrP+gvVwPJskZIj3vihlvUB67lw/RCCRwKjVsc3d0i87iOGs3ihg2Q4oWQfQMlnUNYtPUIbB4kZ+pXx4Xgwubi8W3UMetHaysjy1Xp5Q5/7TA4GYQcxaj96lsfgwOv4v5AeCtwgX/+5JmoHih6GeGKOXTZ5YNfp2vWzdAWO4rngRnaiQ0dwOcdyUoxtdIP3BbW7LB8rBK+i+M9c+bf8YbV/Dr53Sqo1hRB+qVD80ZoHK7aCtOlenaKBpOySzwvd1x6JFJ+QF0w0MtYp0uSF2Q+1k4ddTotp6I+OpZ0yoyhxrS3o/HG6y6+8eBw043HKXptJ6FrFfrjx4A== 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=LA1/9qvE6pULtCke8/mcHni7DR6KdO1cfRZalGosODE=; b=YzF2Bnz7H0VnIef8Jx7n8I03z+dZ86Uzt0OFollvk4+Z6aEZMd+wXLk1stDlAXr4gM/T2137RirbxEcHUX8zeNfKdTnKvqiTXNYlltAm4E9i1wjKQCmd6Fdo5IdHkX8idyf1yPVawXTUjh58APEKJWeZoVYmcwCt4ipmhHx4ZUE97c4CZf73SN+dJwbJqrVDNMLf9Jm/dv3nTw33x6G1GoC9+IgkeGkzV/3webHQX37CUJSv0M+AR6T40UO72Lw8N4G4c9KltdeX45JFJiBqlbX8w79+rgZ74wuIGggV0rBUou1TRO1nsC0V/eMPNiD/Q7bDEuXvn/rAXCbaKa4AwA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LA1/9qvE6pULtCke8/mcHni7DR6KdO1cfRZalGosODE=; b=i7yajGSmfs8mfuINfQLu8+qpU2dioHRqHLr2qa6ntXt+O76QY5Zz99MhJxPYXIbMJlg8MDSs88StETtHBKFHHNGNmPl8z2FewiYchCggkvJ85Us/BP2dpHv00X0inHf1kqCfyepLc8kJ6TqheIJuKKDRummzPwcgApGIVSeU2cVcGoqsaYrFgpCFbs5TP+6lZGJYLzPjl37y7DQKlz9ZjAnlFmCZODJwNw//ul0JwNk6PO/iIhVBKpQvW7gwiXyrxRz3Lv9Mg43sSnx9+f1j72EbL3UqdlPz51m3iVz1goLTsU/kpYupX6aZ9Tu9J6oJtkvwU1PdJe+PA/E/fLuL7g== Received: from SYBP282MB3528.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:1b3::6) by SY4P282MB4160.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:1c9::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.28; Sat, 29 Jun 2024 04:29:30 +0000 Received: from SYBP282MB3528.AUSP282.PROD.OUTLOOK.COM ([fe80::a8e8:3859:c279:c289]) by SYBP282MB3528.AUSP282.PROD.OUTLOOK.COM ([fe80::a8e8:3859:c279:c289%5]) with mapi id 15.20.7719.028; Sat, 29 Jun 2024 04:29:30 +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, Jinjian Song , Jinjian Song Subject: [net-next v3 1/2] wwan: core: Add WWAN ADB and MIPC port type Date: Sat, 29 Jun 2024 12:28:17 +0800 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240629042818.5397-1-songjinjian@hotmail.com> References: <20240629042818.5397-1-songjinjian@hotmail.com> X-TMN: [/r+M+EwL5ef+ErcvkCLojmyq5my08cqC] X-ClientProxiedBy: SG3P274CA0019.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::31) To SYBP282MB3528.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:1b3::6) X-Microsoft-Original-Message-ID: <20240629042818.5397-2-songjinjian@hotmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SYBP282MB3528:EE_|SY4P282MB4160:EE_ X-MS-Office365-Filtering-Correlation-Id: ee283eb0-ea49-4c28-92eb-08dc97f411a6 X-Microsoft-Antispam: BCL:0;ARA:14566002|461199028|8060799006|440099028|3412199025|1710799026; X-Microsoft-Antispam-Message-Info: +t92Y8sJLD5QNxm73lIEMLTBsaLHABIZEYFPn751BihNCndPI4YTAsWaRdl090DJUeDS1UthrZkmhEUsV7BMa49GI8CHVNeJCtuVFIBEqJ5gYfDeXZTNjIDN4uATpW4LGbXCdGd0JkMGq9ROP41VAb9tjqSUGlTbAScq/oiSaSTWTcuaWcskzvxjqn7+KJzrRnZqaNPjTWPOOrYGG5iNJ0RC9reWlCfvyS+AmiQx15ET8L54dv8UC8uEJgmyi+ecix1K5m5krp7t5v+yC2478WRAXYmSeEYjm57zR29pYMMXfBvaMJ6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MlRYgoZvQJHyVuxdrJFjGovj1gmhbZFW5N7lazqWGWC0GWjS/qplafDKBU5w2YUweAgsneOqx4RFBxgu+1cy20ZCeV3O1Lchd6MYSCzjZDVFX4YkDzY3OjSR6Fg3+cemofGiXs1kkyRT/cH7vK+zfNOWNwX2c5liYQ0K+jnGtjDFAAygyXBawuX8gCi0ChFykta7Of7uDTYvw2Ft2pYUcRyyXQO+/IDETaxxozIL3zOz/g6kThJA2AhdNPZ7Xi7h5WFdy+Ai6Iaj1gxmh7/GNDliBBHwcFVsIK8gAvG+MUAfnfzczj8lkzVmefDkcrSUvRTGokZ5Lmq6KEHcf7tOME93KlMn/ALf5FaUC+/HMxIwmL3tQSwc88fZt6i5sNB8OYh3PHS9Vf9U12Sg4/EEjtP1Ig0lwkzJ1qLmhDwdxYfTBoDnD+Gb+n30kzX9h0iWIE7QMc9g+4ig/IsUrWIXMqVuSreLS59hP0TQRaqU6mXAaJi8TvgnQwTchHap3YPm+SM+08FpDiOvHBJdBzJkNQ/UN51PVHwLVYXlVw/AVjOjU39YPZW3NBGnqZF4yapnL5N0MRazm5ZuI4/tgYJLIFbP1AWT5IQ8M X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-746f3.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: ee283eb0-ea49-4c28-92eb-08dc97f411a6 X-MS-Exchange-CrossTenant-AuthSource: SYBP282MB3528.AUSP282.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jun 2024 04:29:30.7621 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SY4P282MB4160 X-Patchwork-Delegate: kuba@kernel.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 Jun 29 04:28:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjian Song X-Patchwork-Id: 13716782 X-Patchwork-Delegate: kuba@kernel.org Received: from AUS01-ME3-obe.outbound.protection.outlook.com (mail-me3aus01olkn2171.outbound.protection.outlook.com [40.92.63.171]) (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 3B1692E3EE; Sat, 29 Jun 2024 04:29:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.63.171 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719635393; cv=fail; b=f6HQ6wA3O2qJwFpXuQr0IYdhZjEoVgcQaXxRfyOGzETGsk+lboEdfNYBcv2ZktwwsIErHrXgDb3rsP9N6AwPeYZ5f0EKS3HJWHqdJo72O7VLjbOveNxgpI7zim+lEnGUULe8OBSV7OOOMsB9PeIgIVvFiGQ1HriehvQp2zh2bBY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719635393; c=relaxed/simple; bh=pTOTquazEhq4BcBV35H6UH7c1iTqXusBxZATaMNTKlw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=nSeZFw4tXDGpv15HXm8xPJnMAzmnxpRq9/6U17O/phPWfjbHJYFth5cdGQU0bYCaJsUmPDO9UBGWOve97wKGPzEGnl358LAFr6Mggs+hpwBsbDqf5M73LJ/VTBV/2P3yiuxz3btMZcszW/PDhA4q/YcsMfn1rFJo1W/8NYvFFMI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hotmail.com; spf=pass smtp.mailfrom=hotmail.com; dkim=pass (2048-bit key) header.d=hotmail.com header.i=@hotmail.com header.b=io4wg9TB; arc=fail smtp.client-ip=40.92.63.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hotmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=hotmail.com header.i=@hotmail.com header.b="io4wg9TB" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fk5wXs5FXgheBr23IdfGd3CgbIZ8UtNnIOuw3HAdJJgEiVNnpvoHwsUbE8odjrJxZ2E+UUEv7BVi6WMGUGELPitnDprdHC4lxqkXAQm6gRX3rkF8TV9UBj0Ko4m1uwKOXZzmnMSwIWr0YpuyKwHZ9Zpv7r2vya/2KS8UfQW10ESIsSI6CFve7d2ZFKb20Z2v/UMxhe9VUEsEHUpIsTgFzrlHJ9D1e+I1IES7nsQpr5zDwKv2AHvP8M6XnAWFBfQDNxk62gUBwrtb8uV63UrTRoUGnH1+kw38R/if934pR/6tTFd8XYtpRVgNQb62Tr0c+GEInKThG9cTSCfRaFCNfQ== 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=fDjdvMRNlcHapbYBZl7KsiIYrB3/nXtvvEfNhUDmovk=; b=H0GvAteFDw0vpDP4qWAB6CnZPvBhrYUq9/joW9iszjfcTSGS7TKv6RW8SpjN+KYocMt6vq3i/4F3OUus+pv25QJUVPPHpV//AfOo4AqCyP70IHRnIFTlwNBbVvz/8Aokt+VolDHRaiSwA9YyUkNWo6ysQdw+Db8e5DCwTAOp95/rnKJzMEeqOYJZC7TZlq0m0PADNaq4ModjEs5oFjCAteSbOjc+8eCB8cndjPmpY/sZI92ypUKUJBlIlv8VmxJfv7DYGVQePiiNLYOuH1w3fPiWJFzskTASkLhRUuGNIZgKdUkMPADGYsr61sMPDfhcgWD1PcTn8QbM1uEHhKsjLQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fDjdvMRNlcHapbYBZl7KsiIYrB3/nXtvvEfNhUDmovk=; b=io4wg9TBXH/11tBY6/K6sdzHvYW+Q4eJDXFKtexi1SyES6o4YIuNzJIc1SRWQY4cfIWQdrqFejBtic3WaeamnSO4yxnQjYbcMhSbgslfPUek4LKJt5hqwi+oc3JQAASGHbX+YIpdWfUD0WPh305zIVfPZgJSM4Wj/qSmqQPpvhT8kMKFPhGkm3oRuUZbc+WMeHZ34rcN5n0DE2WeM6JhRzkGdU/OHTbv46SyCNmG5YxpUVPaIOXKai5TFB8dQzhofwKfnRvE4qHlaiFnNFL5Sd93OpvN017kIdLFGwTGPHf1dD6EqbW1p/oUpzvamxMorhVlyZvIGCogpTfEMSNraw== Received: from SYBP282MB3528.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:1b3::6) by SY4P282MB4160.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:1c9::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.28; Sat, 29 Jun 2024 04:29:45 +0000 Received: from SYBP282MB3528.AUSP282.PROD.OUTLOOK.COM ([fe80::a8e8:3859:c279:c289]) by SYBP282MB3528.AUSP282.PROD.OUTLOOK.COM ([fe80::a8e8:3859:c279:c289%5]) with mapi id 15.20.7719.028; Sat, 29 Jun 2024 04:29:45 +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, Jinjian Song , Jinjian Song Subject: [net-next v3 2/2] net: wwan: t7xx: Add debug port Date: Sat, 29 Jun 2024 12:28:18 +0800 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240629042818.5397-1-songjinjian@hotmail.com> References: <20240629042818.5397-1-songjinjian@hotmail.com> X-TMN: [N0LZoZrbKrlSP6Y1hkp6RTZ+ntO9+ufd] X-ClientProxiedBy: SG3P274CA0019.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::31) To SYBP282MB3528.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:1b3::6) X-Microsoft-Original-Message-ID: <20240629042818.5397-3-songjinjian@hotmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SYBP282MB3528:EE_|SY4P282MB4160:EE_ X-MS-Office365-Filtering-Correlation-Id: d4fdbd8b-aefa-4c31-6ca8-08dc97f41994 X-Microsoft-Antispam: BCL:0;ARA:14566002|461199028|8060799006|440099028|3412199025|4302099013|1602099012|1710799026; X-Microsoft-Antispam-Message-Info: AlHpZyR7Z3f1hcdcJwrGsuuAdYxCK8aPmsaylrH4ohcyFlFBYI8o/mXOFYGBup1s8luwMu8N+Oj6HosIoNRu5jSMLLvYgwjR29FteIaD+fk3Sl32Gr/VSMsvqiawfiuFrgqXwW2n0W/PFRRLd19QJOjHmbu0UheGEh+dVVIRjx/gXH9yvH99Mz5GGKy7QRbiHDEpgIBo16zKCQ7IIMN3tKGUlgk44AsF+1NkNc/WBQzObZ+ZVpZlHJhUI4j4xFretW8I1/Q3B/6kZKL+XYwU3j0tWrEVuOksLUGSzWlIfkA55L8W3LBeie9NeDEXnKjcgDn1JXlEsZF6tp9Thk2Z84cJ8HEZBpOhVfqZB6d0GgS7HVnH806BA9e4+seb6F/QDvrRmTYDeIDMCHbg8aOKE/lxtnpLXmTFRSJm4QkE9rGnL3XNV9kLrazIadYK9wMbR/PW6O41U0pbwYdiNLQtAASD4pugg17AwXKkPjb2NGCh+qNCkZJWf8Uhn4jIhrE1+9nlfbGkC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3YnNSDpxntxbFwqwPG0RAWVrWI5WlqYAAgaO373BUKXQqRaRudpKtNrM/+vUQfU3izo16h1CUJjvCv1f8dWkyN5Tqn1Fgazcyo6m9892QRTUSDGd+ArS+5ogBX59zOdlqIE6lO2HtByo+7uxKedupq4ot773p6YVCV+domlSKVo0Q6SGuI47L/5bZP6fkmHLbkhLtSsEer9odAuCmEuSHGw9OTI2taOrJwW7+2Vz75XwZ9kBDQN2j1RRSDhWaH/uy17LSmfuLKRgghtnOqUT61w6y+hwBBxVd7/eo4t0gx2j09fdEOIEPSxenyaGShBwsSKv4BIMIKSDC+0+65McV5YZc84W9luZY3d59cayNAfHoK6VEIzdOE6CGfISg05jv+MvM/xncrl7fDv3i7zG1jJewWVkyphEh1jPcPE2vt3hPDJXK8YOlvGhQPm8794ROZ+7EcqsOu2SHu6+WRtDAryhZywGFJpKSYatSP9Q1zLTFBtfYrLuJ5RI9tFZNzDn6vKwcCTqxGe X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-746f3.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: d4fdbd8b-aefa-4c31-6ca8-08dc97f41994 X-MS-Exchange-CrossTenant-AuthSource: SYBP282MB3528.AUSP282.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jun 2024 04:29:45.1853 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SY4P282MB4160 X-Patchwork-Delegate: kuba@kernel.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_mode Switch off debug port: - normal: 'echo normal > /sys/bus/pci/devices/${bdf}/t7xx_mode Signed-off-by: Jinjian Song --- 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 | 44 +++++++++++- drivers/net/wwan/t7xx/t7xx_port_proxy.h | 1 + drivers/net/wwan/t7xx/t7xx_port_wwan.c | 8 ++- 7 files changed, 167 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..4891070ad9b1 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)