linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Tali Perry <tali.perry1@gmail.com>
Cc: ofery@google.com, Brendan Higgins <brendanhiggins@google.com>,
	avifishman70@gmail.com, Tomer Maimon <tmaimon77@gmail.com>,
	kfting@nuvoton.com, Patrick Venture <venture@google.com>,
	Nancy Yuen <yuenn@google.com>,
	Benjamin Fair <benjaminfair@google.com>,
	Rob Herring <robh+dt@kernel.org>,
	Wolfram Sang <wsa@the-dreams.de>,
	linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org,
	OpenBMC Maillist <openbmc@lists.ozlabs.org>,
	devicetree <devicetree@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v10 2/3] i2c: npcm7xx: Add Nuvoton NPCM I2C controller driver
Date: Wed, 13 May 2020 18:24:13 +0300	[thread overview]
Message-ID: <20200513152413.GQ185537@smile.fi.intel.com> (raw)
In-Reply-To: <CAHb3i=tERsM+gwmQN1+vjnML9o5NxRK=uBokEUsd-Ljyje4s3A@mail.gmail.com>

On Mon, May 11, 2020 at 02:28:50PM +0300, Tali Perry wrote:
> On Mon, May 11, 2020 at 12:18 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> 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



  reply	other threads:[~2020-05-13 15:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-10 10:23 [PATCH v10 0/3] i2c: npcm7xx: add NPCM i2c controller driver Tali Perry
2020-05-10 10:23 ` [PATCH v10 1/3] dt-bindings: i2c: npcm7xx: add NPCM I2C controller Tali Perry
2020-05-11 16:09   ` Rob Herring
2020-05-10 10:23 ` [PATCH v10 2/3] i2c: npcm7xx: Add Nuvoton NPCM I2C controller driver Tali Perry
2020-05-11  9:17   ` Andy Shevchenko
2020-05-11 11:28     ` Tali Perry
2020-05-13 15:24       ` Andy Shevchenko [this message]
2020-05-10 10:23 ` [PATCH v10 3/3] i2c: npcm7xx: Add support for slave mode for Nuvoton Tali Perry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200513152413.GQ185537@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=avifishman70@gmail.com \
    --cc=benjaminfair@google.com \
    --cc=brendanhiggins@google.com \
    --cc=devicetree@vger.kernel.org \
    --cc=kfting@nuvoton.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ofery@google.com \
    --cc=openbmc@lists.ozlabs.org \
    --cc=robh+dt@kernel.org \
    --cc=tali.perry1@gmail.com \
    --cc=tmaimon77@gmail.com \
    --cc=venture@google.com \
    --cc=wsa@the-dreams.de \
    --cc=yuenn@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).