linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@linux-mips.org>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
	Matt Turner <mattst88@gmail.com>,
	linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rtc: m41t80: Complete error propagation from SMBus calls
Date: Wed, 14 Nov 2018 12:50:06 +0000 (GMT)	[thread overview]
Message-ID: <alpine.LFD.2.21.1811141234140.21654@eddie.linux-mips.org> (raw)
In-Reply-To: <20181114122005.GY29768@piout.net>

On Wed, 14 Nov 2018, Alexandre Belloni wrote:

> >  I think we can discuss that when I post the patches.  The m41t80 driver 
> > currently does not work for me anyway and has to be fixed because of:
> > 
> > i2c /dev entries driver
> > i2c-sibyte: i2c SMBus adapter module for SiByte board
> > i2c i2c-1: doesn't support I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_I2C_BLOCK
> > 
> > and the persistent part is only one patch in the upcoming number of 
> > changes.
> 
> Well, one of the solution for that (and tis is on my todo list) is to
> convert the driver to use regmap which would take care of using the
> proper i2c transfers. However, one of the concern when not having bock
> accesses is that the registers are not latched (as you seem to know).
> One thing I would like is then to avoid the multiple SEC register read
> when not necessary.

 Unfortunately the SMBus host does not give much choice here.  It does 
have some extensions for block transfers, but writes are limited to 5 
bytes and reads to 7 bytes.  The usual solution is to read repeatedly 
until the seconds match.  For writes it is not a problem, because it 
takes less than 1 second to write all the clock registers, so if you 
start with seconds, then the data written will be consistent.

 The Xicor chip is worse as it uses 16-bit addresses and that is not 
handled by SMBus support in our I2C core, however apparently that can be 
simulated by byte writes with that particular chip.  The SMBus host 
implements a protocol extension for 16-bit addressing, but I think it's 
not worth the hassle adding to SMBus support in our I2C core given how 
rare the Xicor setup are.

 Finally the SMBus host does support raw I2C transfers, but only with a 
polled bit-banged interface, where you need to time the loop correctly 
to get clocking of the individual bits right.  I don't think we want to 
go down that path.

  Maciej

      reply	other threads:[~2018-11-14 12:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-07  2:39 [PATCH] rtc: m41t80: Complete error propagation from SMBus calls Maciej W. Rozycki
2018-11-14  9:48 ` Alexandre Belloni
2018-11-14  9:57 ` Alexandre Belloni
2018-11-14 12:05   ` Maciej W. Rozycki
2018-11-14 12:20     ` Alexandre Belloni
2018-11-14 12:50       ` Maciej W. Rozycki [this message]

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=alpine.LFD.2.21.1811141234140.21654@eddie.linux-mips.org \
    --to=macro@linux-mips.org \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=mattst88@gmail.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).