From patchwork Mon Jun 3 15:15:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13683926 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 83F82C25B75 for ; Mon, 3 Jun 2024 15:30:28 +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:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=8ynD+gE+IyeWlReDRPsIJtQA2vk9Ehv0wof1Yd3Q0YQ=; b=F3XZiEQC6xvEPK GuG+iRpzkGZD9IGdKHvYrhjr+GvZr6XTy4A+hWXNxKizVkDYqOsRgTcXffKP982H5ZOZhs9LpIGxj 6MwvJEp+MoWjRzmBzJdp+WIyXi+bPPGtEFX9IsTGjxdfc20QpMQqoO9DN2FYJxiJydV6+mMNv5wcz +nvrXoPv0FkaZTLC2OMyZgD/H4QDGQx4VI4eqDuktyo12w10nPTxiK4uAmTD9mkwck4LnzuVxP0d3 Eirb/b0uzBxl0Z5qAHWgbwxwgKV4lYTo02sux6oEHPlce8cIEjVicnGkoMFlsquqMym3AnG8VLUUs I34LTpmH+TlW5yHQeg8g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sE9dk-0000000HEdd-15EX; Mon, 03 Jun 2024 15:30:28 +0000 Received: from mail-db3eur04on060b.outbound.protection.outlook.com ([2a01:111:f400:fe0c::60b] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sE9di-0000000HEbk-1tOD for linux-i3c@lists.infradead.org; Mon, 03 Jun 2024 15:30:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IwlEvS9542zbUtnpprnYTLnkcMUwPBVmIy+wug58QFPMFpB8W7MicWB70q5Al5Dvr8Ezian4ooDo5IwWcvfJIULFKYcb+3v240umVE60kL+UappFfAMesEdZ2ZaFr4Fsz+kZ4yDgHvUimdQypPfjzSxsXyiyl6/FGxi+ucN9M1ySosC21xWfqUmAGBCnzKBfw7C/lqhgGslMXZKN/zwj8aHh5tYpvlBY2DUlxAT4VAQ1aaHhlSRCu1QkMAvgZjroUpP1t1h0zXLD8CS1eSMrVcaYIsK4suVGoOnNKrbFs8Y7IW3+JTqZiuLJPSB8P+UWSpo5erBeBgCR0Jh760bYSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=9wBUPdXHQ6sB8PkOXiw8IMEV06+hIgB2FCJ3VygLSW0=; b=lrYT1MgggAtFnPIKXbSSMLenll0ntWblOKfOoVeQwdAnyaRga4+adgt8XQEtD9S6EAO2t9Gh+zmu9RDbjb/7IFk+1ist6H7ksGRu/A+yzp8SAUypiSYxkkbqzd1+v/RwYPx+K32l7KbuAMiUyQk1zS8O1f+D9PWbSYQeBu7Okln1Z3xcrhkRrn8ThodsqPwMGQ2LYSK/h1tp+H0/fPmeoYymiUBuXEpa/9tpNs/DArydq+WVEmr2Ey84WKDOw5jjmCfsH1ghIrYDEVKs5BCjA4tz4mdiTV+oSQVLUwKUgiCyJheriY9TRJBUmsBgLlb+CxjxsCRKaH02CA4tgzBbqQ== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9wBUPdXHQ6sB8PkOXiw8IMEV06+hIgB2FCJ3VygLSW0=; b=jOLVUtrSneaPXLcYEXyDGCF33zlLnx5ovJgZ8t4eAjR+iJ/aQKSfoF/NyXrv47oZBg6wnxjM0NEAs+uGl/bXyJSezLJ+kOatuV6y/ksl+pP/DV95FTtaDqhxoRRIc6oVCHB2i36B24e4k1JMW3LqCbl5E/dzfGvIK12+j9YzyfI= 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 AS4PR04MB9624.eurprd04.prod.outlook.com (2603:10a6:20b:4ce::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.27; Mon, 3 Jun 2024 15:15:42 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7633.021; Mon, 3 Jun 2024 15:15:42 +0000 From: Frank Li To: miquel.raynal@bootlin.com Cc: Frank.Li@nxp.com, alexandre.belloni@bootlin.com, conor.culhane@silvaco.com, imx@lists.linux.dev, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] i3c: master: svc: fix IBIWON not set if IBI follow a hot join Date: Mon, 3 Jun 2024 11:15:26 -0400 Message-Id: <20240603151527.52235-1-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: BY3PR04CA0027.namprd04.prod.outlook.com (2603:10b6:a03:217::32) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS4PR04MB9624:EE_ X-MS-Office365-Filtering-Correlation-Id: 65beb6db-6433-4c17-2530-08dc83e008ea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|366007|52116005|1800799015|38350700005; X-Microsoft-Antispam-Message-Info: fGJ3SpU6Fw5n7EL3r0IfJB97kPa/6/X/IQIlQZIKXVeTVh4fdbbtbNtBdxVaz3icv6W/hXNWWl7KDU8wp/CnjrWNvyTuT11QobrN4QJDa7Tj62HtWJmxmdqZUXYYr0Lp2QjjQlkF48ovHR2rbNJpspmqqHPjuTYdWmdmPBC2FTaF7qLEuw2h6zJS5IgpKRF0aAvh2c5KMBcp2lz8kb5gFP1lyZMtVPRpnKb074kwY4tL8421Cd7NI1Q2QWkdzDnrPIRztR+SK1aczXla1DrSbhi5fd3+16eAYuWwD5idA9zDrvs7zrCEFktajwNNWpMq0mRxReDCP4NxrrlXu25L/JS+v8On9i+4lHovMLe1judq5tgOU6y7lm2JoZcubZIv1JVOfgPQ7DiL/jvbkSOXb7ma1Qkl6Qkic94NyRGYcRdmDgg0/OkBKe0YQVD4cI7N8L8mql7SoCvSZMAcrh29lSprfQGbMEztvNVWIvAZ87RzqKoWHbZynBKHDoSkMY1SsxttnbKvWJZ4yAlV1P9XfN6FPxHDNiy+PB7qM6NvTKqGMmv0BQFHUaSVsgA3oJBNOXc3hgxVqEbXioSPtfPkU4mes8Zh3gjLweXnWlLHtC10jfr8TRl22uKeRy3/zn8uzEGL2urpKuHGv+OWBcdVt10AQqQtiUVvDpTpGRwQ8LibXHoO7KEG3YAo0W41Xk7jxMxMwVf/OLmXJlcm68XyGNs5NP1EvdlZ6IHKKleZqAWUx7xlZBNKwbcs+U3+s7AqCy8qJfiaUDPIwNyhDjA9BnoUTEFjPox/XBd9941k2AiAS//C/7UOpuQsmcL7be6J/SoOlwIlhDadF34Q17nL9Qv321iTD1Syyq/qjRmrnpdNSFBvTUnxj4MT5Ngi/D2pXDDVibO68u5xlE+gpsiwNKWPzV3DAlYCqW+55pwOmZ1Ka+RVbfbpz18XNnRsviRHm3g7t4L9w5jhYL5F7+MJrRPTGSkai7MlTxCnEFhDvkQpFhAXerajHfZJkBrTdWlf/RfYKpY/y9Z82vVgQYUPXYP4/GKCObkqLzYVjGr+vYQv+glEAWIj1wlSeH/JrJEKqeOhaRB0e0E5av1sYlt4vw86J3RuH7AEBHmtPwDtyA35kBmGBH1nb6FNc/1ZpJXPpzZ7I+q+Bn9gxK7EPCwIQ6NLdnU6MArE4LiDjMVAG9Dg6sY6EhQKSZvh+hnohTAeA/Iy6DNHkeHrDURbD80awxQwUQrfQUTyI3iBJkdLcR2Jup0GPO0YsLsEhrRt2EDxCSl1G+6rBoFD7EdhEiwYZqKHEJT/OcgJS4omQbGUuecOA7Bra/doJ4G0dAtO9GqYhoq0cqRRRLWrFW1YEXTZZA== 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:(13230031)(376005)(366007)(52116005)(1800799015)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6ht1KAdOVCbZX4ijb2blV0VlxQ4WbketRA1Sn3xAH7jGGKiIHGqfH0binOofdbI/tg3IX6m9Yrnmi/H6POWvP8FSlXRnyIF9/uPAuymq/wejjNts/cqg672r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RaQgD9dB0GSGfRZqBsTJOnvZHszFjLCycNfSCHWZfHfnq4x7VDY6fzKHVC3uvy15AlZ5y9AL7WZLOU6EOSVOoV7e8+W/IFwDi8y/vJI3O0nofeWwNTw+bPlbinbbHdfPhLc/BdGzvVlAbvFgC9f7VJN1N93xh2dv0m89oNsqUxk78zmn+agWw1tGE3PAQ3Yi3f/S+BokCE06+5KkQN7NAaGUyFSEOwnKiHLHA0Z5rv8caqUEInRJChfOiJCvdU+D+Foj3KR0RZH7RIxI7xBlLF90evQvQhmyoZ+AtoO+TEfKCTrkiS0rIcW/GpLrIOTwdlWCEXwN6maQJ4x36cfUyaFbYVvb6/SBFmQgXu97sT++ZLqHh2aZGi523UQ= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 65beb6db-6433-4c17-2530-08dc83e008ea X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2024 15:15:42.6650 (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: CdgMr5uCYXCTalp4WG/AjxX9fIG8AnUT/IlEcD55AbHMxxivNm/G+8KksOj5ztbO8CALRvc5iKdT5RM6mszhoQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR04MB9624 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240603_083026_503463_4C8710AB X-CRM114-Status: GOOD ( 11.50 ) 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 an In-Band Interrupt(IBI) occurs after svc_i3c_master_do_daa_locked(), typically triggered during a Hot Join (HJ) event, the IBIWON flag fails to be set when issuing an auto IBI command. The issue stems from the omission of emitting STOP upon successful execution of svc_i3c_master_do_daa_locked(). Consequently, the controller interprets it as a repeat start when emitting the auto IBI command. Per the I3C specification, an IBI should never occur during a repeat start, thus preventing the IBIWON flag from being set. Emit STOP regardless of the success or failure of svc_i3c_master_do_daa_locked() to match I3C spec requirement. Cc: Fixes: 05b26c31a485 ("i3c: master: svc: add hot join support") Signed-off-by: Frank Li --- Notes: Change from v1 to v2 - update fixes tag drivers/i3c/master/svc-i3c-master.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index bb299ce02cccb..032fe032ec433 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -961,11 +961,11 @@ static int svc_i3c_master_do_daa(struct i3c_master_controller *m) spin_lock_irqsave(&master->xferqueue.lock, flags); ret = svc_i3c_master_do_daa_locked(master, addrs, &dev_nb); spin_unlock_irqrestore(&master->xferqueue.lock, flags); - if (ret) { - svc_i3c_master_emit_stop(master); - svc_i3c_master_clear_merrwarn(master); + + svc_i3c_master_emit_stop(master); + svc_i3c_master_clear_merrwarn(master); + if (ret) goto rpm_out; - } /* Register all devices who participated to the core */ for (i = 0; i < dev_nb; i++) { From patchwork Mon Jun 3 15:15:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13683925 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 C5367C25B75 for ; Mon, 3 Jun 2024 15:30:23 +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:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=IxvitEJKh2mJqcYUeHEDzDDVVTmjwOMCMluZ9MSmPqk=; b=ocnMjnW0Bs43wc RK1EQ/rL5jaQIqzfQ3vfwfOs8pjHgg4YFRM3SbBcmfu1Kog13zCzd35XWjKG4yEq45ZxsJB6BDzxQ BALYQHGCkpQXx4M1ZCXydoTQmNXDWy8IuNaPtwMVy1uAVvTrxIZzZ2QMp/J1wJQF9+EqTf4Ni+DwE fj8wRjr8/IheABcAhNETVQGkoygf0PJeyYDMfvJ5ChhFNW+S32WUmMlwZRUWKDzX1o0WdY4f+1LZg H2m5G/HZjywO11RhldlPMbSEo9I9DKzYsoG9FlYylbXVaPoOIDF9ZsNCymbDXlJ24puJNOg3y8v72 aId4jfeHj9sCFI+dXH6g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sE9df-0000000HEcW-1czW; Mon, 03 Jun 2024 15:30:23 +0000 Received: from mail-db3eur04on060b.outbound.protection.outlook.com ([2a01:111:f400:fe0c::60b] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sE9dd-0000000HEbk-1Yyk for linux-i3c@lists.infradead.org; Mon, 03 Jun 2024 15:30:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LxtNWgPUFynpkHHO3sH58rzAnhU9ynK6hu4LkbB7QA7JjkU3839MhIWrjF35GOsVChLgs+wf5u1sY07GJhfC+1be9DCKd3M5Fk+OJUiMPiZyvVd6iWAq7/Hwcd0sj0Fq/hiydUo8YgNclK7kRr5IxEbyHnftq2Mat3aXyHhhmOx8D2ybHPLuI+v+62WN0QIkWleU33LeXtMf1tF6+nzQL3Zn1r9u95FbsgP/SsfiGb90VCHEOjY9kMJQdQHlP96XXlNgHdJnjkYvxpNycJ+K0MiagL+lhkKo7fedf07jTCvI1ud8sJRw4F2zVyNI8rS5KHj4f3urx8KDZkk3bU0sOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=zWisBc9PQkOmgHG+ALPjmuDuF3UjhVUe3DAd/6Qs2bc=; b=VcWQm7BVzxeu6ICzUX1QukXJ1RbyJfVfyn63e2qKqQOH30y72fCC6zq+73uUhcUQR+mJb9dVbFowqwBqZ23GrmKjuj5f/IjkRkYHWopIZjO5Xwn5pLSGkKx/aQpO2QwsNYPvHTvG6erHX0Dy/VMCiyGNm0YlvFpmdF6KAQwDPdBo9xqLGJ7+1wQU75Ecqt0Pqd59HQ/WaWQYCGsNJiwbY/TwwlfPV8sOhoPgtSU6AMA+y/IJIw8JVnLtIZ0rpFWj97lgYSk7mz+YyHkd3ByN17Ql8WbohZMW6hja0Plmjk0Y/Auc3GZhHWMGLTyn79xwUJ8Y6WKma4RzaCnYIGrKHw== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zWisBc9PQkOmgHG+ALPjmuDuF3UjhVUe3DAd/6Qs2bc=; b=Grv1oISLXfbOFiHWC3uz4u2rnX5Z5rsbbZoqVPvIAJxWaZzEqo4UNWfPcIklFud2EKrESvjhpDjumhbnZuyDznpykwhfeq9I7OJpJB7v4pv1DfCF52f4A+NiKdGPLs3wdLpXAJYpJHArcHLy+fq3+uq64qjN5ROlP/LdoenD1bs= 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 AS4PR04MB9624.eurprd04.prod.outlook.com (2603:10a6:20b:4ce::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.27; Mon, 3 Jun 2024 15:15:45 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7633.021; Mon, 3 Jun 2024 15:15:45 +0000 From: Frank Li To: miquel.raynal@bootlin.com Cc: Frank.Li@nxp.com, alexandre.belloni@bootlin.com, conor.culhane@silvaco.com, imx@lists.linux.dev, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] i3c: master: svc: resend target address when get NACK Date: Mon, 3 Jun 2024 11:15:27 -0400 Message-Id: <20240603151527.52235-2-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240603151527.52235-1-Frank.Li@nxp.com> References: <20240603151527.52235-1-Frank.Li@nxp.com> X-ClientProxiedBy: BY3PR04CA0027.namprd04.prod.outlook.com (2603:10b6:a03:217::32) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS4PR04MB9624:EE_ X-MS-Office365-Filtering-Correlation-Id: fad26744-d99b-4e1e-75b7-08dc83e00a51 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|366007|52116005|1800799015|38350700005; X-Microsoft-Antispam-Message-Info: 6vWvH30gjLOGLkU0xpAYQ0hlCzUKJnr+TTPdRInORaPtm4oN8ws8l8mOrp0EuJl8OyrTdRHyd2o5y1tJT1PiXiEq5KfJzgimws4AHqGTwKSzPy5oi/+E73RagO6dsXlJiW4SpOFKI6mG4BmAWjxkYPrVbFQkeJdPudNgq5sfTueD4WIZWTq54qclz35eFmrwqbRyHn8SwRBqGEugXJK7GO01hbYYW6pjHkkKvtHjnQgf8+MhwK2ogJ4PnCd5aJgmMgRnMMVcib/t0oM05oLRN4Hjob307TSEalvWFXoGmf5AzcbBzkd/MBRMHBi4uhh2quTsKkWFDsdqbjrVFq9gIDo9ZRXih403S7V+xvtI1wWj9z26C2bpSl3Z/NcSjybttd/MGi8JCD9/vbfREfVzdP3Y2Wn3etTpFnsoEkVSQJOWqUZtiHDc1Mh1XUtR/cQKdX/oC5ukHae+B2EsFc+QF/bZ1AIB5P1/+UX5CpU0B+GoZJ2citMarbAJOBhTyNUTSsgfatmlDYrVPWyrPZBNHVkH+evQx2r8Ro+HVaBTw+fHDz7vE37VeLGcVXuxllCyAU7bhzj0umC4kJrNSf4C1nH8adXg9EVHoyv+Tzy1+Ifzv/Ty2oPMTreb1JlY9m4hQn0l0SlJxX2zXStconB+DDcjk23zE1HotgGu0oAQfg9AfWVmBtemWlETg8Mc1QQ17ZJdOO2FZmkkeFqZeuVZ+2M/FyiO5OK8KOTnCZhNtlYz+yoQzg8S8rOaHnSoEndrCf0tZj/j0W9021grQTI/Gl/HXItEMmSB7zxKkgedM7bwCl6HIdZpyRE3LlM2Lr2/vu3xQ5ONXyCFF+yTdt0/wm+3RptVj1GqMYQiNR8gvMIB5WhVVpjh57L/lCMW3W2eq2cyVt+4LNhVEMAUtZVSEbMkAY9kIHPAkCZJadFgTx4MBdKdO5flCdwAjbTPFW8NLMG7GX7I0xKkNKhMQZeAxJ4j2XD6r9HJfgoiDg+2daX3Ahx+oOaeT8OJCYr7J9PgFY/5esl3fhy92On1GRikTFauCVM/Z3cL6CkXVBY14TEGc18aS5Rdj4AY+Bfef7BSA7AeYNnh3HtItGM7t6sz8ALrJPRXvn+iWZZKMsmE7Jb/6JFjLSKA4zu0aY/FOFDakTs91wwhrJM7VN3+znZ9CBTZp7V+seZ45qpYB2bI6wLDlcpxjiczPLSRYXJHsMy9MPwVNrdGF1xcDDlGFhAVcQKmDiPacDx6+R+OUCq+Oa/XmGlxNaT4KC+pg9GgXzHX+zZluwtYAofcpmw/YDOrRCHS86mwSrS3GenrNfIeE+9ERtkV7/LeZTsb6zFlno01ss6sdKmMSWLBveYdZM9oMA== 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:(13230031)(376005)(366007)(52116005)(1800799015)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DnXr7E0NtMW9dqXFiz1xhzn6xaHZmqkTQSIMBQTAWPV819j06OSS/clU1U0AZRpP5rQSsIHIaby468OeApNtHz9T1DZXDpMVSYzBnEuf0dn9sUkYSLk3MZnrENSfBtbzsvNQHwuwiipHAI0J7srAEc6GCH4q5rMtQ0wu8dcpg8ewt8Qx1PtPZc688jKq2tkDq83uOPmK0f4MQ2rNkYg1I8VHRCD8FT2sNNwHenGB8dKVe/b0G3ECMn6AulQEz6yksU71NWHwRgPz82ksJI9jzysnJft6N90gUzgGZnNCpIS81RV6KdCVVJRg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rbmZifF4Z765NqT6D26LRMZgOz3zCcgazO3hpJiiaXGYiJ1eoNtnXMZ2dlyAX7TTWOYst7S1ANg7qMD/dpgdF4fprRNzbDRD224RLC55rhdD6J4TnbzJXzu9zvdFSfic++nvo23AcKCzAbPikU+q3YLC8mDysBgB48= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fad26744-d99b-4e1e-75b7-08dc83e00a51 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2024 15:15:45.0170 (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: i/ogYWg9ne/tRpmMR8dYCPdNiVeFWkFDwmmD7xySx62V8QaVc5qHS/XIEAUKztbxvWGlCQDg8NzDnU4F8Pd/Qg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR04MB9624 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240603_083021_436624_EECEA138 X-CRM114-Status: GOOD ( 15.44 ) 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 According to I3C Spec 1.1.1, 11-Jun-2021, section: 5.1.2.2.3: If the Controller chooses to start an I3C Message with an I3C Dynamic Address, then special provisions shall be made because that same I3C Target may be initiating an IBI or a Controller Role Request. So, one of three things may happen: (skip 1, 2) 3. The Addresses match and the RnW bits also match, and so neither Controller nor Target will ACK since both are expecting the other side to provide ACK. As a result, each side might think it had "won" arbitration, but neither side would continue, as each would subsequently see that the other did not provide ACK. ... For either value of RnW: Due to the NACK, the Controller shall defer the Private Write or Private Read, and should typically transmit the Target ^^^^^^^^^^^^^^^^^^^ Address again after a Repeated START (i.e., the next one or any one prior ^^^^^^^^^^^^^ to a STOP in the Frame). Since the Address Header following a Repeated START is not arbitrated, the Controller will always win (see Section 5.1.2.2.4). Resend target address again if address is not 7E and controller get NACK. Reviewed-by: Miquel Raynal Signed-off-by: Frank Li --- Notes: Change from v1 to v2 Add Reviewed-by: Miquel Raynal drivers/i3c/master/svc-i3c-master.c | 58 ++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 14 deletions(-) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index 032fe032ec433..0b588ed5894ea 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -1052,29 +1052,59 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master, u8 *in, const u8 *out, unsigned int xfer_len, unsigned int *actual_len, bool continued) { + int retry = 2; u32 reg; int ret; /* clean SVC_I3C_MINT_IBIWON w1c bits */ writel(SVC_I3C_MINT_IBIWON, master->regs + SVC_I3C_MSTATUS); - writel(SVC_I3C_MCTRL_REQUEST_START_ADDR | - xfer_type | - SVC_I3C_MCTRL_IBIRESP_NACK | - SVC_I3C_MCTRL_DIR(rnw) | - SVC_I3C_MCTRL_ADDR(addr) | - SVC_I3C_MCTRL_RDTERM(*actual_len), - master->regs + SVC_I3C_MCTRL); - ret = readl_poll_timeout(master->regs + SVC_I3C_MSTATUS, reg, + while (retry--) { + writel(SVC_I3C_MCTRL_REQUEST_START_ADDR | + xfer_type | + SVC_I3C_MCTRL_IBIRESP_NACK | + SVC_I3C_MCTRL_DIR(rnw) | + SVC_I3C_MCTRL_ADDR(addr) | + SVC_I3C_MCTRL_RDTERM(*actual_len), + master->regs + SVC_I3C_MCTRL); + + ret = readl_poll_timeout(master->regs + SVC_I3C_MSTATUS, reg, SVC_I3C_MSTATUS_MCTRLDONE(reg), 0, 1000); - if (ret) - goto emit_stop; + if (ret) + goto emit_stop; - if (readl(master->regs + SVC_I3C_MERRWARN) & SVC_I3C_MERRWARN_NACK) { - ret = -ENXIO; - *actual_len = 0; - goto emit_stop; + if (readl(master->regs + SVC_I3C_MERRWARN) & SVC_I3C_MERRWARN_NACK) { + /* + * According to I3C Spec 1.1.1, 11-Jun-2021, section: 5.1.2.2.3. + * If the Controller chooses to start an I3C Message with an I3C Dynamic + * Address, then special provisions shall be made because that same I3C + * Target may be initiating an IBI or a Controller Role Request. So, one of + * three things may happen: (skip 1, 2) + * + * 3. The Addresses match and the RnW bits also match, and so neither + * Controller nor Target will ACK since both are expecting the other side to + * provide ACK. As a result, each side might think it had "won" arbitration, + * but neither side would continue, as each would subsequently see that the + * other did not provide ACK. + * ... + * For either value of RnW: Due to the NACK, the Controller shall defer the + * Private Write or Private Read, and should typically transmit the Target + * Address again after a Repeated START (i.e., the next one or any one prior + * to a STOP in the Frame). Since the Address Header following a Repeated + * START is not arbitrated, the Controller will always win (see Section + * 5.1.2.2.4). + */ + if (retry && addr != 0x7e) { + writel(SVC_I3C_MERRWARN_NACK, master->regs + SVC_I3C_MERRWARN); + } else { + ret = -ENXIO; + *actual_len = 0; + goto emit_stop; + } + } else { + break; + } } /*