From patchwork Tue Aug 6 06:48:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Song X-Patchwork-Id: 13755291 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 294D7C52D6F for ; Tue, 6 Aug 2024 20:40:26 +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=SkQDNMMUwiWumk7eq1m5Hwp6mxf27qoLn+iH1Snypy4=; b=kVKRSqLLnW7c5G Qj9VwICy5t35k9Cl6MGQMJyAU47WLfKzQPMS3jmM/tXcYGSVxzb6NWSgnyH4IDBNLAA56H7BCun4m Bo1j4SdmFBykuEVDUazJecUzH1IAkBE/3iW02xKqRLImssEuCkm7xa8T1eMaqcGVMk+Dg2DggqTkT SejIxxx3nPaHrK4pPDgZPfbRrqU6IeMP0j1/KGNgc52jgOLvTXicbARGsPLFmx2BwXtEsmuOS3MLO C695Lz85mnY+W6mYF8sQfw1MEXmJkstwANRhCOazut20TCGFMgGdgghNRsYBqXy5pmypPB8DzAXeD H3Unt1GUxsuN9MixW4XQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbQyn-00000002qHN-2Zpr; Tue, 06 Aug 2024 20:40:25 +0000 Received: from mail-db8eur05on20603.outbound.protection.outlook.com ([2a01:111:f400:7e1a::603] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbDsf-00000000hKY-3q9W for linux-i3c@lists.infradead.org; Tue, 06 Aug 2024 06:41:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=flKNZt8u2dpsoeGZYgInepSof9zyJ/5TzD5Is9s+G1WvejGkLaoK9P1fl9kC7ilVzbob0X23VycspCZAUebnb2rAw129PELUW1wEZKAMRF3ZiaGpa7l8s6/L5teJRIOmdN9fcV3xkng05uy077Z3s9GmuCxvDs6MDiIjID3Kwt7U/rIEfjNUsE9mZ2+EaZEUXNi3A3gPJxn/GuM2yV54Pa1vGpRbnksU+YhRMQMSPpwUA9enGqxrlYUODF+q2ZIvbmn1itfEiPsPszhhHL0DjzSPSwvO2lcyoz8+Z1GOqmXL9XRRgdT/doAO9jlWzBgjI3qbEAcc7vkzhCA3uy4dFA== 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=ErLV1tIvao2dN0HR063rroJmN3k2/TZ4fzvrDtm5hp4=; b=dKQeMhSlXbsEuxYaWeH6saEUf2kDElx93nETpIAnviIrBwgzJDoQoU7Zc5nHG+dWsGsja8EVkQaf8HvSqSpsThyEPDGQ0QkMCDgdsCPAvOpMcJkfx7rbLMGnrb16dbOiMrRlLaJ0SHr3EUSPZkPxmvoA69Lv/zYiQeJ0SFcjKe9RNN9c/m2u6BKHNRRUCCvu2QXczOoy5i5ew2xRJUe7Pfb1nmM67OHDeBD67QjGlYbvctBWWAva7WRtCUNE1fQ3k8wc9WglU8SXjG+B+MDF8GhC717cAIw3vhKjxkU2R1VaXdJ4WFzd5Q5YfCHNytUCF2++cZM/qX4A7/5mkgV8KA== 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=ErLV1tIvao2dN0HR063rroJmN3k2/TZ4fzvrDtm5hp4=; b=MqbO70yIj9CM/3pkJVtYQbJqpNr6JMbKH9N//LpGazlokMQaZaW/RXRd2mK8709CvCk3+SkpFXZsMrXHyC4kAzmXZ6+twtg2d4yGrJbpOTIQfN2vHl0SzZlYPRv84sEvRHMRWcBP5Scx+wJBZibxKXjL3sXq+1FPlNIsEFoXpeczzbI1hqbMsMDSRqBC0UL3M5QpuL/eZVQdSYE5Y/1VnrQLN6/7CV+z2KidBBjORfiFn3oOrI6SARxwrp8woZoc57xa9H9+PWFo9vK1f+2LppBoSGDPWOHE7xYxo/p4VpE/wfO4moJxTM1caSC12+bLagRoD0x8x4NW+lhlil9o4w== 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 VI1PR04MB6912.eurprd04.prod.outlook.com (2603:10a6:803:134::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.26; Tue, 6 Aug 2024 06:40:59 +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.7828.021; Tue, 6 Aug 2024 06:40:59 +0000 From: carlos.song@nxp.com To: alexandre.belloni@bootlin.com, frank.li@nxp.com, miquel.raynal@bootlin.com, conor.culhane@silvaco.com Cc: linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-imx@nxp.com Subject: [PATCH 1/2] i3c: master: support to adjust first broadcast address speed Date: Tue, 6 Aug 2024 14:48:50 +0800 Message-Id: <20240806064851.2425797-1-carlos.song@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SI2P153CA0002.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::16) To VI1PR04MB5005.eurprd04.prod.outlook.com (2603:10a6:803:57::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5005:EE_|VI1PR04MB6912:EE_ X-MS-Office365-Filtering-Correlation-Id: 5df0112c-45f7-4b43-2214-08dcb5e2bb79 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: rEoVqTOQNRIbJPDGEb3iHPmuDJsmMTit7shaimgEHh7ADBTCSb753lFCPnDVPZufg/bAO7JubAB4X8YhjBHUPJfwGjWlnE3lfLScYXZ2MUDnaiO5fTnu9PiyVr4KrPzBr3YujtbtJuJohAnJYDw8F1oUT09keclL5UC6LlgKaIdpLj4nyFkhKZ7IggMoSH/SiObHvRnrz90GdMs901iDOG+MGAH0LwOMe2dM+FNFIDD++gdIoCEp/BiaKpyncqJBZ9KkyWCgI/Xy0fFK77whoeQ2o4NLOOMxw/mRW+IH7RoYmFQ34OPulskJvHQWuRxf/6JucYkd3W9BPRSZq5ci9RWYL9mqXiiT5w7xHmqsL7QV94CtuM5J9HkpNxaeTzneucHSqV7T00G97tMX8KtOxNqMKPIwh/V996qt4TW/dpRs4/LQbGIr3NfDciqescRHTN6WtUldaMSfNjhWlw8qQCqhkCmQvmxeVa7cKajEkp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016)(52116014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wkeTZqE/zZnd+TKcyOVGktKmhZbZKyF+Lu6FVyZpZdGPO69r6aVtDCYNSfltDiCFZpVj3yYr69xMnB1lT27llt/03rJbe4eJFUydHR6fSH2km/YK1l9fsVX6Q7c43672yY7dzbL3r5zWWKSJEcpuA8WseNqOLr3K7Cr9/TdKRURUz89nfLAQ0QGUBR8uaUgoLM4nccOFCY+KpN3tFt+Y70RcPWYYCmFoiqhssvT1Vowh9C3Zd6Vat5354hKDeJNQXLCiOy/W2JhAq94w6T0XWGzhk4oQsP3orkkglK15rd77G7tvTAIj+sRiBsnkpOs2cVUymGmxzQRTJtQBgKKd0eBRjpKP4fsok4XTuUI7240UQAdf6lZRAPf5zqISSf+2QqA5VQ9vjF/gSfs0OR2HxTDXRUPXJkEbv7sW2RJk5Buj2DVfF0n4lR1izh/NRbxkbXzk7TF7StKKs1FGWI9PYm5z8yPcwLpTuhfHc+BPV57uUncrmiEpsUorNDvSlNpHsKxHeuzrrcfOy/NwCCVz6Fwpr2pOL/2GGYNruO/yxDBeKW6lR+FsCU7UjirocB9zuD74T9R3f409oqsQkL8gS9CD6c7E0nSDbA/76CHKLoLh0Yp726tvmMyl27r3AkvwvYFEXt0i+4TUifnqDG4nBw/R5+r3/17r10TpfDMPVuPEHQ5Fu3QyvbbgxlphUZy+yE3Knmrv74Tyxih0tlEUEDuC4TCyqPAsi7xqKbirOvCNECjRmCwVXIBKS9c76TmTg9WB+2n3ZNUJVe2u7NtM0NXbpRxwu9Am+scbalC6p4LzPxc6NhClpj3LtEfjd5sIbOaI1mrWRGYLzMCgndjU9a02/RN8p/8D9s+OTshR9iJFIt8z5/ADCXvU29Y3Y0kGR58DAbP1Cz7YOK5CdC4qHTiRzZlDK35sl8b0ORPiuEM2FxxM17TjQAR19s7vNv6TpOya3u2O1NEx6mWNkiqVwZB9jXgPHeZbyHx9rNgdTLiKBd6KDz11pvs+42tiYRUOoh445EzHIH/IAW3l9vfgoRG+lPb49zlr++wlOTPacyDLE0mQ9qMa0T9nzeWdyygR2lTBvYmVnRT01o0ulXmO+VgA8Smw2ukqvIDpnB4SEW5KVUW+KErINSgiYVW9Kb+4fCSLl3OmMJiK4CYm7EmD3Ij25bwx2LOyieSNErLbtPVlL2mHceoDmyTbWzfJH7x1aiU+/bs8hzTP0NQJ/gIatfEjlLZmixMSHHoOlGpThOtGprZHxim+uJEDhds1JKGvpbEZYa+Zyx27C5bKPEGKSb4w2/fqE6uNP0LQUu/Vo9eir859wL+nfxuTCu6L0yF/gVp5AOwGMz4Hlx+l29FJQ5ZgFvvJ5dahZiVsOsbyfUhSPZ/jRaZs9Gb9kJFH14Y25pqcGn+diM8iZV0AzolF1wzvkroSItH/GpTN3lWFSTkb/tvPT9zUjxMTDeKGK8OeCBCvylX/uMYnEbilbO/MEDrijBCvuuacfWV7mvTP/6TkQUg6Ku7zcMdjH7+QYAau4HOBaPv4kPRHPi4thAnsnK2KX+NtsEHlj1wvp/NQGTBRo40XybYuaItRR26APiJG X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5df0112c-45f7-4b43-2214-08dcb5e2bb79 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5005.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Aug 2024 06:40:59.4502 (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: eZ7P+od+H2XnmfLZypJhdmKl9ocnvZkfQFNzQ8Nc91X7oQ5tJ5Kv/+1QA8bFgV5jR9X/bGa6tOT95xQkgMukcg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6912 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240805_234114_222470_31272385 X-CRM114-Status: GOOD ( 11.62 ) X-Mailman-Approved-At: Tue, 06 Aug 2024 13:40:24 -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 --- 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..02e4f47f9d01 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 First Broadcast Address. + * First Broadcast Address in this speed is visible to all I2C/I3C + * devices on the I3C bus. I3C device working as a I2C device will + * turn off its 50ns Spike Filter to change to work in I3C mode. + * @I3C_OPEN_DRAIN_NORMAL_SPEED: Normal open drain speed configured according to + * 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); }; /**