From patchwork Mon Oct 16 15:46:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13423609 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 66C83CDB465 for ; Mon, 16 Oct 2023 15:47:01 +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:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=O8edJfmCuex8UYG9RWP/neEZalR+GbE1Ju/ygyzXWts=; b=ZFeT+iYK9oaKTn vi+7kuI1rmh+EM3I/eDxsrlcwSzWdSzdI56h6WjpEGQKOaalByqBNx3KOk5FksWWKj2Z4kveC8sgV w6iEoof35/sgcj23yPtpH+8e66lzOnK6w+yimuB3AIcsnrjGCME+Wcds36iN3oLxLB2UbDu34OAjo DqPzWHQIDlgW42driA4StE8Zpjag35jPs/geGrfuWfX6jNGgobuaEC+j3Ak/utHZbVSrjORLx1pkN /DgMgX/PvF768xpwrzRmoOaSUez6GoOccH9HmIOnoR3YlH8XAJgE3AAQs07EGSsxCh3pyDAmncgaE 4DChrvS7qE/N5QjAPMgw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qsPo5-00A2Wr-0R; Mon, 16 Oct 2023 15:47:01 +0000 Received: from mail-vi1eur04on0616.outbound.protection.outlook.com ([2a01:111:f400:fe0e::616] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qsPo1-00A2Tr-0X for linux-i3c@lists.infradead.org; Mon, 16 Oct 2023 15:46:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DpE1/Gu8qSVjVtxiWq/3u9ip8SoHTJ6gJstQVrzci3Ps6yxiJZeHKBO0dV/bxfARQ+ShngskK/JmOnYOuPz96OVfyDVxSmsFEVuJ12Nm1rxQO0udkkuOz9IkZVgwRs9CtM1jg83x82X0xSYF+OMv7b8ZzSY+yMHmpAuM9XPLunz+wGDqmvtv3t97tpXj3v2I+UR2TDyoLUxv/lCTRDUyAFpYlkIs7d2qBDFdPqYqJiY5crn9NlmvRD3V7UQpWzYTzKfXMt/ZGbzpEeI8WQpG49eGaAn91xGL8aMRffbN7wnIXQtU+5EFrtFMzm6yjT5lXP0R7T1zXICYfarToP2KCA== 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=CC4uwQKDKlFvTEP4XC+cCKeORb/n/Onc64lf+Xn5MAk=; b=UnxgJfb+KQiQwCF1IT/1SYF7MECKTm+lXkG5KTtXfZVdjNfqIbFiDoH/JEtXbQZ3FynWRbUEbWIlPbFYG7fJq0jwCbhUcQ9qCQj7V9HN8YN08iTMzSgbVkHoKN4RMdBqLlz8d0B8eLH74iBmrlZEcukVFRo10AkSaapKDZeMiunXUONrzY/3zUPXafKHopvjuubW1DlvOWQIp7GMpisfssYgoyMFMyw19Ne0RN20n24ocnYIaUkkODmIFUYI4OADR2lHooY9P1yAofQwwyLEnsNJdcA7qPbCiNJV8IqXlqviMnSJCbO0PyDgvD9X0bYov4sYgYL0kBYVBz3bmcV/Ww== 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=CC4uwQKDKlFvTEP4XC+cCKeORb/n/Onc64lf+Xn5MAk=; b=jLEt/FVV6uDpNhuei3qaSI+goXO57oKtnw5yjgYGs+WWmnCbO63M3FL09Flcmpzb9DQEV3BqWurCIlxUjYU7EWl8HykwOAoyGXv4tHsdp++JHMg4H04xpyGfo2V+Cy54Plvi+n+N+CjRjgJus3Eiu0MtQnmXyDpUYhi5yDTqiC8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by AM7PR04MB6998.eurprd04.prod.outlook.com (2603:10a6:20b:10a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35; Mon, 16 Oct 2023 15:46:50 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::1774:e25f:f99:aca2]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::1774:e25f:f99:aca2%4]) with mapi id 15.20.6886.034; Mon, 16 Oct 2023 15:46:50 +0000 From: Frank Li To: alexandre.belloni@bootlin.com, miquel.raynal@bootlin.com, conor.culhane@silvaco.com, joe@perches.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev Subject: [PATCH 1/5] i3c: master: svc: enable hotjoin default Date: Mon, 16 Oct 2023 11:46:28 -0400 Message-Id: <20231016154632.2851957-2-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016154632.2851957-1-Frank.Li@nxp.com> References: <20231016154632.2851957-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0089.namprd03.prod.outlook.com (2603:10b6:a03:331::34) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AM7PR04MB6998:EE_ X-MS-Office365-Filtering-Correlation-Id: 4a04a720-617e-4436-5e00-08dbce5f1c8b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Pd94ebbfR+3dkAnX/5ZhnSTZT2kKLNly0Tok7v51wc1ooZ7SP9b42aS/NUmTKrGL9Rxw+m0dw6wFvwttErdYQQr4vyUqEPRRBv5wbVMqYW92rk4NZhxTmEnlab1Un2jreyD/fQJBB6OhNEXxEfpPTB5zvAmL/aNy0MEd2kymWmlLZjLhlhXPKkbxtXsZ2OjoB2yt5fdBr64kK289MK++oCxcW8fwhaV+dMZ5G3aoJEG516DSW6Wbf+XRLzoG8winA0vZ9SDaRe0V3LzdHUyVGJPxckJWafeCaQDUwtvfIawNvVZAHc3dMsT1wQI4UEI+V5zc+dQrKSdTap+o33sk5B0017kMeLDyKlrJW+H5w0TLkxYe7n3XD18Lh0AH2gJYW5BJLRG9tOtJTm3CN6l2zAxPHnKOE5Lffkg5x2sfcUuekeIVolLx0IMx6YdWoqzb6Gi2Pcgx0vonXsCv4MAC0atYVFCTfBSkzBBbItQBpBg00GpFQTp5rUVzG8s6fMEbajeTWoGgUdq5LDFC9vg6Es2LYcaYvS58g7uY2D7DlSlGHtjGRFP3VGVwkimJUkcyA7Ee+jeq4LVofAqfURTV77X29tnOsxPBTgnI+sfnJP+bte1+nvfH4gtEvjynsi/t X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(366004)(396003)(136003)(39860400002)(346002)(230922051799003)(451199024)(186009)(1800799009)(64100799003)(1076003)(26005)(2616005)(8676002)(8936002)(5660300002)(38100700002)(83380400001)(41300700001)(478600001)(86362001)(6486002)(38350700005)(2906002)(316002)(6666004)(6506007)(6512007)(52116002)(66946007)(36756003)(66556008)(66476007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1o3Sdf3+Hw+X3X1UE0VA8rBd9H3XLan3HNpLqpHZQ6Jctm6EdQkEuClyfdivcInfDxc9c1vUy4G03zv1OhkapS6uzhgSM25N8Aqkl+LsXHIh8OGEhLX1o7q8jk6/FWyByt1rllpA2Gn0noERmQ5sSD99VOSACiAyUJNq+VFEsPVOvXfnIhYWEMMEp13NkcTOH5gfkKDCpfO18OI7BK43Gle0REVoACXG9q37ujs85vwv800d5GXkInq376u/G7j2Bk+/Q4BCw1ldwQReZ6nghGTeI3qjMUJ5+ELF9qHrhp63yQpGdlWHEl1kfwajpjOf1pAdLSzWZK4XJY7HuTWy1r05Q1doKtb6nOJruPeE5njks+fZBfjz5DT5cogHEqHLc4cpXDW1szO+wE1RdJftZz4BkBBS+E+GILUFIkJfIznIQnBgxAIu/EmPjUBg6eIgG41U4mwKl4WCJRh/SGWdkgi4EbEcOBByMSFX1qga4Wu8iBemcxlYrLyvTfvvm795UD51yciOXk911XFks3R+dUnRoka70nURBT/YdH02v1Ib+e+8nO57EAHeCWcAwlYsWX2d8wJ/3appTBBOy0S2dkLOlp+zILcKJzc/36pJ2UlH29XNBhhPnhBXGSoQIAfNOUSCxasxflwo039QF9rLM3BU4yzeowKkdfBE6SniyJuJ3L1QcIZoL01A4M+pd5i7oeWj6HzPuOtUjc6HMJY9mMvWhwDa0gTnw5vv/tZmhq+DCDqGEkEhZIaPg7tbc+9AND1Dbm6vh+NgKr6LIaoKeF91oJKmztqD41rNQAGWW6lFswZXPm/quP9dRKK1+0FXJo48bx0llAedNbjj/T2GjFxVS9bCNw9WrV3XPJWsX9EpH3nuS7cxLApw141DXMGZjwseAbNbNfGRMPVk7G0ygUmwrT3bg5LvqCM4+g0qk7PUIDtOktQGjbg4Ul83Ej6kjz4gxg9wgF75Xw6iDhuPU7Rxny6TnKSElkcoPXmi/4emuT5P/Oihj+aLugUo80/CcE+GQ1080VF632/SBhpnkd46iUMWIf0Vlk9cQGq48xUuGOHLRYBXQnlir7jFSDIt0moKPlzOgb4oGSDjjdFfD1ADec9gS+CGyi3moAdKBkqvcnikafBrkRssh+BNN+XUwcEOwQXxoBxRGKFCg8f1jHbq/ppVbSly95meT5/op2wkq/5CowvRu5Ymaq2BZSZQBUpFo8t+BDfKYG/+FPTzsOtZDr0Qp+XzyeNEsl4hsvXRmiLThM4ITydX2nk5S871wzNCQlo07n/UqnNjn/u3VsqdWYMYIrxHEBPzTSzzoijoLZ1Xb8xMklatNpd7v/vK3YUC99cTVT7vK+ABGo0UQBpRPoOtkYbrJn3j2CcVx9xnw4P6b9BmBzu+SSue0+ngsxrohkHzyC726kKFDV9ehrUprOjDiB4K2e8InA6w2+4gUPR7HAQYTdl7HxOAZKwwvOyE+P6mM/6a0/cnyFC47zcbScGN+gq6dXULJ45ZakViRMb+a8NGsoynOqca+AxD+BwdMxMVQcUdji8PAM0WAglxv6RvK1u4+v9Rkb833ck= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4a04a720-617e-4436-5e00-08dbce5f1c8b X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 15:46:50.0264 (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: 5cOgdy+IuVBBO5JR4VEUYqsZFkWqRH3ZVBwlVs9oIBmViBzCdsBfknlAYltG9nCIGLAo+bFEh3VbJE54LL51og== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6998 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231016_084657_207799_9C874711 X-CRM114-Status: GOOD ( 10.84 ) 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 Hotjoin require clock running and enable SLVSTART irq. Add module parameter 'hotjoin' to disable hotjoin and enable runtime_pm to save power. Signed-off-by: Frank Li --- drivers/i3c/master/svc-i3c-master.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index 18bc277edc8a..f0d99b029e5f 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -128,6 +128,9 @@ /* This parameter depends on the implementation and may be tuned */ #define SVC_I3C_FIFO_SIZE 16 +static bool hotjoin = true; +module_param(hotjoin, bool, S_IRUGO | S_IWUSR); + struct svc_i3c_cmd { u8 addr; bool rnw; @@ -1623,8 +1626,12 @@ static int svc_i3c_master_probe(struct platform_device *pdev) if (ret) goto rpm_disable; - pm_runtime_mark_last_busy(&pdev->dev); - pm_runtime_put_autosuspend(&pdev->dev); + if (hotjoin) { + svc_i3c_master_enable_interrupts(master, SVC_I3C_MINT_SLVSTART); + } else { + pm_runtime_mark_last_busy(&pdev->dev); + pm_runtime_put_autosuspend(&pdev->dev); + } return 0; From patchwork Mon Oct 16 15:46:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13423610 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 07DE7CDB474 for ; Mon, 16 Oct 2023 15:47:03 +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:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KnsdP9A1egrMeUEUqMMw7l7A9lMID/ZFmBjowdEnD3Q=; b=AjzVDwKSOHAUYj kedY1zqP99fi69ubz1uV/YUP8SxcPvkJyw6LCMqnEJAi9IQK+ySOVUYOnqTLSyT1dndKTIA90vtpU al3ro+wnLebvqhBBhd83nWfIlA1n1yQTmBJxn1zY9BYYzRfA6dZPs29pvqhIE3gxEknndvG1sr7X6 Ks5gEo9GgmcIVGbUmN3Ov0O9L3Yq2LAUjYDze4huICpjaAnb+P51vg4jSSq7z7SoWIjPMbC/FZsHO b70Mx08hjelDxCnQjlgHsZnLULP2nm0GXSaRw0IC6z/ysVTTI/jbSxVKhN9zHHtotdGMBuXARgzSM cuL18UHSIXc1QOlmp8Pg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qsPo6-00A2Xi-2R; Mon, 16 Oct 2023 15:47:02 +0000 Received: from mail-am7eur03on20614.outbound.protection.outlook.com ([2a01:111:f400:7eaf::614] helo=EUR03-AM7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qsPo4-00A2VQ-0p for linux-i3c@lists.infradead.org; Mon, 16 Oct 2023 15:47:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MHcAIEyeVxYH9ZG/l2Vet2h6x7UeTlmTQWI2hdeSlzCjhuHnlGNFiIrIfMjlSPtjWFWdpwT9L08SLGWn0AHBYdr2ePboZfckPIHwyoj7xmLv+ag0p5uxfrFKXhDfRYXlL3r/aFL9GLaH4TlrhGT4Ym23wMVZ3gAcJkFAIpbj2h4Cyve/vgLKPp6jMwF5wU7ao53tFMFEuvLK+sjZ9o12jwLSaS86kgwp3suMbj8jMaFYYepZDR9yeCbIjjkvSaTxQf2S+VYf3OwWi43M6YTLtZ5Oo3/V4d1sttA6F+1nHg2PjvIdSGg9+vzuIZ4AfZ1TASsBzxHF9oGB5Jjj+AbQ9A== 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=y6wYLxGqIqDAdgK8VtmcvwBleY7Zkme71O6KK0sSUG8=; b=DeuvMWkjWa6gYQq7wPu77jzPiDPUah6LiE2wog1N+tiptqa8vzXr28qBaLSfsWuzeXsP3bmLKX3edDIT3rPxMJpVMBH9fjde/DQwh57z5nHAj5i1qhTFQIkV6dB31OetAUSf4nWXfG/d7XEoY3aep1amLMhaAYhjPCilj2MQcwSbDNiQuZ58RPWVDlGAR17zMrGUEstxns599mrcEYzj2KFB6tC6hCBc/q9X7gnqFza/Yl99QQdUijeTEYy6+Ry4DTOnvv1nJyHJVqQpbth+oC1up36frxIkCiUHkDFh/34flcHmLDm6Q5OgckzO8ZdYD0URUuVpKEIbAqH29Xsu7A== 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=y6wYLxGqIqDAdgK8VtmcvwBleY7Zkme71O6KK0sSUG8=; b=quZ3tJ87J2E1Xeb9FiNoUY0SJV73FIiNO1C4CZOo/VqR5Rj0GYxSqX3DJ0XSAM2hOU7xCwJTFEAdZ8yXYGVOQW9aOT7OI0xUvnEYhuW+BNPgg+Ps+r8q/bt3rlB58HJIHRf9zkgAfCURbsN8EFJanEbi2Fj+ELQ2GR3rdIj+MeY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by DB9PR04MB8329.eurprd04.prod.outlook.com (2603:10a6:10:24c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.47; Mon, 16 Oct 2023 15:46:52 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::1774:e25f:f99:aca2]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::1774:e25f:f99:aca2%4]) with mapi id 15.20.6886.034; Mon, 16 Oct 2023 15:46:52 +0000 From: Frank Li To: alexandre.belloni@bootlin.com, miquel.raynal@bootlin.com, conor.culhane@silvaco.com, joe@perches.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev Subject: [PATCH 2/5] i3c: add actual in i3c_priv_xfer Date: Mon, 16 Oct 2023 11:46:29 -0400 Message-Id: <20231016154632.2851957-3-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016154632.2851957-1-Frank.Li@nxp.com> References: <20231016154632.2851957-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0089.namprd03.prod.outlook.com (2603:10b6:a03:331::34) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DB9PR04MB8329:EE_ X-MS-Office365-Filtering-Correlation-Id: 034fbd37-0c12-40bf-625f-08dbce5f1dd4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JgTpxcQQEV/sVhOP2G79UuNaFe24g3ryy5V8MTpQJ/2z7qbevjA5IDqYkbbC0iM1iv+bq/0j6LsFKjqClwFAn/+NuFtdJ5yfAc/9/93p9SVkwKx0fCbGfEd4NuDh6GR0Cn++ffmbndfpPjk0ycQ5kBUvUwV+Q+me0fWiuGugNlV1cZchbpPgsjyhRIviTAn1lpmJ7IMITpVL+9LuWZawVorBOGLVavjGuwcCKC1ExpniRTjaF978joyvrMx1Z+lx7N+XtIJjVXNoyuN1M2BmvtcNBTNcDbPjxBB6mOfEjGcN8Zcd0BNUdHvjCudDBOJbCz4SnsIuAn/9rRMBxFGHE9txT71ymPNrZIpxGoD8cgObSk4SwiolgwT0po4blOgTBLY9PZ1x5BKTDbBm7UTqKTU4ESQF8FCQ0g5kZZBehjJRTNknrikh0glBMm9Lejtb5CN0CBZPgmVTEDQf20FDfqjNZruz8TGpVSTxmUgjLnAon8iahlJH3JrMRa1evo/T8UyZnatgDs8FYl2kYhw9e7OsUGw5XejJuQdAgSWpt6SZziV6MqiDILqn8k5JwMTaUClkUWfEDqb8QfEwhDU0ZVVfs4rhWG6nAJ7k295LQvbWGk0Z+/IU1bxMG6lVt0hf X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(366004)(136003)(346002)(376002)(396003)(230922051799003)(186009)(1800799009)(451199024)(64100799003)(6666004)(6512007)(6506007)(52116002)(5660300002)(8936002)(8676002)(38350700005)(478600001)(6486002)(1076003)(2616005)(26005)(66476007)(66556008)(66946007)(316002)(41300700001)(86362001)(4744005)(38100700002)(2906002)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?/sshdKD2AKBO07XeQUOD7Btqg5AD?= =?utf-8?q?znfo6cwvJcmD9xjEGNZ8K8Iv6+PLQykMYOSKcEjVo6yMlHAc7praBBHXIeheD2Tm5?= =?utf-8?q?cY4uVXO8l0VWNVMhdHp4UmkrbKU94H7qSD+BYgKvqChrxm8mQVY0Jg8SZDXO7fY1d?= =?utf-8?q?li+Y78AryJ8oxyyGmjuGKTXRzCpsWNFoGZ7lQ/9NdvyA6E9yN/mVcU6GtziV5Dob6?= =?utf-8?q?/+t1xAXxSqGUtY+kCa9C3HEs8MLfJtbyQU5KLp1mWtdV9XLPO9EgKxTcZ5Nn7FS0F?= =?utf-8?q?v7wJcfJtH1lYjjwF8p5RigBUwzCau99la0xCuzsDPnKGqWRnpnwN5yjEEPjtELgxl?= =?utf-8?q?8Hkwj1IKGbWHWNL3qDoVMhNOWyfYdfWrLc8BaUMUypbnVvAaJneSOVrCyubpQ8dHx?= =?utf-8?q?+9JA3DBg7hdDbJrNFGqOSfsReLNsMFepS7VN3un0rpSXZHhvUPyujKhbxXOEl6BeZ?= =?utf-8?q?uYlM06g1lZZiaHYfMGfuAcESUUQ4JUkV4qXSGBB9PVf4VT+5/Q8H8Iaa1vzgBZQPo?= =?utf-8?q?ujnS/29mLFhE4OX/XKNaOITwkBinUGj+6jPgOd29ZCjsb5z5gaEdC16tQ9UziBRep?= =?utf-8?q?A1NnloPoP2wI8n061qVJaKqfmVvHAlcQ6WC8EZoWuD4Cbb237urzp37gfV0jLYjky?= =?utf-8?q?gOMrQrIQnXsjTeFYoNsfXqSdCfdUwH1I0ZhIaV1aA0mA0NibG/JnA0piU5ryg4Bvp?= =?utf-8?q?cZ8jZeCIl7u4TovO7jjNjgpEra5wNYrwJOBT+woF9MvhzWhw+zM6KIVfjRgVb3HOL?= =?utf-8?q?nYi4C9Ne4hMEaL4JvChmoVGSjTqWeNxZ+dP/SXlkQuJcEaeI7SgptFjYyb4Eub3Bt?= =?utf-8?q?92C6CMVTzuqYy8AiQ0gYCsJmgCDi6TjBXHreDVxq+IZyQfHadtiSfcLyrqICCwnXP?= =?utf-8?q?gLjzLIlWCJxhorKS3ZHI978fcxru8ASm6aqr+tGcueKdTKzK3YylDo6Kep26Gn/BV?= =?utf-8?q?0vLUsyohEhin7igpiWiucBJ1sP7j0gSbb61wgVUOo8Q3dA7EbDVVpwmO4ahGLrjS7?= =?utf-8?q?awSzmDJ1EtPINPYqR/flXCq3MjwlRQ9P/s6QQWWHAkMMlrBOq1xZK8JBQmYSalX02?= =?utf-8?q?azn4V0Byr2xUpvEjyu9OFPkIfAwUB/Av21hGXn4DVcRC7Tj8Eio4Rw5lTBtXcu6Lz?= =?utf-8?q?6Wcb0Bz7kfp86N6pQOeIza6eGzV1yDiQqzSiJI6PBBqNK1FgT6Laxi5fINQCBBX5X?= =?utf-8?q?GSOF2slfMrB8UQgNiVz0A8K+gQEBHg+5zmgU8ZqeY1JeB+Uk1l0/R4btJLyJLvAzu?= =?utf-8?q?Ko9Xru9ZZyqHBKwxEKgsUVmMd/R88Q+U2/pljbFdRvD8rMpzwYIdZ+bRg/5QS+jOn?= =?utf-8?q?WutxU1UV2D5fyN+CVisomhnP2h4XQP9QXoLssqxqBCPGOO4t897p8dID1Y5dWrKXo?= =?utf-8?q?N77ZDQzMFyXrM6hK9jvhuUIY4fdhJsjOtuaqPtZu1xyGazEkC8J0QwbnxdfP4n0xL?= =?utf-8?q?v0U+Da8666sWACzozCQ1LIoSz2u93H8A7KKjqppchA4zlDT4m42umz0M=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 034fbd37-0c12-40bf-625f-08dbce5f1dd4 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 15:46:52.3691 (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: qHK+GOFjTtmnVvDxP7agUGS5rSS5ak5mlYcnxQsr506ZReVVfQv74W8H+zKDWByTmzSOpPLFThk67OXSgNvdiA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8329 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231016_084700_296278_1E3722DD X-CRM114-Status: UNSURE ( 9.60 ) X-CRM114-Notice: Please train this message. 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 In MIPI I3C Specification: "Ninth Bit of SDR Target Returned (Read) Data as End-of-Data: In I2C, the ninth Data bit from Target to Controller is an ACK by the Controller. By contrast, in I3C this bit allows the Target to end a Read, and allows the Controller to Abort a Read. In SDR terms, the ninth bit of Read data is referred to as the T-Bit (for ‘Transition’)" I3C allow devices early terminate data transfer. So need "actual" field to indicate how much get by i3c_priv_xfer. Signed-off-by: Frank Li --- include/linux/i3c/device.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/i3c/device.h b/include/linux/i3c/device.h index 90fa83464f00..f2fa7ee5d96d 100644 --- a/include/linux/i3c/device.h +++ b/include/linux/i3c/device.h @@ -66,6 +66,7 @@ struct i3c_priv_xfer { void *in; const void *out; } data; + u16 actual; enum i3c_error_code err; }; From patchwork Mon Oct 16 15:46:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13423612 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 69A1BCDB474 for ; Mon, 16 Oct 2023 15:47:05 +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:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1AwhKgMdQoM+ivBv9IGy9CkWBMFxn74F4wAQEiUS03U=; b=EX1NV5rqyeERSa wCjHKkBccSATIhYpRdkHQ8KtiOdYRJVGdQEKKNzCDVHGIIa9uP3N1vZ0M47cn9ygLuaCjS5xHCPrd pciQ1C3/FpUb8MBY7ycTaIVQykuiCo0tFdiBhv/D4QuU+s5bQs3Krq9oVgXoS98GNeCXp2o6icZ9X 6HldwEq7JSMUgYZlfi818vfoecTMhFRCehPoqIBa3orzn4T5Iz/+3+zlhynWmcVN+ybHNfuUlSdbi BVdnjWZBINezAuosaHaLZZrnwSmN7GzqrrnnbojB+MAaxO2/480tT2WkMnhBsVvMaSPbwacaP+kK1 OX3moVyIt/jgb2gLrDFg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qsPo9-00A2Z1-0O; Mon, 16 Oct 2023 15:47:05 +0000 Received: from mail-am7eur03on20614.outbound.protection.outlook.com ([2a01:111:f400:7eaf::614] helo=EUR03-AM7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qsPo5-00A2VQ-2a for linux-i3c@lists.infradead.org; Mon, 16 Oct 2023 15:47:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FePhy3FDQKkK4p/W+jKqMrAhfLaiHcxhyoOMmC515f/v7CjHHE2ElRfFqakeKdjr17gkGFa7A+hlIfzLgCw7sQFZqZu1r+gqw39N9/pz1LbmaU8jh69QIZDBbvT75vHpW5WWUe0nKU5hQ06uNOs6Lr+R0Q3l9KQwQNTKXjA+zBEbTRjCBspj4V4WZo1fgIQpWyX0R+aNECJxvoLic32OiNH2EGaAnvPf201iiUVybbpBjdaX+exOH071q1HlGunUAK+RZ/qQanZmhd1OXPzpQRk4xShpp7s2jBsFAoGT77AzMEcIfKA0NcDp7SbinZZxNbnAvPPbjHvB9EzCRGj4FQ== 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=OLHHTxYnZgBT1P+zxKSvT0yfK4m2Bh87+eq/thPm0/I=; b=eZjJkxjJasigD1vrZYNDdpc7PqAn2iK8op0zBKBlpNOqSQj22vjXBKZppCrIPHFqcnaYGXEQ+KFxUtf8CMjjw1npE0vMlFwWkJvi1OhSFUTfzqfYpVK1C/24kElUsR9OM5hBm//G9K/BAcGNsZQwV/AzErIuc+KDr9wAv7gNMDqlDEdGKdyq2bHPq3ZFigU9rOAJfYlujwPyZBZp+W6BmjW2tpJJOl9oLHxQfXwyq3sV7GHwsnOkwuS9NLYvlNfdDHxtUDaCbLSlIHWKE+xqa/0+JmX7q5bDntUVfQCet3HOt9jE1ILVXD3fQIgzelM8rtEX4y+IAaz95mFzy07aMg== 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=OLHHTxYnZgBT1P+zxKSvT0yfK4m2Bh87+eq/thPm0/I=; b=aKMROMOkMevOzDzDvm82bWDCv82tFFW4CL0FZ7HtkgeofpJ4/2KiSVAAzmz9l43AFJooVBzJ/z3NflIwBcnAgDLOGZOeAAdkOPu9VIxD4xYoIu91FYZ4WoFb1ai+1kghjzW6Ok4my61y/JXE7BlLy/t42lDXJe2c/w6z6zCstoo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by DB9PR04MB8329.eurprd04.prod.outlook.com (2603:10a6:10:24c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.47; Mon, 16 Oct 2023 15:46:55 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::1774:e25f:f99:aca2]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::1774:e25f:f99:aca2%4]) with mapi id 15.20.6886.034; Mon, 16 Oct 2023 15:46:54 +0000 From: Frank Li To: alexandre.belloni@bootlin.com, miquel.raynal@bootlin.com, conor.culhane@silvaco.com, joe@perches.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev Subject: [PATCH 3/5] i3c: svc: rename read_len as actual_len Date: Mon, 16 Oct 2023 11:46:30 -0400 Message-Id: <20231016154632.2851957-4-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016154632.2851957-1-Frank.Li@nxp.com> References: <20231016154632.2851957-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0089.namprd03.prod.outlook.com (2603:10b6:a03:331::34) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DB9PR04MB8329:EE_ X-MS-Office365-Filtering-Correlation-Id: 13f4452e-4a36-48d8-02a4-08dbce5f1f3a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sEnhSdoX2aci+Tt16neEBngChGa37im3tUGzfvjurC0Phxy1mn7fU53TfMIQBzbU9wv9CVYhYA2QW+aFzoYinrr3y3t8etrpyPP6Xb/mbK7ormB0bcKXmYGaRCGwXR9Yjg/Rqas5bVAuLjhzTlOb5K3JAHtJJHKmyCEhVSGwSNj4Ic/Q3nDRbmg/ffzr1VCWwkXjwCkN3ePGRWhFm/DHlCB67kfJUvTSNKotlYPM9SZfV6dlOI5qJZ2HFXLlHl8vALMIoYIFBJEUgUZqFOnwSKVmGxduMoGCQlROLPqfM/YZ1uG+xNyeut7pnTXXTqLZ1VbJy/hyXZbrdx4LI0+q1USHfXOt73OCxzfkL8e7+kExv8ew/7jG8zjsxzExxxz03Zpq8pJWRQv0US7MBVl7nsBdggoXuNlDrkhPdaXUYFjj4tZIi5oJLTqr7GBfDUPL0uqfJcI1KLBc0B0B/+ssKgemptGQEsUa8wTGazaU4xWTSRSf1i1fT4JIAF6707cFv3WtbpWmmGVIaFhWFkRgwTc7DkZIKBbjU147yPLC3YsQFpvKOS10tsmbFrOurS5ZeQQZgJfpNLm1ZBGmNgkIr1XC61K6bf066lzmLG2tS04CeMBZB54ZHckaxObLZZcA X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(366004)(136003)(346002)(376002)(396003)(230922051799003)(186009)(1800799009)(451199024)(64100799003)(6666004)(6512007)(6506007)(52116002)(5660300002)(8936002)(8676002)(38350700005)(478600001)(6486002)(1076003)(83380400001)(2616005)(26005)(66476007)(66556008)(66946007)(316002)(41300700001)(86362001)(38100700002)(2906002)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NQWI7pH9Xi9gNjr1mSV7lB5IUbcqQp0e3BRxSU6+/uMBfbIeuI1yeDCG0O9WcS1bnkwHebrU0Yd0sQZRPdy0YMnF4OxyXxC7JIGqr/Q1wXmo8TAwHlNOm8xXVkbRdGC9XGIxsiKp93AilfTNweuIalNN6kigcOMYzpSZJ4QV33SA8orEqjlQdKJtkKAt0C3FuzZJiTBGbd7ktX08EDuHz/844mx4vIbq38FB4n0dnRdhVTJsSEBCvDx3R6I+cyo+R9pPNw22SDKnhZSvUwk9fc6yXY4FvT6cFgDZzVInHhCDFNKnVsYKREGvfZcNHo71uXVs1YmAmOf8fEMq0fZmT/MosS3EjXUkWeCklx4V+N6rIhqd2ClunvAsyMbxQ0qNFulGUtQ+hsFdzQCj/8afKzh/54Q7MGn7YDU6JeLkGSA3cWR9AH9K9+PCPwk2pTHcgaSvyy4eEAr4kn2cDlKXFeVEOITGiOISllK65tbssgMmJVtvdly7EgkrQci/2ThuLjmL2uXsxDzw7cnoHB17eeh4M6sYYf6cirFppZTcgldZ7tXGBiBx+4n5l95RQl6Lmp3xLuVRV3l8UT83tcuVwrVB6WpsTk+J3vLTKq9wtGGLtpft7+8J3cEtnGwd6EEeg9Zoorjs94RqoLMW0UFav0jcgv6cb0ULp++hiCcCmdSzXJQDiai/r8Gcw6329SQAHQjK3gEvor1ViHJ/J8xngYY3uQK9iZUhG5Ocexhxf5wge/S2edpQcHPXjYKrTYA1ZRENGLmrG2F52juNuMNM0HBUwrX4cRV/1sY3SqPzMdX7QLimlMe1cMmLUtX1CiRXk4f1CUbQytl3DMbbIow+4BopAeDePVnVwHX9WEmHvgNQT6+kGY4tQHlXyNPMGpx1GOOu547m108fUHoxXh/y+rD5uGt2CpoHU/FEiz7Bmd/IVxtxT18pIVFdgzcpeV942dxq+JljtHFtjfnbxcM5Jc7bXgkoQDpl7yasTgqrpZF/RDmX5IJKvlF3PdBAl60chMnmud+XP1zaTHfc+2R12kjqr5OqnRKE7M4jnOMBdh5E6/S0Is3a01gnAITVO5FERk1zZL5VKrMDm4zkM0Yqyid+riVmXIP5uXBtjBdkkrmdkP2JyM7Hekhp2v9vklR7NJlXP++3AQXTeKk6TPyFh4QbpykBGRseSzaAunfTefwBhcLyvtUyg8csI5tXOPHmBTGND1KaotMT1HKGIH0JvXPGzDVJ3dcagfkua3Zmdx+p5FnrylvXndrGf2O3n3pWAW+9UDli+cnWiLMdJ20jxTO10LbiQyiDnV9sczcQr720ekNolL2WlmuiyIUlRvGMXeej0U4FMe56DjjLFYWq1hiJcSs9EKwzXY+T8nKYGaTWMSjKXfp+p2lwk2FxzpCqy5CDVcfXwdBEpbs7kmhNw1ozanyYFE5JbH+L1p+Q5v5xlXcfMwcfZ4ejbZKiWkAzmk/ka7MMYllFwWpa7mO1yRuG/PmzEkWf1ZT2FaMRzxkFalhGYXWNIN4h5MN9hWTKRobGo+Ze1GwXEQrdJQPO/WUD8vsva+yIQ1VKYqZ1WH0= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 13f4452e-4a36-48d8-02a4-08dbce5f1f3a X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 15:46:54.6724 (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: 2siZ+6N1jqsO6gBklU2WvZgLnMz4RqG4mUBlmC9GO35MDrbghme0tkrCph+c3q/GifFezA3vRpK8KWfZPgB4LA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8329 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231016_084701_841965_5877C428 X-CRM114-Status: GOOD ( 11.01 ) 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 I3C transfer, target can early terminate transfer. I2C transfer, target can NACK write transfer. 'actual_len' is better name than 'read_len'. Signed-off-by: Frank Li Reviewed-by: Miquel Raynal --- drivers/i3c/master/svc-i3c-master.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index f0d99b029e5f..3570b709cf60 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -137,7 +137,7 @@ struct svc_i3c_cmd { u8 *in; const void *out; unsigned int len; - unsigned int read_len; + unsigned int actual_len; bool continued; }; @@ -1022,7 +1022,7 @@ static int svc_i3c_master_write(struct svc_i3c_master *master, static int svc_i3c_master_xfer(struct svc_i3c_master *master, bool rnw, unsigned int xfer_type, u8 addr, u8 *in, const u8 *out, unsigned int xfer_len, - unsigned int *read_len, bool continued) + unsigned int *actual_len, bool continued) { u32 reg; int ret; @@ -1035,7 +1035,7 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master, SVC_I3C_MCTRL_IBIRESP_NACK | SVC_I3C_MCTRL_DIR(rnw) | SVC_I3C_MCTRL_ADDR(addr) | - SVC_I3C_MCTRL_RDTERM(*read_len), + SVC_I3C_MCTRL_RDTERM(*actual_len), master->regs + SVC_I3C_MCTRL); ret = readl_poll_timeout(master->regs + SVC_I3C_MSTATUS, reg, @@ -1073,7 +1073,7 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master, goto emit_stop; if (rnw) - *read_len = ret; + *actual_len = ret; ret = readl_poll_timeout(master->regs + SVC_I3C_MSTATUS, reg, SVC_I3C_MSTATUS_COMPLETE(reg), 0, 1000); @@ -1155,7 +1155,7 @@ static void svc_i3c_master_start_xfer_locked(struct svc_i3c_master *master) ret = svc_i3c_master_xfer(master, cmd->rnw, xfer->type, cmd->addr, cmd->in, cmd->out, - cmd->len, &cmd->read_len, + cmd->len, &cmd->actual_len, cmd->continued); if (ret) break; @@ -1241,7 +1241,7 @@ static int svc_i3c_master_send_bdcast_ccc_cmd(struct svc_i3c_master *master, cmd->in = NULL; cmd->out = buf; cmd->len = xfer_len; - cmd->read_len = 0; + cmd->actual_len = 0; cmd->continued = false; mutex_lock(&master->lock); @@ -1261,7 +1261,7 @@ static int svc_i3c_master_send_direct_ccc_cmd(struct svc_i3c_master *master, struct i3c_ccc_cmd *ccc) { unsigned int xfer_len = ccc->dests[0].payload.len; - unsigned int read_len = ccc->rnw ? xfer_len : 0; + unsigned int actual_len = ccc->rnw ? xfer_len : 0; struct svc_i3c_xfer *xfer; struct svc_i3c_cmd *cmd; int ret; @@ -1279,7 +1279,7 @@ static int svc_i3c_master_send_direct_ccc_cmd(struct svc_i3c_master *master, cmd->in = NULL; cmd->out = &ccc->id; cmd->len = 1; - cmd->read_len = 0; + cmd->actual_len = 0; cmd->continued = true; /* Directed message */ @@ -1289,7 +1289,7 @@ static int svc_i3c_master_send_direct_ccc_cmd(struct svc_i3c_master *master, cmd->in = ccc->rnw ? ccc->dests[0].payload.data : NULL; cmd->out = ccc->rnw ? NULL : ccc->dests[0].payload.data, cmd->len = xfer_len; - cmd->read_len = read_len; + cmd->actual_len = actual_len; cmd->continued = false; mutex_lock(&master->lock); @@ -1298,8 +1298,8 @@ static int svc_i3c_master_send_direct_ccc_cmd(struct svc_i3c_master *master, svc_i3c_master_dequeue_xfer(master, xfer); mutex_unlock(&master->lock); - if (cmd->read_len != xfer_len) - ccc->dests[0].payload.len = cmd->read_len; + if (cmd->actual_len != xfer_len) + ccc->dests[0].payload.len = cmd->actual_len; ret = xfer->ret; svc_i3c_master_free_xfer(xfer); @@ -1349,7 +1349,7 @@ static int svc_i3c_master_priv_xfers(struct i3c_dev_desc *dev, cmd->in = xfers[i].rnw ? xfers[i].data.in : NULL; cmd->out = xfers[i].rnw ? NULL : xfers[i].data.out; cmd->len = xfers[i].len; - cmd->read_len = xfers[i].rnw ? xfers[i].len : 0; + cmd->actual_len = xfers[i].rnw ? xfers[i].len : 0; cmd->continued = (i + 1) < nxfers; } @@ -1389,7 +1389,7 @@ static int svc_i3c_master_i2c_xfers(struct i2c_dev_desc *dev, cmd->in = cmd->rnw ? xfers[i].buf : NULL; cmd->out = cmd->rnw ? NULL : xfers[i].buf; cmd->len = xfers[i].len; - cmd->read_len = cmd->rnw ? xfers[i].len : 0; + cmd->actual_len = cmd->rnw ? xfers[i].len : 0; cmd->continued = (i + 1 < nxfers); } From patchwork Mon Oct 16 15:46:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13423611 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 B708FCDB465 for ; Mon, 16 Oct 2023 15:47:05 +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:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cWYN0JUiD+bOJcgDmRTT5AvUjGJ1PZj3L8Uzl4UdAbg=; b=kkie2nJfZs3C10 zp+rDem+wpLWESSNPTnp+j0iTw9OueqtznVbkc9pZbidMXHsk1AnyeqWFmq2JUrTY6OYz0/jOmjuh ZhBmGA+zXtKVnkrZF8cjV+G7WXSjMBpN6c1IfOuOVp5hKQr7IkcyPtorcLoDkIdPWi5BfaAfxlDaH ttZyBla20q+Ols8ch+L4WTe7r+8odiOyc/3jTdgncjOst88o9mYCxS+u01PCzvzJUYDPIgaxS18mi JpZpfFRyhpBjSO3nkkyAWuDQFDIkpRUnfPsd1WLXr44xS4OzZl36OGc0ducL5MYbTs0LiK9BLx8Gw gtKzEa+N5zNXjvcGSkpg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qsPo9-00A2ZX-1Y; Mon, 16 Oct 2023 15:47:05 +0000 Received: from mail-am7eur03on20614.outbound.protection.outlook.com ([2a01:111:f400:7eaf::614] helo=EUR03-AM7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qsPo7-00A2VQ-20 for linux-i3c@lists.infradead.org; Mon, 16 Oct 2023 15:47:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YC63Vy8RV0HVKD9Y9X1Yyt11DQjTsNyAoj0VzoR+2DflTQOffgGlzhovZkfiigPJjVlhH0f1ZHNmWbVnqQ92f8sCSvHjDke9op9EJh11/olcq19hqljYHQ4O01bWnJ9L+w6RGQhaXB3L+mLm5AH4JABao6E+/f3Peht5zikMtcxVBShH4EK/IPb8JaGrXs9Hajg6qCHMDfuryd4PAX4bAyDCn6WtmwVyKvkrFY9jp3rQCWpp+shBihnNatLN3VUyCEZSsojmfbY9a+r3rXudjikK/TYaHR0EIT17TMe/v3WdGMCC+YwjrA8WjgdcZR2TOcH6u+ncw7ba3Su8OGLTqA== 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=4JvC4g+VD60esWxTBSv5RI8lGH6ctutNh7mqUTggFg4=; b=Q3cxx1j+5BWyV8Xxc34x5VZjQ5z7ykhEqk79pt3M/ekZOgW1SNk3rpHAfHyBzPrWqOrTV+HHdT6cSeEQn2/I9lFlGbqya23LkeGOLvDYBRxWoGU8eaJD9qWeOZuoZ0HJnfKLOSsI3cWflYBZRaWFJsEyrSBE/TI2/faK5d17QCKZgkKvtO7VuUy7UmahwVNB2qRH2w5DNZQLQrHdjQ2XIQ0Aa0DLem9LQ9JPT3pcSVx/+r6X/4PP26myzOI2wff4fVEMpEVejNZSzu2BZlTpTGrFZRQcEHvbcqvOMs4kT7HppKatViJ6DKfZyDAHAhrQlMoHcgmcy1UZApGdGxKRNg== 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=4JvC4g+VD60esWxTBSv5RI8lGH6ctutNh7mqUTggFg4=; b=LsDggOlDpdF0D5PC7RDi556E7dlhJCMvdMhLUOEpim4v7GobtHQW34vnHaA8eDjLZBj/VYBiKjStYxsTYlkeSsRZhF1lAxV/3ECexolwrePCw3xFfPZFzj4q2bgRFGk36t/gd5HfV9QK9Zy/zbQ2Ra8DodiNEx4LEBztsBBx2nI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by DB9PR04MB8329.eurprd04.prod.outlook.com (2603:10a6:10:24c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.47; Mon, 16 Oct 2023 15:46:57 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::1774:e25f:f99:aca2]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::1774:e25f:f99:aca2%4]) with mapi id 15.20.6886.034; Mon, 16 Oct 2023 15:46:56 +0000 From: Frank Li To: alexandre.belloni@bootlin.com, miquel.raynal@bootlin.com, conor.culhane@silvaco.com, joe@perches.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev Subject: [PATCH 4/5] i3c: master: svc return actual transfer data len Date: Mon, 16 Oct 2023 11:46:31 -0400 Message-Id: <20231016154632.2851957-5-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016154632.2851957-1-Frank.Li@nxp.com> References: <20231016154632.2851957-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0089.namprd03.prod.outlook.com (2603:10b6:a03:331::34) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DB9PR04MB8329:EE_ X-MS-Office365-Filtering-Correlation-Id: 161f0a0d-488c-4f24-6797-08dbce5f20a4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aZP4zi1TXB2RW3tc0UjLWEfyIfKkJGYn6XJgWeEq+B8tpUDrOcTqGTObIV+sxrggL1v1Tn5V2FwE0ketkYHN6flV1Pht0MWZq8uSNlmxl0lN/s/WiaJkX//WqHdDxuQmP5H/BJ8bOt1j4EeJjrlVf/hM/5PIg+qDupIqIgx6uXpBTjZbeNuw0TP5zKkxOhpHvpS74s3Byi0seNM04XTNY4Nb2Exj8Q7jGLSJ2zbDnTpQgOHMaTDtJ2Ok0nVvJuDJVNt3Z9XzvYtiMBgX1N4B0MdRZIJXTVkwC0Y0u+GFYVlQboP/6z9xQivqzr2Lii8HPPSh0ia/vT3Hm6SP5mNVqoz1CPFve43YHU9SdZIQCmQZKfoLshcEnh2UhYq15zIylX9YxsTqbiHw4+Ie+/XzqqQxp/LRenXmS1h2zeWSQRA37TJO0scN/5cIsO1Si1ZmOATwZsyE3IAkFSUSh/3eVnFjUYnofpL4nlGLNCjLrDgBa9u46vXBJlmDLqMuo9ZeFrJoyqC7Mn7pjThmHE5IPxi/j7ouUY8elJFoXRL75NLDwASd4KxcN5JeHuU3JLb7ne2hxs1Xu4PdLrRLycClhkBCRGz9D5duFtHIA5toIj8OwQOw0I1GKW0qI4L+3b94 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(366004)(136003)(346002)(376002)(396003)(230922051799003)(186009)(1800799009)(451199024)(64100799003)(6666004)(6512007)(6506007)(52116002)(5660300002)(8936002)(8676002)(38350700005)(478600001)(6486002)(1076003)(83380400001)(2616005)(26005)(66476007)(66556008)(66946007)(316002)(41300700001)(86362001)(38100700002)(2906002)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: s55BwbT+di1ygJjsy++c9ZIyg1r/4g2JZ7mx7+jNLH/zoaNOzFDiYouvX6LskWibhokFdEudYhG3xAz4VaP+7gD3s5H7DjLW0UHAFI9EvG9di5VunkHD0YajlBTrrfCWXIhzoCaKL0Y9ASrkzsD+xZ/AVzZttxggqgKG+eRvdvqH2b1p+OxVbFQk7ceMzKEzN7zCXrzdZdeIIdt2PzXRt91dQbh1up+hOtLHsJSPkG+0EbeJlGyWYfQTj1NmPJF9Tqxcuyl7kOStRGd86mtpy3Te2aTgpaF5nH03PnpYzK4eLfGRy2g98YiQQ3IxNrVIL5EbFK2msV+kvKQbY0Ze7IdS0cHcGPlPaOdRkCNKnvfFXhB1KpKRwEqnVURrayr4+yiGEI2WuYiCJVfpyc9baoKsc9kGCU4NbSCkj2+2DfFiX6HemkcGJhr1C43uS6QvzjN+E2vT0fqS5+o/ivS8GJIuiIhvEcvHmdmgsFdZDGD/X3vI73kkxxhobQQMQCbxhTh+4HwH1RguUef/M6vVeqJEvRQQ7SSPWjRd7hKGCmlWC+hIRncg8UuKQpnxB3IJ5rTzDJZRFavBiOA/j8lv6wnTQWSbgp0M4ISyjA6/J30rhQTdawGFtElGMUh2RlI0jzqetESWhwz6r1GWSJahNRwphUxL6g+rYXyNRiQHC+vYvVbta8VnRi7AInUKmKuZLN02zEPJzJ540az4Wazz04/FtT6KlSxxDfRuuezsUgVzZ/T4LPunWYeeVJi/S8BH4bt9tWJivwEGqoFXIz5C6DQ7sYb3gdiJA4agpjU2rNOi8YKxapOyP4hiakTaDQrUhj258OFU+zppjE4QhXrn+plHpqdZ38N1/krQh/X4IigIr7bGtOs23seWbIDoasVHh2esTYa9AWc5Kf9q4U/tagVww+4iRkHgh679RnmKcDJg6hZhqhktn6d5/yi4xkA5DtwU4yKK+ScwB44AUsQHKllfQKxSx7gthKtm01H4NKdT8LddgUus+2RuHzSG8iLk0kSP1X946/zbBmE+gAdAKY5BH4tEjpEdYUKILDTZtErjgBGmIDG20i8V5eSBwxZthKpyDnu6ci5OrqHLWILVCgAtVVGE7ySnKCsGn1XE7R/tFuJQbZBsgfe554D7rgI0v6ifdxGEq8JmsEAKduhdL6tYFsBrxJXTJ00eHIJVssrypV+m38mNS8f0O9fb3kQECTCx2k1mqObeh/coXNYJvXWMptZHDFKcHk25J+1vu05gpogCU2gqULyKZixpDD1HajOIxXIytq7ZT2xQl/axGKTQ3C9M/RDHVqQouISmOZVM+VIw3HAeShXv3c/cNS/j0Zr9qFOTi1ofq2u83XAARentOjobLXKOPQLKvnV4vrIcA4xnWi198l5h4q9OEsi4kS30LEr8Oj6p0vySiDjR+88aXgyIDQH3IxfJT4q18yNiWiOPZVn93cw/i4uzP3rRj8gYhGNo2v86uWwF5JlOV5mP6/hcn4N4zs9VxJ2DywBCy8UpZuDl7LYljTJGtatNljuBvrEIcL4NX1rFJNkoAml9d3Q8tPUP9EtO7qnK8qc= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 161f0a0d-488c-4f24-6797-08dbce5f20a4 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 15:46:56.9398 (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: VCx1GMDBNUymHlGT9sARvJMbYQ3aHpIjC74ifTcRNHCBehZTlK4FOyogFMYFMPVGefxyjrSW+ZxTT+yjThZVCw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8329 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231016_084703_663120_1E152335 X-CRM114-Status: GOOD ( 10.63 ) 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 I3C allow devices early terminate data transfer. So set "actual" to indicate how much data get by i3c_priv_xfer. Signed-off-by: Frank Li --- drivers/i3c/master/svc-i3c-master.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index 3570b709cf60..444825aafa6f 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -138,6 +138,7 @@ struct svc_i3c_cmd { const void *out; unsigned int len; unsigned int actual_len; + struct i3c_priv_xfer *xfer; bool continued; }; @@ -1045,6 +1046,7 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master, if (readl(master->regs + SVC_I3C_MERRWARN) & SVC_I3C_MERRWARN_NACK) { ret = -ENXIO; + *actual_len = 0; goto emit_stop; } @@ -1062,6 +1064,7 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master, */ if (SVC_I3C_MSTATUS_IBIWON(reg)) { ret = -ENXIO; + *actual_len = 0; goto emit_stop; } @@ -1157,6 +1160,9 @@ static void svc_i3c_master_start_xfer_locked(struct svc_i3c_master *master) cmd->addr, cmd->in, cmd->out, cmd->len, &cmd->actual_len, cmd->continued); + if (cmd->xfer) + cmd->xfer->actual = cmd->actual_len; + if (ret) break; } @@ -1344,6 +1350,7 @@ static int svc_i3c_master_priv_xfers(struct i3c_dev_desc *dev, for (i = 0; i < nxfers; i++) { struct svc_i3c_cmd *cmd = &xfer->cmds[i]; + cmd->xfer = xfers + i; cmd->addr = master->addrs[data->index]; cmd->rnw = xfers[i].rnw; cmd->in = xfers[i].rnw ? xfers[i].data.in : NULL; From patchwork Mon Oct 16 15:46:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13423613 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 6B429CDB465 for ; Mon, 16 Oct 2023 15:47:09 +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:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ugsNnr8FefVb97epAM2a3GKd3H/SyDEi9AWmQ3Papak=; b=L9aH1mqN1jZ+aU JUjkQdqFEKCtYIv/yVL9C13K2k1bbyiuAKqdgpqBJ2N17ODynshsM/xX5KJRdM0QSmM4a7YAWmqMo +6pTvLFKfPT34T2RzPq//ZQJutQuTQsxKjCkO+BhLjvLpASDIF50W4n493htlQP4xqiaj+oQAXjTs t/eBNLdCeam6UxslCdskt6mnavbYLX3PvXA5WtMYcisYV97iZzG+6ozbLCHyQ8O/Totf8RJWQNO2q hFL9ayX8YEkjzCHF3eJz9yB6i5NsvTPD9X6vyB2R+sVYuw1xq2bs1mmBXKhykM3ZOL94jPFtTX0/j ivhkw6yKaQSZNkc4jj6Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qsPoD-00A2b8-0X; Mon, 16 Oct 2023 15:47:09 +0000 Received: from mail-am7eur03on20614.outbound.protection.outlook.com ([2a01:111:f400:7eaf::614] helo=EUR03-AM7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qsPo9-00A2VQ-0e for linux-i3c@lists.infradead.org; Mon, 16 Oct 2023 15:47:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PKz8g9SX+ugY25mhv1ZZr1kaclV9s6Y+1/0b6fGQexmz3OJs0Xb66zeMSH60bg/6ce7uhYV0dKNzMLiKPsOAZ0tt5rVlOpsZlU4tJyXNCZOp3D1adQfJ5vZYDueWYyROJRF9X3gYPkRP3dtTLo4eFIOuFUOoqSLzSoms5zu8EPEdi4MvFUsSl62JkR/aGzX8d9H5cUFwzSIVZEfMcN6gIWMrl4fFSNdfqsXzm/WthBlgYqdjljNszwPo9JRqX26XUjaZ8zy9UvdzNmNvdyJs/djGEbnT7RqqStRhLnvZICPghwr055eRnoWpyjZQT83MpBStVhbqBpo3P1Q/5ydmQg== 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=pr4HS15qL0Lr/tIXBZpHIbmsN7TKrO1OgsFr9lMg6OA=; b=jHg4dQXSSYYR0q9D2SGAeeUV/Br2C6IGpEBE+ak+wDv4XT1wI4cLD71SP0PVvoOWYgP9nmSXKZnHWQsR3+Y4KlptWhQS5GKY896awW/PzeQXDrJ7h24pKXrMnctWevUyFRpDqmBFFdwfCqr8KWVDiBVpqSwodu13rsCmsIAdtKdMb63gUy7750Qx3VV7m+BPg9Z2yY4NuavbutggohRbo4os9S5Qk5mh52vQwNWbEpe7+8Q9FlCqVt8OIwYnA0dkhoGfvnqoc+R6azgHUT+dZNvC6h9S+6SvAazoSWWAwg7PtABRVR9za9W5ZEilAp7B8/WBkssgCHPAS2bhFFRCPg== 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=pr4HS15qL0Lr/tIXBZpHIbmsN7TKrO1OgsFr9lMg6OA=; b=LXRe+7ms000qs+sOyh1LPEHpfMf3Xc8pFBfO3JxADVMrAOAPtiLbRqIXkR0ZZX0XwsKU0Wt/fZlIzSr8ECnSs/h/C4Mm7hGXBINBVpzWUCSFzQVGXUrN/LEC0G0bA24b3EB4xCQpuZqyku7dhUpZX2G0f0aJFsOZE1kIhZEr1fs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by DB9PR04MB8329.eurprd04.prod.outlook.com (2603:10a6:10:24c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.47; Mon, 16 Oct 2023 15:46:59 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::1774:e25f:f99:aca2]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::1774:e25f:f99:aca2%4]) with mapi id 15.20.6886.034; Mon, 16 Oct 2023 15:46:59 +0000 From: Frank Li To: alexandre.belloni@bootlin.com, miquel.raynal@bootlin.com, conor.culhane@silvaco.com, joe@perches.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev Subject: [PATCH 5/5] i3c: add API i3c_dev_gettstatus_format1() to get target device status Date: Mon, 16 Oct 2023 11:46:32 -0400 Message-Id: <20231016154632.2851957-6-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016154632.2851957-1-Frank.Li@nxp.com> References: <20231016154632.2851957-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR03CA0089.namprd03.prod.outlook.com (2603:10b6:a03:331::34) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DB9PR04MB8329:EE_ X-MS-Office365-Filtering-Correlation-Id: 2e822f8a-11cf-40be-f505-08dbce5f21f6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VfqJhnqUGNDaA6+YFVt6oS/spGgX26bblxho9jI2UtCMiMxfDh7iPhMYVa3o58cnoQgZR2i48wA4BW6WmyFxXKc8+SpFMHF5XGGlvTrIbt5ySY+/w1vtCNN9np11Qm2JoJG1qAqeLIv1Gp9i/MioIUZVsnT9R55HMT9dJscA4bFy3as93A3C7n+rsZ6I7hjkopDTrf/kJjkpM18NJluc3W0mtuUoHBiyNLGuIOwmMHKKtgUAQM65fSEsyf/Dc4KGDRwe67DbU0wmV9I0/YlgOxIgxGI9sh6UZ8avdFdb1gR5p98rkIy2v5+TxCnWg96L4jP0LrjJYxrGqa2fpFtLfvliiIRIR8mB5nYnBLqDlctf9FO0qk3CdRpDaZPjbA+iv0uItkah3JUgiS6y2/Bf7VlS8AjBB6ESp7xQZcJ9PM9Tk9CvOvDYXVh8x/mTBK1d52x6IO+TcE8R7AGxTrO6+VMi1s8oudtFoom78j71WGV5AQZM0nVWFZppS7ekOUMybV1TU6zTVe34qc1dZdf26wAfe57Co8fio7o7EmGN3MCoID8Wr2Tld0HexM1tg4OUx//27n2FNUuruUXSkFVkJ24ozkT8KYzomRoU5wrFVoKyzH5wk1RieUMKdGEJVxvq X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(366004)(136003)(346002)(376002)(396003)(230922051799003)(186009)(1800799009)(451199024)(64100799003)(6666004)(6512007)(6506007)(52116002)(5660300002)(8936002)(8676002)(38350700005)(478600001)(6486002)(1076003)(83380400001)(2616005)(26005)(66476007)(66556008)(66946007)(316002)(41300700001)(86362001)(38100700002)(2906002)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wvZS4rMownKFy30Ttmq8onegMjl2kViS/IJ8ZfTOr11gvvSXEq6KXwRpRUmbni2U50Ng3xITwvWnUfJTbEJsJfSyv5KyRMcoUxqs0DAeh3Upb3mdoqJAt0rX1mCu915QwjJyu+wwD7WPa3YAQ5wr2ZZO+EjI8I8Nkex7W4zjkWjNBlz68UG67JpOaFtqiWNX6oiDiTtboOKEI7S/5RuBFq9o6OdBsBhetLoonBmTa5H3soNS/Ej1zYKjnSryfuoDOlbNercaNgiY8idA2EKhdakYWeB4KQ1oYhTv8AgCkhxIXNXqmALx0zzGHh8sfuI6Aa2aBZ/lfLSXxH3MbQKCdKHX+/YLEKRUR4cqHODBwvMvvVl08OtZtmaCx80yXAwEk2AlsJrnSZfXcERk+q4BQp8Z/7GrEcTdzRqp2SMnrwrzDMRTItiZmHn6cz1lRAaZvoGCTE2Zk6LCFdL0QOIkWwkQ/jhUoTdHKGIqWNrz42FKPnHCbP6m4VOQlMfJsH3sMvHP88U1HtCOFMSqqNgNFJiiE/3yq/iNk+TqjRCYT+qRGPRYM+M66myEV0XdnKuH7xXTzq14ZupT5U9BYbIDK07rDy+RJbjqiOUE7buD0ZwqlpBwcNTFcfbliGDSTE1GAEb8HmVWbeuQDpkZIiWSRIopvm6fLNchKW7rspMPjAjJIKeyFTOGiuBxoeSkCL5RVK9d9c64OSWMoG//4aXywg136HwvxcyWI9vts8IJglfj8keZEdSQjdt4oBaEg53rkh0LQMoa8iyLuT8P3zHRpuuiGtJNQbfhmSIFqaPuwWAsqjdOO0LuxSwaDZ/Sv1hRemx4k5Cao8YQVoLXUBloySxWjLCGlk2MjToECQD3rewUJlP6Y48AoZqjrJTDFY7LGEUm64gLe137cPz6U+ZUIpgMGjQjjF8b9u4avQw1rWSlxW4KfWUdVLyxiOGwIorVBGd+sgQu9OVaYkLvghI/ZliaA0DzLs8e4ooSZWC5SM57hl1kLjfSZxx4qZl+xAI9JUrGC7V/9usaUpSeWubFjpXSIg9wK4Q9XSkSwmuZHuF8IleO2y/jSGUwahH3/uClhLuBbOqSun0a7KLC9skt2PuSYWTYkTQqI/axsuA61ZZnnqRjbh7zGtm6LwuGmdb6d/VsiIVul2DalQNHBUHGlfMq+dggopdE4JNnZNFVfo1OD7S++915THTLn13NiVNT04DOpVpCrsVykUNoNhZxnm4L03SmGYAR+URA7e8XOxca6GP5fmXUCbCMOWpHfQdXw3d7Wtoz6jk5+EGZOUeb7jE9SZeEcwYqrn0XbcL9X0syD3ovo1iuHNQJEGkdHszAzg1Q4lWFkxd+JpDTsUOqyKfGY2lU4N+/paIt5lBFmz02xB9Y9rfruZEs1o7HlUL/EQtHwsiqbEleVK0B5ew5i0Vy7BIVQ56D0MIXSQGsF/ss311yNBdLNATEnX8nvks+8/d7XhYhcIq+UKE7tXF3+dly37rBnCzuw6jrd0Fp/q0EfSYkbdebLJLpCBV4nee3vPtdgEZTiShB6OX2ApfdTImQmAM61FZJi2F7B1t6CXk= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2e822f8a-11cf-40be-f505-08dbce5f21f6 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 15:46:59.1855 (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: JeQ6TXz93fDbAFi8r/aBnp5ou9uTh7T6EqDbdedPEPJqsk64LpmUhgDs8nvEuRm1Y9MH2moiCjeMIxet3PK0Ug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8329 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231016_084705_240394_EF2586E5 X-CRM114-Status: GOOD ( 13.22 ) 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 I3C standard 5.1.9.3.15 Get Device Status (GETSTATUS): Get request for one I3C Target Device to return its current status. Add API to fetch it with format1. Signed-off-by: Frank Li --- drivers/i3c/device.c | 24 ++++++++++++++++++++++++ drivers/i3c/internals.h | 1 + drivers/i3c/master.c | 27 +++++++++++++++++++++++++++ include/linux/i3c/device.h | 1 + 4 files changed, 53 insertions(+) diff --git a/drivers/i3c/device.c b/drivers/i3c/device.c index 1a6a8703dbc3..0566ab9f1498 100644 --- a/drivers/i3c/device.c +++ b/drivers/i3c/device.c @@ -196,6 +196,30 @@ void i3c_device_free_ibi(struct i3c_device *dev) } EXPORT_SYMBOL_GPL(i3c_device_free_ibi); +/** + * i3c_device_getstatus_format1() - Get device status with format 1. + * @dev: device for which you want to get status. + * @status: I3C status format 1 + * + * Return: 0 in case of success, a negative error core otherwise. + */ +int i3c_device_getstatus_format1(struct i3c_device *dev, u16 *status) +{ + int ret = -EINVAL; + + if (!status) + return -EINVAL; + + i3c_bus_normaluse_lock(dev->bus); + if (dev->desc) { + ret = i3c_dev_getstatus_format1_locked(dev->desc, status); + } + i3c_bus_normaluse_unlock(dev->bus); + + return ret; +} +EXPORT_SYMBOL_GPL(i3c_device_getstatus_format1); + /** * i3cdev_to_dev() - Returns the device embedded in @i3cdev * @i3cdev: I3C device diff --git a/drivers/i3c/internals.h b/drivers/i3c/internals.h index 908a807badaf..976ad26ca79c 100644 --- a/drivers/i3c/internals.h +++ b/drivers/i3c/internals.h @@ -24,4 +24,5 @@ int i3c_dev_enable_ibi_locked(struct i3c_dev_desc *dev); int i3c_dev_request_ibi_locked(struct i3c_dev_desc *dev, const struct i3c_ibi_setup *req); void i3c_dev_free_ibi_locked(struct i3c_dev_desc *dev); +int i3c_dev_getstatus_format1_locked(struct i3c_dev_desc *dev, u16 *status); #endif /* I3C_INTERNAL_H */ diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 08aeb69a7800..fa831721f305 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -2840,6 +2840,33 @@ void i3c_dev_free_ibi_locked(struct i3c_dev_desc *dev) dev->ibi = NULL; } +int i3c_dev_getstatus_format1_locked(struct i3c_dev_desc *dev, u16 *status) +{ + struct i3c_master_controller *master = i3c_dev_get_master(dev); + struct i3c_ccc_getstatus *format1; + struct i3c_ccc_cmd_dest dest; + struct i3c_ccc_cmd cmd; + int ret; + + format1 = i3c_ccc_cmd_dest_init(&dest, dev->info.dyn_addr, + sizeof(*format1)); + if (!format1) + return -ENOMEM; + + i3c_ccc_cmd_init(&cmd, true, I3C_CCC_GETSTATUS, &dest, 1); + + ret = i3c_master_send_ccc_cmd_locked(master, &cmd); + if (ret) + goto out; + + *status = be16_to_cpu(format1->status); + +out: + i3c_ccc_cmd_dest_cleanup(&dest); + + return ret; +} + static int __init i3c_init(void) { int res; diff --git a/include/linux/i3c/device.h b/include/linux/i3c/device.h index f2fa7ee5d96d..212cdcd17179 100644 --- a/include/linux/i3c/device.h +++ b/include/linux/i3c/device.h @@ -344,4 +344,5 @@ void i3c_device_free_ibi(struct i3c_device *dev); int i3c_device_enable_ibi(struct i3c_device *dev); int i3c_device_disable_ibi(struct i3c_device *dev); +int i3c_device_getstatus_format1(struct i3c_device *dev, u16 *status); #endif /* I3C_DEV_H */