From patchwork Wed Apr 6 07:28:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 8758861 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C44F1C0553 for ; Wed, 6 Apr 2016 07:34:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DA4732022A for ; Wed, 6 Apr 2016 07:34:37 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F2D0F20212 for ; Wed, 6 Apr 2016 07:34:36 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1anhww-0003Jp-Nq; Wed, 06 Apr 2016 07:32:26 +0000 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1anhwt-0003Ca-DJ for linux-arm-kernel@lists.infradead.org; Wed, 06 Apr 2016 07:32:24 +0000 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u367Rteq028486; Wed, 6 Apr 2016 00:31:51 -0700 Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0a-0016f401.pphosted.com with ESMTP id 222bekpggg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 06 Apr 2016 00:31:51 -0700 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1104.5; Wed, 6 Apr 2016 00:31:50 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server id 15.0.1104.5 via Frontend Transport; Wed, 6 Apr 2016 00:31:50 -0700 Received: from xhacker.marvell.com (unknown [10.37.135.134]) by maili.marvell.com (Postfix) with ESMTP id 5CF5D3F703F; Wed, 6 Apr 2016 00:31:48 -0700 (PDT) From: Jisheng Zhang To: , , , , , , , , Subject: [PATCH] i2c: designware-platdrv: get fast/std speed scl high/low count from DT Date: Wed, 6 Apr 2016 15:28:00 +0800 Message-ID: <1459927680-5480-1-git-send-email-jszhang@marvell.com> X-Mailer: git-send-email 2.8.0.rc3 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-04-06_04:, , signatures=0 X-Proofpoint-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1601100000 definitions=main-1604060109 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160406_003223_477884_BCC50B36 X-CRM114-Status: UNSURE ( 8.80 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jisheng Zhang , devicetree@vger.kernel.org, linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Sometimes, it's convenient to define the scl's high/low count directly, e.g HW people would do some measurement then directly give out the optimum counts. Previously, we solved the sda falling time and scl falling time by i2c_dw_scl_hcnt() and i2c_dw_scl_lcnt(), then put them into dt, but what we really care isn't the sda/scl falling time. From another side, the dw_i2c_acpi_configure() on ACPI platform also get hcnt/lcnt values rather than the sda/scl falling time from ACPI method, we want similar feature for DT platforms. Signed-off-by: Jisheng Zhang --- Documentation/devicetree/bindings/i2c/i2c-designware.txt | 16 ++++++++++++++++ drivers/i2c/busses/i2c-designware-platdrv.c | 8 ++++++++ 2 files changed, 24 insertions(+) diff --git a/Documentation/devicetree/bindings/i2c/i2c-designware.txt b/Documentation/devicetree/bindings/i2c/i2c-designware.txt index fee26dc..05176fbf 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-designware.txt +++ b/Documentation/devicetree/bindings/i2c/i2c-designware.txt @@ -20,6 +20,22 @@ 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-scl-high-count : should contain the standard speed i2c clock SCL high + count. If defined, the i2c-scl-falling-time-ns and i2c-sda-falling-time-ns + will be ignored. + + - i2c-ss-scl-low-count : should contain the standard speed i2c clock SCL low + count. If defined, the i2c-scl-falling-time-ns and i2c-sda-falling-time-ns + will be ignored. + + - i2c-fs-scl-high-count : should contain the fast speed i2c clock SCL high + count. If defined, the i2c-scl-falling-time-ns and i2c-sda-falling-time-ns + will be ignored. + + - i2c-fs-scl-low-count : should contain the fast speed i2c clock SCL low + count. If defined, the i2c-scl-falling-time-ns and i2c-sda-falling-time-ns + will be ignored. + Example : i2c@f0000 { diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index d656657..8739a60 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -188,6 +188,14 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) &dev->scl_falling_time); device_property_read_u32(&pdev->dev, "clock-frequency", &clk_freq); + device_property_read_u16(&pdev->dev, "i2c-ss-scl-high-count", + &dev->ss_hcnt); + device_property_read_u16(&pdev->dev, "i2c-ss-scl-low-count", + &dev->ss_lcnt); + device_property_read_u16(&pdev->dev, "i2c-fs-scl-high-count", + &dev->fs_hcnt); + device_property_read_u16(&pdev->dev, "i2c-fs-scl-low-count", + &dev->fs_lcnt); } if (has_acpi_companion(&pdev->dev))