From nobody Tue Oct 7 21:28:47 2025 Received: from mx0a-0024c301.pphosted.com (mx0a-0024c301.pphosted.com [148.163.149.154]) (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 8B1A286331 for ; Sat, 5 Jul 2025 00:59:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.149.154 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751677200; cv=fail; b=pBAUumn+eKkqo6KoBjNEkWD8J1+ctx8W3O653x8bKV6yyerziEAApLAGNOtXD+NxTlyaQKmGVgWGj6C3ykVLxLVKeTEIavAXt0tWJea/iPuebDQY3QXf/iJjXzEe6HObAycDzYvw+YG1f8qJiDIwNcZeiYPeHfnTMRlAejk2LTw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751677200; c=relaxed/simple; bh=58MjIaUDOP27HB6JRXrph8hjZw0X/CpfUNpW6a9WUHQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=CLKPgQze/B/6fHLC4tRDcl5CWlItI9mczVzA9zDEH9hvZlDOv0iRB8+wCRik0jibjLKjNmyHVm+wok0ucsITPZz5qHeHT2rE3xNxK3gUYI0p6P58bzbMIwjJJF4gSRQylFmGXjQ3XJhE/ynh0xN2VT2FOhYRxi45dGqI0X1WG7c= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=silabs.com; spf=pass smtp.mailfrom=silabs.com; dkim=pass (2048-bit key) header.d=silabs.com header.i=@silabs.com header.b=a4kRd+Zn; dkim=pass (1024-bit key) header.d=silabs.com header.i=@silabs.com header.b=NddQBIsz; arc=fail smtp.client-ip=148.163.149.154 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=silabs.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=silabs.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=silabs.com header.i=@silabs.com header.b="a4kRd+Zn"; dkim=pass (1024-bit key) header.d=silabs.com header.i=@silabs.com header.b="NddQBIsz" Received: from pps.filterd (m0101743.ppops.net [127.0.0.1]) by mx0a-0024c301.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 564No2mE017370; Fri, 4 Jul 2025 19:40:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pps12202023; bh=8lkQYMjKFJTTwOabgxVKdF5ZbLzKKXaGvirVvcS2azQ=; b=a4kRd+Zn73V8 7COwG9Uxkgdmo9Y+TGOIwbJc+LqXw85oPTUMeMSYTtuYNggGl59jTb3swzb+jcn6 Pno4HEKwuxqAaal/VezRbh+oK1PSpm36FMTD/pkAXTdPowJouvby3hJwDj+afn3L QfvUA8eVm9KAz5L097KWYTwP9Q4XoHWqfLZsvVAUF5ruwjwJmmJzh24j0pQABXiz s21tWCMmmSzR48X23HSj6LeK0ROVgzddJLHycLs3N4YAzlaH9CjYnOpXkHSSWY8U wHZ3fIoZYsJmIICi2aA/OKs/DOCPq1HIZtf9K9bYRCbOJ7Ty2ipvuHNIJG7C84ub zfYxsUkaAw== Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12on2109.outbound.protection.outlook.com [40.107.244.109]) by mx0a-0024c301.pphosted.com (PPS) with ESMTPS id 47p8pvhb7y-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Jul 2025 19:40:53 -0500 (CDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=G/EkKeqDAO5NldZ1mefstBKMpqAlC85ARfu9qMNtVJpaTbMSHbc337a381V+J2C34ZJFr4vmDmwsDvE78KMlgmNojQ1ojtcUIgpo74pgaTkCVh/QxOs8rAXaLARov1/btyhhsKJm9nevpkO6ScaQKZcw6FgXsGzMrviGEPYlOrECHI+mKRRettvnoxPmCWA4Q92cQsHeOR6WDZ1F+C2e4DwggD1xejXio48mb0VXO1w4FV8e7sUTzBaBPkcdRKoIorioWm0l8K+hE1u0lbWFoSC8b5uyWgUZvuivu6N4+M0a3geS7iIt8GY/Vmbrv93gLBV27Tu5jX6OvWWj6KCMUg== 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=8lkQYMjKFJTTwOabgxVKdF5ZbLzKKXaGvirVvcS2azQ=; b=SUd9RjCJAsJ995p4mh2F8HSYMOlhV//9BEAzT7mKvMxK14NYEw7007QZ7Ky6ce714KTrojouJlEEHnJsmW1CmAv2tOeEm+FMIw4aFwvRjoKlk70JhQNZcoGS2M8yZ7lJubqwod4XGTYn0TY432NQ924CjfJfR5OqtKi1wZbpeGJTZprVqlICxqTSi6BF8V8ckqOlu1UYRZjrQjLC4iOd+NEs07wYgM+0QfjZAfTnH5imw+CpyIbH5uGCE6lr7lOQduwpG5OEeMDtg9rtNewLfH+r/i4QyDMLNVj6/Mx1jvYqn/iM+YRewcb2/LcPj6kAdGY3qPLLOrJJzhgkfYApOg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8lkQYMjKFJTTwOabgxVKdF5ZbLzKKXaGvirVvcS2azQ=; b=NddQBIszwKUtITumxGrlpDPWZV0zkl5kX4oxgPbkO6VIVYegT6dZ91oaWDxxdkMiXX9RF2sS+yGQ12sWqojQFu+lkQCtThUoRsHg0tykHb6Y9BAgdnE4wTCsyR3BWz2Yg1UK6FGZTZHGcKwF1PSMNY1PXdKtt3Z79dmInwXZr5s= Received: from DS0PR11MB8205.namprd11.prod.outlook.com (2603:10b6:8:162::17) by SA2PR11MB5068.namprd11.prod.outlook.com (2603:10b6:806:116::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.23; Sat, 5 Jul 2025 00:40:51 +0000 Received: from DS0PR11MB8205.namprd11.prod.outlook.com ([fe80::c508:9b04:3351:524a]) by DS0PR11MB8205.namprd11.prod.outlook.com ([fe80::c508:9b04:3351:524a%4]) with mapi id 15.20.8880.034; Sat, 5 Jul 2025 00:40:50 +0000 From: =?UTF-8?q?Damien=20Ri=C3=A9gel?= To: greybus-dev@lists.linaro.org Cc: linux-kernel@vger.kernel.org, linux-devel@silabs.com, Greg Kroah-Hartman , Alex Elder , Johan Hovold , =?UTF-8?q?Damien=20Ri=C3=A9gel?= Subject: [RFC 1/6] greybus: move host controller drivers comment in Makefile Date: Fri, 4 Jul 2025 20:40:31 -0400 Message-ID: <20250705004036.3828-2-damien.riegel@silabs.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250705004036.3828-1-damien.riegel@silabs.com> References: <20250705004036.3828-1-damien.riegel@silabs.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: YQZPR01CA0029.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:86::26) To DS0PR11MB8205.namprd11.prod.outlook.com (2603:10b6:8:162::17) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB8205:EE_|SA2PR11MB5068:EE_ X-MS-Office365-Filtering-Correlation-Id: 9a5319e9-2be3-4b1e-8744-08ddbb5c973e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?a3JBc2U4OUMzSDlsNllrYmczakp2aGR5WVEyS0pic3E1UitER09pK3N5b01U?= =?utf-8?B?ZkhBL3gyNGR2NUlaRUIxVUZaSEErc2dvc3BTREt3d3cyVkJFL1RIOGdIYUhL?= =?utf-8?B?aklGUElsMCtjdWQ1QWl5dllRMXFmWnRvRmRoaFFuelJkWnQrajFUZzB4K3ZQ?= =?utf-8?B?NEVJV0pjK1FLMFU5LytJL3AySmJtR0FaNGRDSGE4dHFvTFdBQVRNNFAxUlNn?= =?utf-8?B?ZXhad2wrVnYzTTZ3ZlYwME5RSDh6MW5MSlpZa2Y2SnZ6bk41ZUY1U2xKK2Fm?= =?utf-8?B?WTc4bVk3YlAvbWFHZGpZYzFNTkwxZWtBTlFhMFhKbVZ0ZitSazhtei9QWUpx?= =?utf-8?B?Qit2Si9FVmxRRVpWM0tDUnBZMjlHbTRLVWNBWnk5amc0NkU3UlpFaUFad2RM?= =?utf-8?B?REhkTU9aVmc4UHdqRnhqWWhiNldqTGRNek9BQ2U3eFF1RzFwVHNyTjA0REFN?= =?utf-8?B?T1k5ZG1KR3dmNDNYL280bTVPVFdlL0VvUExQMTc4MFJjRzJ1UG1HRmxobk1y?= =?utf-8?B?QkE5d25aU3planRHbGh0U2NuVVlPMEwxZ1EzN1NPMnFQV1VWSndtbFFIczds?= =?utf-8?B?QXhDMDk0ZWcyRFdvSXVscHovTktzUGRCL2pjb3JvQzZPamFMU2FqanhEbzZV?= =?utf-8?B?Z1FaWkgyaUJHdWNHc1pNK1ZBWTlSTTV1MXowUXBwdEFaOTgxY1AwZXZlSmtO?= =?utf-8?B?bnYydUNyZ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B?WkliREw2VStWWGdhVU8yV25vOWVDcHJQelpGc2g2WXU0bWREUTlWemp3NzMy?= =?utf-8?B?TXdKWnIxS28zenRZVlBWTHh5TVZ2M3REYVBoMyt2YU42Y29qdEJLNXlnL1h4?= =?utf-8?B?eUpYMTFjS0tSTlFzWTcxdVRSbm9jcjNpRmFod2FRYUhpeFNOSktCK3FVakdh?= =?utf-8?B?NHlTZkhuek1UcUMwODhpOEhiSVc3ZHo0VnVMU2ZLUlZZNlBZcEU3elVNVDV1?= =?utf-8?B?RnNJNmJjNUYwbzA0TUtURHZ5Qmd6dHhxMGFEdWlLY3FWbzhnRGhKTS8ydExv?= =?utf-8?B?VWE1WkhURWlEUmlabkViL1FpcVZ2QVBLK0NWV1VIR2tmWi9kUi9ETnNYa1V2?= =?utf-8?B?MVNidEVteTJ3PT0=?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR11MB8205.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(376014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ZWdwVDdRUWZDb3dFWkpBcDBXUnkyOU1uYTJ6b2lKYVNNRml2eTQ3NEhobGNQ?= =?utf-8?B?Q2E1VnhScDI3K3lUdENPckd5ajlrbGVnUXdtb0VEY3pjaFljbXcyYUVZOWRx?= =?utf-8?B?clBWbkVlVnEzcGRFSFJYZFl2Yk1GNkxCYUM0NDdiL2ZCc2NvVUE1UFVNRmUv?= =?utf-8?B?TTVTVXU1cjVLdVVNMDNIbzhPQVVldHhmM2ZySmxScThiWlVvUkdFRTlBUXlQ?= =?utf-8?B?WkZqNDhCeHBoemMzUmg0TWpDanVkcHdZVUlDdHlnVnoyclQ4UWgrRGZKUlpJ?= =?utf-8?B?YUpXYXYxR0MwTHhOSldrb2t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2YTFimVfhmc7TkW60oSk?= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9a5319e9-2be3-4b1e-8744-08ddbb5c973e X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB8205.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2025 00:40:50.8754 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Lp5LKaAD6Kw87HAXEKALZlbkCa2+WaxroFAuKRNFI4c2lI5cj0pSXU6afjCqguTeJIbobAY/r2GQgwBCx5quUw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR11MB5068 X-Authority-Analysis: v=2.4 cv=L4EdQ/T8 c=1 sm=1 tr=0 ts=68687495 cx=c_pps a=U259+el5m5zn0mdk/7qTUw==:117 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=Wb1JkmetP80A:10 a=M51BFTxLslgA:10 a=i1IsUcr2s-wA:10 a=2AEO0YjSAAAA:8 a=3t064-VAD3PcOXc-tpYA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 X-Proofpoint-GUID: n42ZsI1gXBQjpLqPVXk3z-KCaOq0Uk8h X-Proofpoint-ORIG-GUID: n42ZsI1gXBQjpLqPVXk3z-KCaOq0Uk8h X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzA1MDAwMSBTYWx0ZWRfX1Abci9alUv3g 02HvgxYdshtRct6vgNKRr/J9pzRihUIddBleNr3fnSU1fnmgAnFXbIC85k0vdFx6G5PEHUzsFCL sKOIFFKnCPt4nWFxAoGip5Cz11ypbs6sGYCgplhYpmLYs53QQHxxMaJdY3aWmQkJkUaiZY8doul E+NfCDX8s7iEzUBAJcRX35NbE9y4IvhUxEQ2JTiaIVMB55koHmYHpYEDg/TEuoZiFp2IoqUuQ3W 2SRw/qyzFe6zDvoqWalTZQ2ae3RtqgCp1BaOa5jb9DN0tEF8kuXZSysMd6Hm1vB+UNbiYVG/JAu 6oQ1ADyst3m3cRFSlABnReZnPK2+j54LRV5eQkWI5E/Pv5bBYoMJtTx6OC1mSDbT0QbJDgakg/3 GhSM6BeKultH+Iw9fMqc0uglOetf3tFdz2t2bYOH2Nh/7gMJYq+K+U91s/+3nFn8CfLqHivD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-07-04_07,2025-07-04_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxlogscore=911 priorityscore=1501 adultscore=0 malwarescore=0 impostorscore=0 bulkscore=0 mlxscore=0 clxscore=1015 suspectscore=0 spamscore=0 phishscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.21.0-2505280000 definitions=main-2507050001 gb-beagleplay is also a Greybus host controller driver, so move comment accordingly. Signed-off-by: Damien Ri=C3=A9gel --- drivers/greybus/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/greybus/Makefile b/drivers/greybus/Makefile index d986e94f889..c3564ad151f 100644 --- a/drivers/greybus/Makefile +++ b/drivers/greybus/Makefile @@ -18,9 +18,9 @@ obj-$(CONFIG_GREYBUS) +=3D greybus.o # needed for trace events ccflags-y +=3D -I$(src) =20 +# Greybus Host controller drivers obj-$(CONFIG_GREYBUS_BEAGLEPLAY) +=3D gb-beagleplay.o =20 -# Greybus Host controller drivers gb-es2-y :=3D es2.o =20 obj-$(CONFIG_GREYBUS_ES2) +=3D gb-es2.o --=20 2.49.0 From nobody Tue Oct 7 21:28:47 2025 Received: from mx0a-0024c301.pphosted.com (mx0a-0024c301.pphosted.com [148.163.149.154]) (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 8B15984A3E for ; Sat, 5 Jul 2025 00:59:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.149.154 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751677201; cv=fail; b=bigIO3+cckgv1zLctM5B4n7UZEdrT6uCitIpDpDnbEycEJh8C8T65cd7kKHsdi1Ai/8vZdAbhhoUJ2iywLadCDkElzhJ/rrBcub/GTruSJeTvpSzIcErqczPoB9orQzUfngGw94wbok0d310xlxdnWcAE73W5HhuDYgkF9X0mVU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751677201; c=relaxed/simple; bh=qVZcIjbPj8RdV6K+cm6XBOxRTzE7Me/rwMsGkPHBHHc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=Ix57pocsx8TXnF1aNfFtFzXfyAj8vR0jwCd+9SceX77+mAa+Csm1CiCgqaCPWiY42AwzYWNeCD9uMNR1/T7/8bqz4mX12SVm+WeHLDT3RBgnv3PbTdX6+DBfzE8irPMsTM52k2dbbLl1XW4U8abUxjKPzGejw6GJqMye4yVqmdE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=silabs.com; spf=pass smtp.mailfrom=silabs.com; dkim=pass (2048-bit key) header.d=silabs.com header.i=@silabs.com header.b=fypmnpG7; dkim=pass (1024-bit key) header.d=silabs.com header.i=@silabs.com header.b=VYpNU3Hl; arc=fail smtp.client-ip=148.163.149.154 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=silabs.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=silabs.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=silabs.com header.i=@silabs.com header.b="fypmnpG7"; dkim=pass (1024-bit key) header.d=silabs.com header.i=@silabs.com header.b="VYpNU3Hl" Received: from pps.filterd (m0101743.ppops.net [127.0.0.1]) by mx0a-0024c301.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 564No2mF017370; Fri, 4 Jul 2025 19:40:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pps12202023; bh=l6TrGuuPLuunJaJORXckr2VCFTWAc7aCLVkh4Mujbps=; b=fypmnpG7+HXS gxMqeckUUsmjUOWgdgwMaG6gV664tIs5446O5uLa5bn1b+1p3pJqsEyjbMnLkXtK oywHBOFcLTvfCgfM9I6eh8Hwaa2VdUiaOrlL38i/DLKGTyIuG/xWP2Tjbb9OuLuq vnqq4XfbBKrkUljQAfOElvxDzy+4TxA72bOxRtHI/i/MZebj0Ky6N3K+sdjXybS/ zc6g7xMyipESBZn0/u3LEIdxHKz5zM04aG4D9kCs28jcyQKbirOTTZjph7Kk9l2C nG8CctITuMWSAfJRyhGwB5PPzDu5Blo6/SceJ7rCjNOB1QNYhydvcfCOMDS9rDYU VatSA0/Yzg== Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12on2109.outbound.protection.outlook.com [40.107.244.109]) by mx0a-0024c301.pphosted.com (PPS) with ESMTPS id 47p8pvhb7y-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Jul 2025 19:40:54 -0500 (CDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dGuxandrA2OdiI1vVKQlyDsmr35NKfuRdozqW1UmrJzdTN4NYpskl2Ftkh+MtWd1vUB34Gd0zSvbRF0YN661NT9gA8iK60uNb8QAkeBzbEZEUXt6ucMNRDJ5AoEmRdi6ok7qT12pP7oc/OXXBEUMnyTc64HVvgox7ySg8fyTbcXfCpLSsngf6TZeuu6/QsRYhMVfVkvKoD+8A7jxizrRETiwZyQqkJt0T3yIclHCayHEr8TLDTDQFSH153hAuelXmKyr0s650wO1tsojZlivjWED+CLS34w2mb8St01ZI4GGBj/yzGf4PMi+xRx87RkvQ53N0SmEe8WwshUR7TzJQQ== 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=l6TrGuuPLuunJaJORXckr2VCFTWAc7aCLVkh4Mujbps=; b=RHmyokdTCEewosXhEVjHcpx7+EWEkDXNLYdayp5NuoEDaJg8nF/VbYJYRy4bX7B96/13ppM9uBD5dq0+1P3EOAa7Pt/PPS4ewNOP3d7uaMjJ9P/o8YRsL4GTE6DjPvQqcnm0xi8+lKDHJcBpbdwruwDwytU7lMwqc89KnMXcbw0S+BT/6TRgHEIpplCldqgOPNatZH7Bv22qJhnPQySL+OnlLzmMk0m3BiP564hU0RFlFWvHkc23sLkHBDC1TB6Ne++yTItc5zLqFYDh8UAOh32q7w/iMC64qoVymq8jfb0Z6oCclt7N8R/hn79HE6cJYppgMHOEIU8iaalWgiAYxg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=l6TrGuuPLuunJaJORXckr2VCFTWAc7aCLVkh4Mujbps=; b=VYpNU3HldVh9dbBb4TbS/xouBhMaLQSPEbwvHb64unPX5S1WBQ9NLAtOy/4dCmfAVVJLzQR+bCYT8WjVxhqQdVrLUxGKt05TNiYVRSNyqsAduE8gNbkVoUNl3ZgjRF3f9kdHf68/H4LM4FvOvlSBZK9eRNp245EDUi0Um0ZEtnY= Received: from DS0PR11MB8205.namprd11.prod.outlook.com (2603:10b6:8:162::17) by SA2PR11MB5068.namprd11.prod.outlook.com (2603:10b6:806:116::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.23; Sat, 5 Jul 2025 00:40:51 +0000 Received: from DS0PR11MB8205.namprd11.prod.outlook.com ([fe80::c508:9b04:3351:524a]) by DS0PR11MB8205.namprd11.prod.outlook.com ([fe80::c508:9b04:3351:524a%4]) with mapi id 15.20.8880.034; Sat, 5 Jul 2025 00:40:51 +0000 From: =?UTF-8?q?Damien=20Ri=C3=A9gel?= To: greybus-dev@lists.linaro.org Cc: linux-kernel@vger.kernel.org, linux-devel@silabs.com, Greg Kroah-Hartman , Alex Elder , Johan Hovold , =?UTF-8?q?Damien=20Ri=C3=A9gel?= Subject: [RFC 2/6] greybus: cpc: add core logic Date: Fri, 4 Jul 2025 20:40:32 -0400 Message-ID: <20250705004036.3828-3-damien.riegel@silabs.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250705004036.3828-1-damien.riegel@silabs.com> References: <20250705004036.3828-1-damien.riegel@silabs.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: YQZPR01CA0029.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:86::26) To DS0PR11MB8205.namprd11.prod.outlook.com (2603:10b6:8:162::17) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB8205:EE_|SA2PR11MB5068:EE_ X-MS-Office365-Filtering-Correlation-Id: 3af7f484-9e43-44e6-2050-08ddbb5c97cb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?OEJuQ0JlKzNjaTZlME9CWEJVZ0U5bjJrMzV0bDQyS2M1ckVhREgySFczdUlH?= =?utf-8?B?VDRNd0RRUzNtbm1tbExwc09mNFdzbXdMWit1dlBkMHZZRzdsOTI1QUZJR0tv?= =?utf-8?B?RXJhUGVxMUVnS0RZV2NWL1daNStiR1dzcjNqa0NFekNOMzhXYW1qNndWMUQ5?= =?utf-8?B?ZWk0YUVRbVhBOXRaMzNCRys0M3dPcTB0bGFUUGt3djhRM29kcG1TbGNKbnBR?= =?utf-8?B?Q29STkFSTUdFdWZWQVducFh5VGFhcEl2UEdhQXE0THZ2U0F1YjVlRGQ1QUYx?= =?utf-8?B?VnN2OUN2dFNwQmVTUTZQa1hpazE2VFVWcmlQbFJrQzlHT21PUDAzNHhNYW5T?= =?utf-8?B?M2x6QUgvRjRHbEVLdndPanlpQ3B2SlFZRHREVzNOTjkzVzJ3cFJjUmVvVWND?= =?utf-8?B?NG5ueTJGeDRMYTlUUVJxcHFGYXU0ZkNpRjlNSXpTa0Z6WWUrOTU2dDJYeFRj?= =?utf-8?B?dTZsUVN2YVJiRlRJblJtZjBKR2tJOGkyM0laYVJXRHVvVk5UUVUvQm93VUhp?= =?utf-8?B?TkVZZ1M0YWdDVWpWSzdpYW9PckJvMk42MnpVWnJqQk9TbzkxcHQzbFVkNHR5?= =?utf-8?B?WFQ2S2RuNXE2NXVyM0dZSUt4QzJKUHkveWlnQ29qbDB2MEJDdHNKWW9IdDBx?= =?utf-8?B?aXJzNFVtK0F4NDdJVkFZZ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VNd3dXVnlBM25xaXhxKzllOHNob3JGNjladkZJY0l1RHZxTjlF?= =?utf-8?B?Rk9vQ3VnSitDRnNabzBoNE1nZ1AyVFBMbzIwTHFua2M0eDBLdnJzL1drMGtt?= =?utf-8?B?aS8xdzNacS8wOUFPVldnVGVwT1NUSHIzeXVKL2YvekUxTG9JZER2dzNIdDNR?= =?utf-8?B?ZGtFdzNGTHJtZDZkUG5PbkViWHYxdWNuTTBjdUN5K3QyMnNQMTdNQjJ3djRJ?= =?utf-8?B?MVBxaEl1ck51QmZFQmpJUHcwV3ByenZ1ZjZJUjQ2cFpucU0ydkx5RTU3Zk8x?= =?utf-8?B?cTJKOEJkYmRqeTkrd2JMbHlwY29sTWxKTXdVOHlxRVo1T0hWblJmYmR4THFP?= =?utf-8?B?YkU1VWxwSDNjMDZ1SVNUNU5DZmlMNGk5Z0RPVUtuTXBFZEVYS09LcFI3ZUl2?= =?utf-8?B?bVBMZ04rQVpRPT0=?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR11MB8205.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(376014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ck5RTmJySXM1cGZpY0o5a2dFZ0ZEdzlZQWFTZmcxUU5qRXY1enM5OCtKR3BT?= =?utf-8?B?YXJ2K1FnU05KaWp1OVVzMy9ydHpxZlRzNmJJTGg5M3NUZi92RStocDdoRkd5?= =?utf-8?B?RUg1TSt4TWlYcjMvOG04eHFNV1JrNnZMZTNxZEMxYkY0WWJJSWNVdmE1VFZ0?= =?utf-8?B?cDR3dmE2bGlwN2o2aGJnUlZoN0tBYUY2TUphd1BYN3NNaGpCQk1LMytaSFRu?= =?utf-8?B?RmJ3NDlQaU1ReEduS1dYTWR4RjBB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3JYZDFWTGpZZzhnR2NFK01uYWM5cjJyYk1QWERpR09IQVRi?= =?utf-8?Q?jjDxry/R4ImV6+R6KTeVTsCfm?= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3af7f484-9e43-44e6-2050-08ddbb5c97cb X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB8205.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2025 00:40:51.6312 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8LvNqyQGkxtvlG2UrUQ60hlRiqNxFvLI4M+iK/Dr9fANUK9AMSdnRnJTYtjlrlZcKo1Bq1yGXxG2N/rzWpE8JQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR11MB5068 X-Authority-Analysis: v=2.4 cv=L4EdQ/T8 c=1 sm=1 tr=0 ts=68687496 cx=c_pps a=U259+el5m5zn0mdk/7qTUw==:117 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=Wb1JkmetP80A:10 a=M51BFTxLslgA:10 a=i1IsUcr2s-wA:10 a=2AEO0YjSAAAA:8 a=VwQbUJbxAAAA:8 a=DYa9-_WpzSahMzQztVoA:9 a=83a8osvCpJRvxTeB:21 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 X-Proofpoint-GUID: qgzUN_2IcAyRJfM3jOxW3p-aTlv0yeDe X-Proofpoint-ORIG-GUID: qgzUN_2IcAyRJfM3jOxW3p-aTlv0yeDe X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzA1MDAwMSBTYWx0ZWRfX16cFRSbE2ids zWqecP6gu5IfIHEjMeh21RmFMq9g2P4sT66lr+OkHOU8uJ0uzCGDqfmHPzymCeHTiP+auTtUMVK vum5t2yX8GsIbBLlyQIZdjZISv5n8C+28Pfr/Meo80LicM1kPvXrN6055jG0MzI5hzVSgvgVu5K 3MiaZySUwN9vLTtSfS73LdGhZFxiOSFqmt0SS3CvMK4aKioG8tfsRcOjiIBVTzZpEz/HJAbmnsw wcs+jgmSktr1RCsZ43hM0oJdGg/uT86guTwHyWub1yt5nzaSqzmF0WZ7Xv32BO2LtZbJflXknZF oHO3tEKEPJ6Mv8QHf20qrBQLk4Ih21RhUGqLejHTBKhd0bESJBoWo+shwUXxjL58Rz/r4x2T62B sNw4ps0TRhuhs2jbbxiflYi4C6eeBZ8rb73ve61dDmX2U3PZawKf6JCIrt/A0wAjqznA57QL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-07-04_07,2025-07-04_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxlogscore=999 priorityscore=1501 adultscore=0 malwarescore=0 impostorscore=0 bulkscore=0 mlxscore=0 clxscore=1015 suspectscore=0 spamscore=0 phishscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.21.0-2505280000 definitions=main-2507050001 This step adds the basic infrastructure in order to use CPC as backend in Greybus. The goal of CPC is to add reliablity, by implementing error detection and retransmission for links that don't have that capability by default. When Greybus establishes the connection between two CPorts, CPC will create an endpoint for this connection. Greybus messages will then be encapsulated in CPC frames, which basically are a custom header + Greybus header + Greybus payload. As this is still evolving and not the main point of the RFC, the whole core is squashed in one big commit, but it will definitely be split into more digestible commits as we refine it. Signed-off-by: Damien Ri=C3=A9gel --- MAINTAINERS | 6 + drivers/greybus/Kconfig | 2 + drivers/greybus/Makefile | 2 + drivers/greybus/cpc/Kconfig | 12 ++ drivers/greybus/cpc/Makefile | 6 + drivers/greybus/cpc/cpc.h | 135 ++++++++++++++++ drivers/greybus/cpc/endpoint.c | 158 +++++++++++++++++++ drivers/greybus/cpc/header.c | 212 +++++++++++++++++++++++++ drivers/greybus/cpc/header.h | 81 ++++++++++ drivers/greybus/cpc/host.c | 113 ++++++++++++++ drivers/greybus/cpc/protocol.c | 274 +++++++++++++++++++++++++++++++++ 11 files changed, 1001 insertions(+) create mode 100644 drivers/greybus/cpc/Kconfig create mode 100644 drivers/greybus/cpc/Makefile create mode 100644 drivers/greybus/cpc/cpc.h create mode 100644 drivers/greybus/cpc/endpoint.c create mode 100644 drivers/greybus/cpc/header.c create mode 100644 drivers/greybus/cpc/header.h create mode 100644 drivers/greybus/cpc/host.c create mode 100644 drivers/greybus/cpc/protocol.c diff --git a/MAINTAINERS b/MAINTAINERS index 8256ec0ff8a..10385b5344b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -10016,6 +10016,12 @@ S: Maintained F: Documentation/devicetree/bindings/net/ti,cc1352p7.yaml F: drivers/greybus/gb-beagleplay.c =20 +GREYBUS CPC DRIVERS +M: Damien Ri=C3=A9gel +R: Silicon Labs Kernel Team +S: Supported +F: drivers/greybus/cpc/* + GREYBUS SUBSYSTEM M: Johan Hovold M: Alex Elder diff --git a/drivers/greybus/Kconfig b/drivers/greybus/Kconfig index c3f056d28b0..565a0fdcb2c 100644 --- a/drivers/greybus/Kconfig +++ b/drivers/greybus/Kconfig @@ -30,6 +30,8 @@ config GREYBUS_BEAGLEPLAY To compile this code as a module, chose M here: the module will be called gb-beagleplay.ko =20 +source "drivers/greybus/cpc/Kconfig" + config GREYBUS_ES2 tristate "Greybus ES3 USB host controller" depends on USB diff --git a/drivers/greybus/Makefile b/drivers/greybus/Makefile index c3564ad151f..4ebf8907405 100644 --- a/drivers/greybus/Makefile +++ b/drivers/greybus/Makefile @@ -21,6 +21,8 @@ ccflags-y +=3D -I$(src) # Greybus Host controller drivers obj-$(CONFIG_GREYBUS_BEAGLEPLAY) +=3D gb-beagleplay.o =20 +obj-$(CONFIG_GREYBUS_CPC) +=3D cpc/ + gb-es2-y :=3D es2.o =20 obj-$(CONFIG_GREYBUS_ES2) +=3D gb-es2.o diff --git a/drivers/greybus/cpc/Kconfig b/drivers/greybus/cpc/Kconfig new file mode 100644 index 00000000000..1512f9324f8 --- /dev/null +++ b/drivers/greybus/cpc/Kconfig @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0 + +config GREYBUS_CPC + tristate "Greybus CPC driver" + depends on SPI + select CRC_ITU_T + help + Select this option if you have a Silicon Labs EFR32 device that acts + as a Greybus SVC. + + To compile this code as a module, chose M here: the module will be + called gb-cpc.ko diff --git a/drivers/greybus/cpc/Makefile b/drivers/greybus/cpc/Makefile new file mode 100644 index 00000000000..08ef7c6d24b --- /dev/null +++ b/drivers/greybus/cpc/Makefile @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0 + +gb-cpc-y :=3D endpoint.o header.o host.o main.o protocol.o + +# CPC core +obj-$(CONFIG_GREYBUS_CPC) +=3D gb-cpc.o diff --git a/drivers/greybus/cpc/cpc.h b/drivers/greybus/cpc/cpc.h new file mode 100644 index 00000000000..4aece6da9f7 --- /dev/null +++ b/drivers/greybus/cpc/cpc.h @@ -0,0 +1,135 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2025, Silicon Laboratories, Inc. + */ + +#ifndef __CPC_H +#define __CPC_H + +#include +#include + +#include "header.h" + +#define GB_CPC_SPI_NUM_CPORTS 8 + +struct cpc_endpoint; +struct cpc_endpoint_tcb; +struct cpc_frame; +struct cpc_host_device; + +/** + * struct cpc_host_device - CPC host device + * @gb_hd: pointer to Greybus Host Device + * @lock: mutex to synchronize access to endpoint array + * @tx_queue: list of cpc_frame to send + * @endpoints: array of endpoint pointers + * @wake_tx: function called when a new packet must be transmitted + */ +struct cpc_host_device { + struct gb_host_device *gb_hd; + + struct mutex lock; + struct list_head tx_queue; + + struct cpc_endpoint *endpoints[GB_CPC_SPI_NUM_CPORTS]; + + int (*wake_tx)(struct cpc_host_device *cpc_hd); +}; + +struct cpc_endpoint *cpc_hd_get_endpoint(struct cpc_host_device *cpc_hd, u= 16 cport_id); +void cpc_hd_send_frame(struct cpc_host_device *cpc_hd, struct cpc_frame *f= rame); +void cpc_hd_rcvd(struct cpc_host_device *cpc_hd, struct cpc_header *hdr, + u8 *data, size_t length); +struct cpc_frame *cpc_hd_dequeue(struct cpc_host_device *cpc_hd); +bool cpc_hd_tx_queue_empty(struct cpc_host_device *cpc_hd); + +/** + * struct cpc_endpoint_tcb - endpoint's transmission control block + * @send_wnd: send window, maximum number of frames that the remote can ac= cept + * TX frames should have a sequence in the range + * [send_una; send_una + send_wnd]. + * @send_nxt: send next, the next sequence number that will be used for tr= ansmission + * @send_una: send unacknowledged, the oldest unacknowledged sequence numb= er + * @ack: current acknowledge number + * @seq: current sequence number + * @mtu: maximum transmission unit + */ +struct cpc_endpoint_tcb { + u8 send_wnd; + u8 send_nxt; + u8 send_una; + u8 ack; + u8 seq; + u16 mtu; +}; + +/** + * struct cpc_endpint - CPC endpoint + * @id: endpoint ID + * @cpc_hd: pointer to the CPC host device this endpoint belongs to + * @lock: synchronize access to other attributes + * @completion: (dis)connection completion + * @tcb: transmission control block + * @holding_queue: list of CPC frames queued to be sent + * @pending_ack_queue: list of CPC frames sent and waiting for acknowledgm= ent + */ +struct cpc_endpoint { + u16 id; + + struct cpc_host_device *cpc_hd; + + struct mutex lock; /* Synchronize access to all other attributes. */ + struct completion completion; + struct cpc_endpoint_tcb tcb; + struct list_head holding_queue; + struct list_head pending_ack_queue; +}; + +struct cpc_endpoint *cpc_endpoint_alloc(u16 ep_id, gfp_t gfp_mask); +void cpc_endpoint_release(struct cpc_endpoint *ep); +int cpc_endpoint_frame_send(struct cpc_endpoint *ep, struct cpc_frame *fra= me); +int cpc_endpoint_connect(struct cpc_endpoint *ep); +int cpc_endpoint_disconnect(struct cpc_endpoint *ep); + +/** + * struct cpc_frame - CPC frame + * @header: CPC header + * @message: Greybus message to transmit + * @cancelled: indicate if Greybus message is cancelled and should not be = sent + * @ep: endpoint this frame is sent over + * @links: list head in endpoint's queue + * @txq_links: list head in cpc host device's queue + */ +struct cpc_frame { + struct cpc_header header; + struct gb_message *message; + + bool cancelled; + + struct cpc_endpoint *ep; + + struct list_head links; /* endpoint->holding_queue or + * endpoint->pending_ack_queue. + */ + struct list_head txq_links; /* cpc_host_device->tx_queue. */ + +}; + +struct cpc_frame *cpc_frame_alloc(struct gb_message *message, gfp_t gfp_ma= sk); +void cpc_frame_free(struct cpc_frame *frame); +void cpc_frame_sent(struct cpc_frame *frame, int status); + +int __cpc_protocol_write(struct cpc_endpoint *ep, struct cpc_frame *frame); + +void cpc_protocol_on_data(struct cpc_endpoint *ep, struct cpc_header *hdr,= u8 *data, size_t length); +void cpc_protocol_on_syn(struct cpc_endpoint *ep, struct cpc_header *hdr); +void cpc_protocol_on_rst(struct cpc_endpoint *ep); + +void cpc_protocol_send_rst(struct cpc_host_device *cpc_hd, u8 ep_id); +int cpc_protocol_send_syn(struct cpc_endpoint *ep); + +int cpc_spi_register_driver(void); +void cpc_spi_unregister_driver(void); + +#endif diff --git a/drivers/greybus/cpc/endpoint.c b/drivers/greybus/cpc/endpoint.c new file mode 100644 index 00000000000..12710edebcf --- /dev/null +++ b/drivers/greybus/cpc/endpoint.c @@ -0,0 +1,158 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2025, Silicon Laboratories, Inc. + */ + +#include + +#include "cpc.h" + +/** + * cpc_endpoint_write - Write a DATA frame. + * @ep: Endpoint handle. + * @frame: Frame to send. + * + * @return: 0 on success, otherwise a negative error code. + */ +int cpc_endpoint_frame_send(struct cpc_endpoint *ep, struct cpc_frame *fra= me) +{ + struct cpc_header *hdr =3D &frame->header; + size_t cpc_payload_sz =3D 0; + int err; + + if (frame->message) { + cpc_payload_sz +=3D sizeof(struct gb_operation_msg_hdr); + cpc_payload_sz +=3D frame->message->payload_size; + } + + mutex_lock(&ep->lock); + + if (cpc_payload_sz > ep->tcb.mtu) { + err =3D -EINVAL; + goto out; + } + + memset(hdr, 0, sizeof(*hdr)); + hdr->ctrl =3D cpc_header_get_ctrl(CPC_FRAME_TYPE_DATA, true); + hdr->ep_id =3D ep->id; + hdr->recv_wnd =3D CPC_HEADER_MAX_RX_WINDOW; + hdr->seq =3D ep->tcb.seq; + hdr->dat.payload_len =3D cpc_payload_sz; + + frame->ep =3D ep; + + err =3D __cpc_protocol_write(ep, frame); + +out: + mutex_unlock(&ep->lock); + + return err; +} + +void cpc_frame_sent(struct cpc_frame *frame, int status) +{ + struct cpc_endpoint *ep =3D frame->ep; + struct gb_host_device *gb_hd =3D ep->cpc_hd->gb_hd; + + /* There is no Greybus payload, this frame is purely CPC */ + if (!frame->message) + return; + + /* + * Increase the send_nxt sequence, this is used as the upper bound of seq= uence number that + * can be ACK'd by the remote. Only increase if sent successfully. + */ + if (!status) { + mutex_lock(&ep->lock); + ep->tcb.send_nxt++; + mutex_unlock(&ep->lock); + } + + if (!frame->cancelled) + greybus_message_sent(gb_hd, frame->message, status); + + kfree(frame); +} + +/** + * cpc_endpoint_tcb_reset() - Reset endpoint's TCB to initial values. + * @ep: endpoint pointer + */ +static void cpc_endpoint_tcb_reset(struct cpc_endpoint *ep) +{ + ep->tcb.seq =3D ep->id; + ep->tcb.ack =3D 0; + ep->tcb.mtu =3D 0; + ep->tcb.send_nxt =3D ep->id; + ep->tcb.send_una =3D ep->id; + ep->tcb.send_wnd =3D 1; +} + +/** + * cpc_endpoint_alloc() - Allocate and initialize CPC endpoint. + * @ep_id: Endpoint ID. + * @gfp_mask: GFP mask for allocation. + * + * Return: Pointer to allocated and initialized cpc_endpoint, or NULL on f= ailure. + */ +struct cpc_endpoint *cpc_endpoint_alloc(u16 ep_id, gfp_t gfp_mask) +{ + struct cpc_endpoint *ep; + + ep =3D kzalloc(sizeof(*ep), gfp_mask); + if (!ep) + return NULL; + + ep->id =3D ep_id; + INIT_LIST_HEAD(&ep->holding_queue); + INIT_LIST_HEAD(&ep->pending_ack_queue); + + mutex_init(&ep->lock); + cpc_endpoint_tcb_reset(ep); + init_completion(&ep->completion); + + return ep; +} + +void cpc_endpoint_release(struct cpc_endpoint *ep) +{ + kfree(ep); +} + +int cpc_endpoint_connect(struct cpc_endpoint *ep) +{ + int ret; + + ret =3D cpc_protocol_send_syn(ep); + if (ret) + return ret; + + return wait_for_completion_interruptible(&ep->completion); +} + +int cpc_endpoint_disconnect(struct cpc_endpoint *ep) +{ + cpc_protocol_send_rst(ep->cpc_hd, ep->id); + + return 0; +} + +struct cpc_frame *cpc_frame_alloc(struct gb_message *message, gfp_t gfp_ma= sk) +{ + struct cpc_frame *frame; + + frame =3D kzalloc(sizeof(*frame), gfp_mask); + if (!frame) + return NULL; + + frame->message =3D message; + INIT_LIST_HEAD(&frame->links); + INIT_LIST_HEAD(&frame->txq_links); + + return frame; +} + +void cpc_frame_free(struct cpc_frame *frame) +{ + kfree(frame); +} diff --git a/drivers/greybus/cpc/header.c b/drivers/greybus/cpc/header.c new file mode 100644 index 00000000000..4faa604b13a --- /dev/null +++ b/drivers/greybus/cpc/header.c @@ -0,0 +1,212 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2025, Silicon Laboratories, Inc. + */ + +#include +#include +#include + +#include "header.h" + +#define CPC_CONTROL_TYPE_MASK 0xC0 +#define CPC_CONTROL_ACK_MASK BIT(2) + +/** + * cpc_header_get_type() - Get the frame type. + * @hdr: CPC header. + * @type: Reference to a frame type. + * + * Return: True if the type has been successfully decoded, otherwise false. + * On success, the output parameter type is assigned. + */ +bool cpc_header_get_type(const struct cpc_header *hdr, enum cpc_frame_type= *type) +{ + switch (FIELD_GET(CPC_CONTROL_TYPE_MASK, hdr->ctrl)) { + case CPC_FRAME_TYPE_DATA: + *type =3D CPC_FRAME_TYPE_DATA; + break; + case CPC_FRAME_TYPE_SYN: + *type =3D CPC_FRAME_TYPE_SYN; + break; + case CPC_FRAME_TYPE_RST: + *type =3D CPC_FRAME_TYPE_RST; + break; + default: + return false; + } + + return true; +} + +/** + * cpc_header_get_ep_id() - Get the endpoint id. + * @hdr: CPC header. + * + * Return: Endpoint id. + */ +u8 cpc_header_get_ep_id(const struct cpc_header *hdr) +{ + return hdr->ep_id; +} + +/** + * cpc_header_get_recv_wnd() - Get the receive window. + * @hdr: CPC header. + * + * Return: Receive window. + */ +u8 cpc_header_get_recv_wnd(const struct cpc_header *hdr) +{ + return hdr->recv_wnd; +} + +/** + * cpc_header_get_seq() - Get the sequence number. + * @hdr: CPC header. + * + * Return: Sequence number. + */ +u8 cpc_header_get_seq(const struct cpc_header *hdr) +{ + return hdr->seq; +} + +/** + * cpc_header_get_ack() - Get the acknowledge number. + * @hdr: CPC header. + * + * Return: Acknowledge number. + */ +u8 cpc_header_get_ack(const struct cpc_header *hdr) +{ + return hdr->ack; +} + +/** + * cpc_header_get_req_ack() - Get the request acknowledge frame flag. + * @hdr: CPC header. + * + * Return: Request acknowledge frame flag. + */ +bool cpc_header_get_req_ack(const struct cpc_header *hdr) +{ + return FIELD_GET(CPC_CONTROL_ACK_MASK, hdr->ctrl); +} + +/** + * cpc_header_get_mtu() - Get the maximum transmission unit. + * @hdr: CPC header. + * + * Return: Maximum transmission unit. + * + * Must only be used over a SYN frame. + */ +u16 cpc_header_get_mtu(const struct cpc_header *hdr) +{ + return le16_to_cpu(hdr->syn.mtu); +} + +/** + * cpc_header_get_payload_len() - Get the payload length. + * @hdr: CPC header. + * + * Return: Payload length. + * + * Must only be used over a DATA frame. + */ +u16 cpc_header_get_payload_len(const struct cpc_header *hdr) +{ + return le16_to_cpu(hdr->dat.payload_len); +} + +/** + * cpc_header_get_ctrl() - Encode parameters into a control byte. + * @type: Frame type. + * @req_ack: Frame flag indicating a request to be acknowledged. + * + * Return: Encoded control byte. + */ +u8 cpc_header_get_ctrl(enum cpc_frame_type type, bool req_ack) +{ + return FIELD_PREP(CPC_CONTROL_TYPE_MASK, type) | + FIELD_PREP(CPC_CONTROL_ACK_MASK, req_ack); +} + +/** + * cpc_header_get_frames_acked_count() - Get frames to be acknowledged. + * @seq: Current sequence number of the endpoint. + * @ack: Acknowledge number of the received frame. + * + * Return: Frames to be acknowledged. + */ +u8 cpc_header_get_frames_acked_count(u8 seq, u8 ack) +{ + u8 frames_acked_count; + + /* Find number of frames acknowledged with ACK number. */ + if (ack > seq) { + frames_acked_count =3D ack - seq; + } else { + frames_acked_count =3D 256 - seq; + frames_acked_count +=3D ack; + } + + return frames_acked_count; +} + +/** + * cpc_header_is_syn_ack_valid() - Check if the provided SYN-ACK valid or = not. + * @seq: Current sequence number of the endpoint. + * @ack: Acknowledge number of the received SYN. + * + * Return: True if valid, otherwise false. + */ +bool cpc_header_is_syn_ack_valid(u8 seq, u8 ack) +{ + return !!cpc_header_get_frames_acked_count(seq, ack); +} + +/** + * cpc_header_number_in_window() - Test if a number is within a window. + * @start: Start of the window. + * @end: Window size. + * @n: Number to be tested. + * + * Given the start of the window and its size, test if the number is + * in the range [start; start + wnd). + * + * @return True if start <=3D n <=3D start + wnd - 1 (modulo 256), otherwi= se false. + */ +bool cpc_header_number_in_window(u8 start, u8 wnd, u8 n) +{ + u8 end; + + if (wnd =3D=3D 0) + return false; + + end =3D start + wnd - 1; + + return cpc_header_number_in_range(start, end, n); +} + +/** + * cpc_header_number_in_range() - Test if a number is between start and en= d (included). + * @start: Lowest limit. + * @end: Highest limit inclusively. + * @n: Number to be tested. + * + * @return True if start <=3D n <=3D end (modulo 256), otherwise false. + */ +bool cpc_header_number_in_range(u8 start, u8 end, u8 n) +{ + if (end >=3D start) { + if (n < start || n > end) + return false; + } else { + if (n > end && n < start) + return false; + } + + return true; +} diff --git a/drivers/greybus/cpc/header.h b/drivers/greybus/cpc/header.h new file mode 100644 index 00000000000..5d574fef422 --- /dev/null +++ b/drivers/greybus/cpc/header.h @@ -0,0 +1,81 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2025, Silicon Laboratories, Inc. + */ + +#ifndef __CPC_HEADER_H +#define __CPC_HEADER_H + +#include +#include + +#define CPC_HEADER_MAX_RX_WINDOW U8_MAX +#define CPC_HEADER_SIZE 8 + +/** + * enum cpc_frame_type - Describes all possible frame types that can + * be received or sent. + * @CPC_FRAME_TYPE_DATA: Used to send and control application DATA frames. + * @CPC_FRAME_TYPE_SYN: Used to initiate an endpoint connection. + * @CPC_FRAME_TYPE_RST: Used to reset the endpoint connection and indicate + * that the endpoint is unavailable. + */ +enum cpc_frame_type { + CPC_FRAME_TYPE_DATA, + CPC_FRAME_TYPE_SYN, + CPC_FRAME_TYPE_RST, +}; + +/** + * struct cpc_header - Representation of the CPC header. + * @ep_id: Address of the endpoint the frame is destined to. + * @ctrl: Indicates the frame type [7..6] and frame flags [5..0]. + * Currently only the request acknowledge flag is supported. + * This flag indicates if the frame should be acknowledged by + * the remote on reception. + * @recv_wnd: Indicates to the remote how many reception buffers are + * available so it can determine how many frames it can send. + * @seq: Identifies the frame with a number. + * @ack: Indicate the sequence number of the next expected frame from + * the remote. When paired with a fast re-transmit flag, it indicates + * the sequence number of the frame in error that should be + * re-transmitted. + * @syn.mtu: On a SYN frame, this represents the maximum transmission unit. + * @dat.payload_len: On a DATA frame, this indicates the payload length. + */ +struct cpc_header { + u16 ep_id; + u8 ctrl; + u8 recv_wnd; + u8 seq; + u8 ack; + union { + u8 extension[2]; + struct __packed { + __le16 mtu; + } syn; + struct __packed { + __le16 payload_len; + } dat; + struct __packed { + u8 reserved[2]; + } rst; + }; +} __packed; + +bool cpc_header_get_type(const struct cpc_header *hdr, enum cpc_frame_type= *type); +u8 cpc_header_get_ep_id(const struct cpc_header *hdr); +u8 cpc_header_get_recv_wnd(const struct cpc_header *hdr); +u8 cpc_header_get_seq(const struct cpc_header *hdr); +u8 cpc_header_get_ack(const struct cpc_header *hdr); +bool cpc_header_get_req_ack(const struct cpc_header *hdr); +u16 cpc_header_get_mtu(const struct cpc_header *hdr); +u16 cpc_header_get_payload_len(const struct cpc_header *hdr); +u8 cpc_header_get_ctrl(enum cpc_frame_type type, bool req_ack); + +u8 cpc_header_get_frames_acked_count(u8 seq, u8 ack); +bool cpc_header_is_syn_ack_valid(u8 seq, u8 ack); +bool cpc_header_number_in_window(u8 start, u8 wnd, u8 n); +bool cpc_header_number_in_range(u8 start, u8 end, u8 n); + +#endif diff --git a/drivers/greybus/cpc/host.c b/drivers/greybus/cpc/host.c new file mode 100644 index 00000000000..0805552d5ec --- /dev/null +++ b/drivers/greybus/cpc/host.c @@ -0,0 +1,113 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2025, Silicon Laboratories, Inc. + */ + +#include +#include +#include + +#include "cpc.h" +#include "header.h" + +struct cpc_endpoint *cpc_hd_get_endpoint(struct cpc_host_device *cpc_hd, u= 16 cport_id) +{ + struct cpc_endpoint *ep; + + for (int i =3D 0; i < ARRAY_SIZE(cpc_hd->endpoints); i++) { + ep =3D cpc_hd->endpoints[i]; + if (ep && ep->id =3D=3D cport_id) + return ep; + } + + return NULL; +} + +void cpc_hd_rcvd(struct cpc_host_device *cpc_hd, struct cpc_header *hdr, + u8 *data, size_t length) +{ + enum cpc_frame_type type; + struct cpc_endpoint *ep; + u8 ep_id; + + cpc_header_get_type(hdr, &type); + ep_id =3D cpc_header_get_ep_id(hdr); + + ep =3D cpc_hd_get_endpoint(cpc_hd, ep_id); + if (!ep) { + if (type !=3D CPC_FRAME_TYPE_RST) { + dev_dbg(&cpc_hd->gb_hd->dev, "ep%u not allocated (%d)\n", ep_id, type); + cpc_protocol_send_rst(cpc_hd, ep_id); + } + return; + } + + switch (type) { + case CPC_FRAME_TYPE_DATA: + cpc_protocol_on_data(ep, hdr, data, length); + break; + case CPC_FRAME_TYPE_SYN: + cpc_protocol_on_syn(ep, hdr); + break; + case CPC_FRAME_TYPE_RST: + dev_dbg(&cpc_hd->gb_hd->dev, "reset\n"); + cpc_protocol_on_rst(ep); + break; + } +} + + +/** + * cpc_interface_send_frame() - Queue a socket buffer for transmission. + * @intf: Interface to send SKB over. + * @ops: SKB to send. + * + * Queue SKB in interface's transmit queue and signal the interface. Inter= face is expected to use + * cpc_interface_dequeue() to get the next SKB to transmit. + */ +void cpc_hd_send_frame(struct cpc_host_device *cpc_hd, struct cpc_frame *f= rame) +{ + mutex_lock(&cpc_hd->lock); + list_add_tail(&frame->txq_links, &cpc_hd->tx_queue); + mutex_unlock(&cpc_hd->lock); + + cpc_hd->wake_tx(cpc_hd); +} + +/** + * cpc_interface_dequeue() - Get the next SKB that was queued for transmis= sion. + * @intf: Interface. + * + * Get an SKB that was previously queued by cpc_interface_send_frame(). + * + * Return: An SKB, or %NULL if queue was empty. + */ +struct cpc_frame *cpc_hd_dequeue(struct cpc_host_device *cpc_hd) +{ + struct cpc_frame *f; + + mutex_lock(&cpc_hd->lock); + f =3D list_first_entry_or_null(&cpc_hd->tx_queue, struct cpc_frame, txq_l= inks); + if (f) + list_del(&f->txq_links); + mutex_unlock(&cpc_hd->lock); + + return f; +} + +/** + * cpc_interface_tx_queue_empty() - Check if transmit queue is empty. + * @intf: Interface. + * + * Return: True if transmit queue is empty, false otherwise. + */ +bool cpc_hd_tx_queue_empty(struct cpc_host_device *cpc_hd) +{ + bool empty; + + mutex_lock(&cpc_hd->lock); + empty =3D list_empty(&cpc_hd->tx_queue); + mutex_unlock(&cpc_hd->lock); + + return empty; +} diff --git a/drivers/greybus/cpc/protocol.c b/drivers/greybus/cpc/protocol.c new file mode 100644 index 00000000000..610e4b96edd --- /dev/null +++ b/drivers/greybus/cpc/protocol.c @@ -0,0 +1,274 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2025, Silicon Laboratories, Inc. + */ + +#include +#include +#include + +#include "cpc.h" +#include "header.h" + +int cpc_protocol_send_syn(struct cpc_endpoint *ep) +{ + struct cpc_frame *frame; + struct cpc_header *hdr; + + frame =3D cpc_frame_alloc(NULL, GFP_KERNEL); + if (!frame) + return -ENOMEM; + + hdr =3D &frame->header; + memset(hdr, 0, sizeof(*hdr)); + + mutex_lock(&ep->lock); + + hdr->ctrl =3D cpc_header_get_ctrl(CPC_FRAME_TYPE_SYN, true); + hdr->ep_id =3D ep->id; + hdr->recv_wnd =3D CPC_HEADER_MAX_RX_WINDOW; + hdr->seq =3D ep->tcb.seq; + hdr->syn.mtu =3D cpu_to_le16(U16_MAX); + + cpc_hd_send_frame(ep->cpc_hd, frame); + + mutex_unlock(&ep->lock); + + return 0; +} + +static void __cpc_protocol_send_ack(struct cpc_endpoint *ep) +{ + struct cpc_frame *frame; + struct cpc_header *hdr; + + frame =3D cpc_frame_alloc(NULL, GFP_KERNEL); + if (!frame) + return; + + hdr =3D &frame->header; + + memset(hdr, 0, sizeof(*hdr)); + hdr->ctrl =3D cpc_header_get_ctrl(CPC_FRAME_TYPE_DATA, false); + hdr->ep_id =3D ep->id; + hdr->recv_wnd =3D CPC_HEADER_MAX_RX_WINDOW; + hdr->ack =3D ep->tcb.ack; + + cpc_hd_send_frame(ep->cpc_hd, frame); +} + +/** + * cpc_protocol_send_rst - send a RST frame + * @cpc_hd: host device pointer + * @ep_id: endpoint id + */ +void cpc_protocol_send_rst(struct cpc_host_device *cpc_hd, u8 ep_id) +{ + struct cpc_frame *frame; + struct cpc_header *hdr; + + frame =3D cpc_frame_alloc(NULL, GFP_KERNEL); + if (!frame) + return; + + hdr =3D &frame->header; + memset(hdr, 0, sizeof(*hdr)); + hdr->ctrl =3D cpc_header_get_ctrl(CPC_FRAME_TYPE_RST, false); + hdr->ep_id =3D ep_id; + + cpc_hd_send_frame(cpc_hd, frame); +} + +static int __cpc_protocol_queue_tx_frame(struct cpc_endpoint *ep, struct c= pc_frame *frame) +{ + frame->header.ack =3D ep->tcb.ack; + + list_add_tail(&frame->links, &ep->pending_ack_queue); + + cpc_hd_send_frame(ep->cpc_hd, frame); + + return 0; +} + +static void __cpc_protocol_process_pending_tx_frames(struct cpc_endpoint *= ep) +{ + struct cpc_frame *frame; + u8 window; + int err; + + window =3D ep->tcb.send_wnd; + + while ((frame =3D list_first_entry_or_null(&ep->holding_queue, + struct cpc_frame, + links))) { + if (!cpc_header_number_in_window(ep->tcb.send_una, + window, + cpc_header_get_seq(&frame->header))) + return; + + list_del(&frame->links); + + err =3D __cpc_protocol_queue_tx_frame(ep, frame); + if (err < 0) { + list_add(&frame->links, &ep->holding_queue); + return; + } + } +} + +static void __cpc_protocol_receive_ack(struct cpc_endpoint *ep, u8 recv_wn= d, u8 ack) +{ + struct cpc_frame *frame; + u8 acked_frames; + + ep->tcb.send_wnd =3D recv_wnd; + + frame =3D list_first_entry_or_null(&ep->pending_ack_queue, struct cpc_fra= me, links); + if (!frame) + goto out; + + /* Return if no frame to ACK. */ + if (!cpc_header_number_in_range(ep->tcb.send_una, ep->tcb.send_nxt, ack)) + goto out; + + /* Calculate how many frames will be ACK'd. */ + acked_frames =3D cpc_header_get_frames_acked_count(cpc_header_get_seq(&fr= ame->header), ack); + + for (u8 i =3D 0; i < acked_frames; i++) { + frame =3D list_first_entry_or_null(&ep->pending_ack_queue, struct cpc_fr= ame, links); + if (!frame) { + dev_err_ratelimited(&ep->cpc_hd->gb_hd->dev, "pending ack queue shorter= than expected"); + break; + } + + list_del(&frame->links); + cpc_frame_free(frame); + } + + ep->tcb.send_una +=3D acked_frames; + +out: + __cpc_protocol_process_pending_tx_frames(ep); +} + +static bool __cpc_protocol_is_syn_ack_valid(struct cpc_endpoint *ep, struc= t cpc_header *hdr) +{ + struct cpc_frame *syn_frame; + enum cpc_frame_type type; + u8 syn_seq; + u8 ack; + + /* Fetch the previously sent frame. */ + syn_frame =3D list_first_entry_or_null(&ep->pending_ack_queue, struct cpc= _frame, links); + if (!syn_frame) { + dev_warn(&ep->cpc_hd->gb_hd->dev, "cannot validate syn-ack, no frame was= sent\n"); + return false; + } + + cpc_header_get_type(&syn_frame->header, &type); + + /* Verify if this frame is SYN. */ + if (type !=3D CPC_FRAME_TYPE_SYN) { + dev_warn(&ep->cpc_hd->gb_hd->dev, + "cannot validate syn-ack, no syn frame was sent (%d)\n", type); + return false; + } + + syn_seq =3D cpc_header_get_seq(&syn_frame->header); + ack =3D cpc_header_get_ack(hdr); + + /* Validate received ACK with the SEQ used in the initial SYN. */ + if (!cpc_header_is_syn_ack_valid(syn_seq, ack)) { + dev_warn(&ep->cpc_hd->gb_hd->dev, + "syn-ack (%d) is not valid with previously sent syn-seq (%d)\n", + ack, syn_seq); + return false; + } + + return true; +} + +void cpc_protocol_on_data(struct cpc_endpoint *ep, struct cpc_header *hdr, + u8 *data, size_t length) +{ + bool expected_seq; + + mutex_lock(&ep->lock); + + __cpc_protocol_receive_ack(ep, + cpc_header_get_recv_wnd(hdr), + cpc_header_get_ack(hdr)); + + if (cpc_header_get_req_ack(hdr)) { + expected_seq =3D cpc_header_get_seq(hdr) =3D=3D ep->tcb.ack; + if (expected_seq) + ep->tcb.ack++; + + __cpc_protocol_send_ack(ep); + + if (!expected_seq) + dev_warn(&ep->cpc_hd->gb_hd->dev, + "unexpected seq: %u, expected seq: %u\n", + cpc_header_get_seq(hdr), ep->tcb.ack); + } + + mutex_unlock(&ep->lock); + + if (data) { + if (expected_seq) + greybus_data_rcvd(ep->cpc_hd->gb_hd, ep->id, data, length); + else + kfree(data); + } +} + +void cpc_protocol_on_syn(struct cpc_endpoint *ep, struct cpc_header *hdr) +{ + mutex_lock(&ep->lock); + + if (!__cpc_protocol_is_syn_ack_valid(ep, hdr)) { + cpc_protocol_send_rst(ep->cpc_hd, ep->id); + goto out; + } + + __cpc_protocol_receive_ack(ep, + cpc_header_get_recv_wnd(hdr), + cpc_header_get_ack(hdr)); + + /* On SYN-ACK, the remote's SEQ becomes our starting ACK. */ + ep->tcb.ack =3D cpc_header_get_seq(hdr); + ep->tcb.mtu =3D cpc_header_get_mtu(hdr); + ep->tcb.ack++; + + __cpc_protocol_send_ack(ep); + + complete(&ep->completion); + +out: + mutex_unlock(&ep->lock); +} + +void cpc_protocol_on_rst(struct cpc_endpoint *ep) +{ + // To be implemented when connection mechanism are restored +} + +/** + * __cpc_protocol_write() - Write a frame. + * @ep: Endpoint handle. + * @frame: Frame to write. + * + * Context: Expect endpoint's lock to be held. + * + * Return: 0 on success, otherwise a negative error code. + */ +int __cpc_protocol_write(struct cpc_endpoint *ep, struct cpc_frame *frame) +{ + list_add_tail(&frame->links, &ep->holding_queue); + + __cpc_protocol_process_pending_tx_frames(ep); + + ep->tcb.seq++; + + return 0; +} --=20 2.49.0 From nobody Tue Oct 7 21:28:47 2025 Received: from mx0a-0024c301.pphosted.com (mx0a-0024c301.pphosted.com [148.163.149.154]) (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 8B0D278C9C for ; Sat, 5 Jul 2025 00:59:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.149.154 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751677200; cv=fail; b=hfwnlSX4MAC8RTRo4BZmmNpONRdkxGO74dTRv1wDOr6a9xXRmwKLpcaSqNSDe5ThlCMMgkjRfDKLiyjl3wj5Td8Y/uU9st6BadY9NDVuJhhIGMERNc2zO/tdqtCG4RyH+M0Ityyz29XDnxOeIfrFrZLHdCsqtJ6oEmRLC+tOb44= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751677200; c=relaxed/simple; bh=0CkmpszOBMds6kdrUUkDHM4Lzl6W2gdrfI30DM/Om4o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=njvwZrFDmlciVRXBpEJt8jTIHnzRc2ocCUHecxZfiSQ0N522aV4h1prkO0FC0FK//kxAvzKdhD9PXn8tbyi6MbRCay1+Dh0vQagFEEQvNl0M3/xSWj+VbIq3gQIpK+OAN7VSte80Z85h6voneRuSDuStanLD7eVbefWAXIoAkng= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=silabs.com; spf=pass smtp.mailfrom=silabs.com; dkim=pass (2048-bit key) header.d=silabs.com header.i=@silabs.com header.b=Q1e9F6FK; dkim=pass (1024-bit key) header.d=silabs.com header.i=@silabs.com header.b=ZYAsY7MA; arc=fail smtp.client-ip=148.163.149.154 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=silabs.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=silabs.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=silabs.com header.i=@silabs.com header.b="Q1e9F6FK"; dkim=pass (1024-bit key) header.d=silabs.com header.i=@silabs.com header.b="ZYAsY7MA" Received: from pps.filterd (m0101743.ppops.net [127.0.0.1]) by mx0a-0024c301.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 564No2mG017370; Fri, 4 Jul 2025 19:40:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pps12202023; bh=DPVDcnaYDPf1dnPAmX8COJCxinBXAlcp5ymcU+3yntw=; b=Q1e9F6FKMWVk YIqeYGJHXf5URk5r8vixAJ97V2bR1AJOq1L5w3etx0ZRJOwNk+CsxMpkfcpbnzty pUOu65Ac7gu9agvNhV2Nz3o+jnfinJrhIHTFpXLvCLACgsQN+/9+lGZ/2YX3cIO6 MDzZkkXr3vzzXMBP4qqhKc6kwpFxHDzNsRkrV25bHT9sEnL+P1L0ySrBoBqV+0Bi /fPTQlqIbIeOqRS4pAcLfZfsM77uYLlqfKtKRqDKnWZ+IsAJV0XX3ar9dU7TfPcc AUcr6mpQNHEp9St9z6IjJHTRwwJ6vAUC0NkbfAJ356JmjD5NcEKnB5GVFq9Lfp7B 5UcmePjRlg== Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12on2109.outbound.protection.outlook.com [40.107.244.109]) by mx0a-0024c301.pphosted.com (PPS) with ESMTPS id 47p8pvhb7y-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Jul 2025 19:40:55 -0500 (CDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Elg+Yh7m5gFHJBV/IbYcaN+/Ldq7996mYgVh7MyT+4Zn1VbT30pJ/4VnYUdC+QPC1zIVwyQCaarIkz6uRywclbw+G/brKteitwOs14RapTMRppujZwrEM1ZkFkVwEz2NGoRMQSk/CXcBJfr5RBP/5TdIzN/cGxtbHq1FKU24ZVTQyTITYsNzAoHX074DklWg08JoqUvGgNPpFcjeHHJfd5nJoJpNTK+5vKro8FVCTqcya4fHrIuV0rYiFTCYplYhokCZiz7soJxow8+Zz8PbbiWZ4yRj8D/SXc8eq9/MlOgAOTXZDHSpVQBWG6MkkmsfBzPCaUadQTVphHoJ5IR3+A== 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=DPVDcnaYDPf1dnPAmX8COJCxinBXAlcp5ymcU+3yntw=; b=gXbZAK5MzLsYbOIjflEYlQh6DO8PyD7ETf5AfeVrgfeOsr5Jnx0XXkXm+A3mFCCsNMCkndWgar1P809jlt7NMIoqiAJ211Ce+CB9Uevg9reTmUhBY7danK1PsM1XPvEUFcgjgeSiBN66h0ZrDvSFipmHBh9hM/W9KNc1EEtfGHCE/SACJhs/dFC+u7DO5XHnGG5gd2jrR3whkZAP2wl7oKfosDxQwhHaP8HoQB4IWpfw/u53IK9TM8eCoDk12KtIpTvCjvhNuHVB2gHLMz1MNqn5gXm5HN4BO9tyhYMZVMkjFgRV4HzIRUCzrKHgDh5gdhAUpFlg5qng0KUQifxVlA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DPVDcnaYDPf1dnPAmX8COJCxinBXAlcp5ymcU+3yntw=; b=ZYAsY7MAw2n6pGp19uhl64GBVzjpU7FbrO9kSy5Q6hII8CK40qyx0nn6bYwsg653jUlIm7OUMe5oqQsV2zE7kXxfwWOqPaccp1faHTiiJYm8nT1PaAWYNe7N8ifYMGFff9cflV75tZNdr4la8CradQrLKRucehZrinKZOMEerto= Received: from DS0PR11MB8205.namprd11.prod.outlook.com (2603:10b6:8:162::17) by SA2PR11MB5068.namprd11.prod.outlook.com (2603:10b6:806:116::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.23; Sat, 5 Jul 2025 00:40:52 +0000 Received: from DS0PR11MB8205.namprd11.prod.outlook.com ([fe80::c508:9b04:3351:524a]) by DS0PR11MB8205.namprd11.prod.outlook.com ([fe80::c508:9b04:3351:524a%4]) with mapi id 15.20.8880.034; Sat, 5 Jul 2025 00:40:52 +0000 From: =?UTF-8?q?Damien=20Ri=C3=A9gel?= To: greybus-dev@lists.linaro.org Cc: linux-kernel@vger.kernel.org, linux-devel@silabs.com, Greg Kroah-Hartman , Alex Elder , Johan Hovold , =?UTF-8?q?Damien=20Ri=C3=A9gel?= Subject: [RFC 3/6] greybus: cpc: add SPI driver Date: Fri, 4 Jul 2025 20:40:33 -0400 Message-ID: <20250705004036.3828-4-damien.riegel@silabs.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250705004036.3828-1-damien.riegel@silabs.com> References: <20250705004036.3828-1-damien.riegel@silabs.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: YQZPR01CA0029.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:86::26) To DS0PR11MB8205.namprd11.prod.outlook.com (2603:10b6:8:162::17) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB8205:EE_|SA2PR11MB5068:EE_ X-MS-Office365-Filtering-Correlation-Id: 612c39c3-839b-40ec-6d8f-08ddbb5c9839 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?QjE5SmhybTlvUVNQZm9DUFdrSExnNjZsR2RNTjdJOCtQZVc5a25mUU1zU0VT?= =?utf-8?B?Z3FCUzZOOXJqY2lITkcxMFhtWXBvaE1RY3RiVTgxOXZiNytsZ1Y0UVgwNWVo?= =?utf-8?B?YVhkdjl3QklxOEtkRmI2VWwxeFBReGVHS1FvSFRsTmgvaTFlVHhGRW9NYzhG?= =?utf-8?B?cHAyZFVJeE9vN0V4Y0d2alVYOFRIM3I5VDVIYjdvQWlRWk94OGZZL1h4bGVE?= =?utf-8?B?WjJtSmR2OHRXQlRTak1kSDJFUGN0eXJzVmFuZVZxS0FLbFVmQWNqK2MvZCtF?= =?utf-8?B?dlUwWWk2YkNvWUZ5TmtJL3FjbzZLVzlsMlBPNXRscnYxTlNzc0JYekZjdUVk?= =?utf-8?B?RDB1cHQxRGRxeG1TNW1iYXFmRU13MUo0cnM5b1pIcFZSUVUwTG11WUlHeFRM?= =?utf-8?B?U1oy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VmI1?= =?utf-8?B?WjFTc01US0xFdHdzamZlaHFmK1JWYW1NNzJLS2V1bEEvemx4K1cySXlkRXI4?= =?utf-8?B?OHMvYkE5WWxyaUxueUdUUlplclFONk4wVHlUWEdOSEozTDdxRngzbWtkZVRj?= =?utf-8?B?cEExTU5iL1ZRcjZ6SjZvYVZHekVTQ3BvQzNlZ0ZPeHl6UUx6Q3gvN1JFTXgy?= =?utf-8?B?RnFVYmpqMGZxc0d1dVZ5TXpudlZ2VHlPREM1VEZ1YXVXWExwWHpjYTFtZWRr?= =?utf-8?B?VDRyMEt0c0ZCSkhPRFJ0YWF5Um1vakVXNklIb3ZtQlNaTGZ0cE5wMG0zRDZh?= =?utf-8?B?Z1YrTkYyNVlBN2c5R2VGK1ZiQkNib3Jsd21hV1hUQ0FvbDJUNWtVOXdwYldW?= =?utf-8?B?eUxRS2tuOWI5aCtmaDRtU0VOcnVnZVNzY1oyc09oNUtzV1BzWGNsUmNROVIr?= =?utf-8?B?bVArVi9QaE4yc2c1WEVCNUUzZDEva256SFd0SnRBMWtDS25MYVN3WHl2YjNw?= =?utf-8?B?eEM1a3cweE1SM1ZWQVVTZVJEYWVaQ3cxbWFEcGpaQ2lQQjk0cWpTVmpmdkRX?= =?utf-8?B?Q3NhQ3cwN2F3TlB3cXZ6WWc4TlNjUjZTdG1JZWxMQTNmN2t4b2VaQ2d0ek1I?= =?utf-8?B?QUJPbGdvTGdwNXM1dmpZek9GSzlSL3poWmdaZFlYbHhzL3UzOUhlVVVCT24w?= =?utf-8?B?WEdGdGo5dHFBPT0=?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR11MB8205.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(376014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8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vMXBBcG9JOGQvZEJGeFJYN0N4WkJHcnlQMTliaFNHTHRzeWtvTFJv?= =?utf-8?B?dmZSY2hMeTlCcWRVcGJBN2lqUU9WcGdHRXo5emtsODR6T1JPQTRRVktxVzFs?= =?utf-8?B?V3JFa0lqMVlZMjlRQ1pxQW93NTJoTkdnY3hOYVV6Mk41b0NGQW5vTUVwU09r?= =?utf-8?B?ZFFDWWdrVzhwRXBNS3BrVVhHQzd5T1ZTY2ZoNzk4UHF1L2EveklvWm0xbTk3?= =?utf-8?B?TzEvZG5lcUJuY3BQTGlweUM3Y29IS3FvdTdRN2w0WGVtdzY4NVArRm9IYXZP?= =?utf-8?B?dWh3MGxiY3d5OEVtUldzVk5UQnN1SlhORERpaXpVOS82MnJZWUdDalBoU3Vt?= =?utf-8?Q?7EJh7DIirzzZX7JHTfwYAiNU6?= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 612c39c3-839b-40ec-6d8f-08ddbb5c9839 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB8205.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2025 00:40:52.3781 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bP2FzxCdamjKDUGoWZTZsMBvzx7XlMQnN6QjpFv9GaZKQqMh8j31vYbu90DP5tJ4KZ1cqxefsU6gGIg8GYfTng== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR11MB5068 X-Authority-Analysis: v=2.4 cv=L4EdQ/T8 c=1 sm=1 tr=0 ts=68687497 cx=c_pps a=U259+el5m5zn0mdk/7qTUw==:117 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=Wb1JkmetP80A:10 a=M51BFTxLslgA:10 a=i1IsUcr2s-wA:10 a=2AEO0YjSAAAA:8 a=qtlJ5sXZiQzIo2tJRN0A:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 X-Proofpoint-GUID: 9SCFJ6vtS2b6x7-vbN4jlJ-qnUXO_GeI X-Proofpoint-ORIG-GUID: 9SCFJ6vtS2b6x7-vbN4jlJ-qnUXO_GeI X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzA1MDAwMSBTYWx0ZWRfX7xoVnHUCYcB7 eloO8bbQvyWfYufKy0mCyf0SJ8/SdczyRz6e/s9bIy6WGOFiyJrX8M3YPj0CEbJL/3faiDGJ4PU S+Y7GcSqYXldrirCwl3Cf2Mc95dqTymyjS2j6qFPjtU6t2dEiO9Cl57KtQzPkoxR2UHpfmpk/Mw F+JrobCP0MOJktpy54kf38l/qwkVO841cfzrsa61rIYj9MrgoePQeBQoR+u4vJEX91/PsZH8zSF vwBVYHqaRm+fq6ACOrkR/uP51VAvQHuIYR2oQFhVZj2hx7LV2Ys5MMIHYCzYxwPY9MYiW3qq/A9 d4pxSfI7X04bBzYCkxO7brk3acVSyhj3MdajQkuYHUQmuxjbaSihrSEUYJXUaVHoOVZjio8nh7X 1gdkT4ad8qAiOk6FTpIwBbvatYQsImErMSSTL1fetpsNfU8GUL61J+AoyDkYvdWJBBfR+WQH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-07-04_07,2025-07-04_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxlogscore=999 priorityscore=1501 adultscore=0 malwarescore=0 impostorscore=0 bulkscore=0 mlxscore=0 clxscore=1015 suspectscore=0 spamscore=0 phishscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.21.0-2505280000 definitions=main-2507050001 Header frames are always 10 bytes (8 bytes of header and 2 bytes of checksum). The header contains the size of the payload to receive (size to transmit is already known). As the SPI device also has some processing to do when it receives a header, the SPI driver must wait for the interrupt line to be asserted before clocking the payload. The SPI device always expects the chip select to be asserted and deasserted after a header, even if there are no payloads to transmit. This is used to keep headers transmission synchronized between host and device. As some controllers don't support doing that if there is nothing to transmit, a null byte is transmitted in that case and it will be ignored by the device. If there are payloads, the driver will clock the maximum length of the two payloads. The payloads are always Greybus messages, so they should be at least 8 bytes (Greybus header), plus a variable greybus payload. Signed-off-by: Damien Ri=C3=A9gel --- drivers/greybus/cpc/Makefile | 2 +- drivers/greybus/cpc/spi.c | 585 +++++++++++++++++++++++++++++++++++ 2 files changed, 586 insertions(+), 1 deletion(-) create mode 100644 drivers/greybus/cpc/spi.c diff --git a/drivers/greybus/cpc/Makefile b/drivers/greybus/cpc/Makefile index 08ef7c6d24b..4ee37ea5f52 100644 --- a/drivers/greybus/cpc/Makefile +++ b/drivers/greybus/cpc/Makefile @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 =20 -gb-cpc-y :=3D endpoint.o header.o host.o main.o protocol.o +gb-cpc-y :=3D endpoint.o header.o host.o main.o protocol.o spi.o =20 # CPC core obj-$(CONFIG_GREYBUS_CPC) +=3D gb-cpc.o diff --git a/drivers/greybus/cpc/spi.c b/drivers/greybus/cpc/spi.c new file mode 100644 index 00000000000..b8f3877bde1 --- /dev/null +++ b/drivers/greybus/cpc/spi.c @@ -0,0 +1,585 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2025, Silicon Laboratories, Inc. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "cpc.h" +#include "header.h" + +#define CPC_SPI_CSUM_SIZE 2 +#define GB_CPC_SPI_MSG_SIZE_MAX 2048 +#define CPC_SPI_INTERRUPT_MAX_WAIT_MS 500 + +struct cpc_spi { + struct cpc_host_device cpc_hd; + + struct spi_device *spi; + + struct task_struct *task; + wait_queue_head_t event_queue; + + struct cpc_frame *tx_frame; + u8 tx_csum[CPC_SPI_CSUM_SIZE]; + + atomic_t event_cond; + + unsigned int rx_len; + struct cpc_header rx_header; + u8 rx_frame[GB_CPC_SPI_MSG_SIZE_MAX + CPC_SPI_CSUM_SIZE]; + u8 rx_csum[CPC_SPI_CSUM_SIZE]; +}; + +struct cpc_xfer { + u8 *data; + unsigned int total_len; + unsigned int remaining_len; +}; + +static inline struct cpc_spi *gb_hd_to_cpc_spi(struct gb_host_device *hd) +{ + return (struct cpc_spi *)&hd->hd_priv; +} + +static inline struct cpc_spi *cpc_hd_to_cpc_spi(struct cpc_host_device *cp= c_hd) +{ + return container_of(cpc_hd, struct cpc_spi, cpc_hd); +} + +static int gb_cpc_spi_wake_tx(struct cpc_host_device *cpc_hd) +{ + struct cpc_spi *ctx =3D cpc_hd_to_cpc_spi(cpc_hd); + + wake_up_interruptible(&ctx->event_queue); + + return 0; +} + +static bool buffer_is_zeroes(const u8 *buffer, size_t length) +{ + for (size_t i =3D 0; i < length; i++) { + if (buffer[i] !=3D 0) + return false; + } + + return true; +} + +static u16 gb_cpc_spi_csum(u16 start, const u8 *buffer, size_t length) +{ + return crc_itu_t(start, buffer, length); +} + +static int gb_cpc_spi_do_xfer_header(struct cpc_spi *ctx) +{ + struct spi_transfer xfer_header =3D { + .rx_buf =3D (u8 *)&ctx->rx_header, + .len =3D CPC_HEADER_SIZE, + .speed_hz =3D ctx->spi->max_speed_hz, + }; + struct spi_transfer xfer_csum =3D { + .rx_buf =3D &ctx->rx_csum, + .len =3D sizeof(ctx->tx_csum), + .speed_hz =3D ctx->spi->max_speed_hz, + }; + enum cpc_frame_type type; + struct spi_message msg; + size_t payload_len =3D 0; + u16 rx_csum; + u16 csum; + int ret; + + if (ctx->tx_frame) { + u16 tx_hdr_csum =3D gb_cpc_spi_csum(0, (u8 *)&ctx->tx_frame->header, CPC= _HEADER_SIZE); + + put_unaligned_le16(tx_hdr_csum, ctx->tx_csum); + + xfer_header.tx_buf =3D &ctx->tx_frame->header; + xfer_csum.tx_buf =3D ctx->tx_csum; + } + + spi_message_init(&msg); + spi_message_add_tail(&xfer_header, &msg); + spi_message_add_tail(&xfer_csum, &msg); + + ret =3D spi_sync(ctx->spi, &msg); + if (ret) + return ret; + + if (ctx->tx_frame) { + if (!ctx->tx_frame->message) { + cpc_frame_sent(ctx->tx_frame, ret); + ctx->tx_frame =3D NULL; + } + } + + if (buffer_is_zeroes((u8 *)&ctx->rx_header, CPC_HEADER_SIZE)) + return 0; + + rx_csum =3D get_unaligned_le16(&ctx->rx_csum); + csum =3D gb_cpc_spi_csum(0, (u8 *)&ctx->rx_header, CPC_HEADER_SIZE); + + if (rx_csum !=3D csum || !cpc_header_get_type(&ctx->rx_header, &type)) { + /* + * If the header checksum is invalid, its length can't be trusted, recei= ve + * the maximum payload length to recover from that situation. If the fra= me + * type cannot be extracted from the header, use same recovery mechanism. + */ + ctx->rx_len =3D GB_CPC_SPI_MSG_SIZE_MAX; + + return 0; + } + + if (type =3D=3D CPC_FRAME_TYPE_DATA) + payload_len =3D cpc_header_get_payload_len(&ctx->rx_header) + + sizeof(ctx->tx_csum); + + if (payload_len) + ctx->rx_len =3D payload_len; + else + cpc_hd_rcvd(&ctx->cpc_hd, &ctx->rx_header, NULL, 0); + + return 0; +} + +static int gb_cpc_spi_do_xfer_notch(struct cpc_spi *ctx) +{ + struct spi_transfer xfer =3D { + .tx_buf =3D ctx->tx_csum, + .len =3D 1, + .speed_hz =3D ctx->spi->max_speed_hz, + }; + struct spi_message msg; + + ctx->tx_csum[0] =3D 0; + + spi_message_init(&msg); + spi_message_add_tail(&xfer, &msg); + + return spi_sync(ctx->spi, &msg); +} + +static unsigned int fill_xfer(struct spi_transfer *xfer, + u8 **tx, unsigned int *tx_len, + u8 **rx, unsigned int *rx_len) +{ + unsigned int xfer_len =3D 0; + + if (*tx_len && *rx_len) + xfer_len =3D (*tx_len < *rx_len) ? *tx_len : *rx_len; + else if (*tx_len) + xfer_len =3D *tx_len; + else if (*rx_len) + xfer_len =3D *rx_len; + else + return 0; + + xfer->tx_buf =3D *tx; + xfer->rx_buf =3D *rx; + xfer->len =3D xfer_len; + + if (*tx) { + *tx +=3D xfer_len; + *tx_len -=3D xfer_len; + } + + if (*rx) { + *rx +=3D xfer_len; + *rx_len -=3D xfer_len; + } + + return xfer_len; +} + +static int gb_cpc_spi_do_xfer_payload(struct cpc_spi *ctx) +{ + unsigned int rx_len =3D ctx->rx_len ? ctx->rx_len + CPC_SPI_CSUM_SIZE : 0; + struct spi_transfer xfers[4]; + struct spi_message msg; + int ret; + + unsigned int tx_lens[3] =3D { 0 }; + u8 *tx_ptrs[3] =3D { NULL }; + + spi_message_init(&msg); + + if (ctx->tx_frame && ctx->tx_frame->message) { + struct gb_message *m =3D ctx->tx_frame->message; + unsigned int idx =3D 0; + u16 csum =3D 0; + + tx_ptrs[idx] =3D (u8 *)m->header; + tx_lens[idx++] =3D sizeof(struct gb_operation_msg_hdr); + csum =3D gb_cpc_spi_csum(csum, (u8 *)m->header, sizeof(struct gb_operati= on_msg_hdr)); + + if (m->payload_size) { + tx_ptrs[idx] =3D m->payload; + tx_lens[idx++] =3D m->payload_size; + csum =3D gb_cpc_spi_csum(csum, m->payload, m->payload_size); + } + + put_unaligned_le16(csum, ctx->tx_csum); + + tx_ptrs[idx] =3D ctx->tx_csum; + tx_lens[idx++] =3D CPC_SPI_CSUM_SIZE; + } + + unsigned int tx_idx =3D 0; + unsigned int tx_len =3D tx_lens[tx_idx]; + u8 *tx_ptr =3D tx_ptrs[tx_idx]; + u8 *rx_ptr =3D rx_len ? ctx->rx_frame : NULL; + + /* + * This loop goes over a list of TX elements to send. There can be 0, 2 o= r 3 (nothing, + * greybus header + csum, and optionally greybus payload). + * RX, if present, consists of only one element. + * [ tx_ptr1; tx_len1 ] --> [ tx_ptr2; tx_len2 ] --> [ tx_ptr3; tx_len3 ] + * [ rx_ptr1; rx_len1 ] + * + * The RX buffer can span over several TX buffers, the loop takes care of= chunking into + * spi_transfer. + * + */ + for (unsigned int i =3D 0; i < ARRAY_SIZE(xfers); i++) { + struct spi_transfer *xfer =3D &xfers[i]; + + fill_xfer(xfer, &tx_ptr, &tx_len, &rx_ptr, &rx_len); + + spi_message_add_tail(xfer, &msg); + + /* + * If the rx pointer is not NULL, but the rx length is 0, it means that = the rx + * buffer was fully transferred in this iteration. + */ + if (rx_ptr && !rx_len) { + rx_ptr =3D NULL; + + /* + * And if tx_ptr is NULL, it means there was no TX data to send, so the + * transfer is done. + */ + if (!tx_ptr) + break; + } + + /* + * If tx_len is zero, it means we can go the next TX element to transfer. + */ + if (!tx_len) { + tx_idx++; + if (tx_idx < ARRAY_SIZE(tx_ptrs)) { + tx_len =3D tx_lens[tx_idx]; + tx_ptr =3D tx_ptrs[tx_idx]; + } else { + tx_len =3D 0; + tx_ptr =3D NULL; + } + + /* + * If there's nothing else to transfer and the rx_len was also NULL, + * that means the transfer is fully prepared. + */ + if (!tx_len && !rx_len) + break; + } + } + + ret =3D spi_sync(ctx->spi, &msg); + if (ret) + goto exit; + + if (ctx->rx_len) { + unsigned char *csum_ptr; + u16 expected_csum; + u16 csum; + + if (ret) + goto exit; + + csum_ptr =3D ctx->rx_frame + ctx->rx_len; + csum =3D get_unaligned_le16(csum_ptr); + + expected_csum =3D gb_cpc_spi_csum(0, ctx->rx_frame, ctx->rx_len); + + if (csum =3D=3D expected_csum) + cpc_hd_rcvd(&ctx->cpc_hd, &ctx->rx_header, ctx->rx_frame, ctx->rx_len); + } + +exit: + ctx->rx_len =3D 0; + + return ret; +} + +static int gb_cpc_spi_do_xfer_thread(void *data) +{ + struct cpc_spi *ctx =3D data; + bool xfer_idle =3D true; + int ret; + + while (!kthread_should_stop()) { + if (xfer_idle) { + ret =3D wait_event_interruptible(ctx->event_queue, + (!cpc_hd_tx_queue_empty(&ctx->cpc_hd) || + atomic_read(&ctx->event_cond) =3D=3D 1 || + kthread_should_stop())); + + if (ret) + continue; + + if (kthread_should_stop()) + return 0; + + if (!ctx->tx_frame) + ctx->tx_frame =3D cpc_hd_dequeue(&ctx->cpc_hd); + + /* + * Reset thread event right before transmission to prevent interrupts t= hat + * happened while the thread was already awake to wake up the thread ag= ain, + * as the event is going to be handled by this iteration. + */ + atomic_set(&ctx->event_cond, 0); + + ret =3D gb_cpc_spi_do_xfer_header(ctx); + if (!ret) + xfer_idle =3D false; + } else { + ret =3D wait_event_timeout(ctx->event_queue, + (atomic_read(&ctx->event_cond) =3D=3D 1 || + kthread_should_stop()), + msecs_to_jiffies(CPC_SPI_INTERRUPT_MAX_WAIT_MS)); + if (ret =3D=3D 0) { + dev_err_once(&ctx->spi->dev, "device didn't assert interrupt in a time= ly manner\n"); + continue; + } + + atomic_set(&ctx->event_cond, 0); + + if (!ctx->tx_frame && !ctx->rx_len) + ret =3D gb_cpc_spi_do_xfer_notch(ctx); + else + ret =3D gb_cpc_spi_do_xfer_payload(ctx); + + if (!ret) + xfer_idle =3D true; + } + } + + return 0; +} + +static irqreturn_t gb_cpc_spi_irq_handler(int irq, void *data) +{ + struct cpc_spi *ctx =3D data; + + atomic_set(&ctx->event_cond, 1); + wake_up(&ctx->event_queue); + + return IRQ_HANDLED; +} + +static int gb_cpc_spi_cport_allocate(struct gb_host_device *hd, int cport_= id, unsigned long flags) +{ + struct cpc_spi *ctx =3D gb_hd_to_cpc_spi(hd); + struct cpc_endpoint *ep; + + for (int i =3D 0; i < ARRAY_SIZE(ctx->cpc_hd.endpoints); i++) { + if (ctx->cpc_hd.endpoints[i] !=3D NULL) + continue; + + if (cport_id < 0) + cport_id =3D i; + + ep =3D cpc_endpoint_alloc(cport_id, GFP_KERNEL); + if (!ep) + return -ENOMEM; + + ep->cpc_hd =3D &ctx->cpc_hd; + + ctx->cpc_hd.endpoints[i] =3D ep; + return cport_id; + } + + return -ENOSPC; +} + +static void gb_cpc_spi_cport_release(struct gb_host_device *hd, u16 cport_= id) +{ + struct cpc_spi *ctx =3D gb_hd_to_cpc_spi(hd); + struct cpc_endpoint *ep; + + for (int i =3D 0; i < ARRAY_SIZE(ctx->cpc_hd.endpoints); i++) { + ep =3D ctx->cpc_hd.endpoints[i]; + if (ep && ep->id =3D=3D cport_id) { + cpc_endpoint_release(ep); + ctx->cpc_hd.endpoints[i] =3D NULL; + break; + } + } +} + +static int gb_cpc_spi_cport_enable(struct gb_host_device *hd, u16 cport_id, + unsigned long flags) +{ + struct cpc_spi *ctx =3D gb_hd_to_cpc_spi(hd); + struct cpc_endpoint *ep; + + ep =3D cpc_hd_get_endpoint(&ctx->cpc_hd, cport_id); + if (!ep) + return -ENODEV; + + return cpc_endpoint_connect(ep); +} + +static int gb_cpc_spi_cport_disable(struct gb_host_device *hd, u16 cport_i= d) +{ + struct cpc_spi *ctx =3D gb_hd_to_cpc_spi(hd); + struct cpc_endpoint *ep; + + ep =3D cpc_hd_get_endpoint(&ctx->cpc_hd, cport_id); + if (!ep) + return -ENODEV; + + return cpc_endpoint_disconnect(ep); +} + +static int gb_cpc_spi_message_send(struct gb_host_device *hd, u16 cport_id, + struct gb_message *message, gfp_t gfp_mask) +{ + struct cpc_spi *ctx =3D gb_hd_to_cpc_spi(hd); + struct cpc_endpoint *ep; + struct cpc_frame *frame; + + frame =3D cpc_frame_alloc(message, gfp_mask); + if (!frame) + return -ENOMEM; + + ep =3D cpc_hd_get_endpoint(&ctx->cpc_hd, cport_id); + if (!ep) { + cpc_frame_free(frame); + return -ENODEV; + } + + message->hcpriv =3D frame; + + return cpc_endpoint_frame_send(ep, frame); +} + +static void gb_cpc_spi_message_cancel(struct gb_message *message) +{ + struct cpc_frame *frame =3D message->hcpriv; + + frame->cancelled =3D true; +} + +static struct gb_hd_driver gb_cpc_driver =3D { + .hd_priv_size =3D sizeof(struct cpc_spi), + .message_send =3D gb_cpc_spi_message_send, + .message_cancel =3D gb_cpc_spi_message_cancel, + .cport_allocate =3D gb_cpc_spi_cport_allocate, + .cport_release =3D gb_cpc_spi_cport_release, + .cport_enable =3D gb_cpc_spi_cport_enable, + .cport_disable =3D gb_cpc_spi_cport_disable, +}; + + +static int cpc_spi_probe(struct spi_device *spi) +{ + struct gb_host_device *hd; + struct cpc_spi *ctx; + int ret; + + if (!spi->irq) { + dev_err(&spi->dev, "cannot function without IRQ, please provide one\n"); + return -EINVAL; + } + + hd =3D gb_hd_create(&gb_cpc_driver, &spi->dev, + GB_CPC_SPI_MSG_SIZE_MAX, GB_CPC_SPI_NUM_CPORTS); + if (IS_ERR(hd)) + return PTR_ERR(hd); + + ctx =3D gb_hd_to_cpc_spi(hd); + ctx->cpc_hd.gb_hd =3D hd; + ctx->cpc_hd.wake_tx =3D gb_cpc_spi_wake_tx; + + spi_set_drvdata(spi, ctx); + + ret =3D gb_hd_add(hd); + if (ret) + goto err_hd_del; + + ret =3D request_irq(spi->irq, gb_cpc_spi_irq_handler, IRQF_TRIGGER_FALLIN= G, + dev_name(&spi->dev), ctx); + if (ret) + goto err_hd_remove; + + ctx->task =3D kthread_run(gb_cpc_spi_do_xfer_thread, ctx, "%s", + dev_name(&spi->dev)); + if (IS_ERR(ctx->task)) { + ret =3D PTR_ERR(ctx->task); + goto free_irq; + } + + return 0; + +free_irq: + free_irq(spi->irq, ctx); +err_hd_remove: + gb_hd_del(hd); +err_hd_del: + gb_hd_put(hd); + + return ret; +} + +static void cpc_spi_remove(struct spi_device *spi) +{ + struct cpc_spi *ctx =3D spi_get_drvdata(spi); + + kthread_stop(ctx->task); + free_irq(spi->irq, ctx); + gb_hd_del(ctx->cpc_hd.gb_hd); + gb_hd_put(ctx->cpc_hd.gb_hd); +} + +static const struct of_device_id cpc_dt_ids[] =3D { + { .compatible =3D "silabs,cpc-spi" }, + {}, +}; +MODULE_DEVICE_TABLE(of, cpc_dt_ids); + +static const struct spi_device_id cpc_spi_ids[] =3D { + { .name =3D "cpc-spi" }, + {}, +}; +MODULE_DEVICE_TABLE(spi, cpc_spi_ids); + +static struct spi_driver gb_cpc_spi_driver =3D { + .driver =3D { + .name =3D "cpc-spi", + .of_match_table =3D cpc_dt_ids, + }, + .probe =3D cpc_spi_probe, + .remove =3D cpc_spi_remove, +}; + +module_spi_driver(gb_cpc_spi_driver); + +MODULE_DESCRIPTION("Greybus Host Driver for Silicon Labs devices using SPI= "); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Damien Ri=C3=A9gel "); --=20 2.49.0 From nobody Tue Oct 7 21:28:47 2025 Received: from mx0a-0024c301.pphosted.com (mx0a-0024c301.pphosted.com [148.163.149.154]) (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 8B08C74BE1 for ; Sat, 5 Jul 2025 00:59:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.149.154 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751677200; cv=fail; b=FO9D6Fcz9fVEkuKTJ0wERVCfJupyC//yHzLCK0QKbe7y7xw7r1AWFQc2Rf0NTIXSF5rrbH+buErRRAddk069f2l9EvWjNwbWocBkow+V03aX7x/MWL1CWFR4AlS7rF93w3y13FmuD5O0eIGeIufDkITR5Fbl0pyJNOC5uonnVbw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751677200; c=relaxed/simple; bh=hPBnEKYCwZqXBzfpU/7ZWEJA1cup7KdhElESxor1Zpc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=fA8Xh77A8jgxtjBhK+yJ/RLDbni3SBmpNeqUiSxbx/WFt28FyBGp/srIoQlaXXMTWyb6zAalLvmCYOJoUW23AK1d3CtXqHMvOWzJD0rjJK62GmrbajKDgW13yMuRC2zuqpcSaWNh0Lo4bsi5KM2mFlULBoz48TV6ia/7zeMAwFU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=silabs.com; spf=pass smtp.mailfrom=silabs.com; dkim=pass (2048-bit key) header.d=silabs.com header.i=@silabs.com header.b=n0eNiGMq; dkim=pass (1024-bit key) header.d=silabs.com header.i=@silabs.com header.b=NfRlRfv4; arc=fail smtp.client-ip=148.163.149.154 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=silabs.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=silabs.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=silabs.com header.i=@silabs.com header.b="n0eNiGMq"; dkim=pass (1024-bit key) header.d=silabs.com header.i=@silabs.com header.b="NfRlRfv4" Received: from pps.filterd (m0101743.ppops.net [127.0.0.1]) by mx0a-0024c301.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 564No2mH017370; Fri, 4 Jul 2025 19:40:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pps12202023; bh=F4gKMnoonnzTBR9A1rN+QuOw6RPsoaVLkuTIs0CJlwQ=; b=n0eNiGMqy0/j jRVlHtgvfDfyqSI6KoHZjAi03NoOHcAYv8grKwmmBoNiRcP5Rb7AhDpiCc/Wz8/j 0WdsLIk09ZrVYjYQfDhx5SoranK0cQLXJKkmK4X6Unl7ukDLN/GGDcdwHOpbWBWl PQlugzxAZWqcRY+2/PaihwSmk4FpCS/RRVyhzyhFyagRVMq1h5m9XHKxenSswFyI ZihGeglmiI/uZcw/JbV99HCVR8ScFL0hv354CMfyiwF1tv+/SMzNy5PEuyNF3puJ h9goEh2yuLRtwt9WvcG08JrQ03onVtUzHMLodW/9VRE+WS4pUUOy+jMaj4ngPL07 cCbj7id9Kw== Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12on2109.outbound.protection.outlook.com [40.107.244.109]) by mx0a-0024c301.pphosted.com (PPS) with ESMTPS id 47p8pvhb7y-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Jul 2025 19:40:55 -0500 (CDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SI/PwOIZxsbg8OL8212rWup8pxCCOoHCs7jIp5cOG1kM0xmMHQlSXfNV41sGOl3dJGNlQaFpcB/UkGuVU3zlL2K+e5VjDF3+FhpF9MLq3z6nnQBz0Jh0auVF94qHeXqpc/xjQsZL6yT3Cjf1l3qIyiRGJtyJVRD1333Yc6/nxaeRLf0EB8PpUOUe+1bJEoXsOne0cvvpsTicwVujppZAluvaRQU4Xtl7OqXHaM7zpEihVZH+8iCmDHGnQM0MpTiZMDoEH25b+zcsUVZwh1qV1I0/hRvLkDwuI7Q+5gRejOZscbjr9eN2xsI/eZwoCnjAE1yvF+FpZz4j+UsjZx08zg== 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=F4gKMnoonnzTBR9A1rN+QuOw6RPsoaVLkuTIs0CJlwQ=; b=yJgQizAPEf81fqKKiSNXKjrgMK5ZOAt1fc+89UCe12oEx5LXCOuckKeRAlwgl2QfVg/JYcOUruUoNJG2ALKPQH7LOZcE9l9jGvXmgmf7hHiY5+SUHDlyXqj0YcAQzuHjAp2YGUb7uI6tSKWQCkictZiknw/NHqlN+UZ3I/2B2FLnBAlKQnOUwmnbYv5US88b06C9zcf5HvBGtdHJGZOTLRe3VqbD8X6ANB5Eu6ZFKOKyRmNjzpZVClu5S4ApO6SQT98MQnqusyaisOV8sWH9OtZD6KDGZ4t8rsjIK6pKao/UEeAtJDHJg7wdTAQqmTMZIGpsbIGJHlJEbaOnnDx1hg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=F4gKMnoonnzTBR9A1rN+QuOw6RPsoaVLkuTIs0CJlwQ=; b=NfRlRfv4ahlaZyjDFeStyHzOyG0Gm7uJ8K6kLwnBxU7iYfjrzcpM0WFX6imupApEYqdqUIfwoO/nm9DIu7AD7gofi6ddo+DOnDRGQQh6VgMIkR/ZesfN7Dy7dn5iXpYlHyjj4OdzEViKfUAUf0xhfs+6N0s5miWctO/zswykEzY= Received: from DS0PR11MB8205.namprd11.prod.outlook.com (2603:10b6:8:162::17) by SA2PR11MB5068.namprd11.prod.outlook.com (2603:10b6:806:116::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.23; Sat, 5 Jul 2025 00:40:53 +0000 Received: from DS0PR11MB8205.namprd11.prod.outlook.com ([fe80::c508:9b04:3351:524a]) by DS0PR11MB8205.namprd11.prod.outlook.com ([fe80::c508:9b04:3351:524a%4]) with mapi id 15.20.8880.034; Sat, 5 Jul 2025 00:40:53 +0000 From: =?UTF-8?q?Damien=20Ri=C3=A9gel?= To: greybus-dev@lists.linaro.org Cc: linux-kernel@vger.kernel.org, linux-devel@silabs.com, Greg Kroah-Hartman , Alex Elder , Johan Hovold , =?UTF-8?q?Damien=20Ri=C3=A9gel?= Subject: [RFC 4/6] greybus: add API for async unidirectional transfer Date: Fri, 4 Jul 2025 20:40:34 -0400 Message-ID: <20250705004036.3828-5-damien.riegel@silabs.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250705004036.3828-1-damien.riegel@silabs.com> References: <20250705004036.3828-1-damien.riegel@silabs.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: YQZPR01CA0029.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:86::26) To DS0PR11MB8205.namprd11.prod.outlook.com (2603:10b6:8:162::17) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB8205:EE_|SA2PR11MB5068:EE_ X-MS-Office365-Filtering-Correlation-Id: affabde7-26f9-4efc-d624-08ddbb5c98b2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?RmhVU2NvVFBxSW0yN3ZtYnBaUEkxTXBiaGVQMzVFWUZON25XU2VPeHoxa1hn?= =?utf-8?B?Y0dVcnhGVmZqRjFBSk5lZ0pTUlp3ajB0cWdmcG5QenUrTWMxS3EyS25ycWlM?= =?utf-8?B?OTNJVjRlMjY4OFBJZ3hzRGdQc1UyNFdlQWs5alFSb3M2N3R1dkpxa00wQUVI?= =?utf-8?B?RjV4L3dxLzNsbUNjWVZMQndDUWVObVdmZ1VNYitmTlZWS1hkc1FWRHhFNUNM?= =?utf-8?B?S2kxeXZ3WUpaSlVxa1lJaWd4M3Q1QzkwY1NCVExmVTZWZHV0bHZja09YSDE4?= =?utf-8?B?MzJ2VnNRdHJpZm9uZURhUGtOZEk2UVE5LzBFODI0TVh0ZURPelhEWGd1ZjBp?= =?utf-8?B?blM0bFJVbU1JZVZDLzU3bWdSdHFzOUd2SlZRcVVjd2YrQndiVStRQXc3VEtQ?= =?utf-8?B?bjBRbnlZTXNNM1Z6RkxEdTIrUUJ5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Vh1SXljWnorYWtJZjBBOExGSk5jem1nTDhQN2duVVkvTytxcWF0?= =?utf-8?B?Vi9XOXIwV1FwOVp4SENmc3kvNkovY1JtTWVXWjZ6aDVuU2ZqNnc3eXR2SkVC?= =?utf-8?B?ZDJHWVZITnJ2R1lNTEZaeWY0V0RUZDRsNDdtV2wybzN3Vm9TeUV4Nk14MDZR?= =?utf-8?B?NUdORjkzbXk3cDFwbHg1VXl0ZEd5a05GVHUvZVdHdnAvYkdJUjB4WUJsclpx?= =?utf-8?B?WTlwQThjMlUwYk0vMUt4NlhtNFJhdC9HTWRyMXVUYVBINm44TE53UVY4ZUIv?= =?utf-8?B?MG51cmFxU1V6TXFrOG8yd3YyV0xwQkJUUDlvMSs4aExvZ0tuMkRwOVNjL2tN?= =?utf-8?B?ajFtaFJFWlFONSs5MkJrR2pWNmY4RzFJUDdLVDFvTzNUN0o0TDQwczVqa0RB?= =?utf-8?B?UWlZSmVoQ2tvOGFDT1hBRnFqNFRTTC96REdTenIva1lJVXNFdlQ1YUFNV0tW?= =?utf-8?B?S2Q3RzNaQlUwVVNJd0ZIOWUrUllnM3BnbEJFeUJ0QjV2cmt2ZXZCWUd0ektF?= =?utf-8?B?amplZXNJRlVFazFpKzJ6WHBMdXk1aUZiM0NxWEh2ajRSL3dvemwwOGo5YmxX?= =?utf-8?B?OXA3YWhiOVZRZXM4TlQ0UDQzZU44UktXc0xWUU9qcVc4bkhFYjd1NHZOVEtE?= =?utf-8?B?dThWekZYS053PT0=?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR11MB8205.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(376014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?aFQwRDlybGFpUHVObEtLZEJGckJoUUVHMHdt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VMMC83Ym1LdGkwT0VRdCs1c3dRSm15cVdtU2xQa0ZXNHBiTGdERVdFS3lH?= =?utf-8?B?cHE0ZHpGdTd4S3lmTlJha0VhRDc3amZIU2U4MUovLzZ3eGxGOGRsbktXN2RZ?= =?utf-8?B?MUw2UzREOS9nSEJYMFN5QkhBbGd4L0tJNkRhYmNWcFJxQnJiRmhwU1YzRGpO?= =?utf-8?B?aHFTQU9lc3pCei93eHZXNHl4ZGt3WG0yU2xiWWphNzlYWnhWOTg4UDdMMURG?= =?utf-8?B?M2tWelRaZnFtNUNrM0NpRDRRdFJiaWFDQkQrT2lSSDNZdlh1aVRDenljeFMv?= =?utf-8?Q?+1DkpW/VrT1ViauzTD8NvChfy?= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: affabde7-26f9-4efc-d624-08ddbb5c98b2 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB8205.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2025 00:40:53.1399 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0k3WtOJLWt8kY09NuSlVBcJSYFHbPyE9Ni8q4viM5MnLq4KQimjBcODPwwBNRpNDelylnayrMlf+fVaDt3en7w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR11MB5068 X-Authority-Analysis: v=2.4 cv=L4EdQ/T8 c=1 sm=1 tr=0 ts=68687497 cx=c_pps a=U259+el5m5zn0mdk/7qTUw==:117 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=Wb1JkmetP80A:10 a=M51BFTxLslgA:10 a=i1IsUcr2s-wA:10 a=2AEO0YjSAAAA:8 a=GVRe3fU0mJIiiMqSPh0A:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 X-Proofpoint-GUID: 1E8GbldkeTYWMrcebihJHIOufjPBmYO_ X-Proofpoint-ORIG-GUID: 1E8GbldkeTYWMrcebihJHIOufjPBmYO_ X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzA1MDAwMSBTYWx0ZWRfX20jrGRq4Z4Zn FNoY2ZgynX+hz+ERk9LvA3Afv+c7RfmEJa0MLQ28P5KUkZoDH9CRbokIVs4WVncypT0OHjj16OV 06SZQZVlmcRwB3m4vTn7cirwt3mCj9J8A4CYg6+hSPj78mMG4/H10pe7xjXh/VKhD11YPn0QK4W If32mtjxlK8U5i+T+zS1ao63du7wNg4VK5GhyPYCizvt3r3ptVC7ioZOQEKGmmY8D5QOAULdjFL GouseZTOXAC/5XiYkijkCntLl2QMN1FcIjwuv6ldHcaP8XN0Si70UuEY0mzhAKQAGChI96lVfdK vMHJBNn7fGhgA9oyshNk3Z+HPoLETy02xW27wO1k1UKWLP/jhcso8TAuO7wAYEfxF+XHrH4mKTj MoWHXl+w+4J/WeuiZnVt1glRnRGF1Ri0EVKpmyA7zQu86/s9QKkguwEShE3ngi7j12O9uV3a X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-07-04_07,2025-07-04_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxlogscore=999 priorityscore=1501 adultscore=0 malwarescore=0 impostorscore=0 bulkscore=0 mlxscore=0 clxscore=1015 suspectscore=0 spamscore=0 phishscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.21.0-2505280000 definitions=main-2507050001 This adds a helper function for unidirectional asynchronous transfer. This is just for convenience as some drivers do these steps manually, like the loopback driver in gb_loopback_async_operation(). Signed-off-by: Damien Ri=C3=A9gel --- drivers/greybus/operation.c | 52 +++++++++++++++++++++++++++++++ include/linux/greybus/operation.h | 4 +++ 2 files changed, 56 insertions(+) diff --git a/drivers/greybus/operation.c b/drivers/greybus/operation.c index 8459e9bc074..a599b9d36cf 100644 --- a/drivers/greybus/operation.c +++ b/drivers/greybus/operation.c @@ -1174,6 +1174,58 @@ int gb_operation_sync_timeout(struct gb_connection *= connection, int type, } EXPORT_SYMBOL_GPL(gb_operation_sync_timeout); =20 +/** + * gb_operation_unidirectional_async_timeout() - initiate an asynchronous = unidirectional operation + * @connection: connection to use + * @callback: function called when operation completes + * @data: user-data, retrieved with gb_operation_get_data() + * @type: type of operation to send + * @request: memory buffer to copy the request from + * @request_size: size of @request + * @timeout: send timeout in milliseconds + * + * Initiate a unidirectional operation by sending a request message. Compl= etion is notified by the + * user-provided callback. User can determine operation status with gb_ope= ration_result(). + * operation must be released with gb_operation_put(). + * + * Note that successful send of a unidirectional operation does not imply = that + * the request as actually reached the remote end of the connection. + */ +int gb_operation_unidirectional_async_timeout(struct gb_connection *connec= tion, + gb_operation_callback callback, void *data, + int type, void *request, int request_size, + unsigned int timeout) +{ + struct gb_operation *operation; + int ret; + + if (request_size && !request) + return -EINVAL; + + operation =3D gb_operation_create_flags(connection, type, + request_size, 0, + GB_OPERATION_FLAG_UNIDIRECTIONAL, + GFP_KERNEL); + if (!operation) + return -ENOMEM; + + gb_operation_set_data(operation, data); + + if (request_size) + memcpy(operation->request->payload, request, request_size); + + ret =3D gb_operation_request_send(operation, callback, timeout, GFP_KERNE= L); + if (ret) { + dev_err(&connection->hd->dev, + "%s: asynchronous operation id 0x%04x of type 0x%02x failed: %d\n", + connection->name, operation->id, type, ret); + gb_operation_put(operation); + } + + return ret; +} +EXPORT_SYMBOL_GPL(gb_operation_unidirectional_async_timeout); + /** * gb_operation_unidirectional_timeout() - initiate a unidirectional opera= tion * @connection: connection to use diff --git a/include/linux/greybus/operation.h b/include/linux/greybus/oper= ation.h index cb8e4ef4522..01dd1d89d89 100644 --- a/include/linux/greybus/operation.h +++ b/include/linux/greybus/operation.h @@ -192,6 +192,10 @@ int gb_operation_sync_timeout(struct gb_connection *co= nnection, int type, void *request, int request_size, void *response, int response_size, unsigned int timeout); +int gb_operation_unidirectional_async_timeout(struct gb_connection *connec= tion, + gb_operation_callback callback, void *data, + int type, void *request, int request_size, + unsigned int timeout); int gb_operation_unidirectional_timeout(struct gb_connection *connection, int type, void *request, int request_size, unsigned int timeout); --=20 2.49.0 From nobody Tue Oct 7 21:28:47 2025 Received: from mx0a-0024c301.pphosted.com (mx0a-0024c301.pphosted.com [148.163.149.154]) (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 8B1E4126C05 for ; Sat, 5 Jul 2025 00:59:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.149.154 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751677201; cv=fail; b=WMmeVBUY0SKQpFV1fbwQjqElLYwFVS/JNjhJm1PY1zgwxuvj0am1pa2bRUJcWkOMlRoMkxvJVYEWR7ZDdGIVWRwtU0YTyTaSsTCOcWTegMoIqm/C+EkTXqgryUhG1stfPgSKVwurWWZ0NKKvf8QAcvTMVH0CH5i7bCU0HDCs/hQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751677201; c=relaxed/simple; bh=xDmgnxgLe552/pXdBR5wzGnhDNTGOfQ+r77evFPNCWY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=fZpF0xSEWKSUTOSnariIftqR82iQFPVM2Ej0P+0P23GsWU12VyARGguNS9nuuePcXHfUZddF3358uVz1zSAIXW7SC229QlNA6n54WPffWPK3WfyK5vnEuhtSUdvDXejZck5yzfy0RetxDnlY6ltPY8gzvAmgTwPYxPNYV/skBfM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=silabs.com; spf=pass smtp.mailfrom=silabs.com; dkim=pass (2048-bit key) header.d=silabs.com header.i=@silabs.com header.b=gI0oLc9o; dkim=pass (1024-bit key) header.d=silabs.com header.i=@silabs.com header.b=VPjoFap6; arc=fail smtp.client-ip=148.163.149.154 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=silabs.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=silabs.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=silabs.com header.i=@silabs.com header.b="gI0oLc9o"; dkim=pass (1024-bit key) header.d=silabs.com header.i=@silabs.com header.b="VPjoFap6" Received: from pps.filterd (m0101743.ppops.net [127.0.0.1]) by mx0a-0024c301.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 564No2mI017370; Fri, 4 Jul 2025 19:40:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pps12202023; bh=/suzptPQQhpdB33961Lc8ADWizMVaJZi9ivZd/di7AM=; b=gI0oLc9o10yk sQKfJ0SXQLzqmxuUOtYQXVxi5E3aXTEx3hQbtXztlpXqcdD5f4PCqZevk5FSniCp nU0D3MmQqkkgrm5o5R9ByXKKFGj73XCuodfNIqPALoEQiQ7jtGqfy88i/r8oPD2i fscItuDKGb531oUoacqMPyg25HfPS5y8tJ8i3JSzFZTHITYJnJyL0guC6XQk5Itd ARqKifZLJd9daFhoPH0bh2vd+Rs0lHnTIzgYinLklQXIlOgKc6W8MaLzIiOKiBzJ A5fP1Rd+R53jQyRx0wxFnnW5NXj2F0C+u/ECR5A4kFMSWv4H0jiuzT6/oi7pTFfD lz5SJAFMvA== Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12on2109.outbound.protection.outlook.com [40.107.244.109]) by mx0a-0024c301.pphosted.com (PPS) with ESMTPS id 47p8pvhb7y-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Jul 2025 19:40:56 -0500 (CDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eWbgRjHjuZNkDWU9ZlsdbsvgZrEdKvTAxETBh/RTwldD7roeneT04FIBJgRVQ6tpk+WU13dTNt+v7Jxb1CcMAcqSHAFGknXxGcpiiSiNJ5YFznHE9k7jgognhEWS0UKn5rCcCOoexyz/yuVrEf9jwOl0U7A4YEZ55MdZzgZk3EyrDdoi8moymKsX9i5zFbkwuLNY3IUlpZltNjzxbYOHhbTYlcbyDNT5DD4v7Zbrfkph+0GaEhp6VwKsTyh9RRAHRbP6idLKDjszlndU56c0Z0orVuOV6NOjzIy6Jfv1VOmD1MP3njLZzWfSogjIFLHbt2eEEBBvolctMwdqYCm0aw== 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=/suzptPQQhpdB33961Lc8ADWizMVaJZi9ivZd/di7AM=; b=QUHg0/n17wCIJnO0ASWtqxztDLM41txFitmglvvjRU/Vbx8aU4CtbkiBH3e7afC1zLN1ZEa65ai0R/vvD6hOojq6iI1oBI/Av4WPAjD8a2LSGqbegqjPLHKaIWPg1iyiE4dUQCPAWgcziyNND56X/YxOp5UqWzzXZhehDRFUKVdRaUw5iXnRLmVfJuKHi/X+UsD7ppAeQd9/zIILy6ya/2M/rtZUCNZjezGQ41qU/g59yiFZziRJNHUka1Xu3TcPg5t8TZSt/0KghxM3IPv4NqzVmQNdiLScC33LDwwnQl1l0gx3cKdgkO4QsINo2cNLX19R8LyC+E3ilPhjKqBA1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/suzptPQQhpdB33961Lc8ADWizMVaJZi9ivZd/di7AM=; b=VPjoFap6eEnsjVyEL8P0b+KmWl8bogB+17AZEedLCFdgc/vy2tRmIQ1WB9Bx9UBqaNegDLXwzTNw3mRV3JFuOOJt8C5fz54qWxyjIALgGuSW37IuRxcUQIZy+7yHNoeyXv0NBIbMVUy1DlQlbw0NDdcDWTCeNSF0OZrtXD0oB5M= Received: from DS0PR11MB8205.namprd11.prod.outlook.com (2603:10b6:8:162::17) by SA2PR11MB5068.namprd11.prod.outlook.com (2603:10b6:806:116::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.23; Sat, 5 Jul 2025 00:40:54 +0000 Received: from DS0PR11MB8205.namprd11.prod.outlook.com ([fe80::c508:9b04:3351:524a]) by DS0PR11MB8205.namprd11.prod.outlook.com ([fe80::c508:9b04:3351:524a%4]) with mapi id 15.20.8880.034; Sat, 5 Jul 2025 00:40:53 +0000 From: =?UTF-8?q?Damien=20Ri=C3=A9gel?= To: greybus-dev@lists.linaro.org Cc: linux-kernel@vger.kernel.org, linux-devel@silabs.com, Greg Kroah-Hartman , Alex Elder , Johan Hovold , =?UTF-8?q?Damien=20Ri=C3=A9gel?= Subject: [RFC 5/6] greybus: match device with bundle ID Date: Fri, 4 Jul 2025 20:40:35 -0400 Message-ID: <20250705004036.3828-6-damien.riegel@silabs.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250705004036.3828-1-damien.riegel@silabs.com> References: <20250705004036.3828-1-damien.riegel@silabs.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: YQZPR01CA0029.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:86::26) To DS0PR11MB8205.namprd11.prod.outlook.com (2603:10b6:8:162::17) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB8205:EE_|SA2PR11MB5068:EE_ X-MS-Office365-Filtering-Correlation-Id: e38fca8d-0152-4650-2f9b-08ddbb5c992a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?OUhNTVFxZUYyeUJRV1RVcU93VENBaU5xcVlnalZEQjIxb3NjdUZTTlVCNGI3?= =?utf-8?B?ekx5anFHTmJ1UTkyb3hLeGpUZ2Q0dWlHN29maE1DRHFrU0NLeG5WZFdrQ0VF?= =?utf-8?B?ZXJTRGRXMUkxWndnUVBIUlVLU2l3SEozZlBPend4VHRGZ3RGbFNSbU8zUlJR?= =?utf-8?B?UTdINGJ3azYwanF0bEhFejA3aXpJdEtVZkpDWkhxcCtXQjQ3NXZQRERrR0Jt?= =?utf-8?B?YWZIVHBIcmxMbFAxZk9IRUpzU1REckRzZ2VsMWl1SVI3K0hVWnNqSk1oV1ZM?= =?utf-8?B?ckhHNmhTTmd6ejVYdUZ0Y0hrbVl6VlR5VGtYMkk5WnZBY3RoUjdGQTU2bHZY?= =?utf-8?B?WjZrQkN1UG5PMCtyTzgvRyt4c2Naa0c4RFFnZEk5T2Iyc0R6bmZoMEltSzN5?= =?utf-8?B?a3dJS09wai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8?B?Zm5Oayt2aU8vVFYrQ29seHZGRU03MDl5eXlhNVZJc2QrcDJXd0ttcklNZE12?= =?utf-8?B?VUZZaDJ0eG9HSGFxYWE0bjRBWmJKdHBXVXBmdXBHVENBK0tvc0pZWHNjbXdj?= =?utf-8?B?U2RBYXBCUFZDVTBsT3ptQXJ0dWVGOEdSZ1o3TVpnYnNwdzdRR1AvT2VOeGJt?= =?utf-8?B?VmtESFR6WDF1ckMrUlYwUHVGNFQyMUYwQWxNQ3JZSldQNjVyQnUrL0trZ2xX?= =?utf-8?B?VDJ2dE8ybEpnK29aNTI5NUFKWDAzaldwbWZ2VmVERHFJMWhZYTZ3TS95Ymln?= =?utf-8?B?Z1o5bEdEY0FFcnM3bGUyREFoS2RrNkNzSndYdXMzSjVqd0JuR3hCQ3laSjc2?= =?utf-8?B?c2tNbGpHeTBnWkpidTFENkt0Z05VTmRzeGdTVDhBUzRmcE1wUE1aSnZiVE81?= =?utf-8?B?WWFtQ0Q4NFV6a3R5T0RmUTRXVm5ZbEplREk4WjhTc3cyRElkTTFma05jUmx6?= =?utf-8?B?aTV3dEorUloxRkhEcWp2MTVwN0RWMC9FSFlNYnNKUG9xc2tmWC9hTnQ2ZFk1?= =?utf-8?B?b0ZnUnZiUkc5cTlwTmRZanpKQWcvTmdTd1JoNWRWMVh3eVg1RHlXUkRUYWpw?= =?utf-8?B?SDl2azVTRmt3d2NHQkE5RGdMcmczN3Jxbk93SzlWK3lWTnhjVHNSaUc4QVFM?= =?utf-8?B?aVZML2Y5dWlnPT0=?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR11MB8205.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(376014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?SVhEZGN0WnF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TYVlTVDFR?= =?utf-8?B?TlVMamYzT2pVSDBERzdQUVZ0cmROYlVxM1BPclFiREd1N21QK2IyNFZFRzBV?= =?utf-8?B?NXE5M0lzZ3QyclZsWUFDSDVUa0F6Q3hEUzMzVVZWbVBDN3R0Q1VZTVJGRnp0?= =?utf-8?B?QzczQmd2bW1pS2NxUFM5OHAwWFdvTlo2dC9YL0h5TW83emUxN25TTkFoYzVF?= =?utf-8?B?b3JwQ1ViaE9GaHVHUTBsSFpadC9KT2Z3anMwSnNDMTA0MWovRzJqU3c0SG9v?= =?utf-8?B?aEk5QjJjTS9uZ0NXNU5ZY1VwNW1pdUY3Z1liblRQeC9mcHZRb2tWa1Y4OHhN?= =?utf-8?Q?rBVxtZBffBSTP+8/u7q7oimgZ?= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: e38fca8d-0152-4650-2f9b-08ddbb5c992a X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB8205.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2025 00:40:53.8911 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kVLNQulh0FyoI+PHN9StiB73+e4vGEtdo1G/0glIFtz8P8RrkzAJFTm+92yobBG+6R12Zzz+Y7MewQ82UM+Wbg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR11MB5068 X-Authority-Analysis: v=2.4 cv=L4EdQ/T8 c=1 sm=1 tr=0 ts=68687498 cx=c_pps a=U259+el5m5zn0mdk/7qTUw==:117 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=Wb1JkmetP80A:10 a=M51BFTxLslgA:10 a=i1IsUcr2s-wA:10 a=2AEO0YjSAAAA:8 a=QR_wBcAtP5jTkrNFJ_gA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 X-Proofpoint-GUID: ppPbQp_q168DV6yismbYyiArQIWc2mkg X-Proofpoint-ORIG-GUID: ppPbQp_q168DV6yismbYyiArQIWc2mkg X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzA1MDAwMSBTYWx0ZWRfX1/DCVKF7r0ve u/kzg1DnJyWwlh8/OsGgjQiBG8dYp8J7NHJ5v9MqT3nMZAqv0A0KTptoqLk3KrehzNKo2blFgZZ aCO9524iy1IFJNQk7MN2cN0YWK0hxAXPaWTZsiRMo03FXOU+a4VpcDFBdL+RXTNwAmdi8Ii2mJ2 wSg3IqnL010OiZFy2OLdl44OLKThqdF5DkdJucTzvzNGIDQsUplX0ERNCNMmjkGOpUjAja2IoBv S+pqfBhPDO+EH6uAE1lssA+mkD6+KviLoLUj5vF/8PjGvh9ne6tdHYPgai/1k92yjlHGYPZqte2 kxGURIBSVpq4DIjzfqRV9xPC2htBwFrrfv5vCPAfuoWEUVDUiK66UZYBAZe1VfnY/uzWJ/cBhUt gTTKAY0LoC6kV3kPFBxTwyyHWYeKt9RyEdwb31jHLAyKr5487VuIaSpqgsKb5n1rQT15CM/j X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-07-04_07,2025-07-04_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxlogscore=999 priorityscore=1501 adultscore=0 malwarescore=0 impostorscore=0 bulkscore=0 mlxscore=0 clxscore=1015 suspectscore=0 spamscore=0 phishscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.21.0-2505280000 definitions=main-2507050001 When matching a device, only the vendor ID and product ID are used. As all bundles in an interface share the same VID and PID, there is no way to differentiate between two bundles, and they are forced to use the same driver. To allow using several vendor bundles in the same device, include the bundle ID when matching. The assumption here is that bundle IDs are stable across the lifespan of a product and never change. The goal of this change is to open the discussion. Greybus standardizes a bunch of protocols like GPIO, SPI, etc. but also has provisioning for vendor bundle and protocol. There is only one ID reserved for vendor, 0xFF, so the question is did Greybus ever envision supporting several vendor bundles, or one vendor bundle with several vendor cports in it? Or the assumption always was that there could be at most only vendor cport? Signed-off-by: Damien Ri=C3=A9gel --- drivers/greybus/core.c | 4 ++++ include/linux/greybus.h | 7 ++++--- include/linux/greybus/greybus_id.h | 2 ++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/greybus/core.c b/drivers/greybus/core.c index 313eb65cf70..a4968a24a08 100644 --- a/drivers/greybus/core.c +++ b/drivers/greybus/core.c @@ -68,6 +68,10 @@ static bool greybus_match_one_id(struct gb_bundle *bundl= e, (id->product !=3D bundle->intf->product_id)) return false; =20 + if ((id->match_flags & GREYBUS_ID_MATCH_BUNDLE_ID) && + (id->bundle_id !=3D bundle->id)) + return false; + if ((id->match_flags & GREYBUS_ID_MATCH_CLASS) && (id->class !=3D bundle->class)) return false; diff --git a/include/linux/greybus.h b/include/linux/greybus.h index 4d58e27ceaf..9c29a1099a4 100644 --- a/include/linux/greybus.h +++ b/include/linux/greybus.h @@ -38,12 +38,13 @@ #define GREYBUS_VERSION_MINOR 0x01 =20 #define GREYBUS_ID_MATCH_DEVICE \ - (GREYBUS_ID_MATCH_VENDOR | GREYBUS_ID_MATCH_PRODUCT) + (GREYBUS_ID_MATCH_VENDOR | GREYBUS_ID_MATCH_PRODUCT | GREYBUS_ID_MATCH_BU= NDLE_ID) =20 -#define GREYBUS_DEVICE(v, p) \ +#define GREYBUS_DEVICE(v, p, id) \ .match_flags =3D GREYBUS_ID_MATCH_DEVICE, \ .vendor =3D (v), \ - .product =3D (p), + .product =3D (p), \ + .bundle_id =3D (id), =20 #define GREYBUS_DEVICE_CLASS(c) \ .match_flags =3D GREYBUS_ID_MATCH_CLASS, \ diff --git a/include/linux/greybus/greybus_id.h b/include/linux/greybus/gre= ybus_id.h index f4c8440093e..3e0728e1f44 100644 --- a/include/linux/greybus/greybus_id.h +++ b/include/linux/greybus/greybus_id.h @@ -15,6 +15,7 @@ struct greybus_bundle_id { __u32 vendor; __u32 product; __u8 class; + __u8 bundle_id; =20 kernel_ulong_t driver_info __aligned(sizeof(kernel_ulong_t)); }; @@ -23,5 +24,6 @@ struct greybus_bundle_id { #define GREYBUS_ID_MATCH_VENDOR BIT(0) #define GREYBUS_ID_MATCH_PRODUCT BIT(1) #define GREYBUS_ID_MATCH_CLASS BIT(2) +#define GREYBUS_ID_MATCH_BUNDLE_ID BIT(3) =20 #endif /* __LINUX_GREYBUS_ID_H */ --=20 2.49.0 From nobody Tue Oct 7 21:28:47 2025 Received: from mx0a-0024c301.pphosted.com (mx0a-0024c301.pphosted.com [148.163.149.154]) (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 8B11684039 for ; Sat, 5 Jul 2025 00:59:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.149.154 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751677200; cv=fail; b=dtbhtmmGxJ4SttpkHrLGOutSY8gcbs6bHGyjqRwwhb1XpVlsOWS+Eki7So6O7G+ZED891qA6rm+hLa3mrr+xE4kQg5QmA4evvZPuBox1rXSdFSt1s/ZUIDuBiC1TuhiZltM7+trJWiSmX1YgX0l9vdrF0OwTt3Z5ZkbJRwbuxuA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751677200; c=relaxed/simple; bh=YJzVM1McDp3ifazYWKmZTN4SaklAUyE6YKsmq/ZdWw0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=SMfYfi2XT7XYa6U9YHlIO7iEtmr/CDpNSfsvQOWcYr59ryf8jxaIyqpK9R67gId0CNvPcVTuyDPWoo6VP5V++FgD7az9hU0n/ymF7/945UD4zH3gqERJWX8yK2usXt5gYPexdwVUXEwvIvFVQltHaCCD7ZW2sn3KpK4Cvejt2XI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=silabs.com; spf=pass smtp.mailfrom=silabs.com; dkim=pass (2048-bit key) header.d=silabs.com header.i=@silabs.com header.b=eAe/OLiK; dkim=pass (1024-bit key) header.d=silabs.com header.i=@silabs.com header.b=fNS+tVSy; arc=fail smtp.client-ip=148.163.149.154 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=silabs.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=silabs.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=silabs.com header.i=@silabs.com header.b="eAe/OLiK"; dkim=pass (1024-bit key) header.d=silabs.com header.i=@silabs.com header.b="fNS+tVSy" Received: from pps.filterd (m0101743.ppops.net [127.0.0.1]) by mx0a-0024c301.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 564No2mJ017370; Fri, 4 Jul 2025 19:40:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pps12202023; bh=cYEL8pBgfR6bC9LiB7XkCS4rGyaUEohwSYu6kpQ0jmQ=; b=eAe/OLiKBB4J xrrdxRDRG2HhKVGTEEl462Nn+sHKcdaWpvIQ4+51CsMlyEvHgZIugmm3qLMj2mCp HwVa3EKaUcx/XgqYuSuVvH2xGp5IFPYaPUrfOs+Tto01aekmYmrW+1O/Vt6lq0SS OVPJWjq+WCXIlVuqdMHFmaIl58JThFqjvclBcHuP9R8Cyq2LlSVTtpGosSeeEEbN x1h62yjEOltxlQ2QbQVSiACON2OCYXP3+ueW8oxGIofhAXc+dmTGELxgQZHkSmBl CqcKO09qZKnj6wyRnDxInTxhkPJFzkzoJO//3o/8IUJbun+J19dvrGvoVIYTrt4j atDC76GHJw== Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12on2109.outbound.protection.outlook.com [40.107.244.109]) by mx0a-0024c301.pphosted.com (PPS) with ESMTPS id 47p8pvhb7y-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Jul 2025 19:40:57 -0500 (CDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LteX+gqS8of3i+rkY7WkU4+nBG7Gk9E5594OxCZZxgwYMgDy1NiY0dAuxdqFzBLlUpgSeiJYIClitq2RHz2EjGn/Scy9m5vyZing3uLDyzP0/3WD90sI9ZFoc+PLpsP5ACHM1LSigGeIJ9acw6wkFQPkbJBFRYYFpnE4fflKPVXazNJzytEUQaCjszbV2D4C/ZqYSCmYnKOyJm/hEYHa3Go5h6/+HsLzlst7Krb4iFWpe+260HtBIY7JR7xozAt+qX0B+EYSp5qmY+Zqc7Y6baVCkQfm0IbxxiqiDcTDORsIH6GuU9316M7A+0GdETjRBqnl2rGHN7CmdSyjnknDDw== 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=cYEL8pBgfR6bC9LiB7XkCS4rGyaUEohwSYu6kpQ0jmQ=; b=TCqMQ01B5k1htCyPB7Hk4DtFGU2i7JX+GjXWNuQVz0WFyHRf+VGOuOvTVZ/uTuykHemoPWQnzTpgK/jvmVbR/Xj4bReub89ksNxEcK4aCppiQL2D2YqUBQmYlEV8N4wYdqOs+Tu7RL2bK5JdLeef52zxiFLmtQ98ZairL3JuhSeBGzpHYnR2wSZDZ/npJtmQU5DsV6HqFwacEtJI8moSTkOQeSnAVxpNoijNCNs9T/aTVCTkJ+tGAqmV/JpD58QT5BjoPNLGWJcTcPVfDNxxjqkdqTevNGPgjrocE9Jtwow4vDSp5MA2q5yCeVra296N95/ozYuKxfFoRg+Ogzep9Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cYEL8pBgfR6bC9LiB7XkCS4rGyaUEohwSYu6kpQ0jmQ=; b=fNS+tVSyQT3zQ9tOoRV8jpiPYBnPMLPgTXPLYM9ionjUtOk0NMgP3vbMSbuLnQaPBusJYMR1gkr664uT25qG/XH6AGHU/NianTt2X4pnX3G6++1TvKRb33N0/loNh+GxnWgeGxYzGfF2p17uRb8EW5Hlx9991eTNmtSIV8ZZvdY= Received: from DS0PR11MB8205.namprd11.prod.outlook.com (2603:10b6:8:162::17) by SA2PR11MB5068.namprd11.prod.outlook.com (2603:10b6:806:116::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.23; Sat, 5 Jul 2025 00:40:54 +0000 Received: from DS0PR11MB8205.namprd11.prod.outlook.com ([fe80::c508:9b04:3351:524a]) by DS0PR11MB8205.namprd11.prod.outlook.com ([fe80::c508:9b04:3351:524a%4]) with mapi id 15.20.8880.034; Sat, 5 Jul 2025 00:40:54 +0000 From: =?UTF-8?q?Damien=20Ri=C3=A9gel?= To: greybus-dev@lists.linaro.org Cc: linux-kernel@vger.kernel.org, linux-devel@silabs.com, Greg Kroah-Hartman , Alex Elder , Johan Hovold , =?UTF-8?q?Damien=20Ri=C3=A9gel?= Subject: [RFC 6/6] greybus: add class driver for Silabs Bluetooth Date: Fri, 4 Jul 2025 20:40:36 -0400 Message-ID: <20250705004036.3828-7-damien.riegel@silabs.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250705004036.3828-1-damien.riegel@silabs.com> References: <20250705004036.3828-1-damien.riegel@silabs.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: YQZPR01CA0029.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:86::26) To DS0PR11MB8205.namprd11.prod.outlook.com (2603:10b6:8:162::17) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB8205:EE_|SA2PR11MB5068:EE_ X-MS-Office365-Filtering-Correlation-Id: f8bd3066-eb2f-40dd-880c-08ddbb5c9997 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|366016|1800799024|7053199007|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?aUpmSjIreHNlMkJmLzlRRXhHelJjcTBDejlrQjduY0Jzc2ZpOE1VcTN1RHkv?= =?utf-8?B?U04zczI0azRjSlM4cXdFY08rRE1Va2pBdmRMbzZYWkhGL1FKQWx3cnkwMTNQ?= =?utf-8?B?K2N2MHpNTEx4aUZIVGlJakZDWm5pWlQyNXk2eXZIbmZaMmZ1QTI2VmkrNExv?= =?utf-8?B?RmFRTUJqYjNpa2lRZCsvc1FuQng1ZDMrbzNrd3ZwazR3MGd0ay9HSXl3aXFY?= =?utf-8?B?bURvcC9PSU1FQjUxOGo5Q3dKWUJQNEpXd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;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR11MB8205.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(376014)(366016)(1800799024)(7053199007)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?QUcvREZYcDA5TWJsTVZpSDZzSUJ3elpLaElnNHdzRVBsWkR0dUZlNE00TkJz?= =?utf-8?B?a3gxRUVHTlIyVXBROEw5UW0rMFI3aDZYNlRpOGRKRGo0UFNNYlpFTzNxeTV1?= =?utf-8?B?ZHBqRnFCSlR5RUJnRjZHaXZwdEJpNGV5YU1jbTVQUEFDSmxCcEREQk5yTE0y?= =?utf-8?B?WUQxVERZTlE1eS9oN25EMDIwT2gycjdtcm5CWkF4a2VUelR2VTZLUTVWd040?= =?utf-8?B?RUZGbHlLM2RzTFJUMkZBVlNITVNNWkEzMVVhZGdXc0dzcVE1VXNQUGkyVk5C?= =?utf-8?B?NWF1MjBSOHg0K1BMYW1Tak5tQkFveStoMHFPb3lhZTZvcnZ5NmFPRnZ6R1pD?= =?utf-8?B?ekJPQmsvMk5Ra2RvbThvU1VyNkd5UXJxN28wS1pudnR4cWNWbUZPVzVYZWFH?= =?utf-8?B?b3dKZjdNRFRLeGk1ZGFnQ2VtMk53R2xMWHE4WVhrU1BsNmdWVE1vV2hqWUxp?= =?utf-8?B?Und3ZDVGUHdaVUtMbWJQeWdIM3RJaTBsVEV1Wm1RVFlZeXJoNW14TFVmTE1x?= =?utf-8?B?TkM4TDlNYWtEWXptNE5XeWRFRWNIRjRPZU5NZGFSOW1tYk1wZFNOcTJmUlgr?= =?utf-8?B?WUhKRlYzenhYSktlRFJZbmk3bFNSS3pXUmdIbHRvT2NGRWkvR3NadjVvSkYr?= =?utf-8?B?b2ZST2FpVWFDd05RS1IzaSt5bXA0QWlFRUozVGZ2bXM5UTdnVWdQbU9zNXV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QZlVNZUs1?= =?utf-8?B?azhsTHFnc3ZHVk5ZSHptVDNpTlQwT3dFQk1vNEdVRHNHT3BCTktnZnc3ckRF?= =?utf-8?B?cElBWjVtNS9CWW5nSlNxQzZtUjhCOU1sRDNBOGpvbEFOTi9hVzg4bG9WaTUr?= =?utf-8?B?azFCUnhYc29rbk5YWUhGSW9EZEFLWlhBdGVCclNhaFJDNXp3R0ZtaG9pMUdB?= =?utf-8?B?bERZQ1VmMytHd0R1UVlVbzRrTVpZL3FCdm1NTi9BOVRoQkpIaDFMQTV5K0lr?= =?utf-8?B?VGZFdFlWSGhGNDB4QjRFYlNodGk1SUl4NXJPVzVSd2UvYWVIZ0dHemlWbUVJ?= =?utf-8?B?N2J4VXhrSjc4cmVEQTFHOFUwZEloSHNJanV1Y0l4V2dZT0JzWjlSQlk1NUI0?= =?utf-8?B?L0xDelNqMDA5cytFZXZyNVVBbmxVcVRJazFXemxZQXVuMkZ2ZDlleGZFMDNQ?= =?utf-8?B?MEg2WUppWkk3czViTlVuWWdXL2xQUEpGTnc0ZmdwWGdtYS9BcEdSQWFuZm5B?= =?utf-8?Q?hFR9s42z9nyLUyNTvW9ZOs9KP?= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: f8bd3066-eb2f-40dd-880c-08ddbb5c9997 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB8205.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2025 00:40:54.6027 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gXtUmnxD4x1Oa2+vgT6lgZgeERtqeDj5HC9Cmxc0xhgTgSz3NRyarotJjPBVY98mludiagStOjl8MCqbtzaAww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR11MB5068 X-Authority-Analysis: v=2.4 cv=L4EdQ/T8 c=1 sm=1 tr=0 ts=68687499 cx=c_pps a=U259+el5m5zn0mdk/7qTUw==:117 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=Wb1JkmetP80A:10 a=M51BFTxLslgA:10 a=i1IsUcr2s-wA:10 a=NEAV23lmAAAA:8 a=2AEO0YjSAAAA:8 a=pGLkceISAAAA:8 a=KKAkSRfTAAAA:8 a=H03fXF6sB4HNYwN3RssA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: VbUqaPDpo_pFWuQgZYpQiF89WrLstDek X-Proofpoint-ORIG-GUID: VbUqaPDpo_pFWuQgZYpQiF89WrLstDek X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzA1MDAwMSBTYWx0ZWRfX2aSiO26yMVTm zyp5D6IM/5f/x7X7Ch7OsnPuYX4Xn9jnOiO1JO+qYXj8Tl8iBfBSAAvBBDVJt73Cch5JJQQIfvd 1Ej7ZTlR9ayDUTUuxfmzZeEMGKChvLAay1ZLG9Bj0a7B9XnnKUn3ZeeNn48rt746FZtYOEsZYpi /BPHqwkR5B/9dymC9XXFTQMq/jI7RdXPaTUYUJCq//DD1CCs0ilg5ruV8odQRobASqlLHHYfZvd sqK6HGy5C10glSrT/ZKHQA7AJNJkR5/TC5JCbYr8GvHQwFmFbkcp00qjUoUywUl+3IFqyf+zrN9 gNrDDc8l6AFMfB2g4zwcYmyHyPRPXlGbl5DcdLH6MXK+U1LL4Mlw/gXbdy+iWXRbwMkMdzdeg3U Oza5fjA67XrOHOqsd08XrEkonEqC6bF6UQIcMkNAa/90DBcHQFMMshnVOPqemE09vhZ+Mg42 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-07-04_07,2025-07-04_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxlogscore=999 priorityscore=1501 adultscore=0 malwarescore=0 impostorscore=0 bulkscore=0 mlxscore=0 clxscore=1015 suspectscore=0 spamscore=0 phishscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.21.0-2505280000 definitions=main-2507050001 This class only supports one type of operation: - name: BLE_TRANSFER - id: 0x01 - unidirectional - payload is: - first byte: HCI packet type - HCI packet Implementation is very naive and doesn't keep track of in-flight frames. The goal of this commit is mostly to open a discussion. What would be the process to add new bundle and protocol to Greybus? Should Linux be considered the actual standard (as it already differs in subtle ways from the official specification)? Or should the (official? [1]) specifications be updated first? [1] https://github.com/projectara/greybus-spec Signed-off-by: Damien Ri=C3=A9gel --- MAINTAINERS | 6 + drivers/staging/greybus/Kconfig | 9 ++ drivers/staging/greybus/Makefile | 6 + drivers/staging/greybus/silabs-ble.c | 203 +++++++++++++++++++++++++++ 4 files changed, 224 insertions(+) create mode 100644 drivers/staging/greybus/silabs-ble.c diff --git a/MAINTAINERS b/MAINTAINERS index 10385b5344b..ea0923741cf 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -10009,6 +10009,12 @@ F: drivers/staging/greybus/sdio.c F: drivers/staging/greybus/spi.c F: drivers/staging/greybus/spilib.c =20 +GREYBUS BLUETOOTH DRIVER +M: Damien Ri=C3=A9gel +R: Silicon Labs Kernel Team +S: Supported +F: drivers/staging/greybus/silabs-ble.c + GREYBUS BEAGLEPLAY DRIVERS M: Ayush Singh L: greybus-dev@lists.linaro.org (moderated for non-subscribers) diff --git a/drivers/staging/greybus/Kconfig b/drivers/staging/greybus/Kcon= fig index 1e745a8d439..3d14eabb196 100644 --- a/drivers/staging/greybus/Kconfig +++ b/drivers/staging/greybus/Kconfig @@ -213,4 +213,13 @@ config GREYBUS_ARCHE To compile this code as a module, chose M here: the module will be called gb-arche.ko =20 +config GREYBUS_SILABS_BLUETOOTH + tristate "Greybus Silabs Bluetooth Class driver" + help + Select this option if you have a Silicon Labs device that + supports Bluetooth over Greybus. + + To compile this code as a module, chose M here: the module + will be called gb-silabs-ble.ko + endif # GREYBUS diff --git a/drivers/staging/greybus/Makefile b/drivers/staging/greybus/Mak= efile index 7c5e8962233..c61e402595a 100644 --- a/drivers/staging/greybus/Makefile +++ b/drivers/staging/greybus/Makefile @@ -71,3 +71,9 @@ obj-$(CONFIG_GREYBUS_USB) +=3D gb-usb.o gb-arche-y :=3D arche-platform.o arche-apb-ctrl.o =20 obj-$(CONFIG_GREYBUS_ARCHE) +=3D gb-arche.o + + +# Greybus vendor driver +gb-silabs-ble-y :=3D silabs-ble.o + +obj-$(CONFIG_GREYBUS_SILABS_BLUETOOTH) +=3D gb-silabs-ble.o diff --git a/drivers/staging/greybus/silabs-ble.c b/drivers/staging/greybus= /silabs-ble.c new file mode 100644 index 00000000000..588e8e067e2 --- /dev/null +++ b/drivers/staging/greybus/silabs-ble.c @@ -0,0 +1,203 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Driver for Bluetooth HCI over Greybus. + * + * Copyright (c) 2025, Silicon Laboratories, Inc. + */ + +#include +#include +#include +#include + +#define GREYBUS_VENDOR_SILABS 0xBEEF +#define GREYBUS_PRODUCT_EFX 0xCAFE + +#define GB_BLE_TRANSFER 0x01 + +struct gb_ble { + struct gb_connection *conn; + struct hci_dev *hdev; + struct sk_buff_head txq; +}; + +static int gb_ble_open(struct hci_dev *hdev) +{ + struct gb_ble *ble =3D hci_get_drvdata(hdev); + + skb_queue_head_init(&ble->txq); + + return gb_connection_enable(ble->conn); +} + +static int gb_ble_close(struct hci_dev *hdev) +{ + struct gb_ble *ble =3D hci_get_drvdata(hdev); + + gb_connection_disable(ble->conn); + + return 0; +} + +static void gb_ble_xfer_done(struct gb_operation *operation) +{ + struct sk_buff *skb =3D gb_operation_get_data(operation); + + kfree_skb(skb); +} + +static int gb_ble_send(struct hci_dev *hdev, struct sk_buff *skb) +{ + struct gb_ble *ble =3D hci_get_drvdata(hdev); + int ret; + + memcpy(skb_push(skb, 1), &hci_skb_pkt_type(skb), 1); + + ret =3D gb_operation_unidirectional_async_timeout(ble->conn, + gb_ble_xfer_done, skb, + GB_BLE_TRANSFER, + skb->data, skb->len + 1, + GB_OPERATION_TIMEOUT_DEFAULT); + + return -ENOMEM; +} + +static int gb_ble_request_handler(struct gb_operation *operation) +{ + struct gb_ble *ble =3D gb_connection_get_data(operation->connection); + struct device *dev =3D &operation->connection->bundle->dev; + struct sk_buff *skb; + unsigned int skb_len; + + switch (operation->type) { + case GB_BLE_TRANSFER: + /* Must be unidirectional as AP is not responding to this request. */ + if (!gb_operation_is_unidirectional(operation)) + return -EINVAL; + + if (operation->request->payload_size < 2) + return -EINVAL; + + skb_len =3D operation->request->payload_size - 1; + skb =3D bt_skb_alloc(skb_len, GFP_KERNEL); + if (!skb) + return -ENOMEM; + + /* Prepare HCI SKB and pass it to upper layer */ + hci_skb_pkt_type(skb) =3D ((u8 *)operation->request->payload)[0]; + memcpy(skb_put(skb, skb_len), &(((u8 *)operation->request->payload)[1]),= skb_len); + hci_skb_expect(skb) =3D skb_len; + + hci_recv_frame(ble->hdev, skb); + + break; + default: + dev_err(dev, "unsupported request: %u\n", operation->type); + return -EINVAL; + } + + return 0; +} + +static int gb_ble_probe(struct gb_bundle *bundle, + const struct greybus_bundle_id *id) +{ + struct greybus_descriptor_cport *cport_desc; + struct gb_connection *connection; + struct gb_ble *ble; + int err; + + if (bundle->num_cports !=3D 1) + return -ENODEV; + + cport_desc =3D &bundle->cport_desc[0]; + if (cport_desc->protocol_id !=3D GREYBUS_PROTOCOL_VENDOR) + return -ENODEV; + + ble =3D kzalloc(sizeof(*ble), GFP_KERNEL); + if (!ble) { + err =3D -ENOMEM; + goto alloc_ble_fail; + } + + greybus_set_drvdata(bundle, ble); + + connection =3D gb_connection_create(bundle, le16_to_cpu(cport_desc->id), + gb_ble_request_handler); + if (IS_ERR(connection)) { + err =3D PTR_ERR(connection); + goto connection_create_fail; + } + + gb_connection_set_data(connection, ble); + ble->conn =3D connection; + ble->hdev =3D hci_alloc_dev(); + if (!ble->hdev) { + err =3D -ENOMEM; + goto alloc_hdev_fail; + } + + hci_set_drvdata(ble->hdev, ble); + ble->hdev->open =3D gb_ble_open; + ble->hdev->close =3D gb_ble_close; + ble->hdev->send =3D gb_ble_send; + + err =3D hci_register_dev(ble->hdev); + if (err) + goto register_hdev_fail; + + return 0; + +register_hdev_fail: + hci_free_dev(ble->hdev); +alloc_hdev_fail: + gb_connection_destroy(connection); +connection_create_fail: + kfree(ble); +alloc_ble_fail: + return err; +} + +static void gb_ble_disconnect(struct gb_bundle *bundle) +{ + struct gb_ble *ble =3D greybus_get_drvdata(bundle); + + hci_unregister_dev(ble->hdev); + hci_free_dev(ble->hdev); + + /* + * The connection should be disabled by now as unregistering the HCI devi= ce + * calls its close callback, so it should be safe to destroy the connecti= on. + */ + gb_connection_destroy(ble->conn); + + kfree(ble); +} + +static const struct greybus_bundle_id gb_silabs_ble_id_table[] =3D { + { GREYBUS_DEVICE(GREYBUS_VENDOR_SILABS, GREYBUS_PRODUCT_EFX, 1) }, + { } +}; +MODULE_DEVICE_TABLE(greybus, gb_silabs_ble_id_table); + +static struct greybus_driver gb_silabs_ble_driver =3D { + .name =3D "silabs-ble", + .probe =3D gb_ble_probe, + .disconnect =3D gb_ble_disconnect, + .id_table =3D gb_silabs_ble_id_table, +}; + +static int silabs_ble_init(void) +{ + return greybus_register(&gb_silabs_ble_driver); +} +module_init(silabs_ble_init); + +static void __exit silabs_ble_exit(void) +{ + greybus_deregister(&gb_silabs_ble_driver); +} +module_exit(silabs_ble_exit); + +MODULE_DESCRIPTION("Bluetooth Driver for Silicon Labs EFx devices over Gre= ybus"); +MODULE_LICENSE("GPL"); --=20 2.49.0