qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: minyard@acm.org, Joe Komlodi <komlodi@google.com>
Cc: venture@google.com, peter.maydell@linaro.org, qemu-devel@nongnu.org
Subject: Re: [PATCH v4 0/3] hw/i2c: smbus: Reset fixes
Date: Thu, 22 Feb 2024 15:47:20 +0100	[thread overview]
Message-ID: <aedde374-0a7a-4a38-9149-7002c627b743@linaro.org> (raw)
In-Reply-To: <20240220211123.2664977-1-komlodi@google.com>

Hi Joe,

On 20/2/24 22:11, Joe Komlodi wrote:
> Changelog:

> This series adds some resets for SMBus and for the I2C core. Along with
> it, we make SMBus slave error printing a little more helpful.
> 
> These reset issues were very infrequent, they would maybe occur in 1 out
> of hundreds of resets in our testing, but the way they happen is pretty
> straightforward.
> 
> Basically as long as a reset happens in the middle of a transaction, the
> state of the old transaction would still partially be there after the
> reset. Once a new transaction comes in, the partial stale state can
> cause the new transaction to incorrectly fail.

Sorry for jumping late, at v4. I'm a bit confused by this series.

- AFAICT there is no in-band or RESET line with I2C, but
   the AN10216 document mentions:

   I2C Bus recovery

   • Typical case is when masters fails when doing a read
     operation in a slave
   • SDA line is then non usable anymore because of the
     “Slave-Transmitter” mode.
   • Methods to recover the SDA line are:
     – Reset the slave device (assuming the device has a
       Reset pin)
     – Use a bus recovery sequence to leave the “Slave-
       Transmitter” mode
   • Bus recovery sequence is done as following:
     1 - Send 9 clock pulses on SCL line
     2 - Ask the master to keep SDA High until the “Slave-
         Transmitter” releases the SDA line to perform the
         ACK operation
     3 - Keeping SDA High during the ACK means that the
         “Master-Receiver” does not acknowledge the previous
         byte receive
     4 - The “Slave-Transmitter” then goes in an idle state
     5 - The master then sends a STOP command initializing
         completely the bus

- For SMBus Specification Version 2.0:

   3.1.4.2 Power-on reset

   SMBus devices detect a power-on event in one of three ways:
   • By detecting that power is being applied to the device,
   • By an external reset signal that is being asserted or
   • For self-powered or always powered devices, by detecting
     that the SMBus is active (clock and data lines have gone
     high after being low for more than 2 1/2 seconds).

Questions:

- Is the first patch "hw/i2c: core: Add reset" really for
   I2C? Otherwise we could expand smbus form i2cbus, and have
   this reset only for smbus.

- Should we model the "I2C bus recovery sequence" before
   triggering reset?

- Shouldn't we model the smbus 2.5s timeout before triggering
   the reset?

Thanks,

Phil.


      parent reply	other threads:[~2024-02-22 15:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-20 21:11 [PATCH v4 0/3] hw/i2c: smbus: Reset fixes Joe Komlodi
2024-02-20 21:11 ` [PATCH v4 1/3] hw/i2c: core: Add reset Joe Komlodi
2024-02-20 21:11 ` [PATCH v4 2/3] hw/i2c/smbus_slave: Add object path on error prints Joe Komlodi
2024-02-21 18:28   ` Philippe Mathieu-Daudé
2024-02-20 21:11 ` [PATCH v4 3/3] hw/i2c: smbus_slave: Reset state on reset Joe Komlodi
2024-02-22 14:47 ` Philippe Mathieu-Daudé [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=aedde374-0a7a-4a38-9149-7002c627b743@linaro.org \
    --to=philmd@linaro.org \
    --cc=komlodi@google.com \
    --cc=minyard@acm.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=venture@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).