From patchwork Wed Oct 25 18:50:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Shikhar Dogra (shidogra)" X-Patchwork-Id: 830347 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=cisco.com header.i=@cisco.com header.b="nLGc9Wke"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yMfZy4mwzz9t3p for ; Thu, 26 Oct 2017 05:59:54 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932285AbdJYS7w (ORCPT ); Wed, 25 Oct 2017 14:59:52 -0400 Received: from alln-iport-3.cisco.com ([173.37.142.90]:30707 "EHLO alln-iport-3.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932231AbdJYS7w (ORCPT ); Wed, 25 Oct 2017 14:59:52 -0400 X-Greylist: delayed 568 seconds by postgrey-1.27 at vger.kernel.org; Wed, 25 Oct 2017 14:59:51 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2756; q=dns/txt; s=iport; t=1508957992; x=1510167592; h=date:from:to:cc:subject:message-id:mime-version; bh=YT7HvvLbiUetPF2dPFDoG3gruDvm/bFuP8C7rh11V/A=; b=nLGc9Wker/1WHQgC47MO3F3evr9K86szR6yGMVP/fGJPL9jwttG/d/sp lBHYC3ETxDh69WYGcMF4YBIS2d/hAkquSbP772/Z7XZBq2WT1E5drxtwu 09UpMLDkXuYDtYga4ihNuI8p49sM2B6stIJddaAZgCBNjtBWegBI5y34n o=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CdAAC32/BZ/5xdJa1bGQEBAQEBAQEBAQEBBwEBAQEBg1+BUieOGY8LmDSCEQqFO4RvPxgBAgEBAQEBAQFrKIVLEz88NAUYMhKKHwGrSjqKdQEBAQEBAQEDAQEBAQEBIhSDGoIHgVCBaYtygjIFkmSPD5RqkzEClgGBOR84gVs0IQgdFYMthH9WjAoBAQE X-IronPort-AV: E=Sophos;i="5.43,432,1503360000"; d="scan'208";a="22136835" Received: from rcdn-core-5.cisco.com ([173.37.93.156]) by alln-iport-3.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Oct 2017 18:50:22 +0000 Received: from sjc-ads-4188.cisco.com (sjc-ads-4188.cisco.com [171.70.54.209]) by rcdn-core-5.cisco.com (8.14.5/8.14.5) with ESMTP id v9PIoMO7022888; Wed, 25 Oct 2017 18:50:22 GMT Received: by sjc-ads-4188.cisco.com (Postfix, from userid 341545) id 0AE6B9D7; Wed, 25 Oct 2017 11:50:22 -0700 (PDT) Date: Wed, 25 Oct 2017 11:50:22 -0700 From: Shikhar Dogra To: jarkko.nikula@linux.intel.com, 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 Subject: [PATCH] i2c: designware: make *CNT values configurable Message-ID: <20171025185022.GA25920@sjc-ads-4188.cisco.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-12-10) X-Auto-Response-Suppress: DR, OOF, AutoReply Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org 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. + Example : i2c@f0000 { @@ -42,4 +54,8 @@ Example : i2c-sda-hold-time-ns = <300>; i2c-sda-falling-time-ns = <300>; i2c-scl-falling-time-ns = <300>; + i2c-ss-hcnt = /bits/ 16 <5000>; + i2c-ss-lcnt = /bits/ 16 <5000>; + i2c-fs-hcnt = /bits/ 16 <5000>; + i2c-fs-lcnt = /bits/ 16 <5000>; }; 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); + + of_property_read_u16(pdev->dev.of_node, + "i2c-ss-lcnt", &dev->ss_lcnt); + + of_property_read_u16(pdev->dev.of_node, + "i2c-fs-hcnt", &dev->fs_hcnt); + + of_property_read_u16(pdev->dev.of_node, + "i2c-fs-lcnt", &dev->fs_lcnt); + /* Only standard mode at 100kHz and fast mode at 400kHz * are supported. */