From patchwork Thu Jan 15 17:24:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory CLEMENT X-Patchwork-Id: 429544 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 774CF1400EA for ; Fri, 16 Jan 2015 04:25:28 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755504AbbAORZZ (ORCPT ); Thu, 15 Jan 2015 12:25:25 -0500 Received: from down.free-electrons.com ([37.187.137.238]:55932 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753972AbbAORZW (ORCPT ); Thu, 15 Jan 2015 12:25:22 -0500 Received: by mail.free-electrons.com (Postfix, from userid 106) id 595CE41D; Thu, 15 Jan 2015 18:25:23 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (von69-1-88-162-9-206.fbx.proxad.net [88.162.9.206]) by mail.free-electrons.com (Postfix) with ESMTPSA id D08B440C; Thu, 15 Jan 2015 18:25:22 +0100 (CET) From: Gregory CLEMENT To: Wolfram Sang , linux-i2c@vger.kernel.org Cc: Thomas Petazzoni , Ezequiel Garcia , Maxime Ripard , Boris BREZILLON , Lior Amsalem , Tawfik Bayouk , Nadav Haklai , Mark Rutland , devicetree@vger.kernel.org, Marcin Wojtas , Gregory CLEMENT Subject: [PATCH] i2c: mv64xxx: enable acquisition of timeout value from Device Tree Date: Thu, 15 Jan 2015 18:24:31 +0100 Message-Id: <1421342671-20468-1-git-send-email-gregory.clement@free-electrons.com> X-Mailer: git-send-email 1.9.1 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org From: Marcin Wojtas This commit enables obtaining timeout value in miliseconds using the timeout-ms property. If it doesn't succeed, the default value of 1000ms is set. The Device Tree binding documentation is updated accordingly. [gregory.clement@free-electrons.com: convert commit log to mainline style] Signed-off-by: Marcin Wojtas Signed-off-by: Gregory CLEMENT --- Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt | 5 +++++ drivers/i2c/busses/i2c-mv64xxx.c | 9 ++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt index 5c30026921ae..d7fa740b68f1 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt +++ b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt @@ -25,12 +25,16 @@ default frequency is 100kHz whenever you're using the "allwinner,sun6i-a31-i2c" compatible. + - timeout-ms : timeout value in miliseconds. If not set the default + timeout is 1000ms + Examples: i2c@11000 { compatible = "marvell,mv64xxx-i2c"; reg = <0x11000 0x20>; interrupts = <29>; + timeout-ms = <1000>; clock-frequency = <100000>; }; @@ -40,5 +44,6 @@ For the Armada XP: compatible = "marvell,mv78230-i2c", "marvell,mv64xxx-i2c"; reg = <0x11000 0x100>; interrupts = <29>; + timeout-ms = <1000>; clock-frequency = <100000>; }; diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index 30059c1df2a3..a379a17c5c21 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c @@ -803,7 +803,7 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data, #else const struct of_device_id *device; struct device_node *np = dev->of_node; - u32 bus_freq, tclk; + u32 bus_freq, tclk, timeout; int rc = 0; if (IS_ERR(drv_data->clk)) { @@ -832,10 +832,9 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data, reset_control_deassert(drv_data->rstc); } - /* Its not yet defined how timeouts will be specified in device tree. - * So hard code the value to 1 second. - */ - drv_data->adapter.timeout = HZ; + if (of_property_read_u32(np, "timeout-ms", &timeout)) + timeout = 1000; /* 1000ms by default */ + drv_data->adapter.timeout = msecs_to_jiffies(timeout); device = of_match_device(mv64xxx_i2c_of_match_table, dev); if (!device)