From patchwork Mon Aug 19 16:01:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13768530 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 283B1C3DA4A for ; Mon, 19 Aug 2024 16:03:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To:In-Reply-To: References:Message-Id:Subject:Date:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=z08FI5HDToHA4OxwWb+9hhI9RCo7sPpBQknSLKQid9I=; b=edAzBiS8jvraBWgNqAsEQulPvJ dGnonc88SDAkPcAiE1juG1t0hP3i3preNo/JITVYA04/PLJMJTq63MrK74zVp3UArIsqo3jlfGKzb riWw/R6K/KcDCGTGCAYMlyXFKejANAZEz7kQBuz6934MI1tdudi1/Hh3e3VX7PDwULxjW94QdNhzS p4I0eANOuWRqB1yxiy0wAY8SLkYmKcy1KR3MFgjxO/OLCC6dHZC1dM6n5g6gsIsL0NfhubF0YsChr aMrEk1ybMtNoInhBAPjhJFUcjmqingc3ZEE1YR5RuSohDTSfzSZ9pI0Bh0LqYDVoghgvckcjhVelA GEBdefTA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sg4ql-000000024hX-3i40; Mon, 19 Aug 2024 16:03:19 +0000 Received: from mail-westeuropeazlp170100000.outbound.protection.outlook.com ([2a01:111:f403:c201::] helo=AM0PR83CU005.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sg4pv-000000024DK-1yxT for linux-i3c@lists.infradead.org; Mon, 19 Aug 2024 16:02:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VRZUsi/UiARK420EBNqbB4SsChBMTNREhJZZDxv9c9zhcY7cfoPAb0XN0G9eKLkvuEqo48pN/8KkLdut6kY+QVzpc4gluABVIJ3U8rhVSS6GPqC9HIqPJ5MokR4SUi5a1wkrnKDM46ralLwx2e/10EuZ+ydS9ipZEFMrh8ZChAHlX76J6u5sFS/W/qIvQRwcEucCoNiS7bvgyFsQvM9949/yUKltGWuw5mW7/OEd3gq9HeAfgoABwcvC4qgmjawvPmYyF2iMVANgQA8OQ+vBeIGHCMmDfMSU/iIiUQgYz7cV8dx2w5cad5QIg/sk3/AE368dn7MmyhWKUsMBXsPqsw== 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=Jk3Sg8K892J5LLK9qnygB0m2WRCfBM/GY0tQ0z2NeDw=; b=F8Hg7R2iEOlWCQrQ4xKQ+NSKUaYZ5ItyIQol0SvJbxzdHUqOXK0mwxOBovpUyvpkpE48o+ha5LCOTKQFJOD13Kpf2559SDl0kdPBx7NtqhkkthLBoY7GUkz/cR02pFpiw0IUZl07GLN7y8X4QaGmifBJiuq9DXQulUMBnqHQmWQjk1I3qtXdP9hzuaQ8GMlwv96de5tPs5pS2+ca4exEEXaNBUgH32O5/EZrKZ6ZJocwLCHXowuITW5MMxqXremq79B0UoYyZr8ItKLhMCWIyDjd/QhCRTs0hPTaZYagg1Ny8mThxMvsMO/v0QqBb9qeHHw3LOyngyYWDFAwWVi/pQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Jk3Sg8K892J5LLK9qnygB0m2WRCfBM/GY0tQ0z2NeDw=; b=Y61hzPCY7DdZu6dPh7EkNDtJ3EGGeS00CmUKTEaIVi2+PDMq4d0Dqg/zFUAJg+CH3n2MlyvGdM/Rw17ZyLPNAUOidUB8iXirDhQqZFB859K/R6n27DWlDRepev/Iyefh0I4ajyf8DWQHllhEV7P8XrjYabYi3Mk8Fs2QWBjVrcZ90hHy7cf7TWYZzNr7U4sziEdtCspvyJqS06O51j5vjuHDy06SWJsorITsTUTuCPgrwXtk2aYs25TND8TWddhldS4lVnJ+aTloGlclCbyRVuz/kbJKGq0zL6OJpajNk3rD7sJPd6lhIB7LO0nHnQ08sZA4dT21Fvfh5Q4STzl7Lg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by DU0PR04MB9659.eurprd04.prod.outlook.com (2603:10a6:10:320::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Mon, 19 Aug 2024 16:02:15 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%3]) with mapi id 15.20.7875.019; Mon, 19 Aug 2024 16:02:15 +0000 From: Frank Li Date: Mon, 19 Aug 2024 12:01:57 -0400 Subject: [PATCH v3 03/11] i3c: master: Extend address status bit to 4 and add I3C_ADDR_SLOT_EXT_INIT Message-Id: <20240819-i3c_fix-v3-3-7d69f7b0a05e@nxp.com> References: <20240819-i3c_fix-v3-0-7d69f7b0a05e@nxp.com> In-Reply-To: <20240819-i3c_fix-v3-0-7d69f7b0a05e@nxp.com> To: Alexandre Belloni , Boris Brezillon , Parshuram Thombare , Greg Kroah-Hartman , Boris Brezillon , Arnd Bergmann , Miquel Raynal , Conor Culhane Cc: linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1724083326; l=5289; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=nvcmTWDJj+SrtpBzaB8l8keUZ2F8Z2oCpFCzJlzH9us=; b=ELiX+puj5c7a1rmOAJG04z8hB45bXBVpVH3C6CTavRWD83sSUWHazijgZ05nyDFUViSEmq9f+ 4I87vY0LIYzAFhDQXMdxftWqnxU5faZO88M7QSzBctSk/b+26OHqtdy X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SA9PR03CA0005.namprd03.prod.outlook.com (2603:10b6:806:20::10) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DU0PR04MB9659:EE_ X-MS-Office365-Filtering-Correlation-Id: f9a7c7fb-bd21-4b49-02c8-08dcc0684b7c X-LD-Processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|7416014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: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wtLRjC5Rq4g2/ezLLmEUG42l8C+FwXCRYzappTKp8?= =?utf-8?q?UjFhjXwlXrKFFVzgRuOKhvHRPv8Yxemx9TNP+Nux81tSFjTLOYII+2L/ouFskKxmB?= =?utf-8?q?EU+D6KJ6Kj3/MqB1y9wuChh+ufdqqXdNO2uZ1grOgW+YsKgz4WhCq4KNUh9bYk5TQ?= =?utf-8?q?hVn7mL3TGoMst/pf71C8Q1S99XnZavkS7sn7KLHLyeOdJvTVlCp+XSqRQw/HzsKVM?= =?utf-8?q?mgZo4mEDbcDvNQuTEcQ/uIZxCNUlh5ej/8TjF7nlMoVc1gGnvUMV0DNfSF3jNl36n?= =?utf-8?q?ys254swCDQvuvYhSZ/5uEJt1G0v0PQXLYntDi8am2fM+OXNqKnnB2p+gxd/yuIBXr?= =?utf-8?q?dpl0DCSd6z7oIVN8gyZ6tu1xwUs5KQSJINtRtdvCzoyuwSjF8fQ6CLyFEGVd6LW1y?= =?utf-8?q?q6BFsUaIdtLUqDpao0jJhGGnuKGHx6jOW0adUAtA73EksXcQi/hIXhZ3KNlcvhemB?= =?utf-8?q?CoOXgB4mqDswRoI6f8ioLBAcw/EDHVQu6Q=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014)(7416014)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?gd3YHqeZRi1bKRtCBFoUgfElX4y1?= =?utf-8?q?gKvbGsBguzRFRVOQLcvryRbhJMcc3IAzsm6Y8MJGwH12n2HS8y7MScqlI1BvMay7x?= =?utf-8?q?0c8L7ebQoQygS1P+C5N002ULeVF4p0F58TbRvxw+eL9RJHkjAks1r8uSjPZKTJwB/?= =?utf-8?q?9Tj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Y4NlCquHLzdPflyuXk5JCJL9LBK3C+/lmdLKXU?= =?utf-8?q?CY0QG+DLOetry2uQEAwX5PBEmXWWCl6tH/R9x2+7EbedoYXTU050TLLb7JZ1zH0Y7?= =?utf-8?q?zF3OeDybjmhKis7+5VO1q2hO0wda0nZGs7WD9U4+RcuT5a6opGuDcyizmzcON1zmH?= =?utf-8?q?yJQWeGHjA9nd8pl9BOBXQDANrln2U7xHj39FajsJZHVzAfsOKpO75AmsTpvnoFAtp?= =?utf-8?q?VSKi+PbFoNkbMIdH/Q2GDpdI2mQQYwVBvb0mdQLPCFjq9Mq/wgh2Dz2CtmMtiNPRW?= =?utf-8?q?1CI/lmIsM9C3CyeqzoinibefbYaYAY1xC/W1UQbqm0BMGFUxNlfjDIVlKnCxr/EAJ?= =?utf-8?q?+EuRb6bflBgHbuipGvLdfihUD906PYIkbvyUaHE2EXP+BZ2rOqG+2byBMxpzl+i9g?= =?utf-8?q?splNZh1LKBH0jKgjU1as7FtIFEJfrGeatzZbCSFr2Uuo3dDMOwcz5TNd4kAgXoWen?= =?utf-8?q?oZO5eOdAmqPp?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f9a7c7fb-bd21-4b49-02c8-08dcc0684b7c X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Aug 2024 16:02:15.6910 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: e6NTMQJNAn+skfnkAXOPDD+Vz9cbW6H076g4axp7SSxnJaugQqEAveTpBvYDpQBn121YlIwZi0BWDAodMdK0PQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR04MB9659 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240819_090227_635068_F086407B X-CRM114-Status: GOOD ( 20.01 ) X-BeenThere: linux-i3c@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-i3c" Errors-To: linux-i3c-bounces+linux-i3c=archiver.kernel.org@lists.infradead.org Extend the address status bit to 4 and introduce the I3C_ADDR_SLOT_EXT_INIT macro to indicate that a device prefers a specific address. This is generally set by the 'assigned-address' in the device tree source (dts) file. When an i3c device is removed from the bus, the old address status is set to FREE, allowing other devices to use the address during hotjoin. The I3C_ADDR_SLOT_EXT_INIT status indicates that an address is preferred by some devices. The function i3c_bus_get_free_addr() will first attempt to use unassigned addresses before searching for assigned addresses of devices that have been removed from the bus, trying to best match the 'assigned-address'. Signed-off-by: Frank Li --- drivers/i3c/master.c | 43 ++++++++++++++++++++++++++++++++++--------- include/linux/i3c/master.h | 6 +++++- 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 85c737554c940..4281f673e08d8 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -345,7 +345,7 @@ const struct bus_type i3c_bus_type = { EXPORT_SYMBOL_GPL(i3c_bus_type); static enum i3c_addr_slot_status -i3c_bus_get_addr_slot_status(struct i3c_bus *bus, u16 addr) +i3c_bus_get_addr_slot_status_ext(struct i3c_bus *bus, u16 addr) { unsigned long status; int bitpos = addr * I3C_ADDR_SLOT_BITS; @@ -356,11 +356,17 @@ i3c_bus_get_addr_slot_status(struct i3c_bus *bus, u16 addr) status = bus->addrslots[bitpos / BITS_PER_LONG]; status >>= bitpos % BITS_PER_LONG; - return status & I3C_ADDR_SLOT_STATUS_MASK; + return status & I3C_ADDR_SLOT_EXT_STATUS_MASK; } -static void i3c_bus_set_addr_slot_status(struct i3c_bus *bus, u16 addr, - enum i3c_addr_slot_status status) +static enum i3c_addr_slot_status +i3c_bus_get_addr_slot_status(struct i3c_bus *bus, u16 addr) +{ + return i3c_bus_get_addr_slot_status_ext(bus, addr) & I3C_ADDR_SLOT_STATUS_MASK; +} + +static void i3c_bus_set_addr_slot_status_mask(struct i3c_bus *bus, u16 addr, + enum i3c_addr_slot_status status, int mask) { int bitpos = addr * I3C_ADDR_SLOT_BITS; unsigned long *ptr; @@ -369,11 +375,22 @@ static void i3c_bus_set_addr_slot_status(struct i3c_bus *bus, u16 addr, return; ptr = bus->addrslots + (bitpos / BITS_PER_LONG); - *ptr &= ~((unsigned long)I3C_ADDR_SLOT_STATUS_MASK << - (bitpos % BITS_PER_LONG)); + *ptr &= ~((unsigned long)mask << (bitpos % BITS_PER_LONG)); *ptr |= (unsigned long)status << (bitpos % BITS_PER_LONG); } +static void i3c_bus_set_addr_slot_status(struct i3c_bus *bus, u16 addr, + enum i3c_addr_slot_status status) +{ + i3c_bus_set_addr_slot_status_mask(bus, addr, status, I3C_ADDR_SLOT_STATUS_MASK); +} + +static void i3c_bus_set_addr_slot_status_ext(struct i3c_bus *bus, u16 addr, + enum i3c_addr_slot_status status) +{ + i3c_bus_set_addr_slot_status_mask(bus, addr, status, I3C_ADDR_SLOT_EXT_STATUS_MASK); +} + static bool i3c_bus_dev_addr_is_avail(struct i3c_bus *bus, u8 addr) { enum i3c_addr_slot_status status; @@ -388,6 +405,14 @@ static int i3c_bus_get_free_addr(struct i3c_bus *bus, u8 start_addr) enum i3c_addr_slot_status status; u8 addr; + /* try find an address, which have not pre-allocated by assigned-address */ + for (addr = start_addr; addr < I3C_MAX_ADDR; addr++) { + status = i3c_bus_get_addr_slot_status_ext(bus, addr); + if (status == I3C_ADDR_SLOT_FREE) + return addr; + } + + /* use pre-allocoated by assigned-address because such device was removed at bus*/ for (addr = start_addr; addr < I3C_MAX_ADDR; addr++) { status = i3c_bus_get_addr_slot_status(bus, addr); if (status == I3C_ADDR_SLOT_FREE) @@ -1906,9 +1931,9 @@ static int i3c_master_bus_init(struct i3c_master_controller *master) goto err_rstdaa; } - i3c_bus_set_addr_slot_status(&master->bus, - i3cboardinfo->init_dyn_addr, - I3C_ADDR_SLOT_I3C_DEV); + i3c_bus_set_addr_slot_status_ext(&master->bus, + i3cboardinfo->init_dyn_addr, + I3C_ADDR_SLOT_I3C_DEV | I3C_ADDR_SLOT_EXT_INIT); /* * Only try to create/attach devices that have a static diff --git a/include/linux/i3c/master.h b/include/linux/i3c/master.h index 4601b6957f799..c923b76bbc321 100644 --- a/include/linux/i3c/master.h +++ b/include/linux/i3c/master.h @@ -284,6 +284,8 @@ enum i3c_bus_mode { * @I3C_ADDR_SLOT_I2C_DEV: address is assigned to an I2C device * @I3C_ADDR_SLOT_I3C_DEV: address is assigned to an I3C device * @I3C_ADDR_SLOT_STATUS_MASK: address slot mask + * @I3C_ADDR_SLOT_EXT_INIT: the bit mask display of addresses is preferred by some devices, + * such as the "assigned-address" in device tree source (dts). * * On an I3C bus, addresses are assigned dynamically, and we need to know which * addresses are free to use and which ones are already assigned. @@ -297,9 +299,11 @@ enum i3c_addr_slot_status { I3C_ADDR_SLOT_I2C_DEV, I3C_ADDR_SLOT_I3C_DEV, I3C_ADDR_SLOT_STATUS_MASK = 3, + I3C_ADDR_SLOT_EXT_STATUS_MASK = 7, + I3C_ADDR_SLOT_EXT_INIT = BIT(2), }; -#define I3C_ADDR_SLOT_BITS 2 +#define I3C_ADDR_SLOT_BITS 4 /** * struct i3c_bus - I3C bus object