linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Scott Wood <oss@buserror.net>
To: Joakim Tjernlund <Joakim.Tjernlund@infinera.com>
Cc: "linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>
Subject: Re: i2c-mpc: Correct I2C reset procedure
Date: Wed, 10 May 2017 20:42:20 -0500	[thread overview]
Message-ID: <1494466940.29095.3.camel@buserror.net> (raw)
In-Reply-To: <1494399764.5113.30.camel@infinera.com>

On Wed, 2017-05-10 at 07:02 +0000, Joakim Tjernlund wrote:
> On Tue, 2017-05-09 at 15:54 -0500, Scott Wood wrote:
> > On Tue, May 09, 2017 at 02:03:51PM +0200, Joakim Tjernlund wrote:
> > > Current I2C reset procedure is broken in two ways:
> > > 1) It only generate 1 START instead of 9 STARTs and STOP.
> > > 2) It leaves the bus Busy so every I2C xfer after the first
> > >    fixup calls the reset routine again, for every xfer there after.
> > > 
> > > This fixes both errors. Add an iobarrier_rw() when writing the
> > > I2C control register as well to make sure the register reaches the
> > > controller in time.
> > > 
> > > Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
> > > ---
> > > 
> > >  Not sure where to sent this as there is no maintainer so adding
> > >  Scott Wood as well.
> > > 
> > >  drivers/i2c/busses/i2c-mpc.c | 24 ++++++++++++++++--------
> > >  1 file changed, 16 insertions(+), 8 deletions(-)
> > > 
> > > diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
> > > index 8393140..09b826d 100644
> > > --- a/drivers/i2c/busses/i2c-mpc.c
> > > +++ b/drivers/i2c/busses/i2c-mpc.c
> > > @@ -86,6 +86,7 @@ struct mpc_i2c_data {
> > >  static inline void writeccr(struct mpc_i2c *i2c, u32 x)
> > >  {
> > >  	writeb(x, i2c->base + MPC_I2C_CR);
> > > +	iobarrier_rw();
> > >  }
> > 
> > Why are the barriers in the I/O accessors insufficient?
> 
> You mean writeb()?  As far as I can see the writeb/readb only uses volatile
> and that
> can be a bit weak for ppc, even on guarded, uncached memory mappings.
> I wanted to make sure multiple writeb did hit the controller correctly.

It's not just a volatile.  There's a sync before each access, and a twi/isync
after loads.  writeb() maps to __do_writeb() which maps to out_8() which is
implemented with DEF_MMIO_OUT_D.

-Scott

  reply	other threads:[~2017-05-11  1:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-09 12:03 [PATCH] i2c-mpc: Correct I2C reset procedure Joakim Tjernlund
2017-05-09 20:54 ` Scott Wood
2017-05-10  7:02   ` Joakim Tjernlund
2017-05-11  1:42     ` Scott Wood [this message]
2017-05-11 11:23       ` Joakim Tjernlund
2017-05-11 11:28 ` [PATCH] " Wolfram Sang
2017-05-11 11:42   ` Joakim Tjernlund

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=1494466940.29095.3.camel@buserror.net \
    --to=oss@buserror.net \
    --cc=Joakim.Tjernlund@infinera.com \
    --cc=linux-i2c@vger.kernel.org \
    /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).