From patchwork Thu Aug 29 21:14:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13783886 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 A3490CA0EC0 for ; Thu, 29 Aug 2024 21:15:15 +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=PdxTdBwEne5Wmgw3E3jQ/MVXU/zU2eNeW05rvTYQFjE=; b=HkPOpOsQvy9FrYYurTrfR9yZzu vUSjs42MYYx5MTvaAadJ1fKqmuLPjvbcGTCcfoVZGuYm9rlVGdZk0Xv4H8w9BJrtcQuF8QLcsHg+w ixMAf51LhIw9UO8LJ2ApWkkllFAaK9sN1qh8WEjqG+9pYrVI59O58MSmADVkEPB5yDBNKw36LjCzG mPes27VnfzMP8KuM5OplrhX2g+xKsiAzD36n55M/xxIxe2A5FtYgyBMxsaYCh4jHenlaBrUCovF91 X/Q2pESZaxnDAYYqc2GS/WIo+zEtJZGiw9j/lt98/ePbSFjFCUYKu4/g5d8MBRph6aNjIpn3f92mx oTUdXGlg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjmU7-00000003ewx-1HbG; Thu, 29 Aug 2024 21:15:15 +0000 Received: from mail-northeuropeazlp170110001.outbound.protection.outlook.com ([2a01:111:f403:c200::1] helo=DB3PR0202CU003.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjmU5-00000003ev3-1o7e for linux-i3c@lists.infradead.org; Thu, 29 Aug 2024 21:15:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YobVni+mq3poyw4AzlilK79ka+vFch4UMsAFfqnlU8WjXTE6tIDY0a1OUdnP9ORa26ZIyLMBFtRYKsM8YqFcrcIPLdP79ARB0Sfo76S09ngKKo3KdsVQlSSRq9XLyCG8Xk3UcJXUxrVH2kY0YcFUvPM8cziNU1FPwc8WE6qCvdPvwExEtfj8Qm9yuGAV7buqU17dFV4zdKg9j4xrSo789HmjEFZ9WS7bKBgWvkuwOjFLdVJWpvVJBwpoGFhVSy3QIMEbckdmzpZfwq0iXOY46xGvioxDlVdtOil+jtwZemczQ0l683ZbZHffnieSwgD3ihPS4oe5JkyaEVJ+ecjYng== 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=JGcdrxq3VsDXfDuenVX/J6JpFFtyfXUUfnacJFSh40Q=; b=qfmWNCUgCsEQrn03ksrdnguOeUVHHLbfMhEQynSyWKrVNcLqAhmCQOmoRGWLfqZxBOiUhCLneWgBhy5e06i1SiwPs8WZZtn9spF8cH4Ag/EbwSmf/4tDsmj7e8y9ragWmrNhiBagODuY1gjMhvbXr1XutcTDkArRrcVwipj23+hsn7COgWKMdFM5L20VoTcXWAXWBC4QNBUf2R8TldMcFsYA3U/Z+4Up+PzGWYB9YXW7/f3AzPXv86dz54NKooiVkjJVE+m+BoDJ4ynsgdyqoWQuOmOwupEpIQx4cy4Z2v9qz0WmUgHRmSs78Gn2RnqM44ybTfANqPnaEvmLkmCBPQ== 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=JGcdrxq3VsDXfDuenVX/J6JpFFtyfXUUfnacJFSh40Q=; b=ZrEPAsl3Wnb5VVCcyiimPy3atnJTMqZrHsLx3P6uiFa+YnSm/5TYGgA1ZYYrCZFzq0p8dB1RuEHjKFJvod1Vhl3RR1kpiqB7QRsPcbYZYKp0alyxg4vvr/J+yfmENGO/da42moc39t4s5A3wMFqfLx3mA5oWetBjGNgaMIC0Z+dJseb/xWG4mUXJAQROZBcZFKGfdxTbz6Cr5Rk+Z1srftYOl+9T+96aoBZaudDZSlufJ6K+drf0FTMD5px+yXqvyajlXpgB13j7w6cVZW8En5EMi9WGacBCSuZYCr1eqkln156oRnnePw2sZv7EZPT5m5YCTnkFVxHM6a7vAwDRkA== 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 AM9PR04MB8971.eurprd04.prod.outlook.com (2603:10a6:20b:40a::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.20; Thu, 29 Aug 2024 21:15:09 +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.7897.027; Thu, 29 Aug 2024 21:15:09 +0000 From: Frank Li Date: Thu, 29 Aug 2024 17:14:04 -0400 Subject: [PATCH v4 07/11] i3c: master: svc: manually emit NACK/ACK for hotjoin Message-Id: <20240829-i3c_fix-v4-7-ebcbd5efceba@nxp.com> References: <20240829-i3c_fix-v4-0-ebcbd5efceba@nxp.com> In-Reply-To: <20240829-i3c_fix-v4-0-ebcbd5efceba@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=1724966083; l=1870; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=Abu8R9fjCyCOO6LsZNj8SF9ckbtApgfch6j5wEiJ3L0=; b=lNyY3IKUOLnuOh7Pz9pmkiRTkyrrKIcQYW38dRa4KN/3ICEhLIlwIyg4n6Rn+rraDgKgXEEKt yX5Auqk4+peAOMeBomHTz9hQvcEX1Qlh93x/U3mt3L1Nhr8loVKww9F X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR13CA0219.namprd13.prod.outlook.com (2603:10b6:a03:2c1::14) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AM9PR04MB8971:EE_ X-MS-Office365-Filtering-Correlation-Id: 72c58072-0607-436e-1a65-08dcc86fa963 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|376014|1800799024|52116014|7416014|366016|38350700014; X-Microsoft-Antispam-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Y/AEWS6CqkQG3Lc+LBWE1O26qJTBVwqUQ5vG3xjiJ4M6?= =?utf-8?q?PUXeewIj1vwNHdc9iPKdH1HrfjLiqZOa6T7+JsPbW07kcwBReq6Eve1Y79l2cokVh?= =?utf-8?q?vpOBvZJUGgA/HyOiBWAKUFb4MuJFPZGZU1Vl38sHxjKWoQqb1C2hzhhZP8nfQieOb?= =?utf-8?q?zLizBIfQZ2bZsuleHIG+qqGJeSTZAlMPGzave+kIXXM6bJF1nlovGXh4z9nlqXS6W?= =?utf-8?q?mi29VkYQD+Hc8CwmUMIlVOTluJPrETEfSdrwIf3pAhZyq5QSamsyfiqIqObp8BSO/?= =?utf-8?q?QB7gJZ5Jrtve0mJebrvLXdJ6WMCKulmjEVSGzrIOD+GSiWRyXsO4p8QN3sXYsGz6g?= =?utf-8?q?oHcIASRmWhJOk8oOTaC1G2Ckcblr5NwMvtRxNXB0EhmJCMSXxUo/fPUyXVrHOHVkK?= =?utf-8?q?57g7uQbIlWrtZp1m8LUkrXhh7Pmb0ULZLU6ODc12ZPIM9FLICx0HE2Mw2qbEYXUbe?= =?utf-8?q?w0NHaimFAdEYunODSMvz3M8KGzlMkbpgjA=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)(376014)(1800799024)(52116014)(7416014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?tOS4IvM4XCRCjzDn79Le9ypG3Hlk?= =?utf-8?q?8df77OaBA9ledW88+o504OEURCeiu5OPm168hTtKRock6W5mO0A3m74q8In6M70Ch?= =?utf-8?q?Wj0GWjVNNP/da+bjY6bjoRODDbIJuS4XJfnIt6PwN+1Pc+eQ+AaDVQdUun4oC1OER?= =?utf-8?q?hNC6tQ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Yt+CzIwDra/VYwfWMm5OTLRUpGpZdPY1JFXsc893r4/bY69jcqIWLEuwiH?= =?utf-8?q?BoNuFDow1XTpOffBCl6ai10lm5fX1zD0e/mVCS2lnvQK4yKggSKf6sOOSukJD8pII?= =?utf-8?q?iEZOs5mmHE9zipPgevvgtXQviLJpKCbDWPL9cikZr8yjR9HgWWnoVbTDJYVzurdlV?= =?utf-8?q?pg+DvrcyBNpMAIlfAyqClPWS3cLjNPzg9qsQHYqkICiyofgCk5t5FSCPTuYPJZ4/H?= =?utf-8?q?XxagVsyM+bU8o1PFqMVg+W9xOcdHjgXImhokRb9XYyOH7dfU9a2TAZwBsPZ57ewcW?= =?utf-8?q?NRWoL9wbmDhr/bLOmgVUsJox8ppjgULOMsijYWDwvZlB7ZTPnTNZvlkADRg6OKbe7?= =?utf-8?q?3Tuy2HDXYj6UZfa9GfXWzIhLFCxKkTfVJ0W3qgCbY6vWjEIqaF56pdB9NmsVCdE9c?= =?utf-8?q?AnO2RDM6menXcpPQnSwCfVyHv67zjqAowh/R5Oa9EVDCqo/JgTSBTbY1s5SA36SU6?= =?utf-8?q?jn559o0hTw7x?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 72c58072-0607-436e-1a65-08dcc86fa963 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2024 21:15:08.9330 (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: achJiPKrjX64lc3o/If3jodcW3eXBdJzi6lqSiNx8uSZ+tN4vcKUdrhroUx4e/70cX2Yt5oPjJFUZACiYrD0Eg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8971 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240829_141513_513227_1ED14707 X-CRM114-Status: GOOD ( 14.17 ) 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 When the address is arbitrated at send address, the hardware can auto-send NACK if it is an IBI. However, manual emission of NACK/ACK is needed for hot join or controller request events. Add help function svc_i3c_master_handle_ibi_won() to check event type and send out NACK if the event is not an IBI. Reviewed-by: Miquel Raynal Signed-off-by: Frank Li --- change from v3 to v4 - add Miquel review tag --- drivers/i3c/master/svc-i3c-master.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index ad999a1346686..122778b51c720 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -405,6 +405,24 @@ static void svc_i3c_master_nack_ibi(struct svc_i3c_master *master) master->regs + SVC_I3C_MCTRL); } +static int svc_i3c_master_handle_ibi_won(struct svc_i3c_master *master, u32 mstatus) +{ + u32 ibitype; + + ibitype = SVC_I3C_MSTATUS_IBITYPE(mstatus); + + writel(SVC_I3C_MINT_IBIWON, master->regs + SVC_I3C_MSTATUS); + + /* Hardware can't auto emit NACK for hot join and master request */ + switch (ibitype) { + case SVC_I3C_MSTATUS_IBITYPE_HOT_JOIN: + case SVC_I3C_MSTATUS_IBITYPE_MASTER_REQUEST: + svc_i3c_master_nack_ibi(master); + } + + return 0; +} + static void svc_i3c_master_ibi_work(struct work_struct *work) { struct svc_i3c_master *master = container_of(work, struct svc_i3c_master, ibi_work); @@ -1113,7 +1131,7 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master, * start. */ if (SVC_I3C_MSTATUS_IBIWON(reg)) { - writel(SVC_I3C_MINT_IBIWON, master->regs + SVC_I3C_MSTATUS); + svc_i3c_master_handle_ibi_won(master, reg); continue; }