From patchwork Mon Aug 26 05:09:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Song X-Patchwork-Id: 13777289 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 1568AC5321E for ; Mon, 26 Aug 2024 07:15:22 +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=ERSgLglBSzvsdu1bOpp5FVKoWe8cPS69QWKbZODzyhE=; b=QAcPSBt0U5b5rj Iqy8HdqBncF30n7AI5lv5hH3ayMEHaC20oQApz2KFwYcvX+7UJ5rTLcRTHE0nMkknoKPRX4cFRy6N 1tuav3mrM4o2Wx7zIvJvqNfKP42eYFPos3Ow7f5y/k/0lTe8jDifaluchmxLKFwJ9Ah5cJUVEjPTu 58gV/S1yQ0z7XOvG3gS8Muyr/z3l46xKO/cj70jzDQnHbDyXIMZrRAYhGeTm91fNaD7y1OFlh08b5 CYlcyIFxAv7IUMfA3xu2kOBleDnEHObEE9GVd91LdT5/v9FsKMB3wVZRbqFETKsEcb/4rHOBIVuzO sHqq5k08ZoSTaND1DabA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siTwf-00000006E4x-2GMn; Mon, 26 Aug 2024 07:15:21 +0000 Received: from mail-vi1eur03on20618.outbound.protection.outlook.com ([2a01:111:f403:260c::618] helo=EUR03-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siRqe-00000005pra-3Ftj for linux-i3c@lists.infradead.org; Mon, 26 Aug 2024 05:01:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=OLnZSwgdpGzo+3vBqaHEDDRdomP09DWCmOpLbGWvz0RqY9aRaAomb/2fT0UD9hRHrCbFPppWhTwUBIWcxI7DlhF49NtLLNHQpG2w7PiZy7RcY2lTFyY79MYmnNquYkdchLbbLYFMgsU51Cwvt5rIRcLBm6BGezlp5CnHb33I4fnkUQTGSwKjYMFbaEIN8zjG9mlD/Wa3IbJ9BJeZMzHevdAzdnYdpqhzw4zTgi+2sBzF9qKTxuWleCa3+GilBbQs33bdDlqnMqCAI3WFhr2VknO2fzkoTpuKOhF9cR3usfFggIyhNLYTwgthxKD5hwTG4OLOSxck4gnrFvhF5jH4tg== 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=a/jaS4Z0npCG7Py3zy4lPBjPEoFbJmfApCQ1POa4AaA=; b=pGkfITC0UatnqaR2T6WeN/mhRg5xszhnYA0jEbjmDB7QTMZGhjprSjaHEWIvejaTXshvo46ohxekxOr9XRwqhIYf20tmDU5kQABIx8lhYCCARP8OBvJMrUlxqCZ7QzSueKgHQzStuHQr6975JGRzUGxXJK5kOq7pqMS9wGVzJeg1IK0oE8/aMpY2C7g5lOZNb38SPGcVMI490HmJqeGs7L7QeK4gm3qLdpSQ6NJxD7PR3RGcJMRlh7PCvyy/XooZFsyzCb4YEQKUfT9wVER/2WjFb6QxY3YW5mVvJegRzULiymy8vrHOaWwsyLjbSUtJkKC+24rpYargaxQeRUT5fg== 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=a/jaS4Z0npCG7Py3zy4lPBjPEoFbJmfApCQ1POa4AaA=; b=R47/V6p8rHUAQV9tsUNLuFcrWIlzJlYXKfoe/VTM5YHxNDkf45vnjeSUasRA9Cd0ZR724q14iaB7mzX6WcA4fUwgYCjzR8kplEl42nkAmWGh1HCppmDiS52wtC38/B09CY/E2CiymYjRgNq5CI+gbhHEdDe3rpXOxCY+oyK/ilc4uHRlrcCrha/qaDNa17qDIBUE5qbqh77+GG7v2dhOQILWGPGKcKZ2M+5Rz10tsBWBbmRTUjtbcRmvjG223CZBFCNzFtWSNPey4hZWAwRwuLbReTfEMU7xYdsLJPMXThec2YkdP+0N8GuKXdg+niV2P/9IGmXBRlRoVmJk2ibIbA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5005.eurprd04.prod.outlook.com (2603:10a6:803:57::30) by DBBPR04MB8058.eurprd04.prod.outlook.com (2603:10a6:10:1e7::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Mon, 26 Aug 2024 05:00:48 +0000 Received: from VI1PR04MB5005.eurprd04.prod.outlook.com ([fe80::3a57:67cf:6ee0:5ddb]) by VI1PR04MB5005.eurprd04.prod.outlook.com ([fe80::3a57:67cf:6ee0:5ddb%4]) with mapi id 15.20.7897.021; Mon, 26 Aug 2024 05:00:48 +0000 From: carlos.song@nxp.com To: miquel.raynal@bootlin.com, alexandre.belloni@bootlin.com Cc: linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-imx@nxp.com Subject: [PATCH v3] i3c: master: support to adjust first broadcast address speed Date: Mon, 26 Aug 2024 13:09:57 +0800 Message-Id: <20240826050957.1881563-1-carlos.song@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SI2P153CA0027.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::22) To VI1PR04MB5005.eurprd04.prod.outlook.com (2603:10a6:803:57::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5005:EE_|DBBPR04MB8058:EE_ X-MS-Office365-Filtering-Correlation-Id: cf9e4f80-da91-43eb-e3fc-08dcc58c0c9f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: paN8oqPyRgdp866YNMoAwgQKEP5J/RRK6VQjkrOGfg3wObhcwthu+LOaH5APyyRz81fIJ7/EvRjAY8FQkA7JGO8YPVfNFXX+qUa9WJdq2VlZ3vRdfbKWzQGZS1hXsz/fHPR0hw9eaw8EAY6Nv4wLtZjHjcb9Skk7zYR39CmDasxHvpPd3SFCLKvD116o+J1mDzwGTE19wjBqCj72x4BfVx/1f4imuiw/zAxS5Jt3xRQboYseBBGcWALuXG6YzMlo1ftZF/nfoV+2RbRlBAKtcXopdoUt0lupwJpMfgmlOVVSqnFZCUhwTw7hb+10a/ke6F44L3psmMGEHbU4ak30oTbvUfHwZ+/WXA2CSXMs5pe3jnzIVYgPY4xPMYZ7ZUg0PLDQSbR2mwwuXpR61luIDdrOBo9IoV8UewYsxV98CSRtzD8FDi0XLzx2QutWUaCb7hX6hQYakKa+UBKjCtj4jdidXmgmn9PQn1pEmqW7rMcYfd1x/RRIfW64BxI1ke/lUvbicfqhFSc7PF2PwF/uH9sL5kUlNQpnFsdFhnfhY7O3X0BSbB/nSXuZKUvyHa0KBlTRDY6eRIs58AtUYBVdlBjKWysWosYLJ3tvQGFl/M3b16Y8lb2ADFVKVX0jKS5BjsqPu+5SstAMKyQVQIZdar5+bN8SVr5HFnsT/KTu9b6vS3hB76jbyiu5JXh8WHLP38+0wdM38MoVNbRt7Wq4J/AJ+vl+ukjDgfqBbL59sFrNEmmoQjhATy2VndxbB4nLA95ztIT9ZVFKhyMNACpA+vvuEoZQFogKLvUvCRFhJUq2QXHaKoALFlULLJeynFrIptrD6r3DPf26ab/AtUZWX2F/fjApQHPEJzmxNPZNjHw84v2K+FDkDL3oHQNqOOqS7sKVzsMjVwi/RkXdKOK2xwLWVQQ+tMly1fugNTwhZypAu0q0v7zuUu7uo6z4+Yu53nzw8cmXTQQOEzhr52ZxFO1afcGg+AgTPH/MWx0a4Ei9q/4b4nxclzKc7pvw16P4wKXc917IIATAJkpMKiGbAt2Uq8YZCOu4k8b5aO7Hv3ajVJ3DlmGVDzs4nXAp8FwFdOa8VJsLIhBWCaE7b84nuS56iAAS9DJns1v/Igp6uQ4HDoNJ42otuIWKbTsUTSXAcXczut6wOH2tC9dGW6GIRuFd7pSnVSDis/lVmunMpmQdXI5Eirbch6CJaT/auTsAkbEOT6MeYIT/anZnJ7xs/yVJzepgh0Fr065ebZVMoGZQaMPQu+zMx87EcnHab0BOpiKWSWBWCEv6n1Hv06x0YXrup3CXaA4GZWhMEH0g0h0OSWLO5+0bsSldE86j8EqgHsoQqw8fqAtNzuiIKojvt1DCxMuwRJ8LKk9UYTx851iZqGAizozu5CJOyAtEOw7oLPADt1z5UvrKjMB2QD4OKg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5005.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014)(52116014)(38350700014);DIR:OUT;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8L3MmgiD2gULvipQwa86n6UcZFnVCNmtNH5jlhglaS8YBVG9HFvFJKjkD5JF/d01M6rsSLAgJWFzrkOAG1xTq59DcJh0QIcInugRSejjWjUIYHJbrymmKu9a3qlzs50QnBgR2C2EtDd8okzVl5iEvNwSsVfEKiwjdiYON3QIVvPfPRJsozsdoaZOhPyhF8KkgbNrUnZACXLvskGCqAcomYMNStR3ZPMiUnoqBOLH86LLVLTAzSPj16zP9R4dX8nxLcpzhZt0ufNUzBASd6CrvFgXQB1DnTEQO0IVIjkhzHaTXaSISC5+HVam3nm4kp+qI9wYU6A3r1rgLgJDfg3CJZ1uMyEhXlUBCzbVgT4oVALmAdckgMutvB45MdC2f404oVmMX164JoFsIF3NlkkJ/x8wEm5IO9PFkKf7CPeJrCItNGwqXQ4UzOlTqKqwtGfKPxyF0vOIv7GaljYMMWGiVFeev/ogF7ZfPStyyjE2wdt/Oup5v2xpLB1o2fWJEH+c7onS/WF9gYEV4iCLojx16n1aU6bWx+O7+meua+qHNaVTsP6x3CiIHNFjGpMvVe9XJgEIPyOMzfMGvqG X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cf9e4f80-da91-43eb-e3fc-08dcc58c0c9f X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5005.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2024 05:00:47.9760 (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: nf/oLFBCHKzrbBJJsGLXavZ1Ip3tzov5pa2ok/OLToXJd9QSpVVAhxwIb1NPTsCBExHV6CyWXRPh6coNf3yYXA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB8058 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240825_220100_879521_C6358ACB X-CRM114-Status: GOOD ( 11.68 ) X-Mailman-Approved-At: Mon, 26 Aug 2024 00:14:14 -0700 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: Frank Li Reviewed-by: Miquel Raynal --- 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); }; /**