From patchwork Fri Sep 27 04:22:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Wu X-Patchwork-Id: 831095 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2094.outbound.protection.outlook.com [40.107.237.94]) (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 99D22170836; Fri, 27 Sep 2024 05:25:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.94 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727414711; cv=fail; b=qEdbdkKuxnRNVrCMd/RsB0DxQajNLNUo4RDOOGlh15aklsf51/JPFO3GG8mm/znQ2cdok4su4ydrXXGIwmIQMhXOg2/sCtCZnaHKTFumSuA6zfsa3kicps4WGHJztjt2vGAZIkjKaCujNij22L8StC346jd+wbjlenhm86v2gWI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727414711; c=relaxed/simple; bh=5ekITy4Ofip2Xj/exR4ZlKCvGt8huJq6VWCdGxO1MfU=; h=From:To:Cc:Subject:Date:Message-ID:Content-Type:MIME-Version; b=BdmFqal+d57KPM4E1CdRp0PsJX6tn0YBjpCUK+Bat645WdjTG216kH9xY5EiXVzvJ33BLn0xhA8UxlvY53UAzRY8pgiiAfLg6NRWiYwYsWgEJksAzTBCMSC/5CIXrFhqQSKXenr2hzMUMSfyGWL5wBcpfBqUu+peXln5uT76fps= 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=A1W56Db9; arc=fail smtp.client-ip=40.107.237.94 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="A1W56Db9" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GAjkQoeQ5mG73uNjDWpF75Po2U9FIqyWCEoHXcFNC3eofNJqyqNd2IXnKU77d2KBra4GSbqH5V0lK5nxoHFICAHiW7MCBvG9W5Os6a0CMk2pZS/a/e14cmcAXjjFTBBjbBNmBT37FnvEeSKzvLOlR4X3KlofV2xHRJI60BUP/tyzPBEJp+TvZ37wjS7KreHYKbn9E4mFVf8nG4mdziu0pSICxDQ80q+Cs5coWgROUDIWgucUBO7uADVZNvIXXjE8jDHbPLReub2DnCHm9rpAp1Ivs/RUHRd3o0QZ7NMJdY5JCxeRKc9sGtr7wiLg8FoOSTMyWrpDcctwe91jNAQxJg== 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=HBT8G3MnDtY3w5AoGkKsYicm6VAsPn+OT8Ddcnky3Wo=; b=nM4A07MLa2lrJsMCa/ysfR2YqLqh1xD5DANpAQ8sehCSaVsd2gOUJ72zsuggt26MgjqU42/6uT+cXJUMYU1i/f5F9c3+wzI6s49hsL0ZNPR6JGdWWO82WGvCuHIC6G2XO33T1demiVtmIEs438FwqCcsIKiGclh6A9CuM3eKYtqSlKweOyXgbbfReREBsTZ8e4A2kyc+jB+LeqaqLdCYeOMKs32maANglf4lR9pMhWEuJI1H7kLp6gIz+sIec8CvLE9lG9oNA9vRFvSm9r50aYdHhuuNNbLvB9NHnU+2EnQ9ueipFPfzI8g9IQZCbxS6yL3uqFVb0PbhhYh+Z4Ev+w== 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=HBT8G3MnDtY3w5AoGkKsYicm6VAsPn+OT8Ddcnky3Wo=; b=A1W56Db9EpQPEHUQHeZ9I5TnA5d+ywlmfV8Inz0RmoDfxaQ4XZsxfQNA18WpGed+i7ciz3esCDbvOVco+DVvZ7yWnKwTYkN/P7HUzTUjrb6A8EhHbjZNY7RHa4bP7NV2LMn4bOjRA4HRDe+UtQi0JlhsjT+VhkMOSOHH32XZ+/w= 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 DM4PR14MB5526.namprd14.prod.outlook.com (2603:10b6:8:bf::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.28; Fri, 27 Sep 2024 05:25:05 +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.8005.021; Fri, 27 Sep 2024 05:25:05 +0000 From: Michael Wu To: Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jarkko Nikula , Andy Shevchenko , Mika Westerberg , Jan Dabros , linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Morgan Chang , mvp.kutali@gmail.com, Michael Wu Subject: [PATCH v2 0/2] Compute HS HCNT and LCNT based on HW parameters Date: Fri, 27 Sep 2024 12:22:15 +0800 Message-ID: <20240927042230.277144-1-michael.wu@kneron.us> X-Mailer: git-send-email 2.43.0 X-ClientProxiedBy: TYAPR01CA0148.jpnprd01.prod.outlook.com (2603:1096:404:7e::16) 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_|DM4PR14MB5526:EE_ X-MS-Office365-Filtering-Correlation-Id: e925a85f-3cb8-4603-3f46-08dcdeb4be4b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|52116014|376014|7416014|1800799024|80162021|921020|38350700014; X-Microsoft-Antispam-Message-Info: dJ2USWWj7oNg7iuCYdqEh2bWw84+xjG0Cc/yGWvkmnVrdVYnf+ZfhRGEYlLJZ0cP78ij0gUn5jyWJIhG3sxv8B8EBFu9zn0Jf9ZQogcCoWGuX/EZzSbhjTK8V55RwjYYqLEGd1fkHvVF1kuEng66X8QQAxi14JlMBBkpmC0y6BsR1celxGKaTP7ssrH31YrCUYww1PQqpRtwo/0hGfcAoDiIv7i6V8VdRjKYASkODTb+x/L6J+n3J4shO+UQLF7P3EHW4UgpVXFMJ1vYbfFJlRwEXe5ZTkMa0Z8h0aC06KB6ir61yTcrH7iLw7rEl+kSsdnqcJoqvQs6RNLxoY0+70uISBgMvI0Mem9qKe56AA+gx2yza/1Wotm2/gQIy1G08JFAEDjqD9szkYHANX//jsHsTNemCREg2v4RXjwUrazO+QlipY5Jw6VLRoegj6h4uCfJt1N6jwxjSB35DUJ3SBCZFYKH4hdAnGako9d/khotUr9kXsoQxBu2vwfET8gW49RRJPPBI81WRAJIu3euI6Kb3wm+kwd6d4xjCGA3qBTPusaWVuu9dVyeZoLwsAxN1YSaaVqNODP5GTFatVb4FoATkG6EEsPYkZL4/z4AQpzUca9p+T7kHLt4JWCOQCafJfoN6DxgnoeStnJJiaP968uu1OQ6+Wg6BtIA0BTACPGPvyE/IeIDAH9wCx8rtrH7q1AqcHozn+gPq+eqBNwVUXh59Yi9NYN+xf04RdYeA2O8YRWZxxNCEwAnvKbmnJTMVfnN9tWqdR/jlT+KDBlfaNntYl831dnAFAHEM0Eiui38KK6ALQwnhbcsf4ddkJtYa2mUjOfNrMhvVQOid/p/j2bofIVrTvDa/0kMBRt9ihvZFcIh1G6IrSnWqDyMPWZxSI0hSXWAn3v7rbP/T0OL+dmzKYxL2nusQjz0qTmtoNjxGTG+hKubDM298/14uRUgppquoWFWQHzxJdsgPJ3HnrNzMtO3+CiexhhEpU/u7cHw8vBp+NiWziSI9w6fMwpDuyvY6vx8xUfhoSJS7EdQCYOHWI7GQpUcmMDv6sd2SsmKsj7THWL2KThLk6axMRVQ46tDtXUKD+4icVhiH9RU47DGEx//+6KrOjO8cUpDwK/xBxTq0X7rPgZMetkChNVoyiTgz7G04DyKc2uEY3t4D1lYVV5o3d/KKPULiBH4B0SuTK0SxazUOw6jf1lWFEcXXEAMefzXF0dpC5luNH8zqfz0ILbnvtBtMP6HUfzR9DZ9QMKuu3efeJCDzq2Ssjop7vz5XiVF3lv4HuLWyk2VlT/xCexqL+vzyF1Sld+6hrnpJB0MV3jOig0d8v0Qow8O58j8oHIm6C3IH47YBNILcJ1eqDOYl9WFewF22JrQEEJ5PJECOGhJ4il42rq71VMMnAXNO5+5vkxHl1/k6iMDz1DbVXDVo2SW1OiIaDqSRmR9l+Fq2+VGjcO1VdPn7NhN X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:IA1PR14MB6224.namprd14.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(52116014)(376014)(7416014)(1800799024)(80162021)(921020)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nADP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aq/rosfRK0PjwlIn4UP+3O+ePsqYNxrwWDiW06T9P+hf1RWwFJeYqtgjAjZXQpKn7WmCtueXWJo5gGY5IiiL5IHwioxqOtZqk7aQbjcAL5Gi8lzbgcsiGDt7VZNDkfKa7XWPUwuw3A8Ms6q2yqt0/ax78WpONQQbxk/e+7wzBHrn0K3HwqCs6XEq/h+LbsModUtX829PF+P3yfcSAxBz3OGYMuVQ/LT7YScuBgLLEArM7pAn0fPq6y8ZR54YOM3kd3Td+Ipqm/DLhBVoqYBLv36D2yNHtGMJ4UhM3RZM34LLwrYeDyntmEK90UYSy9sgYfy4pelDhpNk5kPjuvBtaBxLNVFjXAW08LppPI7tu3N6qWC+X7wj9EPA9CA3UN7hlMo1igU2SKUTfIseucNByIk5Z3Etfoc1pmIn3rMz3M2YFMN9EUY+2AE9O2wbT82oizykTBuC/a8cm3y8zlhpbDc+paZ78UbylntxYP25sXye+DcRQdGbZu/BOmXLzejQBnbFdMq X-OriginatorOrg: kneron.us X-MS-Exchange-CrossTenant-Network-Message-Id: e925a85f-3cb8-4603-3f46-08dcdeb4be4b X-MS-Exchange-CrossTenant-AuthSource: IA1PR14MB6224.namprd14.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2024 05:25:05.2907 (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: 5BLCvEYBmAOsw/LsaG/ztCuBDLTLvbuSsttv2Q7p4jpPSUYQmvYZCXur1DzPlVFCwCroQI2ua2SlYIaD4xW3ug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR14MB5526 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, the set of these 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 declared through the device tree. v2: - provide more hardware information in dt-bindings - rename "bus-loading" to "bus-capacitance-pf" - call new i2c_dw_fw_parse_hw_params() in i2c_dw_fw_parse_and_configure() to parse hardware parameters from the device tree. Michael Wu (2): dt-bindings: i2c: snps,designware-i2c: add bus-capacitance-pf and clk-freq-optimized i2c: dwsignware: determine HS tHIGH and tLOW based on HW parameters .../bindings/i2c/snps,designware-i2c.yaml | 14 ++++++++++++++ drivers/i2c/busses/i2c-designware-common.c | 16 ++++++++++++++++ drivers/i2c/busses/i2c-designware-core.h | 6 ++++++ drivers/i2c/busses/i2c-designware-master.c | 14 ++++++++++++-- 4 files changed, 48 insertions(+), 2 deletions(-)