From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AADA5C433DF for ; Wed, 13 May 2020 15:24:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D10A9207F5 for ; Wed, 13 May 2020 15:24:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730668AbgEMPYS (ORCPT ); Wed, 13 May 2020 11:24:18 -0400 Received: from mga02.intel.com ([134.134.136.20]:63313 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729153AbgEMPYQ (ORCPT ); Wed, 13 May 2020 11:24:16 -0400 IronPort-SDR: ihX3aOfMkDRyoSI3BXeQDwlHzLsfm4qh59ktvA7M5GXsYGPFaezzB8OsiqZVJvnynpYmFxFOP5 jqhfsr+xUh1w== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.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 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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