From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936979Ab3DIJey (ORCPT ); Tue, 9 Apr 2013 05:34:54 -0400 Received: from mga09.intel.com ([134.134.136.24]:49070 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932892Ab3DIJew (ORCPT ); Tue, 9 Apr 2013 05:34:52 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.87,438,1363158000"; d="scan'208";a="315226631" Date: Tue, 9 Apr 2013 12:39:03 +0300 From: Mika Westerberg To: Wolfram Sang Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, ben-linux@fluff.org, Jean Delvare , Andy Shevchenko , Christian Ruppert Subject: Re: [5/7] i2c-designware: enable/disable the controller properly Message-ID: <20130409093903.GI21818@intel.com> References: <1363867800-23861-5-git-send-email-mika.westerberg@linux.intel.com> <20130409090914.GD28509@the-dreams.de> <20130409092836.GG21818@intel.com> <20130409092857.GE3624@the-dreams.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130409092857.GE3624@the-dreams.de> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 09, 2013 at 11:28:57AM +0200, Wolfram Sang wrote: > On Tue, Apr 09, 2013 at 12:28:36PM +0300, Mika Westerberg wrote: > > On Tue, Apr 09, 2013 at 11:09:14AM +0200, Wolfram Sang wrote: > > > > > > > +static void __i2c_dw_enable(struct dw_i2c_dev *dev, bool enable) > > > > +{ > > > > + int timeout = 100; > > > > + > > > > + do { > > > > + dw_writel(dev, enable, DW_IC_ENABLE); > > > > + if ((dw_readl(dev, DW_IC_ENABLE_STATUS) & 1) == enable) > > > > + return; > > > > + > > > > + usleep_range(25, 250); > > > > > > This would wait 25ms max. Is there a timeout value specified in the docs? > > > > The datasheet says something like: > > > > 1. Define a timer interval (t_i2c_poll) equal 10 times the highest > > signaling period. For 400kHz this is 25us. > > > > 2. Define max timeout parameter, MAX_T_POLL_COUNT, such that if any > > repeated operation exeeds this maximum, an error is reported. > > > > In this case I have: > > > > t_i2c_poll = 25 (to 250 us) > > MAX_T_POLL_COUNT = 100 > > Maybe worth a comment? I'll add it in the next revision. > Other than that, the series looks fine to me. Thanks!