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: 13777085 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2048.outbound.protection.outlook.com [40.107.22.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 114A855893 for ; Mon, 26 Aug 2024 05:00:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724648454; cv=fail; b=LsX0LPwF7YvnkO403F3a3ayjIOB0ToF/8GNUz0CFSAjkey2C6S0cxxuT3u5NrsRbJblUX+D9xxx2LqMyM/4nROYC90pFlcqjn/yKZnAkedPKoQ9u6RsBLPJW/IaSezLnx3LPSnxgRni+vZL+7GRuyDmZZYiSNoyiSAcauJTMl68= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724648454; c=relaxed/simple; bh=9OuVVNUTBCZrLo+ZoFXRYOgugKpZWyiCeqMxsAy1RnQ=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=G+UvaDzj0fErIJ9MhWQjh52phAhWM0a08bXI5AGruUkDjeFDbqgQKR9D0AN81aXrx97sdy5lgZuwMzLvwJEzFBsvve0iQU4CYBhRg549AL6Y1mWYCMzkeyLBaD4sN7LdSCZM+tCHZn4DA14XPKPCgxVBO3dRJ3X0wIvPqFmXibg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=R47/V6p8; arc=fail smtp.client-ip=40.107.22.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="R47/V6p8" 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) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: 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;SFP:1101; X-MS-Ex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wa86n6UcZFnVCNmtNH5jlhglaS8YBVG9HFvFJKjkD5JF/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 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); }; /**