From patchwork Tue Oct 1 16:02:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13818330 Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012013.outbound.protection.outlook.com [52.101.66.13]) (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 60F4E1CB512 for ; Tue, 1 Oct 2024 16:03:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.66.13 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727798627; cv=fail; b=A2MAw7DlI6yDkXcYk/I1x11VyY8ty+XeAvqOI3uoktIBwOBti2ig6JPBZu4d7GIDSxXLCSksr2da0cZxFEk/qBwftCnyuNVwQrXRL6gvHvmk23DUzQj47rgrO0x7F7GFHyTMXdG20MrcmKpnlDmW/zbIKeOZjUYrPJhPnHg8FfE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727798627; c=relaxed/simple; bh=HGmPEBh3mp0etKTNyLcYhyNHTes4xfDtOurveSww8os=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=q7NKWO2g6VAP7RVo+Gt4M54ugxj2lwSppPemdhV32U6VMcCly9zTfSDtShOYcgtedq10gFEY5ABum5lYSP032oppGe2+Ybutf/FBxawao/elQml33dp21atJDczuYZRcGLmCwiJDzc+CKbodLBV+iPulmm0g+bnx5DmTyQfu+0k= 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=D/oRgZFT; arc=fail smtp.client-ip=52.101.66.13 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="D/oRgZFT" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Bv8oIuO3d/wNoWfiduoIRsfCyyVSry+j/hSDC4ADfgBOEXlVUDyFoExXGwDz3S1yUJBhI+pExYSn1lhT3IdqpuAhoKOxUEv1+TjipW8DRIn0eZq6y1LhtCR0/5X/2o8rUnAfbA7AAtwPeU2IRyKdW24PzGeA1bKs6RaZNQmEmLDrtN/aPtEE8fluPTPYD/RYxMwa2k6aFuKXTjRZ5kGsGNg99hVySG+RZzpTiepbta2lNHSj2U8xF+taf3csTQdee7IJ0R3cE6WKY4nFXfQ2sQckVlBxF72KuzapNJ7ixy7FvEs0gYkxmRggayqfG5uHg9NGM+6cq8rfIk5IuhUwpA== 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=phGcqpjKBhpboIAfePzMU+xlXCV/r2VDbu5UN0qglSI=; b=F3gVSIQf9JtAl+zIWYyduXLB/GKe58KN5J000left4RKB898OzpyvsDMrsoKGRpO81w0Jj8ix8XemZMTRnDseNifaszZxJS9q3nG7p8r5AG+buMXqo6VwnnUbCOqFQ0+5gW4gg1inaHMcl6zAYaeVAXqN7E/Y6Iu9prwEPBE+V8s17DT5O70u6OMUVQGb3EzYMftgGpkqgazCH9NPYXmuqmQCZOngrWcrpUJVn8t6F+UsevwYj053lspK8QqYTZlxr8ursw8D+zrk9SRyysOOG+Gr0I4+IhxEH4+BXJrqkAQ9kFFbNntYmgfRi5xFdZ3EOhc8Wv+o91YO1hRjVfgEw== 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=phGcqpjKBhpboIAfePzMU+xlXCV/r2VDbu5UN0qglSI=; b=D/oRgZFTz4AS5e2soZYQ9QnFh9u6uTr0ok+id/5XJBwJUeY7q9+6tmZMM/6tNCEiwpLJAw2SWXek0nYRj1SrLIkizak33kkJHeExPLB9XM913ueVb+5uuS4PXMJ0qm2XYOfcuHqg+IB/wHVWKrj4QVVe4aa8tkLEcQdqYv3cxssu2FNebNPWuefSJ1ii3Y2oGtlAV47lrW47C/yc+B5r8iT3wkMYcR3eZEgr4L5XJ72x3mv4pO8b6szSxeWIc8N0jij7clJuTER/qEYdDpEhzZhhyu6+yStA9rE5vph8QLnUJN20pGbMbJe7S5CjcJokpECv6+A7ueZStCHzqI4ALA== 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 AS8PR04MB7879.eurprd04.prod.outlook.com (2603:10a6:20b:2a4::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.27; Tue, 1 Oct 2024 16:03:41 +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.8005.024; Tue, 1 Oct 2024 16:03:41 +0000 From: Frank Li Date: Tue, 01 Oct 2024 12:02:51 -0400 Subject: [PATCH v5 2/6] i3c: master: svc: manually emit NACK/ACK for hotjoin Message-Id: <20241001-svc-i3c-hj-v5-2-480ab8aed849@nxp.com> References: <20241001-svc-i3c-hj-v5-0-480ab8aed849@nxp.com> In-Reply-To: <20241001-svc-i3c-hj-v5-0-480ab8aed849@nxp.com> To: Miquel Raynal , Conor Culhane , Alexandre Belloni 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=1727798616; l=1870; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=HGmPEBh3mp0etKTNyLcYhyNHTes4xfDtOurveSww8os=; b=oUeixh/hE6hKHFP0GFQxi5DGSNggf9MDispFIBBJzUmMXx+VmMdMRY+iyFkW2dMpSXsBdp/6S jsMtmNlUCy/Ai2Bd6TrmoLQ2uE5uPYWFjHP1NpeVRZpEkPujcFRw8Wt X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SA1P222CA0045.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:2d0::22) 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_|AS8PR04MB7879:EE_ X-MS-Office365-Filtering-Correlation-Id: 45b9b58d-ef8a-487c-ac79-08dce2329e39 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?SE/F0aZMInTkGV/DqWbteTX+6StCjxu?= =?utf-8?q?m+Lj3KtBL8nNi6yT3tKOyYI6XlMtR8549iCDxesVZcFziGzWwgOjTuSarwq7gndZ7?= =?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ciuOSoq29W0l5NwPHYMH192MyiN2EHbgtQyFB1dLV2WHpgqrVvQchg9JUg8lznUE?= =?utf-8?q?n+uUiL8t4jQJBFb7GpoGNrKDZi59k+YE2vbl1sIwd4eoK0vux3G3x7ApBBFIbF7k/?= =?utf-8?q?WAO47BrPCWGTPh/YSAeePZD7fx5klke1FyPMY+Jy9a1KjQfD/E6xXvs7c9hCg9qmY?= =?utf-8?q?y3R2z04y8aOtbxDYw5NE7qXmdYKBnHKHIcs/+A9rLT2pjvzA/UzzJ8Q9Doan9Agtq?= =?utf-8?q?il5iLazOcyfU+yvUzDozX2P/U4pzwvOJzX3Fk54EXsqYl2dN/83RX9MlU0ElU/9NR?= =?utf-8?q?TeXMKH11acd9wvji5+66dHWTqYeKrySPFvQ=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)(376014)(52116014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?2WcMzU0tp+1H1wSH/wAyF1KFuI+E?= =?utf-8?q?ypdIrBCTsto9LFKDPKc9vwadFz/gBpTudgkcBmyscBQzA64hcFIGaL0LsA7zb04Na?= =?utf-8?q?So6k2DMjh2EXYbXPFgDl9LAHD2JPT3s2ikK+IiM9Xru6ZXFAPwSx/H5BSoJfTyBgu?= =?utf-8?q?1FBMyKorEMFyBaGN1nbTgsjXMnTOUIMv16tYbYQrz/KCxhpJK5VNfT3hdXYunuL3p?= =?utf-8?q?Dj/yZxmYn2E1juIIsTnNOtgiGrcPc9m8dfILvah3m1GHCZ9oUOo3+dE03spvmZ5mz?= =?utf-8?q?Ke1nxqJtH+aD9FKHpvEByQGDj5aeEcZUb2NdrIhBgAJjG+pEvkfxzGwSq+P08IjdA?= =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9T2nBy3Wqb95pOodFLqzc/vYvVq+aNKLpSvNKyw1pzby5mR+kfvhEZDikNB/uR?= =?utf-8?q?wuH5Xn8rzGAdEvzvExud51VTn1M8GihcvTUu1tXKTIKgqiBNvzBiwDd1DrcSYdh+R?= =?utf-8?q?dtm9+vnudTguCUmpwlEiKJJFItGJXZLSMaCTBeWFEgLv0IGe7UHNXD5IwXd3U8IkF?= =?utf-8?q?9AnRaUYXNcvLFo/A6Dzne7y1COYftplN2NQr5XhXEPWbTT/g4rK8UfbO4CQmEnxfa?= =?utf-8?q?ke2kNtQFWBosLoeuAdeVdFY/PToxlnJFxbUlv9WUblRm2i4E+Z5xfiHc=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 45b9b58d-ef8a-487c-ac79-08dce2329e39 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2024 16:03:41.1224 (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: i2M5T9zxo17/dyGgUsFkdI6kFprxRMoPMkl+16KR6SstpTfo3N1lsvVLuhpnWbi5Uvx4IklzVBeNd1U7oVTgAQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7879 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 7cd3ce2643f1a..c35a228f0c2f4 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -409,6 +409,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); @@ -1177,7 +1195,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; }