From patchwork Fri Nov 1 16:50:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13859611 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2087.outbound.protection.outlook.com [40.107.21.87]) (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 B09C819D089 for ; Fri, 1 Nov 2024 16:50:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.87 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730479828; cv=fail; b=e/GbPrWBWtoq0Ak9xwmi8VLtHBeQ1c4n7lZAEF7X0mQJpfzsFH4m301Al7xdQl815C1OKQ5FEF7ErJId4/hXlferLSaX3GgQwHokz1dKq10HQIQ9Yy+Y1rUonO64saEgQOiwlPAzWsc2+r2y2ST6bvuWyB10CXmgdWd3PXiGZow= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730479828; c=relaxed/simple; bh=MYVWkobQ46xnf1oTLC4Zx59IeCfJbBMF8dvp2yQlUco=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=FJgq40KlBfGHY9SZNAXybzjOfXJiNB2FF6QBZ/VLHlTve7H8p81/LjId86op5wxsVEb1PvgENfiZOjV63qXXH6DwvSpvXP+jZySztvdD3gaxOwm4OdplxP5BiLdzwE1STGsKdoPCr3mxCVbacBHOEBhQPiyxVvo/O2KpjhTiVEY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=cUbBQG63; arc=fail smtp.client-ip=40.107.21.87 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="cUbBQG63" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=d1kM7Vj+fyOyC7KY1dgCJuXcrmSP9xyupoEA0/J9Hl/4KfgMlvpElj/uK5xsKiLyGlrDXH45aEsuw5vuK71uwc9ZmSIOUzof8YLOTO9OjBUGNQ3ydfdDC/ANK8Uhe1/D7tHGt5BdTMKSB4/klexI1gPTEfvJz35AivND+S/w8P0WWzhqvsHzk7nMXMxLG+3OAkdq7Qs0PCfyc/I+MZ6DJv/8Pi948bVWTqqr9nU90adFh/Fd8zP4dOLVVNIaFyk5gpDSP2sfRcBKUJW5/4/ti8+R3s0GS9SYYC1EAVeA5VGV2x4EJnB/3Y7NTPWwr9AkmYnTHioUujn3qG7g1i4uIg== 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=5KBgxRO4NBY42OTzZaW0c4I8dLq1r+LVI+ujJGeJmig=; b=X/qYUakqL460XA0FjZL6H4d1vtJPrJLlIo9zHKJK6nLMPIU8S5XFtmZ9G0ApYVuZJC1KNcQoSMVZizVIM2PWewnsTF4xtjK5k6eC/VRFtBnYTnatJo6VWwxHN4TMv5PF9DFgTH2FKO+03rio3TDy4GwHyV9uNclgonKnv6H+d2DlQfy3J+OPRYICmR0TrBaw1v+tgLt3ZTbc0hgBqZE8HFVeTCaRcT2AfZA1gId8KE1vuU7/9rcjgV8Vy9GT6UZcehiBLD2z9F6tTQa2XzubRvMJYoEK6+VwEak/WBnzVUaZOnZjWTsf3iOVwmdJTU+YVZXBlj1jUDc9D5HRLOg2kg== 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=5KBgxRO4NBY42OTzZaW0c4I8dLq1r+LVI+ujJGeJmig=; b=cUbBQG63uxyNEnFOrebilpuN5JPuYisppfEjtayip3rAtMRQ7pg7VCJCEjhSNBIHGVOgPHLfocujmYB42FPX5sYZmwl69Pm/iWCEYmeutrG9jAtHhujrkQ57BxgkI2iAm9c+Pwz5m+VxiKAjO5x7oZGMTBUJ0WW8mZcDsIfAiDFv/oIyzX827+dom3W6BwYiT0qc23EEq6JwnWN99C3dQid8dKFB5GyJP+BSXMef72252Sdj6YwATFN3MGRRb3EAGqyEnznTrRUe3oUqKUxYEpwmwqPIYowl9Y2GFLikXbYLXI9UPVORKmHh3QtSgsAClVINYPl3vBQ4lsOaE3xc0Q== 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 DBBPR04MB7930.eurprd04.prod.outlook.com (2603:10a6:10:1ea::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Fri, 1 Nov 2024 16:50:22 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%4]) with mapi id 15.20.8093.027; Fri, 1 Nov 2024 16:50:21 +0000 From: Frank Li To: alexandre.belloni@bootlin.com Cc: Frank.Li@nxp.com, conor.culhane@silvaco.com, imx@lists.linux.dev, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, miquel.raynal@bootlin.com, xiaoning.wang@nxp.com Subject: [PATCH v2 1/1] i3c: master: svc: Modify enabled_events bit 7:0 to act as IBI enable counter Date: Fri, 1 Nov 2024 12:50:02 -0400 Message-Id: <20241101165002.2479794-1-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SJ0PR03CA0383.namprd03.prod.outlook.com (2603:10b6:a03:3a1::28) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DBBPR04MB7930:EE_ X-MS-Office365-Filtering-Correlation-Id: 2a7232af-7137-4310-8631-08dcfa95464f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|52116014|376014|366016|38350700014; X-Microsoft-Antispam-Message-Info: uwGUGizq+wC+fNGauxD7AIla2ImpqnRz0KVJlJOKinzbKrZyz3CMb3x+VAsnTgqUPsgZ8/wrJxCB2meMZ/GpTRG5+tNEhoCnAse793vAzIll509hxFLADFvfHcM+3FPv5sF8Y20MNhfKLfLQ2hPdpjzpPdrzUsY4HoEYltv9/SM8dSM+awr25bYv1GmsBcD4QDtBXYYGglIM/v4ekpUt89SBcRiZ2IbcGe5o7ax/qeF/+dmeK0JSiSmNtOh3wYlCHzXeTS+n0A0AVdk5xMPX3ZEN4ANrzLc8WeYUzpnKcWP5sssmcXb2F7RzwUkCMkEvGBEaDjDOqZzNECaAotMrAR5fc55qz03Rr8Gd01+xKrYKWUEKwPOsWQiMeEM3Cist2bPBHHSTFBQB89X5mDNjsktRKRafozzNXKPdhFkgD/IEEmeQDhg8zGos8sqwU9lV1pzWRPQntQI/KjnNBsGYszAE+iWikToW55sie0WNymwf68mUAbQ2gk4YcyWMhHf42EQocS3ohAOFP8KNXRuWptoibk4Fo0YyMK+oZg6wszD72sE8fqalRhKeFOr1tXOfbBsO4BJAo5+o4Gh3b/o9raun2xyE1AHd9HtRRX58azLzFmml7o/wq/ASwiDRcduDzV7ESXoATng2XRuhZi+gYOwXb9bh1Hwt4INfB0m801cr+G7exm3UYmKBZrQAng7nLMrYmlicIIRAJmhC0uD8U+izes2BrJf42EZBXXuYoiafWg8khtBrx/SnNnoFj64e5VGwa+A35yzupkX7rnzDMAclrS6pfjSB+2+gIrwk8rI60tLhjhym7y9AXiupSZVZRG9yhQzC3a9syrAzIORj2pkARCU7JJxo6IDtEbpy/eCR+WdyCcdDzubY6HP3udsDbaij1OYiW8Xl91WLSDhd2jjNhxVFEsQywfL3dLwEb+AOyniQUjjo2KCv2/w175N99Ae0hCk5m8y5ZUCCAIpmaCNapz79Hj4/0QF/FSVj/LRNId2nRd3VfV6rP0fvYFP+5/Hq7AMph3agRkhGZ2h9lXGNbhjwP6qbQG4Nmg24eznlX4j+Nw//Yn8hpeuEaRkOn14dUgQ0vWThQ4WN7cIu3Hzf2lh/nPXECYVnZWnmsMZZZRI5QzrelVmiDOaqmmglpWxE6gWHqi9Gee1dprFYpEnIfUa1DyFWab+B/cAqdbtl6TD2mwxh8M6Jx0lK6Prmgtuvq2QQILnZ1DKoaZIDvMdfyZKxhrBBcuB5R+Y1c9kYImcMvqJ6VN0HjrUYz/5twzJOkQyzU94Ln6UThv2Lq0WIvD5sOEhRQ8qnqk5s8QPc/Ggy0QNyQPijl3mI2WYGWCJZOoxosNxGF0I2gmOuT9W2oEYHgZoNpvKz/GIkXM8= 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)(1800799024)(52116014)(376014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-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3LlNxr8acVUnu9+V03mNlnLdZn6qHXS/v9HJpBMyGubfOCoWdCfOpHc2g8l8SOW93q1zFIz5j7EQtFJ+otnruGyyGSox+XBlyQxARzfvhKc13SwPqwa4nPZf0YstOw8exTIm3o/P9hSirouu0JMjG/Outb5MlZkk6YA1moaoKF9895jtKclK9Lx56c4wFRmqSYQ3FyF9x1egq3wTFktsCIKkaACJlkz7hzihQadNqL0+QEA88f6744+inTY/sWWyvcUbAm5iUGVRBfcCj6lyST4ny1HS4+4UzXI34x9vBiOnYAZ+wPXpz7uklusOZJrpQRceeRyozGNaXLT7r70BYjc1lqurtUiOZ2l/uBQEXvZr1pGvOHQ46ngVGxnEUHvloeJxHm1+11FW7xxT5wsMkghS4gJAWeVtELhQQBzaj2u/kNNzsUH1FmgKzrjhtA47b+Zo/TlLIhm/RhwI73WL+7l55ZgNYxSdh7foTkthUt9HFewyr5sIlxcnHoqGKvnmoQtRUeBIWAOzVS0s4kYa0K6uzQO/vvrEZ+uq+I= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2a7232af-7137-4310-8631-08dcfa95464f X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2024 16:50:21.8255 (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: FJEdiCtWIVEeQF4tcDRFpyk/cprw0XJj+YtiSsviHwU9FQycaX8wfnY2EcPFJUQu4+hzVDRsQagmqq9Rv8cu4Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7930 Fix issue where disabling IBI on one device disables the entire IBI interrupt. Modify bit 7:0 of enabled_events to serve as an IBI enable counter, ensuring that the system IBI interrupt is disabled only when all I3C devices have IBI disabled. Cc: stable@kernel.org Fixes: 7ff730ca458e ("i3c: master: svc: enable the interrupt in the enable ibi function") Reviewed-by: Miquel Raynal Signed-off-by: Frank Li --- Change from v1 to v2 - rebase to i3c/next branch - add Reviewed tag of Miquel Raynal --- drivers/i3c/master/svc-i3c-master.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index c53f2b27662f4..c1ee3828e7eec 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -130,8 +130,8 @@ #define SVC_I3C_PPBAUD_MAX 15 #define SVC_I3C_QUICK_I2C_CLK 4170000 -#define SVC_I3C_EVENT_IBI BIT(0) -#define SVC_I3C_EVENT_HOTJOIN BIT(1) +#define SVC_I3C_EVENT_IBI GENMASK(7, 0) +#define SVC_I3C_EVENT_HOTJOIN BIT(31) struct svc_i3c_cmd { u8 addr; @@ -214,7 +214,7 @@ struct svc_i3c_master { spinlock_t lock; } ibi; struct mutex lock; - int enabled_events; + u32 enabled_events; u32 mctrl_config; }; @@ -1688,7 +1688,7 @@ static int svc_i3c_master_enable_ibi(struct i3c_dev_desc *dev) return ret; } - master->enabled_events |= SVC_I3C_EVENT_IBI; + master->enabled_events++; svc_i3c_master_enable_interrupts(master, SVC_I3C_MINT_SLVSTART); return i3c_master_enec_locked(m, dev->info.dyn_addr, I3C_CCC_EVENT_SIR); @@ -1700,7 +1700,7 @@ static int svc_i3c_master_disable_ibi(struct i3c_dev_desc *dev) struct svc_i3c_master *master = to_svc_i3c_master(m); int ret; - master->enabled_events &= ~SVC_I3C_EVENT_IBI; + master->enabled_events--; if (!master->enabled_events) svc_i3c_master_disable_interrupts(master);