qemu-stable
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH qemu 1/2] hw/at24c : modify at24c to support 1 byte address m


From: Cédric Le Goater
Subject: Re: [PATCH qemu 1/2] hw/at24c : modify at24c to support 1 byte address mode
Date: Tue, 14 Feb 2023 15:29:33 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1

On 2/10/23 07:20, ~ssinprem wrote:
From: Sittisak Sinprem <ssinprem@celestca.com>



You will need to add a Signed-off-by tag

Thanks,

C.

---
  hw/nvram/eeprom_at24c.c | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/hw/nvram/eeprom_at24c.c b/hw/nvram/eeprom_at24c.c
index 2d4d8b952f..693212b661 100644
--- a/hw/nvram/eeprom_at24c.c
+++ b/hw/nvram/eeprom_at24c.c
@@ -87,7 +87,7 @@ uint8_t at24c_eeprom_recv(I2CSlave *s)
      EEPROMState *ee = AT24C_EE(s);
      uint8_t ret;
- if (ee->haveaddr == 1) {
+    if (ee->rsize > 256 && ee->haveaddr == 1) {
          return 0xff;
      }
@@ -104,11 +104,13 @@ int at24c_eeprom_send(I2CSlave *s, uint8_t data)
  {
      EEPROMState *ee = AT24C_EE(s);
- if (ee->haveaddr < 2) {
+    if ((ee->rsize > 256 && ee->haveaddr < 2) ||
+        (ee->rsize <= 256 && ee->haveaddr < 1)) {
          ee->cur <<= 8;
          ee->cur |= data;
          ee->haveaddr++;
-        if (ee->haveaddr == 2) {
+        if ((ee->rsize > 256 && ee->haveaddr == 2) ||
+            (ee->rsize <= 256 && ee->haveaddr == 1)) {
              ee->cur %= ee->rsize;
              DPRINTK("Set pointer %04x\n", ee->cur);
          }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]