From patchwork Tue Aug 13 15:15:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13762207 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 377B2C52D7C for ; Tue, 13 Aug 2024 15:15:34 +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=XjnFKRN7QDNvPY4mRG9tOL3aMd p2BWNuwUuYnZroiaJOmyoC9hV/yuj3dKCTX9H8OSkrksx4jKKG5xcdW7WmqEHiyKjl1z+LFwEfGOl oL0T33KW1V7YyTSMFSMCD7Aw29KlZ9AByoXxPqjo+Y4ni8so1HI9aSWMwii6VRx4CDV0X3Ckbx86L oVY9BxAPwLM2C6B/tEXtjhGBf6BJECGdxoE+8UY/qEBM44Cz4mdbgfo74hnHBnYPjuuwhL86r/UQ6 0YBowqAeznwrhEGuCaaEN1Rm5hYpufYp56ttog+c+R2La0yDM387egpGC4e3kyf58Ol/pQ24iAEzz 6j+Y0VPA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdtFF-00000004Aj7-3nXx; Tue, 13 Aug 2024 15:15:33 +0000 Received: from mail-northeuropeazlp170120003.outbound.protection.outlook.com ([2a01:111:f403:c200::3] helo=DU2PR03CU002.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdtFD-00000004AgF-165z for linux-i3c@lists.infradead.org; Tue, 13 Aug 2024 15:15:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QUySjTbPCaDi9BVxnyT5GCLJ/SLB35nTPLdSdaNe/Ioj5YsrxTeUQjk3jAYwsyiEA747m815kPzSe6EPGBAeiJQDixLF5oQmqkQYlE1fK8vO+Vn3DM+Kp2VJPfKP87MJhsg7+JFOJ1mXcPCBULq3rb2QvbA13Kzm3Hic2RV7S48o6HbzngVb9g06LxcAhHDmpo5QTy3EnU8C2pkXBzPjN9X3O9tKL9V1ZTs7XrYFHBO8oYXUoQDZImQaDYb+qDzh/LF+4cFdT4TlkEuqIOZOJm32pa8OBCWJneQJ+O/yMjw9+dsTJrtwPjt89WEySQPr2C1RvWjFOJc34J8VP2fYOw== 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=aoroXpYg78M5cnYZaU+aiYb4osHvKA0JQ29nrO90Jj14GWnSmObArQHNg74KG4heMg9y37U7SbcY+dgfKS71JwpfCA/soO8RbH47rb+xzP+M6rPYy5Bv2Nf2zDzfb4bLJ1+CNLoXWsLC5rOQkERC+hthHZ30Z7tIQ8F4lDFA4D5xtnq6mONmOmkwxmBmBtiz8D1C1IZ+3FHp6LmM0yQYycvm/LgL8WPWg4JDGvfDHX5yv2c9OuwG8a9zZo1e/zuCVy3z9repY1Cc1jPZYP8rYrljokpgFaKW4BWRZK/pqyUTgWqX2BW9Pm6k8lJ5u3mY4IrU49/aj8udRUGZWxF23Q== 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=Pxyb3Wz/EOpHMAZPPGGxlpejPg65BcLMIa90/r6FjrWuOgmKHXpn/q8F3mBDUATvwPDMeJXDDNMvUy7HUdpm2YqcLa6VC4KznmzXAZhrFaswT4dOp8Z0HHZgFKUCNqAUb6WIPiLTUz+lqmRN9UNkaruhymsJ6aVywZ0nsU0G1IXbvrs6o1PtwUpoAQa+DVVmw2EQJ38bJL7ifeXFmpzXnvHrUkwelYp2G6offIgLWeBeJlHXGaD6Me/04JhFJSAxvGOcnzh+j2Vgr/OEC980noVQZvYqJd86kxHClCCNS6N0jT636VKHiYtC/hgWMcGazkEN4t4P6+0Eoh5M1sEnkg== 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 AS8PR04MB8404.eurprd04.prod.outlook.com (2603:10a6:20b:3f8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.22; Tue, 13 Aug 2024 15:15:29 +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.7849.019; Tue, 13 Aug 2024 15:15:29 +0000 From: Frank Li Date: Tue, 13 Aug 2024 11:15:01 -0400 Subject: [PATCH v2 03/11] i3c: master: Extend address status bit to 4 and add I3C_ADDR_SLOT_EXT_INIT Message-Id: <20240813-i3c_fix-v2-3-68fe4a050188@nxp.com> References: <20240813-i3c_fix-v2-0-68fe4a050188@nxp.com> In-Reply-To: <20240813-i3c_fix-v2-0-68fe4a050188@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=1723562115; l=5289; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=nvcmTWDJj+SrtpBzaB8l8keUZ2F8Z2oCpFCzJlzH9us=; b=x5XiFTV1Fax58n9YQ6RD5YTd7QDCwA5yVOOZt5k2+oYaM3D0toNZ9ZPMesddvRrd/5HrGwOyG +LcwritCa9gBBWN+GYobInDb8536jgwnCVR2/HB/6l/+Aj0XcC19D3G X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0125.namprd05.prod.outlook.com (2603:10b6:a03:33d::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_|AS8PR04MB8404:EE_ X-MS-Office365-Filtering-Correlation-Id: 29e9eede-6f01-4f81-3dfa-08dcbbaac455 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|7416014|376014|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?rmqhAJ55KdOIOQbwcVbk16QB4sFR99k?= =?utf-8?q?spWCfNDVombLhtEHGnVOmg9w64lQebQRG73DoJoCyYfJcN6IIEkSBHc4a0IOqwoE6?= =?utf-8?q?3rpuUSleabJioZjdWZdI5VeGeSHP59EWVYasABLHjOhARuzF/bV83rTVeWKxMf7S2?= =?utf-8?q?wJhMGNTtT4KQQLsbgxI3TAtXTYHisYF50w/B1fGtkydsqxXD835bDlTir01ZG1yJA?= =?utf-8?q?EJtks6arkNHeCu2FV0tmiTe3TQVb54PN00Y3l/QjwOcq03ue+3oSRzy1mXamIabCx?= =?utf-8?q?W2Q/n9UCSyauI10ZOjDCmRmvb3XWi9YwzOkhC6ZwjwN3YV3ZJOV2MW35KsdgFh428?= =?utf-8?q?sFhofyZHNHMysssQPMueYSfbEMTwOiTFZFKUu3JCh9OzFrPl8430QFOJjZZjIJMd3?= =?utf-8?q?esl8SU43ig5V7UNCgd/wJRNLEENQ/ywtLk0b8yILdyPr0rJcU0GDt518Wd9StQZSQ?= =?utf-8?q?61UqUHVbLdAq008v5NaKZpVrZyUr5SVTOASom52/FrJm31DB2YbLY+OtFvzX8Spf0?= =?utf-8?q?VSecKR1rLjTMrdjfAdBVKj7jwFDeltlh7Aue4aotWS3zxdxezYzjgiD9FQ2+HP4e6?= =?utf-8?q?uCFqxgZNmdC3BWkglNPC1Zt4Ot56HeQBeVgd8UtDsW98MNZi/NPT1zNsZjByz2cEX?= =?utf-8?q?wQi1U4IKhEP4A2TZnBU7dbGEi0HpIHvWB5YxXuFRPbyIkoDBY570zOUFN1t/ZNcqB?= =?utf-8?q?9aHKkWeD8QUQihM4S1JCsNQlaKH1FqvrrHglhynJVRuAum0FnfmsJXG2krNmH82Go?= =?utf-8?q?dP8hYVG7oRgmpNbqVvnF6i2kuF1Vtiz3wwneSatcjaRiUwEk8h143Gk8TO/KPQiZK?= =?utf-8?q?fuUJTrkvx+uaBMZDqygTF9KkRBjuxk8oqfGuy+tWVaGA0hFy2sRNopYBp+anXuTH5?= =?utf-8?q?Y4R9TXs239Rvrteedw9HSK+nnEPQENXLb5z7aImcQfCSoNvHNwQKK4eGL8sX4XDAR?= =?utf-8?q?h019dVMGcXl5Lu7PfKxoND3OrP1QayutFFY20tZI7P4LzGUHPs7+Y1JqsJF77Mpgx?= =?utf-8?q?6J+v1RW+U3nF2VuCD3ExIUIeWriAMiittonqvUy0+ftSRzh/DulY2hDPtiGPAGj/D?= =?utf-8?q?q08HFtxxLxmeX5Tr8f8hKmCubWnwTB/JRF3X6ADsi0JF78zB7wna+0PudDWqysVgA?= =?utf-8?q?NAs1oxasp7QghdmBOHa5VDt6yrqkikjTuUouH58yP2AUcuJZOsSAr+PC+CY3Fgb3K?= =?utf-8?q?bY8mT47Pqf+3zAv1TkzA25Ac+7C8bE5k7umrtDL0wOpVKGfHDZ6EQwsN4LjLGN6xm?= =?utf-8?q?Y/7GCEYgzTb71fA22Q2fOYSfSOSbRekDSDE7tE13yqO1t7TLsapLtC3bD+YaPd8Xy?= =?utf-8?q?QVMzoWoWxz510UXisNyHr2o580rJlrQrAw=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)(7416014)(376014)(52116014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?cXfyrfUAGcp27Y3rBd5ZOmeThtNE?= =?utf-8?q?jThjnjZaH1UsI+92mtW/xA9WoCFlmmHxcc82zdHir5oT7wQ66v12PDWshauTHPVaS?= =?utf-8?q?zsqrKXod3nrApZ3jvTuaVBs3ZgLzAIzBXOMtJCEPRRc1IkmkV1NfSeIHVYbZCgj9D?= =?utf-8?q?zY8tn6YUqiYJchVi/To5TVStSEwijFgZ0UdGuFZxbMg8cZ9wgGUF/7P6MwBj4xmEA?= =?utf-8?q?9wPF0TbrkLuLRnQGvUM1cVRc70+3JpHI+PXmefEKHWoolBz9kOtZ6huatwFV2ER6g?= =?utf-8?q?FRT3awuvxWFbBX5CYWFYoSo7CWfRRLcnnGFDpRs6bmlMGOYFdIywaXCfq3LLc85Bm?= =?utf-8?q?xnlRZS++0WvRRnpQyRebjVVW5J0j7WVc3+nu/OorY8AyEdH5EN7VX45gfJn7fd49m?= =?utf-8?q?f834DLa6BzWNRnDaZurhMDgSrSAAR070e3XfM6/jxHPx7buXEpfbyW0Ax7FxZPWC0?= =?utf-8?q?Z/0krlnN21jwjKHZuHy47Y9ANrF96jjgxTes3ZuMLrEfaOJt7d0kXSADYeapk2dmp?= =?utf-8?q?G691MG2i/cGcQ635kb0yMfskh14V2UZx4MtIH3jwjwxbVfrUjTzG1x49mgv44Hie/?= =?utf-8?q?mOSucJp27XDLG8zPcYPA8o7CWwyMXZz+IrbItjaFTxY+560S273oFve54DR0E+pFs?= =?utf-8?q?88zWzloxcFu+xju4LTgeshyarkm+SMZ6Nlkc4qdiwEVErjljQPueWSWdZEtPoeY6p?= =?utf-8?q?vZZHPmoeGkN31ZQYwq0EoTVuL32YcmCYeK8OMJ38VbWzipCSSJ1f2Kb6PxtjqPlnk?= =?utf-8?q?Rxq9IX8I5v9ThQZjCcuezQp2hsp6fRUrvvYDQ6NP8MY4j7xUdVgBPoOnP0BBzFcwl?= =?utf-8?q?xliUdFDgKVceDFdPrz6rt33xfwU6jL4zTcoHwiSpm8RgHbswbKbrpThWUYvGeEwCx?= =?utf-8?q?k/+HTlG7F1zb18A+phfvSOcv48syNArAMNS9GFpeXqaz6C/oZoiaJVNKM8wDjjkEf?= =?utf-8?q?n39ls3DQe/CVCIcf2XS5JRnsvm19rgrCW0gRO5SZ+oLfWm6IIAZf3hv3A2jgB1l5f?= =?utf-8?q?p7yjQ7gQ3siDSYBSQmvlFIAVL8gRnKJ33KOZyAXwb5MNLCWgfYTryDsHV4D+Vb1AN?= =?utf-8?q?9hzhPDvys60ctrDoW/67DzizFvDj69qEFREiVTIw0D9gKYoBTsYoeN/xVAX0kJJME?= =?utf-8?q?NaMLsdqGtwRXdprWzjOYoSCxL4lP4K+tfoDciGxPsdYHbXM2lF7gXdh1PjRCH9OFv?= =?utf-8?q?Fn/pcs72UBUzc0ovERnAv2NRNzttUu8Sd2YpShFBEKO5eB/sBAyW4ID6nBk0A/3YB?= =?utf-8?q?5YFY9Vy3TuDWgUfzAhOHp5FCZmf4nbxgFV95imGEvc95OUckZ1N1pzyMRxa2Wh1y2?= =?utf-8?q?VE4bHyq0DTodMIvhahvoZJhW9rS74zTmdzQWeK9yUJCmx1U5Ce94EwKfIL/I9fXzg?= =?utf-8?q?fcDhekonwGdKqCTKrKU2kbgaWCk49JXRD+1xBpsVMrgcwHs4NpGkpFUOuMSK2PfYa?= =?utf-8?q?wrsOC726/I8htVgLRxDoz01hF2AI3EAi/H6Gzkgo4smd4q6WZFn1iZtg=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 29e9eede-6f01-4f81-3dfa-08dcbbaac455 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2024 15:15:29.3427 (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: kS15Mq+/IwEW8EDy+F/J4h5osrWefahFHsJKiQo6g6OVpWcngDQEeEoBiKmiluCdVrI9df3x0/0BpINaYSMGGg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8404 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240813_081531_346469_39F4C1B5 X-CRM114-Status: GOOD ( 20.24 ) 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