qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/1] I2C patches for 2022-03-14
@ 2022-03-14 13:50 Philippe Mathieu-Daudé
  2022-03-14 13:50 ` [PULL 1/1] hw/nvram: at24 return 0xff if 1 byte address Philippe Mathieu-Daudé
  2022-03-14 18:11 ` [PULL 0/1] I2C patches for 2022-03-14 Peter Maydell
  0 siblings, 2 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-03-14 13:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

The following changes since commit 15df33ceb73cb6bb3c6736cf4d2cff51129ed4b4:

  Merge remote-tracking branch 'remotes/quic/tags/pull-hex-20220312-1' into staging (2022-03-13 17:29:18 +0000)

are available in the Git repository at:

  https://github.com/philmd/qemu.git tags/i2c-20220314

for you to fetch changes up to 1cbab82e9d1bdb2c7b9ef46a396fdc03ea3fa04c:

  hw/nvram: at24 return 0xff if 1 byte address (2022-03-14 14:48:35 +0100)

----------------------------------------------------------------
I2C patch queue

- Fix AT24 EEPROM partial write (Patrick Venture)

----------------------------------------------------------------

Patrick Venture (1):
  hw/nvram: at24 return 0xff if 1 byte address

 hw/nvram/eeprom_at24c.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

-- 
2.34.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PULL 1/1] hw/nvram: at24 return 0xff if 1 byte address
  2022-03-14 13:50 [PULL 0/1] I2C patches for 2022-03-14 Philippe Mathieu-Daudé
@ 2022-03-14 13:50 ` Philippe Mathieu-Daudé
  2022-03-14 18:11 ` [PULL 0/1] I2C patches for 2022-03-14 Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-03-14 13:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: Patrick Venture, Philippe Mathieu-Daudé,
	Philippe Mathieu-Daudé

From: Patrick Venture <venture@google.com>

The at24 eeproms are 2 byte devices that return 0xff when they are read
from with a partial (1-byte) address written.  This distinction was
found comparing model behavior to real hardware testing.

Tested: `i2ctransfer -f -y 45 w1@85 0 r1` returns 0xff instead of next
byte

Signed-off-by: Patrick Venture <venture@google.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20211220212137.1244511-1-venture@google.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/nvram/eeprom_at24c.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/hw/nvram/eeprom_at24c.c b/hw/nvram/eeprom_at24c.c
index da435500ba..01a3093600 100644
--- a/hw/nvram/eeprom_at24c.c
+++ b/hw/nvram/eeprom_at24c.c
@@ -58,9 +58,10 @@ int at24c_eeprom_event(I2CSlave *s, enum i2c_event event)
 
     switch (event) {
     case I2C_START_SEND:
-    case I2C_START_RECV:
     case I2C_FINISH:
         ee->haveaddr = 0;
+        /* fallthrough */
+    case I2C_START_RECV:
         DPRINTK("clear\n");
         if (ee->blk && ee->changed) {
             int len = blk_pwrite(ee->blk, 0, ee->mem, ee->rsize, 0);
@@ -84,6 +85,10 @@ uint8_t at24c_eeprom_recv(I2CSlave *s)
     EEPROMState *ee = AT24C_EE(s);
     uint8_t ret;
 
+    if (ee->haveaddr == 1) {
+        return 0xff;
+    }
+
     ret = ee->mem[ee->cur];
 
     ee->cur = (ee->cur + 1u) % ee->rsize;
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PULL 0/1] I2C patches for 2022-03-14
  2022-03-14 13:50 [PULL 0/1] I2C patches for 2022-03-14 Philippe Mathieu-Daudé
  2022-03-14 13:50 ` [PULL 1/1] hw/nvram: at24 return 0xff if 1 byte address Philippe Mathieu-Daudé
@ 2022-03-14 18:11 ` Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2022-03-14 18:11 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé; +Cc: qemu-devel, Philippe Mathieu-Daudé

On Mon, 14 Mar 2022 at 14:11, Philippe Mathieu-Daudé
<philippe.mathieu.daude@gmail.com> wrote:
>
> From: Philippe Mathieu-Daudé <f4bug@amsat.org>
>
> The following changes since commit 15df33ceb73cb6bb3c6736cf4d2cff51129ed4b4:
>
>   Merge remote-tracking branch 'remotes/quic/tags/pull-hex-20220312-1' into staging (2022-03-13 17:29:18 +0000)
>
> are available in the Git repository at:
>
>   https://github.com/philmd/qemu.git tags/i2c-20220314
>
> for you to fetch changes up to 1cbab82e9d1bdb2c7b9ef46a396fdc03ea3fa04c:
>
>   hw/nvram: at24 return 0xff if 1 byte address (2022-03-14 14:48:35 +0100)
>
> ----------------------------------------------------------------
> I2C patch queue
>
> - Fix AT24 EEPROM partial write (Patrick Venture)
>
> ----------------------------------------------------------------


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/7.0
for any user-visible changes.

-- PMM


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-14 18:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-14 13:50 [PULL 0/1] I2C patches for 2022-03-14 Philippe Mathieu-Daudé
2022-03-14 13:50 ` [PULL 1/1] hw/nvram: at24 return 0xff if 1 byte address Philippe Mathieu-Daudé
2022-03-14 18:11 ` [PULL 0/1] I2C patches for 2022-03-14 Peter Maydell

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).