From patchwork Wed Jan 29 20:05:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13954100 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 6AC14C0218F for ; Wed, 29 Jan 2025 20:06:18 +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=/zYp3NyYtMOdE7petW7+TO1iV11P675B16n0Jy+ax9A=; b=sElCjrKInhKBegpmYqAlnMDFrr 8hdgE8mTwt3gsl8hyGtItUQsVGpIstBQd+ywmVTMDkCaHTm/RZy2hxTx9iLEqyBgu5gHjHb1vYJbL a73RzLQSCOYI2eX/XaQ1rXTuhxsN2vaihzDaV2EbJu53R0UTJ2WlN7S5uXLFML8L544KZF543jgOT 9h5SAoj8k2VNa4yAXY5g5xPreitbTSHyYOtQr3bghYZFWU70WLEkiH2syTQroc8s0AOLcJbvyg8NE xl4wuhiunc19Kz//p2z3JpjPZn/XmvHBk1j0swwMOdbC5MmQe/VMzqSVUgheKsRjlQ2VQ0z2kogZd XOl1g2kQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tdEKI-00000007jnw-0XN3; Wed, 29 Jan 2025 20:06:18 +0000 Received: from mail-westeuropeazlp170100000.outbound.protection.outlook.com ([2a01:111:f403:c201::] helo=AM0PR83CU005.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tdEKG-00000007jml-0fjD for linux-i3c@lists.infradead.org; Wed, 29 Jan 2025 20:06:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TlxbHDjDrWLMEj4QoQ4AgdGVBkl7q6A5TkPq+wZ2YtobbuRrr8+dhBmglKECw1j5N0baQIB7h1J3g5DbZVxvhaCiRYC8jrrR6MJcsiHBUp9i9KyTxKRZW9iYnqrhSwxCpZgYVwjlsgo5eR/lCtZenRWE9n20LCmeAIicUAarSHt0RCENdPbZx4jcMORtwUl6f/ybSyjkiP4pQEa5+FnloiHLS66wRO0u5Gp51Xwqz48WTLV8LwHs0QASoyyG5dR47icyVnQ20P6uZNtM9Vr52uej7XjvIikImHN6xcKUW+5ltO8jhfo21UFMiiQblA2diNoVxXiXZhfbVTBBvYk8Gg== 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=5xn3u/pAWnMVPiqNzEyEfz/JVJtr2ST8EZyxY/LMSig=; b=EmCLDg6teR+t5dNg+LkYWj/QTo3PJTsmIDhOeXhCR9up6AYmk5fwW1bmnxOMZHM9cYn/SN6a2bU/1TCcAmrWWRkGUtr/LMwCbInDsY0QQES5wKdsBcFrF86SKuWtXkerVQnUGOOZrd1MzGVQwVzLixr/Ooa7gMPGn8KZpO3gbF3DyDqCZkOPHOutBhxPj0KqnJSAj+Gq3mr2a6+I1Y13is2cHdsQjo0tcxXO6pNj7DCOzK6X/TwDaG9E2eWAEJzqIJY7ky5VqgFa6QnkZGOz900wFyCeEMloQi5rKf18sSOy5AVyxalYE36qWs1m/2qDN9sXXEUPUpOMCIAn7x4EuQ== 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=5xn3u/pAWnMVPiqNzEyEfz/JVJtr2ST8EZyxY/LMSig=; b=koL8xuk4hr9/FKboVdXoqp7vJrua7sS/ig4ZFb+dl0Mq3svcWNfqAJMCD5UJPiAVahcVkxZAjzIba7UFmD1tQBuMA4vTrLRr+dWNk3vYb8eLhs1j35CR3g41bdGaryrEam78l57+HbNma7GILNSloMWJIXnt6QQ9C4AhcnxbKdHxppJ4s7QxaZpEkcxYpn6yRJeWVI9gceZSsg1Itq0ugK27uY+KHkIdr4BF5BwYKYRLdEnar50Uy9u5mzZQuXM9MsCB/xfSg/UKZtIUkZkIzPRmIaFrHJHRnMqlyvQfw6IpzW70p0NHNg5VqyRON54ehQyyZU+8I9OrsZXX/Dp2fw== 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 AS8PR04MB8995.eurprd04.prod.outlook.com (2603:10a6:20b:42e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8398.18; Wed, 29 Jan 2025 20:06:07 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%5]) with mapi id 15.20.8377.021; Wed, 29 Jan 2025 20:06:07 +0000 From: Frank Li Date: Wed, 29 Jan 2025 15:05:52 -0500 Subject: [PATCH 1/2] i3c: Add basic HDR support Message-Id: <20250129-i3c_ddr-v1-1-028a7a5d4324@nxp.com> References: <20250129-i3c_ddr-v1-0-028a7a5d4324@nxp.com> In-Reply-To: <20250129-i3c_ddr-v1-0-028a7a5d4324@nxp.com> To: Alexandre Belloni , 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=1738181163; l=6612; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=Qv+OIZUavFWAsZsR0hppGZh+8cB7gwaFIH0gV7V5F2Q=; b=wrmGPkIgbj/nyGtRsl41Dg9/ksdiyaa8YDyPFqFJsuwVmv+5LyiPATNBBUDi7EijUYL54GK// DJs11Sq/Q/DCWe7ctzzPqw0N7Zgmzliqx0bXQJDGsCFdZFn0S65tbfD X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY5PR03CA0012.namprd03.prod.outlook.com (2603:10b6:a03:1e0::22) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS8PR04MB8995:EE_ X-MS-Office365-Filtering-Correlation-Id: 587ad316-beb0-4472-ad9d-08dd40a05e18 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|52116014|376014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?6HFA/s2Ib9vtTzyalXjWrmKvGiQGlN1?= =?utf-8?q?hSFFpHuR39/oW/FCgeAUDT2niiln97k8TaQyblEH8rH4tVhucMtqMqLBkSA/WTqBr?= =?ut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= =?utf-8?q?XriVmxghTtBcZPORFj+w2kqF1vHviVprLYyl06EjdTvur9cf2F4kksV4JMmOUk2BK?= =?utf-8?q?xCMcEu2SM+F2geDBi5Rq6s+mS/+FwRxP5zIEJEVlg18zRbogBdjROXb4NurW6asQ5?= =?utf-8?q?c6QU4tWYCkSINmR28fgiPucr4GEhF25pyjGJfgZz5wFDStxPaG0HXt5+m4yqVyn8Z?= =?utf-8?q?peCyMcaFVhk29aszBeLMW8lqCE2PnjCZRt1+UfSORrg3Lh28lF/CWbVSjkBRCKyVq?= =?utf-8?q?MxliCEs52G3zqbxYy2oUJ0plALBS5Nwraq9V6B3wFrdoS0Ghf4WGr2fbYzkxiV16O?= =?utf-8?q?iX65XJT7SRlMkwDxgbyMTsQcQRh0UI6E3lajDbvRSQmeJafRms0CxQwRibWCsAvVw?= =?utf-8?q?ll4QPiXC072eECPNbIfwkLpXvhXaAVRI+DQO2gct5spAYDODxmneh5RZ8BXD5W1tZ?= =?utf-8?q?u7IaQ6zK9KS?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(52116014)(376014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Qech0cCpi1DCsQma4KZFDimmENZZ?= =?utf-8?q?Z8x/AsWrpo+u5cij2roWAvtsNsLt6gYyL/V+75YamlGywSqmJ0iLGmDzXTzIJr9H+?= =?utf-8?q?cLSZ6iNfRWoMpYsoMRcuJLmeHqlMKiZ2JPisDugz/Vrb/MPQL5jiziu/7qOM9l9xt?= =?utf-8?q?5N5JQPDfSF0KHvwDhhfRh+eCHLXL+R/Za0cG4X1GsqVyqED5EiP3G2x5vJJvm/a7Z?= =?utf-8?q?+LbCbmh3pmJ+q39d2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n4e38pyJVURhq31MCzkzIGvBtfikh+2twhzAxicNZaIspN?= =?utf-8?q?laHY77OTf6gFCf5FEswk9teZ0VFMiQBBfgnduaGgPGBg/oEyhW4OjMcewmJd4mpDt?= =?utf-8?q?OBsS+4L9WIOt68VaTegOkS9/adoI3HDu6GGsGcSBQiCmUA9AMZ0x8pGRuTAQySPhL?= =?utf-8?q?vaK0HEMw3wlK2ITe1jrTorF4ZWqmw7tP/tk02x6WE4D2BEL+kAhiESM4BW1W/OUl+?= =?utf-8?q?hLfPblGOF9ZEPoqyE+ZmOpUc7+qMphsWLZPPPo0WNDuWxTTP/SAZSFCPuCNOBH495?= =?utf-8?q?j9Sc8HmUWf7O/DnIln+Kh0RwIjQNBLOd1xOUQd1A36+RrbJ8FjhIGNsE3lwHCquo8?= =?utf-8?q?fnZLFNloWFIlGkHDC5wiiK03jqRfKI68fIQLYTCWkKwjN2pPkcA01xNFBxYp6deiw?= =?utf-8?q?UzwXLq1rschQ?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 587ad316-beb0-4472-ad9d-08dd40a05e18 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2025 20:06:07.5444 (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: JwywFUA+AUHDHqXQgHAfg9Vqs8oh0/7GP32Ppd7DP0+amRdm1XZvJw80oB9zPqVdFqh/5uoITjGi53NeYwobcA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8995 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250129_120616_352566_FF065FEE X-CRM114-Status: GOOD ( 18.24 ) 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 HDR requires enter/exit patterns during each I3C transfer. Add a new API i3c_device_do_priv_xfers_mode(). The existing i3c_device_do_priv_xfers() now calls i3c_device_do_priv_xfers_mode(I3C_SDR) to maintain backward compatibility. Introduce a 'cmd' field in 'struct i3c_priv_xfer', using an anonymous union with 'rnw' since HDR mode relies on read/write commands instead of the 'rnw' bit in the address as in SDR mode. Add a priv_xfers_mode callback for I3C master drivers. If priv_xfers_mode is not implemented, fallback to SDR mode using the existing priv_xfers callback. Signed-off-by: Frank Li --- Why not add hdr mode in struct i3c_priv_xfer because mode can't be mixed in one i3c transfer. for example, can't send a HDR follow one SDR between START and STOP. i3c_priv_xfer should be treat as whole i3c transactions. If user want send HDR follow SDR, should be call i3c_device_do_priv_xfers_mode() twice, instead put into a big i3c_priv_xfer[n]. --- drivers/i3c/device.c | 19 +++++++++++++------ drivers/i3c/internals.h | 2 +- drivers/i3c/master.c | 8 +++++++- include/linux/i3c/device.h | 12 +++++++++++- include/linux/i3c/master.h | 3 +++ 5 files changed, 35 insertions(+), 9 deletions(-) diff --git a/drivers/i3c/device.c b/drivers/i3c/device.c index e80e487569146..e3db3a6a9e4f6 100644 --- a/drivers/i3c/device.c +++ b/drivers/i3c/device.c @@ -15,12 +15,13 @@ #include "internals.h" /** - * i3c_device_do_priv_xfers() - do I3C SDR private transfers directed to a - * specific device + * i3c_device_do_priv_xfers_mode() - do I3C SDR private transfers directed to a + * specific device * * @dev: device with which the transfers should be done * @xfers: array of transfers * @nxfers: number of transfers + * @mode: transfer mode * * Initiate one or several private SDR transfers with @dev. * @@ -32,9 +33,9 @@ * driver needs to resend the 'xfers' some time later. * See I3C spec ver 1.1.1 09-Jun-2021. Section: 5.1.2.2.3. */ -int i3c_device_do_priv_xfers(struct i3c_device *dev, - struct i3c_priv_xfer *xfers, - int nxfers) +int i3c_device_do_priv_xfers_mode(struct i3c_device *dev, + struct i3c_priv_xfer *xfers, + int nxfers, enum i3c_hdr_mode mode) { int ret, i; @@ -47,11 +48,17 @@ int i3c_device_do_priv_xfers(struct i3c_device *dev, } i3c_bus_normaluse_lock(dev->bus); - ret = i3c_dev_do_priv_xfers_locked(dev->desc, xfers, nxfers); + ret = i3c_dev_do_priv_xfers_locked(dev->desc, xfers, nxfers, mode); i3c_bus_normaluse_unlock(dev->bus); return ret; } +EXPORT_SYMBOL_GPL(i3c_device_do_priv_xfers_mode); + +int i3c_device_do_priv_xfers(struct i3c_device *dev, struct i3c_priv_xfer *xfers, int nxfers) +{ + return i3c_device_do_priv_xfers_mode(dev, xfers, nxfers, I3C_SDR); +} EXPORT_SYMBOL_GPL(i3c_device_do_priv_xfers); /** diff --git a/drivers/i3c/internals.h b/drivers/i3c/internals.h index 433f6088b7cec..553edc9846ac0 100644 --- a/drivers/i3c/internals.h +++ b/drivers/i3c/internals.h @@ -16,7 +16,7 @@ void i3c_bus_normaluse_unlock(struct i3c_bus *bus); int i3c_dev_setdasa_locked(struct i3c_dev_desc *dev); int i3c_dev_do_priv_xfers_locked(struct i3c_dev_desc *dev, struct i3c_priv_xfer *xfers, - int nxfers); + int nxfers, enum i3c_hdr_mode mode); int i3c_dev_disable_ibi_locked(struct i3c_dev_desc *dev); int i3c_dev_enable_ibi_locked(struct i3c_dev_desc *dev); int i3c_dev_request_ibi_locked(struct i3c_dev_desc *dev, diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index d5dc4180afbcf..67aaba0a38db2 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -2945,7 +2945,7 @@ int i3c_dev_setdasa_locked(struct i3c_dev_desc *dev) int i3c_dev_do_priv_xfers_locked(struct i3c_dev_desc *dev, struct i3c_priv_xfer *xfers, - int nxfers) + int nxfers, enum i3c_hdr_mode mode) { struct i3c_master_controller *master; @@ -2956,9 +2956,15 @@ int i3c_dev_do_priv_xfers_locked(struct i3c_dev_desc *dev, if (!master || !xfers) return -EINVAL; + if (master->ops->priv_xfers_mode) + return master->ops->priv_xfers_mode(dev, xfers, nxfers, mode); + if (!master->ops->priv_xfers) return -ENOTSUPP; + if (mode != I3C_SDR) + return -EINVAL; + return master->ops->priv_xfers(dev, xfers, nxfers); } diff --git a/include/linux/i3c/device.h b/include/linux/i3c/device.h index b674f64d0822e..7ce70d0967e27 100644 --- a/include/linux/i3c/device.h +++ b/include/linux/i3c/device.h @@ -40,11 +40,13 @@ enum i3c_error_code { /** * enum i3c_hdr_mode - HDR mode ids + * @I3C_SDR: SDR mode (NOT HDR mode) * @I3C_HDR_DDR: DDR mode * @I3C_HDR_TSP: TSP mode * @I3C_HDR_TSL: TSL mode */ enum i3c_hdr_mode { + I3C_SDR, I3C_HDR_DDR, I3C_HDR_TSP, I3C_HDR_TSL, @@ -53,6 +55,7 @@ enum i3c_hdr_mode { /** * struct i3c_priv_xfer - I3C SDR private transfer * @rnw: encodes the transfer direction. true for a read, false for a write + * @cmd: Read/Write command in HDR mode, read: 0x80 - 0xff, write: 0x00 - 0x7f * @len: transfer length in bytes of the transfer * @actual_len: actual length in bytes are transferred by the controller * @data: input/output buffer @@ -61,7 +64,10 @@ enum i3c_hdr_mode { * @err: I3C error code */ struct i3c_priv_xfer { - u8 rnw; + union { + u8 rnw; + u8 cmd; + }; u16 len; u16 actual_len; union { @@ -301,6 +307,10 @@ int i3c_device_do_priv_xfers(struct i3c_device *dev, struct i3c_priv_xfer *xfers, int nxfers); +int i3c_device_do_priv_xfers_mode(struct i3c_device *dev, + struct i3c_priv_xfer *xfers, + int nxfers, enum i3c_hdr_mode mode); + int i3c_device_do_setdasa(struct i3c_device *dev); void i3c_device_get_info(const struct i3c_device *dev, struct i3c_device_info *info); diff --git a/include/linux/i3c/master.h b/include/linux/i3c/master.h index 12d532b012c5a..352bd41139569 100644 --- a/include/linux/i3c/master.h +++ b/include/linux/i3c/master.h @@ -472,6 +472,9 @@ struct i3c_master_controller_ops { int (*priv_xfers)(struct i3c_dev_desc *dev, struct i3c_priv_xfer *xfers, int nxfers); + int (*priv_xfers_mode)(struct i3c_dev_desc *dev, + struct i3c_priv_xfer *xfers, + int nxfers, enum i3c_hdr_mode mode); int (*attach_i2c_dev)(struct i2c_dev_desc *dev); void (*detach_i2c_dev)(struct i2c_dev_desc *dev); int (*i2c_xfers)(struct i2c_dev_desc *dev,