From patchwork Tue Sep 10 05:16:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Song X-Patchwork-Id: 13797953 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 CA93DEB64DE for ; Tue, 10 Sep 2024 05:07:59 +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=bcNY7QZTxJgR1v7zu70N9b+2ZFzBiibSm4G/PLD8OpI=; b=JmI3P6n9gagck/ jGE08/NgB2U0dU8148GSTrhxiEcQm8YSff2WJThT3BHuXGAwmDTtFlCfXZRv3eUFM52NQ/RwaR/su KhwdeRuOUYm/nuX1zGyBEAD9FwgPZetJH+fOj9qUW9I6PtPqaSyehrXzpUDRp7BKvgnOyL4BkNAAP D7mygDfARQCjewd/oZdx++p12F1JN+u/d++vjhD9apG18kEeIfu9awvqI0fz2J54wTt4iitlzQ/Gw o9TaXR8CNTpgD6ASAxOBWioaLgoO/7LdLLo4BlAlnzXHkHuDEMFk8TbP81jEhrWnQc0w6h2+3O6bx Pd4+Xx7ISyMEMDtKTxwQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1snt6d-00000004I6s-0yXU; Tue, 10 Sep 2024 05:07:59 +0000 Received: from mail-northeuropeazlp170120003.outbound.protection.outlook.com ([2a01:111:f403:c200::3] helo=DU2PR03CU002.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1snt6K-00000004I2X-2sMW for linux-i3c@lists.infradead.org; Tue, 10 Sep 2024 05:07:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vX5cpqT/qM8WXdhow+v7aJgv5B9OpmI2bobPehkpZ+z1tgw3CE1LzH6h69SSEwLd1qvPVYRVfD0lRHA/j5w1/QEYqtS9vIUt/+CCyrQ8mRyn/b/v06N7v9znHJCakPzhbxpIwiPuLcZArH/gE5Zf+vmOYljVn9AcwPobv+lVuqBoGm+PfWy2VRNWHlo6P5Y/w14jeaSfHweB/sZ2psJLIT0EiZ7QDDs4BscXE4LPZtXF/RywAPuoA1whmGfx3JHDPumikOvo+3lwmG8boHK6PNNkm1TnmoNyPyin5CIEp1t3Ra+Bg7Zv5vTj+3E/kmSrkPqXMfchsyswHBC9dsi4YA== 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=SLXvFcXqaV8OnaBfbT0OdUDO3x8JowFD99/xqDUU4Oo=; b=QMCrL0/lIExB0g6+Avh6xgoas6tbTOa/asI6BVAJ92si46IXREeD5mf5Kx8xjZpOKb5/fQ6+qD47yNgRfsgKZqeHuO7sEawHDZZUZjtxHew4tLm1L0a2FjFEKIZj8DNEEcXWowdsy7WSCv5JVaab/O7QLV4E8M71ZpwB2V6wG7SgAus6JGp8B9aWPm/XAW+vymX92RRU6IYdCY0VQd5WIdE0Ou0NV7I6LjCk1Ferpgnl2xr/94vov9/2lRcT0uEt0QeKZD6JNqy12oNtlWaz1FREcqSbnGLwt/oqRa0EBfXOvzc2lOMStGFr8BVrhq9ir8vqsRhULmNGOZEvA/nJPA== 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=SLXvFcXqaV8OnaBfbT0OdUDO3x8JowFD99/xqDUU4Oo=; b=VYIsnskBAytSJB2AT/kwGokCXITLHfI7v8drwfpE8iIU1HGTlKUtQpCikRQRa8a7qPRNn2oQ/eePbZBU6xyq08IooVvVxix4ICcRbH3E9cyTMKB4xBIyWhxKmSblRKHy39fiJPhw1H24rSrroHjnX6zQ9tKpg0TEXL06bWMoYW06YbEBUNc2BawwYki52gDTFtHc0hQu4MK1Iq/9Xk3hgonWouN2GUKcPPsRoxbKN1gtPpEgDGd7SavxBnf2z5/Rr5gwMR85/foyLvkuHPQF9CAiYSQWySNPMpuPrfFT+zaVmrVQHYI/8CKJKpWyqpYhpH6VeDHVbVwsha9lk+bX9A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB7PR04MB5003.eurprd04.prod.outlook.com (2603:10a6:10:1a::19) by VI1PR04MB7134.eurprd04.prod.outlook.com (2603:10a6:800:12e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.23; Tue, 10 Sep 2024 05:07:35 +0000 Received: from DB7PR04MB5003.eurprd04.prod.outlook.com ([fe80::68ea:5937:4fa7:db2b]) by DB7PR04MB5003.eurprd04.prod.outlook.com ([fe80::68ea:5937:4fa7:db2b%6]) with mapi id 15.20.7918.024; Tue, 10 Sep 2024 05:07:35 +0000 From: carlos.song@nxp.com To: alexandre.belloni@bootlin.com, miquel.raynal@bootlin.com, conor.culhane@silvaco.com, frank.li@nxp.com Cc: linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev Subject: [PATCH V5 1/2] i3c: master: support to adjust first broadcast address speed Date: Tue, 10 Sep 2024 13:16:25 +0800 Message-Id: <20240910051626.4052552-1-carlos.song@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SG2PR01CA0197.apcprd01.prod.exchangelabs.com (2603:1096:4:189::8) To DB7PR04MB5003.eurprd04.prod.outlook.com (2603:10a6:10:1a::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR04MB5003:EE_|VI1PR04MB7134:EE_ X-MS-Office365-Filtering-Correlation-Id: 4a49e9a2-b6ef-46de-6d99-08dcd1567b13 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: tv3ADf5QxFVUY4BUfZNhU/20p589kn3PTdYolBMnEqseYaKgggXvgh9nfRX5Lcwdwx/A+Iexi5gMzf2Z0Auxnp/8GhjB5WuA9LkFu4gcX+3BE1i6zZoZaEOcevlV9uMoFen2V55ATg17e8+/5lOTsyP5zeAki/al9cIuyJpZTj/9ZqjStgGVP9xpr/SdNuNbG1MVT2zgFSxiH4q4FV2nSAxElI5EZt+M47F4sfu9sL1yujUhqVJ9rtdk9iP+HQbyXGmT1YDH9qspyCAHSghn8WFuAGaUUhkfpVBVslyofQm3ke904Glj1wNTBi2FzCbDKlxnSQ0UOh7XS3X5kO1Woeo8AohvEFR3jDrlLrRtqnzk6t7MfIpjbBQLrzf0IIo/pumjbpDXiaLw6u32SZ7arL2Am5xN/pH/3/N45OlAZfjN6zJILUzQ2sH2DNIB0GD+x/SGtPpO/ZyT3DA7roTmmBEny3OOFPCEus9lN1pPs+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)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tw+5x6Ca6UkTmx7f0tjQpqvlMTef16YwSEIrSGBLUftvBgvcCwHDAx5nY8B8ZwmjMh1ySqfTn3OmsyU5MJJraesoB0UBScAisxWaHrHc3dLZPtsHEWY0msliCqav/I+5mZu5wn/c+Q10+LnCQv60STUrly9a888X4hVlyP01CxzzMyAEaBnSSGhe8vWYlHbwiCeCZdZcqp/8tOLYQIOnZGNFobtxqL+GGBN1jRYeiTmx1yLYyZSlZVEdFqgnZLIUriUEWP8xgpU77ro8ABLMtSZxeykCWCytG4pacgoX8TxBityyqbFbdF9BpecetwtDSo5iUcvkzPj2Ft0fMG1xJM/OMbv1JvQdsOATZM/F+qxFtCvWlcyeI0aSbAI3kDiKco8sBbqGDQ2rJd+tfrnU8iBn5DVhy1s4Fcbtl0fE0sxQceiSS5Vd1PQH+EWcQyZtX1uKwcpfhrYGpx+yJvQCrPFSyiY14SJmIMoamUl5d+fzP/ntCO7zAxtjpmzk516cAgcQknXHbrpwdSwesGh0wJLmtS+mPbEi11FSnhcCgM2K27O6pf5C+HeftJd5PL/5YU1fpfM3Xj4kcZ1ezECBOUCQ3/JfHrlBvmWkc18Kyl6vTBh/7MXz9VwDzYTgucaImBgNVNsAL5YNP2dp/fOQhsyNhNosL6slgE86Xnfn8pcWaKe/agELRUIRYqpwdvpeAh/tVB1cwKAcKQP9C4drqAW72Y7CCqsFBDP49KiO5pBQ2hlxa7z1wFylKHVrAu6h3vXLUZn48n+lHXO7m5F8FDnkNX7sypA5dL+ExADm1D+4XcO7jJryF8PSPYbCJmR9h9vfWifhtm5pjBVAP4cyinWb/oYiPHAXZWgdrlo4tDvnJ9qFNignW1oFuec4FN0NjTNldHf47WoAKAU4BfycedlL2pqCHWCp7K4j6JGIeUG5fPv5TUPRQtNOehTLzxdYPcrg63Nr2ctYW19ypxIZspSTDskY7CN6FeV6cdzHTgw1pb8qznROgI4+xSzVTeh0uRjqfsFTmIWBLGUEkO+xxwdzWCg81AeKiGxu3jbi9C8bP8guPwh23O6ODvOu+kw+ahIPmz++F8+92+4lhWygIhDXLz/PFRQBM7HenVvWOSAa1c0MTwl3e4pDKLghMpzW9HxObUhITdHoufK2gcBKHFGJ8TpxzPMzFdlswfTpZXxWGNHw6tc/vLlkV9pF0UxUVTt7SxhwPP75QlnALntlwJ2Z+oLasZHknGOL/2+TxnKUcKIwu98cop+yZL0+9vvIGXJr33FPE6l8Ge+E06rzmRo+w2ZlSFTQXXIyI+Pez4okI/jpLs5xDKLXg5kfUo+YAKYITDg63JbKidh4qaqaUGLQ7VlJfMGH5buq+B8MsWsyBbUiORj/5rXQA5I/M3qSaABqoSq6rTQP3B/JmvObOR6Op0pypQnerJpyYXOCvV3Qu/Pwo/ja9qVMqPkPnmueSC2SSDKuwOcjm4GJXnvWSzpBdx+WhvpzTT0/HEXT3V5HR3Wl2edtaqDVFK5MYbJCQuuQmZ37kFvIQ3sww7lS01xc1kCkDLGKhe3x/20E5juWPj4RxaD3ZcgVzJ4/F/0b X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4a49e9a2-b6ef-46de-6d99-08dcd1567b13 X-MS-Exchange-CrossTenant-AuthSource: DB7PR04MB5003.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Sep 2024 05:07:35.2017 (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: bwbQHt7AxKcuND1XtjPbSrPNQyKtmNFo2UJB/saTR0kLr51KVq14gUY2yNYCtdyDDSoZtczQTery+ByIJxhk3Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7134 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240909_220740_755593_CA568B60 X-CRM114-Status: GOOD ( 13.62 ) 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 From: Carlos Song According to I3C spec 6.2 Timing Specification, the Open Drain High Period of SCL Clock timing for first broadcast address should be adjusted to 200ns at least. I3C device working as i2c device will see the broadcast to close its Spike Filter then change to work at I3C mode. After that I3C open drain SCL high level should be adjusted back. Signed-off-by: Carlos Song Reviewed-by: Miquel Raynal Reviewed-by: Frank Li --- Change for V5: - No change. Resend this patch to list after subscribe to mail list. Change for V4: - No change. Send this patch with svc-i3c-master.c fix patch. Change for V3: - Modify comments from Miquel's suggestion Change for V2: - Fix set_speed description from Frank's comment --- drivers/i3c/master.c | 12 ++++++++++++ include/linux/i3c/master.h | 16 ++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 7028f03c2c42..6f3eb710a75d 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -1868,6 +1868,12 @@ static int i3c_master_bus_init(struct i3c_master_controller *master) goto err_bus_cleanup; } + if (master->ops->set_speed) { + ret = master->ops->set_speed(master, I3C_OPEN_DRAIN_SLOW_SPEED); + if (ret) + goto err_bus_cleanup; + } + /* * Reset all dynamic address that may have been assigned before * (assigned by the bootloader for example). @@ -1876,6 +1882,12 @@ static int i3c_master_bus_init(struct i3c_master_controller *master) if (ret && ret != I3C_ERROR_M2) goto err_bus_cleanup; + if (master->ops->set_speed) { + master->ops->set_speed(master, I3C_OPEN_DRAIN_NORMAL_SPEED); + if (ret) + goto err_bus_cleanup; + } + /* Disable all slave events before starting DAA. */ ret = i3c_master_disec_locked(master, I3C_BROADCAST_ADDR, I3C_CCC_EVENT_SIR | I3C_CCC_EVENT_MR | diff --git a/include/linux/i3c/master.h b/include/linux/i3c/master.h index 074f632868d9..2a1ed05d5782 100644 --- a/include/linux/i3c/master.h +++ b/include/linux/i3c/master.h @@ -277,6 +277,20 @@ enum i3c_bus_mode { I3C_BUS_MODE_MIXED_SLOW, }; +/** + * enum i3c_open_drain_speed - I3C open-drain speed + * @I3C_OPEN_DRAIN_SLOW_SPEED: Slow open-drain speed for sending the first + * broadcast address. The first broadcast address at this speed + * will be visible to all devices on the I3C bus. I3C devices + * working in I2C mode will turn off their spike filter when + * switching into I3C mode. + * @I3C_OPEN_DRAIN_NORMAL_SPEED: Normal open-drain speed in I3C bus mode. + */ +enum i3c_open_drain_speed { + I3C_OPEN_DRAIN_SLOW_SPEED, + I3C_OPEN_DRAIN_NORMAL_SPEED, +}; + /** * enum i3c_addr_slot_status - I3C address slot status * @I3C_ADDR_SLOT_FREE: address is free @@ -436,6 +450,7 @@ struct i3c_bus { * NULL. * @enable_hotjoin: enable hot join event detect. * @disable_hotjoin: disable hot join event detect. + * @set_speed: adjust I3C open drain mode timing. */ struct i3c_master_controller_ops { int (*bus_init)(struct i3c_master_controller *master); @@ -464,6 +479,7 @@ struct i3c_master_controller_ops { struct i3c_ibi_slot *slot); int (*enable_hotjoin)(struct i3c_master_controller *master); int (*disable_hotjoin)(struct i3c_master_controller *master); + int (*set_speed)(struct i3c_master_controller *master, enum i3c_open_drain_speed speed); }; /**