Return-Path: Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=linux.intel.com (client-ip=192.55.52.151; helo=mga17.intel.com; envelope-from=andriy.shevchenko@linux.intel.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.intel.com Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 49MdkW2FTHzDq9G for ; Thu, 14 May 2020 01:24:18 +1000 (AEST) IronPort-SDR: yrKJQWcRlY37P0kI3RqvGGw8jK5Am+DVjn+MmsgknD7POfqrL1HLkLuPeEJWQabp5c86HOeS0r 4lOml69TxJkg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2020 08:24:15 -0700 IronPort-SDR: LEYmL0D8h4/MJPzQww7+nG6ZMTyIUMdrpW620uivs8d1RMOvGn0hsKExHGUYjZoUgEhe4Gmdup YKNkAXzriOTw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,388,1583222400"; d="scan'208";a="251288456" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga007.jf.intel.com with ESMTP; 13 May 2020 08:24:10 -0700 Received: from andy by smile with local (Exim 4.93) (envelope-from ) id 1jYtEz-006Rr3-Pi; Wed, 13 May 2020 18:24:13 +0300 Date: Wed, 13 May 2020 18:24:13 +0300 From: Andy Shevchenko To: Tali Perry Cc: ofery@google.com, Brendan Higgins , avifishman70@gmail.com, Tomer Maimon , kfting@nuvoton.com, Patrick Venture , Nancy Yuen , Benjamin Fair , Rob Herring , Wolfram Sang , linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, OpenBMC Maillist , devicetree , Linux Kernel Mailing List Subject: Re: [PATCH v10 2/3] i2c: npcm7xx: Add Nuvoton NPCM I2C controller driver Message-ID: <20200513152413.GQ185537@smile.fi.intel.com> References: <20200510102330.66715-1-tali.perry1@gmail.com> <20200510102330.66715-3-tali.perry1@gmail.com> <20200511091759.GE185537@smile.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-BeenThere: openbmc@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development list for OpenBMC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2020 15:24:20 -0000 On Mon, May 11, 2020 at 02:28:50PM +0300, Tali Perry wrote: > On Mon, May 11, 2020 at 12:18 PM Andy Shevchenko > wrote: > > On Sun, May 10, 2020 at 01:23:29PM +0300, Tali Perry wrote: ... > > > +#if IS_ENABLED(CONFIG_DEBUG_FS) > > > > Why? > > We wanted to add an optional feature to track i2c slave status. > the NPCM has 16 channels handling multiple devices each. Some of the devices > are polled periodically, and might power down. > The user wanted to implement a health monitoring option > to occasionally check the status of the buses (how many timeouts, recovery etc.) > This feature is optional and depends on CONFIG_DEBUG_FS The counters are exposed > to user through the file system. What I meant is why do you need an #ifdef? ... > > > +#define I2C_NUM_OF_ADDR 10 > > > > Is it 10-bit address support or what? > > > > No, the NPCM has an option to respond to multiple slave addresses > (10 own slave addresses) Perhaps more descriptive name then? ... > > > + // Repeat the following sequence until SDA is released > > > + do { > > > + // Issue a single SCL toggle > > > + iowrite8(NPCM_I2CCST_TGSCL, bus->reg + NPCM_I2CCST); > > > + udelay(20); > > > + // If SDA line is inactive (high), stop > > > + if (npcm_i2c_get_SDA(_adap)) { > > > + done = true; > > > + status = 0; > > > + } > > > + } while (!done && iter--); > > > > readx_poll_timeout() ? > > Not exactly, readx_poll_timeout includes only a read operation, here there is a > write in the middle. (iowrite8) Ah, indeed. Perhaps time to add writex_poll_timeout() ? -- With Best Regards, Andy Shevchenko