From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932453AbdJZOUf (ORCPT ); Thu, 26 Oct 2017 10:20:35 -0400 Received: from mga06.intel.com ([134.134.136.31]:34119 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932246AbdJZOUd (ORCPT ); Thu, 26 Oct 2017 10:20:33 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,434,1503385200"; d="scan'208";a="1210413489" Subject: Re: [PATCH] i2c: designware: make *CNT values configurable To: Shikhar Dogra , andriy.shevchenko@linux.intel.com, mika.westerberg@linux.intel.com, wsa@the-dreams.de Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, xe-linux-external@cisco.com References: <20171025185022.GA25920@sjc-ads-4188.cisco.com> From: Jarkko Nikula Message-ID: <4ddeadd3-aa31-87f4-cd8d-ddf2132edb49@linux.intel.com> Date: Thu, 26 Oct 2017 17:16:07 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20171025185022.GA25920@sjc-ads-4188.cisco.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi On 10/25/2017 09:50 PM, Shikhar Dogra wrote: > The values are already configurable from ACPI. > > This patch makes the high count (HCNT) and low count (LCNT) > register values configurable through device tree. > > Cc: xe-linux-external@cisco.com > Signed-off-by: Shikhar Dogra > --- > Documentation/devicetree/bindings/i2c/i2c-designware.txt | 16 ++++++++++++++++ > drivers/i2c/busses/i2c-designware-platdrv.c | 12 ++++++++++++ > 2 files changed, 28 insertions(+) > > diff --git a/Documentation/devicetree/bindings/i2c/i2c-designware.txt b/Documentation/devicetree/bindings/i2c/i2c-designware.txt > index fee26dc..2b9ddca 100644 > --- a/Documentation/devicetree/bindings/i2c/i2c-designware.txt > +++ b/Documentation/devicetree/bindings/i2c/i2c-designware.txt > @@ -20,6 +20,18 @@ Optional properties : > - i2c-sda-falling-time-ns : should contain the SDA falling time in nanoseconds. > This value which is by default 300ns is used to compute the tHIGH period. > > + - i2c-ss-hcnt : should contain the I2C controller standard speed HCNT value. > + If this is not set we use the calculated and more conservative values. > + > + - i2c-ss-lcnt : should contain the I2C controller standard speed LCNT value. > + If this is not set we use the calculated and more conservative values. > + > + - i2c-fs-hcnt : should contain the I2C controller fast speed HCNT value. > + If this is not set we use the calculated and more conservative values. > + > + - i2c-fs-lcnt : should contain the I2C controller fast speed LCNT value. > + If this is not set we use the calculated and more conservative values. > + Worth to add also properties for high-speed while at it. Out of curiosity, are calculated values by using "i2c-sda-falling-time-ns" and "i2c-scl-falling-time-ns" properties non-optimal on your platform and controller clock? > diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c > index 6b00061c..25c3b0c 100644 > --- a/drivers/i2c/busses/i2c-designware-platdrv.c > +++ b/drivers/i2c/busses/i2c-designware-platdrv.c > @@ -177,6 +177,18 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) > of_property_read_u32(pdev->dev.of_node, "clock-frequency", > &clk_freq); > > + of_property_read_u16(pdev->dev.of_node, > + "i2c-ss-hcnt", &dev->ss_hcnt); > + This patch is against old kernel. These were converted near 2 years ago by the commit 4c5301abbf81 ("i2c: designware: Convert to use unified device property API") -- Jarkko