From patchwork Wed Sep 25 08:04:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Wu X-Patchwork-Id: 830881 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2138.outbound.protection.outlook.com [40.107.236.138]) (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 45D251591FC; Wed, 25 Sep 2024 08:04:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.138 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727251492; cv=fail; b=GqQyTVSEHHx1p4birmYnSfBrcCCLqkLehbDe00N106TFvEvicTY5sTbOiEZy5lmDn72QmfdkEOnHPiwtiXle/32AQU9N5euNoW0qYys7qqTYndrP/JRdqslYEaDYuHVSjAYvx70MECyJHfJ7/mhJeNdXmKLmXWmhn4xdOvbVrnk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727251492; c=relaxed/simple; bh=zW3gtNjDIcCy+Tf4YFtK9ecb3yvkYQBe/SaXhUFwtu0=; h=From:To:Cc:Subject:Date:Message-ID:Content-Type:MIME-Version; b=KvOL8K5L3Y365uxm9SJ51JNhHXAX+OQGpDuILcEq+B4jcdhhJVaWk47OQ+k3lD/7Lkq49qXkf4wdq5bwAc7Qmx7kKt8qoqDZyhJ1L67+yVvJmB2rDYlSXsLZTwBTu22Sc0yGufRLvXmrfxvMh6FsGON0nnsy/D0AZRq+/xiJx7w= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=kneron.us; spf=pass smtp.mailfrom=kneron.us; dkim=pass (1024-bit key) header.d=kneron.us header.i=@kneron.us header.b=jA0LTNTD; arc=fail smtp.client-ip=40.107.236.138 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=kneron.us Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kneron.us Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=kneron.us header.i=@kneron.us header.b="jA0LTNTD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CdQK09dkQg9xDg3QulKQi2U0WDy+ilVVR43fnAuodLnit7dSU5FafKSVIBb4KRVAtGpt3Tyi4HbuATX2+xKWYWHFjCKKBVYrdmO0gfysFrmXn9r4YH1sUzAL9YXVR1eCFHHvu+ez6PlW7i7v594yuONaYC4efr6jL4VD0SySCvl7vsKzTxZCs/hEz5Gj01Ts0WLHV/dXW9GuMbVQg8Z5NXPIfjTa+cfvQnoon7Kv5B8QHHTIL70BdmdarpZKGcdiMgxNwIMvYoMsg5PwYI7Ht4DQIDU8htPx0daqCzqDdP9qC/LdHwL+9VruHf/aKdK8oxWFZSBgZ04yqpKRR7Gvew== 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=1ZQ6WefrxFy6WppcKc3G0k9DCHenAWzt8s4c1yrCE+8=; b=qsjY/vh+P7sy0YogjTmtSAvnQsM1CVW9g/uIMksQylIyndmYJMi6i8DKmUeq+F+2g4GGagpc5HhifOKevDXnzjCHsxW+A5spfZ0qAUrjyMBOERIzgMsyU2ftqzcuOid9H6ME+QQ/NZQienCUXJcwmQ8Oc02VI4WE0bIPTXSmCYepGE2PzNGnonW2Jp+Sm2tFiwfYN+7MU6I0hE+4gzIvqR1uZHkN7zbUrVJ4mPKEg+7EVaEITLZeVIv5PQ1dS0wchhF3sJGogCxWdG7G6PDzl24R9tMbOOlmXjKtuGkFK/wCAt9+Kp5RTrT251kjHVwzU24qpK1e8UGTeuyloohrZQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=kneron.us; dmarc=pass action=none header.from=kneron.us; dkim=pass header.d=kneron.us; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kneron.us; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1ZQ6WefrxFy6WppcKc3G0k9DCHenAWzt8s4c1yrCE+8=; b=jA0LTNTDei3/OXLYMRw5jqKH8r+jdAhrwDWO3j2RVWPYUXKtcL5LPKb8pifzGTljAQmcoHfg2D5slJ1E5prafQtY7MPPba+Z7yA87brI9UpLrP9vcctzTjNvG/7fIgj41ya2YZU6Q4HEnq49Np7dIFRyVdTHG8gT2oHZLOD00Lo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=kneron.us; Received: from IA1PR14MB6224.namprd14.prod.outlook.com (2603:10b6:208:42b::6) by PH8PR14MB7109.namprd14.prod.outlook.com (2603:10b6:510:254::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.27; Wed, 25 Sep 2024 08:04:48 +0000 Received: from IA1PR14MB6224.namprd14.prod.outlook.com ([fe80::c527:653c:698d:3d94]) by IA1PR14MB6224.namprd14.prod.outlook.com ([fe80::c527:653c:698d:3d94%3]) with mapi id 15.20.7982.022; Wed, 25 Sep 2024 08:04:48 +0000 From: Michael Wu To: Jarkko Nikula , Andy Shevchenko , Mika Westerberg , Jan Dabros , linux-i2c@vger.kernel.org Cc: Andi Shyti , Morgan Chang , linux-kernel@vger.kernel.org, Michael Wu Subject: [PATCH 0/2] Compute HS HCNT and LCNT based on HW parameters Date: Wed, 25 Sep 2024 16:04:29 +0800 Message-ID: <20240925080432.186408-1-michael.wu@kneron.us> X-Mailer: git-send-email 2.43.0 X-ClientProxiedBy: TYCP286CA0161.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:383::6) To IA1PR14MB6224.namprd14.prod.outlook.com (2603:10b6:208:42b::6) Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR14MB6224:EE_|PH8PR14MB7109:EE_ X-MS-Office365-Filtering-Correlation-Id: a8b4d290-947c-46c9-25e6-08dcdd38b99e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|376014|1800799024|366016|80162021|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?NQ5hSvobvepeLMxPN/RRlgVuVE80uhG?= =?utf-8?q?ejuWv+wZGMhGELMSpjZBWlV8CF3HnytCmjR5AgjH2d+/adP6ZAKQasnjWfWau0kA1?= =?utf-8?q?uNpyZlA7ROwGuZr0LqxFUueGB6BtezFcEdpKSIADHFb7DWQrGAcT0Dg7Wlq7ZWHrM?= =?utf-8?q?IpJIk8hMikXsmYPINA+wHJzS5/3VrSxiLWRPe6w6J8L/iuSjfl7mrUjuUdwDPr/nN?= =?utf-8?q?fOlnVuY21IjcWvdzKNFYNS2FjLO92IGpixIsWFYZ+ToJ817KmKtYYov6X5Y0Vcd03?= =?utf-8?q?qeEukyeEKz5EzRVYUIVkgb9I2QpgSMWlytyQok9sfYebeF2QQAl4LeKDENSGAbfRu?= =?utf-8?q?5YHzcwR+064x/g9DpSlsMUwaNQKmxe9Y1QclHBtOScX7jJ/Xb5GRvWxnsaIV8m2ze?= =?utf-8?q?gDl/jAfJpVq/6+6prrcAx88Dm/knN/KlMW4knAhkw1Dk7IYT2hPSAR9kGlWFYK4da?= =?utf-8?q?Q0I46opdIJSb5nd+rX/uBfLTTDbXFekKQWLQSEPy1EQODSI4Q1qOPpyoCB6kSyfmz?= =?utf-8?q?G52baD/HcjvuAb4vEO+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; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:IA1PR14MB6224.namprd14.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(376014)(1800799024)(366016)(80162021)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?0RU22iL5ZJAKKnGnQ4x5vS12nYF1?= =?utf-8?q?uQu5WOiRn//gtj0MhXQRCtPbZUuv7AqhmZFCr2lyr3ONahmz5gTYsj1v14ZIbcABp?= =?utf-8?q?mqXitha4zPDQYSpL/M54BUUU+czGlv+Du4zGtlyiZzUpPkYOOLgATFHRrFm9MiKC4?= =?utf-8?q?FxPVbBhqvnJdf9WIFBzAPhtcLX+itOvDuXnrNXXpszGHExhZJRAIpjyQABnwpFl/a?= =?utf-8?q?gS5zwxa5H6li2Yvr1it9pYkahCweWG9X0M87AKGt/ffRS/8SZsSeSCIR4Jxct8XPb?= =?utf-8?q?cjyFx1OivcnvMZxhPe/CG+zbCj5FufWjT4BXnt/7oKMqJeTQlOI6nNn+xoclcv2X8?= =?utf-8?q?zZaySjr4bLsOymzsrGTGdj+4I/mKrFShMVxe9nijzRZoRDa0ln8DmS9ETW0/8hEfK?= =?utf-8?q?JGg77d4SEPL7qNaj1W/J2qOEPMtCvWPfaaRFaQ5kAKugoa4ddYkNKAQpqEOoEtHo/?= =?utf-8?q?g8RwptiqdqsUyTyCXwXP1aCeHzy1ijH0ss6Wf4C6wWhwD614YlFWLxIcGcs1Nr5UV?= =?utf-8?q?ZURoXByspt6wQz+pwRiWvtPBFlsr0lI8HsA7rUipF7YzDW+UzoEpqzuySzmwe+RZk?= =?utf-8?q?KIQO2I0hTJpJPgC/xUC/uJCYrFjzx+iQkCifrgrp9v2+gTwWdyfhtonRAEPFTsdiJ?= =?utf-8?q?c/2Yrr/t2nCYjWWN6pDYDHVX/M4PeiAlmuS3mZ9b/P1W2fdgOGY2/5SBjNP3C7YoD?= =?utf-8?q?NEoDNqQmx6xpIgjOnen4k4UU2wUbAfKWx5RzNtccc8Qp3Pa5CyeeeLNep9aA8BAwT?= =?utf-8?q?rhk6uNBGayQfRWHVTK6HwBKs0dLKkfn4gLPjntAMyGxhE8lwgE183m7irrUJT/i1d?= =?utf-8?q?DbzoIlp5oRVybvTxeyv3RCXH8bjuvdYocADe62uiDynUr/v9imcrULBWz9RSxUQkS?= =?utf-8?q?2dRYGw/VgW5OxUnyadin5S/NTndm8F0tpMQ7KBumsFEdIC5QaJcL+iofpXxJe3b2G?= =?utf-8?q?np+I9n9j3CnpD0OF11put5UEuuZAQUHicgUCLs+OtLNnYe2Nt3ciRo1LkdzI/8ltl?= =?utf-8?q?NHlBMzbvkpb2JbQphp7tnJigHlBpPq/Tel3D/yv8KrnkqG1vm8UEK79o7MIJNiVS9?= =?utf-8?q?B1dZqcxFaLnFSnsgfXJpIs6XzrUWi2V8oS2A3QDAFEr8snS1lQ4ZT9jQWlLTAGGc0?= =?utf-8?q?t5GUcmVQVi+khy/bCgpsqV/BrKx72KHHVgid9g5MPFkK12WR30a10wHvBTA4uEI9C?= =?utf-8?q?nglobgSvqQdiYh0iYdWY+gYrvJVC7cuCsSFkuE0uzOkdXGxrbkwDUQXc8IykamVxe?= =?utf-8?q?BhDCzkK12ykQJ28Q2nNNg/F6ABNYcdIqI3TwPs80+x6X458XOnSAStza7Q+FcjG71?= =?utf-8?q?r4DoZXcP9XKe93rc1Yn5xbhDvP8UAA1k+2MSqlLMapFsMo/JooBtAYs6jmtB/p5at?= =?utf-8?q?l7rqa1F52sfxsQeMf2TnkPZMABs3PMDhrxjYDmel9S0JfmogSiogZn1tdDZ+43X3N?= =?utf-8?q?wIzW6vsAq6D5lJo7ycMJv2lqCXYWcqh5Pofo1VR78szl00wPcoPy38m+InhVqf1XC?= =?utf-8?q?PJuM1WLJGQvd?= X-OriginatorOrg: kneron.us X-MS-Exchange-CrossTenant-Network-Message-Id: a8b4d290-947c-46c9-25e6-08dcdd38b99e X-MS-Exchange-CrossTenant-AuthSource: IA1PR14MB6224.namprd14.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2024 08:04:48.4797 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f92b0f4b-650a-4d8a-bae3-0e64697d65f2 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: q6jeez/8StFPb3Pg5n7vHeHfVRCwqxyCa03d6KhDW24KD4l+pUO74wYusC3Y12hs8C9nHkXC4uLU4MHVSSycDA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR14MB7109 In commit 35eba185fd1a ("i2c: designware: Calculate SCL timing parameters for High Speed Mode") hs_hcnt and hs_lcnt are computed based on fixed tHIGH = 160 and tLOW = 320. However, this fixed values only applies to the combination of hardware parameters "IC_CAP_LOADING = 400pF" and "IC_FREQ_OPTIMIZATION = 1". Outside of this combination, SCL frequency may not reach 3.4 MHz if hs_hcnt and hs_lcnt are both computed using these two fixed values. Since there are no any registers controlling these two hardware parameters, their values ​​can only be noted through the device tree. Michael Wu (2): i2c: designware: determine HS tHIGH and tLOW based on HW paramters dt-bindings: i2c: snps,designware-i2c: add bus-loading and clk-freq-optimized .../bindings/i2c/snps,designware-i2c.yaml | 19 +++++++++++++++ drivers/i2c/busses/i2c-designware-common.c | 16 +++++++++++++ drivers/i2c/busses/i2c-designware-core.h | 8 +++++++ drivers/i2c/busses/i2c-designware-master.c | 24 +++++++++++++++++-- drivers/i2c/busses/i2c-designware-platdrv.c | 2 ++ 5 files changed, 67 insertions(+), 2 deletions(-)