Skip to contentSkip to conversation

hw/i2c/aspeed: Fix wrong I2CC_DMA_LEN when I2CM_DMA_TX/RX_ADDR set first

PATCH In review Jamin Lin via 3 participants 5 messages Apr 8, 2025 – Apr 9, 2025 Arm/Aspeed machine support

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hw/i2c/aspeed: Fix wrong I2CC_DMA_LEN when I2CM_DMA_TX/RX_ADDR set first

In the previous design, the I2C model would update I2CC_DMA_LEN (0x54) based on the value of I2CM_DMA_LEN (0x1C) when the firmware set either I2CM_DMA_TX_ADDR (0x30) or I2CM_DMA_RX_ADDR (0x34). However, this only worked correctly if the firmware set I2CM_DMA_LEN before setting I2CM_DMA_TX_ADDR or I2CM_DMA_RX_ADDR.

If the firmware instead set I2CM_DMA_TX_ADDR or I2CM_DMA_RX_ADDR before setting I2CM_DMA_LEN, the value written to I2CC_DMA_LEN would be incorrect.

Ideally, this issue should be resolved by updating the model to set I2CC_DMA_LEN (0x54) when the firmware writes to the I2CM_DMA_LEN (0x1C) register, instead of when it writes to I2CM_DMA_TX_ADDR (0x30) or I2CM_DMA_RX_ADDR (0x34).

Originally, the design of I2CM_DMA_LEN (0x1C) included buffer length write-enable bits for the current command:
Bit 31 enabled the RX buffer length update
Bit 15 enabled the TX buffer length update

In other words, when the firmware set either bit 31 or bit 15, the I2C model could safely update I2CC_DMA_LEN (0x54) with the value in I2CM_DMA_LEN (0x1C).

However, starting with the AST2700, the design of the I2CM_DMA_LEN (0x1C) register was changed. The write-enable bits (bit 31 and bit 15) were removed, meaning there is no longer an explicit indication of whether the firmware intends to update the TX or RX length.

As a result, on AST2700 and newer SoCs, the model cannot reliably determine whether a write to I2CM_DMA_LEN was meant for TX or RX. This ambiguity is especially problematic when the value written is 0, which actually corresponds to a DMA length of 1.

To ensure consistent behavior across all SoCs, the model now updates I2CC_DMA_LEN when I2CM_CMD (0x18) is written, as this is the final command that initiates a TX or RX transfer and reflects the firmware’s intent more clearly.

Fixes ba2cccd (aspeed: i2c: Add new mode support)
---
 hw/i2c/aspeed_i2c.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
hw/i2c/aspeed_i2c.c +14 -4
index a8fbb9f44a..c659099e9a 100644
@@ -634,6 +634,20 @@ static void aspeed_i2c_bus_new_write(AspeedI2CBus *bus, hwaddr offset,
             break;
         }
 
+        /* Handle DMA length */
+        if (SHARED_FIELD_EX32(value, TX_DMA_EN) &&
+            SHARED_FIELD_EX32(value, M_TX_CMD)) {
+            bus->regs[R_I2CC_DMA_LEN] = ARRAY_FIELD_EX32(bus->regs,
+                                                         I2CM_DMA_LEN,
+                                                         TX_BUF_LEN) + 1;
+        }
+        if (SHARED_FIELD_EX32(value, RX_DMA_EN) &&
+            SHARED_FIELD_EX32(value, M_RX_CMD)) {
+            bus->regs[R_I2CC_DMA_LEN] = ARRAY_FIELD_EX32(bus->regs,
+                                                         I2CM_DMA_LEN,
+                                                         RX_BUF_LEN) + 1;
+        }
+
         if (bus->regs[R_I2CM_INTR_STS] & 0xffff0000) {
             qemu_log_mask(LOG_UNIMP, "%s: Packet mode is not implemented\n",
                           __func__);
@@ -656,8 +670,6 @@ static void aspeed_i2c_bus_new_write(AspeedI2CBus *bus, hwaddr offset,
         bus->dma_dram_offset =
             deposit64(bus->dma_dram_offset, 0, 32,
                       FIELD_EX32(value, I2CM_DMA_TX_ADDR, ADDR));
-        bus->regs[R_I2CC_DMA_LEN] = ARRAY_FIELD_EX32(bus->regs, I2CM_DMA_LEN,
-                                                     TX_BUF_LEN) + 1;
         break;
     case A_I2CM_DMA_RX_ADDR:
         bus->regs[R_I2CM_DMA_RX_ADDR] = FIELD_EX32(value, I2CM_DMA_RX_ADDR,
@@ -665,8 +677,6 @@ static void aspeed_i2c_bus_new_write(AspeedI2CBus *bus, hwaddr offset,
         bus->dma_dram_offset =
             deposit64(bus->dma_dram_offset, 0, 32,
                       FIELD_EX32(value, I2CM_DMA_RX_ADDR, ADDR));
-        bus->regs[R_I2CC_DMA_LEN] = ARRAY_FIELD_EX32(bus->regs, I2CM_DMA_LEN,
-                                                     RX_BUF_LEN) + 1;
         break;
     case A_I2CM_DMA_LEN:
         w1t = FIELD_EX32(value, I2CM_DMA_LEN, RX_BUF_LEN_W1T) ||
Signature · 1 line
2.43.0
#1 lore raw

Hi Cedric,

After discussing with the I2C hardware designers, we confirmed that the I2c design in AST2600 and AST2700 A1 is the same. The datasheet will be updated accordingly for AST2700.

However, please note that bit 15 and bit 31 are not available on AST2700 A0 and FW do not set either bit 15 and bit 31. AST2700 A0 was an engineering sample version. Given this, I plan to resend the v3 patch with AST2700 A0 explicitly marked as unsupported. I prefer not to introduce workarounds specifically for AST2700 A0, as it is not a production-grade silicon.

I will resend the v3 patch with the same content as v1, since the only issue in v1 was a functional test failure on AST2700 A0. Apologies for the inconvenience, and thank you for your understanding.

Thanks-Jamin

************* Email Confidentiality Notice ********************
免責聲明:
本信件(或其附件)可能包含機密資訊,並受法律保護。如 台端非指定之收件者,請以電子郵件通知本電子郵件之發送者, 並請立即刪除本電子郵件及其附件和銷毀所有複印件。謝謝您的合作!

DISCLAIMER:
This message (and any attachments) may contain legally privileged and/or other confidential information. If you have received it in error, please notify the sender by reply e-mail and immediately delete the e-mail and any attachments without copying or disclosing the contents. Thank you.

Quoted 119 lines

-----Original Message-----
From: Jamin Lin <[email protected]>
Sent: Tuesday, April 8, 2025 4:25 PM
To: Cédric Le Goater <[email protected]>; Peter Maydell <[email protected]>; Steven Lee <[email protected]>; Troy Lee <[email protected]>; Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>; open list:ASPEED BMCs <[email protected]>; open list:All patches CC here <[email protected]>
Cc: Jamin Lin <[email protected]>; Troy Lee <[email protected]>
Subject: [PATCH v2] hw/i2c/aspeed: Fix wrong I2CC_DMA_LEN when I2CM_DMA_TX/RX_ADDR set first

In the previous design, the I2C model would update I2CC_DMA_LEN (0x54) based on the value of I2CM_DMA_LEN (0x1C) when the firmware set either I2CM_DMA_TX_ADDR
(0x30) or I2CM_DMA_RX_ADDR (0x34). However, this only worked correctly if the firmware set I2CM_DMA_LEN before setting I2CM_DMA_TX_ADDR or I2CM_DMA_RX_ADDR.

If the firmware instead set I2CM_DMA_TX_ADDR or I2CM_DMA_RX_ADDR before setting I2CM_DMA_LEN, the value written to I2CC_DMA_LEN would be incorrect.

Ideally, this issue should be resolved by updating the model to set I2CC_DMA_LEN (0x54) when the firmware writes to the I2CM_DMA_LEN (0x1C) register, instead of when it writes to I2CM_DMA_TX_ADDR (0x30) or I2CM_DMA_RX_ADDR (0x34).

Originally, the design of I2CM_DMA_LEN (0x1C) included buffer length write-enable bits for the current command:
Bit 31 enabled the RX buffer length update Bit 15 enabled the TX buffer length update

In other words, when the firmware set either bit 31 or bit 15, the I2C model could safely update I2CC_DMA_LEN (0x54) with the value in I2CM_DMA_LEN (0x1C).

However, starting with the AST2700, the design of the I2CM_DMA_LEN (0x1C) register was changed. The write-enable bits (bit 31 and bit 15) were removed, meaning there is no longer an explicit indication of whether the firmware intends to update the TX or RX length.

As a result, on AST2700 and newer SoCs, the model cannot reliably determine whether a write to I2CM_DMA_LEN was meant for TX or RX. This ambiguity is especially problematic when the value written is 0, which actually corresponds to a DMA length of 1.

To ensure consistent behavior across all SoCs, the model now updates I2CC_DMA_LEN when I2CM_CMD (0x18) is written, as this is the final command that initiates a TX or RX transfer and reflects the firmware’s intent more clearly.

Fixes ba2cccd (aspeed: i2c: Add new mode support)
---
 hw/i2c/aspeed_i2c.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
hw/i2c/aspeed_i2c.c index renamed from hw/i2c/aspeed_i2c.c +0 -0

a8fbb9f44a..c659099e9a 100644

hw/i2c/aspeed_i2c.c +11 -0
@@ -634,6 +634,20 @@ static void aspeed_i2c_bus_new_write(AspeedI2CBus
 *bus, hwaddr offset,
             break;
         }
 
+        /* Handle DMA length */
+        if (SHARED_FIELD_EX32(value, TX_DMA_EN) &&
+            SHARED_FIELD_EX32(value, M_TX_CMD)) {
+            bus->regs[R_I2CC_DMA_LEN] = ARRAY_FIELD_EX32(bus->regs,
+
 I2CM_DMA_LEN,
+
 TX_BUF_LEN) + 1;
+        }
+        if (SHARED_FIELD_EX32(value, RX_DMA_EN) &&
+            SHARED_FIELD_EX32(value, M_RX_CMD)) {
+            bus->regs[R_I2CC_DMA_LEN] = ARRAY_FIELD_EX32(bus->regs,
+

I2CM_DMA_LEN,
+
RX_BUF_LEN) + 1;

hw/i2c/aspeed_i2c.c +2 -0
+        }
+
         if (bus->regs[R_I2CM_INTR_STS] & 0xffff0000) {
             qemu_log_mask(LOG_UNIMP, "%s: Packet mode is not

implemented\n",

                           __func__);
hw/i2c/aspeed_i2c.c +1 -2
@@ -656,8 +670,6 @@ static void aspeed_i2c_bus_new_write(AspeedI2CBus
 *bus, hwaddr offset,
         bus->dma_dram_offset =
             deposit64(bus->dma_dram_offset, 0, 32,
                       FIELD_EX32(value, I2CM_DMA_TX_ADDR,
 ADDR));
-        bus->regs[R_I2CC_DMA_LEN] = ARRAY_FIELD_EX32(bus->regs,
 I2CM_DMA_LEN,
-                                                     TX_BUF_LEN)
+ 1;
         break;
     case A_I2CM_DMA_RX_ADDR:
         bus->regs[R_I2CM_DMA_RX_ADDR] = FIELD_EX32(value,

I2CM_DMA_RX_ADDR, @@ -665,8 +677,6 @@ static void aspeed_i2c_bus_new_write(AspeedI2CBus *bus, hwaddr offset,

         bus->dma_dram_offset =
             deposit64(bus->dma_dram_offset, 0, 32,
                       FIELD_EX32(value, I2CM_DMA_RX_ADDR,

ADDR));
- bus->regs[R_I2CC_DMA_LEN] = ARRAY_FIELD_EX32(bus->regs,
I2CM_DMA_LEN,
- RX_BUF_LEN)

+ 1;
         break;
     case A_I2CM_DMA_LEN:
         w1t = FIELD_EX32(value, I2CM_DMA_LEN, RX_BUF_LEN_W1T) ||

--
2.43.0

#2 lore raw

Hello,

Quoted 7 lines · Jamin Lin

Hi Cedric,

After discussing with the I2C hardware designers, we confirmed that the I2c design in AST2600 and AST2700 A1 is the same. The datasheet will be updated accordingly for AST2700.

However, please note that bit 15 and bit 31 are not available on AST2700 A0 and FW do not set either bit 15 and bit 31. AST2700 A0 was an engineering sample version. Given this, I plan to resend the v3 patch with AST2700 A0 explicitly marked as unsupported.

Are you going to introduce an I2C property to distinguish the A0 implementation for the A1 ?

Quoted 1 line

I prefer not to introduce workarounds specifically for AST2700 A0, as it is not a production-grade silicon.

We can deprecate the AST2700 A0 machine too, See 56a37eda93ed, and change the ast2700-evb machine alias.

Quoted 2 lines

I will resend the v3 patch with the same content as v1, since the only issue in v1 was a functional test failure on AST2700 A0. Apologies for the inconvenience, and thank you for your understanding.

That's ok. Nothing is merged. Let's get it right first.

Thanks,

C.

Quoted 130 lines

Thanks-Jamin

************* Email Confidentiality Notice ********************
免責聲明:
本信件(或其附件)可能包含機密資訊,並受法律保護。如 台端非指定之收件者,請以電子郵件通知本電子郵件之發送者, 並請立即刪除本電子郵件及其附件和銷毀所有複印件。謝謝您的合作!

DISCLAIMER:
This message (and any attachments) may contain legally privileged and/or other confidential information. If you have received it in error, please notify the sender by reply e-mail and immediately delete the e-mail and any attachments without copying or disclosing the contents. Thank you.

Quoted 119 lines

-----Original Message-----
From: Jamin Lin <[email protected]>
Sent: Tuesday, April 8, 2025 4:25 PM
To: Cédric Le Goater <[email protected]>; Peter Maydell <[email protected]>; Steven Lee <[email protected]>; Troy Lee <[email protected]>; Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>; open list:ASPEED BMCs <[email protected]>; open list:All patches CC here <[email protected]>
Cc: Jamin Lin <[email protected]>; Troy Lee <[email protected]>
Subject: [PATCH v2] hw/i2c/aspeed: Fix wrong I2CC_DMA_LEN when I2CM_DMA_TX/RX_ADDR set first

In the previous design, the I2C model would update I2CC_DMA_LEN (0x54) based on the value of I2CM_DMA_LEN (0x1C) when the firmware set either I2CM_DMA_TX_ADDR
(0x30) or I2CM_DMA_RX_ADDR (0x34). However, this only worked correctly if the firmware set I2CM_DMA_LEN before setting I2CM_DMA_TX_ADDR or I2CM_DMA_RX_ADDR.

If the firmware instead set I2CM_DMA_TX_ADDR or I2CM_DMA_RX_ADDR before setting I2CM_DMA_LEN, the value written to I2CC_DMA_LEN would be incorrect.

Ideally, this issue should be resolved by updating the model to set I2CC_DMA_LEN (0x54) when the firmware writes to the I2CM_DMA_LEN (0x1C) register, instead of when it writes to I2CM_DMA_TX_ADDR (0x30) or I2CM_DMA_RX_ADDR (0x34).

Originally, the design of I2CM_DMA_LEN (0x1C) included buffer length write-enable bits for the current command:
Bit 31 enabled the RX buffer length update Bit 15 enabled the TX buffer length update

In other words, when the firmware set either bit 31 or bit 15, the I2C model could safely update I2CC_DMA_LEN (0x54) with the value in I2CM_DMA_LEN (0x1C).

However, starting with the AST2700, the design of the I2CM_DMA_LEN (0x1C) register was changed. The write-enable bits (bit 31 and bit 15) were removed, meaning there is no longer an explicit indication of whether the firmware intends to update the TX or RX length.

As a result, on AST2700 and newer SoCs, the model cannot reliably determine whether a write to I2CM_DMA_LEN was meant for TX or RX. This ambiguity is especially problematic when the value written is 0, which actually corresponds to a DMA length of 1.

To ensure consistent behavior across all SoCs, the model now updates I2CC_DMA_LEN when I2CM_CMD (0x18) is written, as this is the final command that initiates a TX or RX transfer and reflects the firmware’s intent more clearly.

Fixes ba2cccd (aspeed: i2c: Add new mode support)
---
  hw/i2c/aspeed_i2c.c | 18 ++++++++++++++----
  1 file changed, 14 insertions(+), 4 deletions(-)
hw/i2c/aspeed_i2c.c index renamed from hw/i2c/aspeed_i2c.c +0 -0

a8fbb9f44a..c659099e9a 100644

hw/i2c/aspeed_i2c.c +11 -0
@@ -634,6 +634,20 @@ static void aspeed_i2c_bus_new_write(AspeedI2CBus
 *bus, hwaddr offset,
              break;
          }
 
+        /* Handle DMA length */
+        if (SHARED_FIELD_EX32(value, TX_DMA_EN) &&
+            SHARED_FIELD_EX32(value, M_TX_CMD)) {
+            bus->regs[R_I2CC_DMA_LEN] = ARRAY_FIELD_EX32(bus->regs,
+
 I2CM_DMA_LEN,
+
 TX_BUF_LEN) + 1;
+        }
+        if (SHARED_FIELD_EX32(value, RX_DMA_EN) &&
+            SHARED_FIELD_EX32(value, M_RX_CMD)) {
+            bus->regs[R_I2CC_DMA_LEN] = ARRAY_FIELD_EX32(bus->regs,
+

I2CM_DMA_LEN,
+
RX_BUF_LEN) + 1;

hw/i2c/aspeed_i2c.c +2 -0
+        }
+
          if (bus->regs[R_I2CM_INTR_STS] & 0xffff0000) {
              qemu_log_mask(LOG_UNIMP, "%s: Packet mode is not

implemented\n",

                            __func__);
hw/i2c/aspeed_i2c.c +1 -2
@@ -656,8 +670,6 @@ static void aspeed_i2c_bus_new_write(AspeedI2CBus
 *bus, hwaddr offset,
          bus->dma_dram_offset =
              deposit64(bus->dma_dram_offset, 0, 32,
                        FIELD_EX32(value, I2CM_DMA_TX_ADDR,
 ADDR));
-        bus->regs[R_I2CC_DMA_LEN] = ARRAY_FIELD_EX32(bus->regs,
 I2CM_DMA_LEN,
-                                                     TX_BUF_LEN)
+ 1;
          break;
      case A_I2CM_DMA_RX_ADDR:
          bus->regs[R_I2CM_DMA_RX_ADDR] = FIELD_EX32(value,

I2CM_DMA_RX_ADDR, @@ -665,8 +677,6 @@ static void aspeed_i2c_bus_new_write(AspeedI2CBus *bus, hwaddr offset,

          bus->dma_dram_offset =
              deposit64(bus->dma_dram_offset, 0, 32,
                        FIELD_EX32(value, I2CM_DMA_RX_ADDR,

ADDR));
- bus->regs[R_I2CC_DMA_LEN] = ARRAY_FIELD_EX32(bus->regs,
I2CM_DMA_LEN,
- RX_BUF_LEN)

+ 1;
          break;
      case A_I2CM_DMA_LEN:
          w1t = FIELD_EX32(value, I2CM_DMA_LEN, RX_BUF_LEN_W1T) ||

--
2.43.0

#3 lore raw

Hi Cedric,

Quoted 12 lines

Subject: Re: [PATCH v2] hw/i2c/aspeed: Fix wrong I2CC_DMA_LEN when I2CM_DMA_TX/RX_ADDR set first

Hello,

Quoted 3 lines · Jamin Lin

Hi Cedric,

After discussing with the I2C hardware designers, we confirmed that the I2c

design in AST2600 and AST2700 A1 is the same.

Quoted 2 lines

The datasheet will be updated accordingly for AST2700.

Quoted 8 lines
Quoted 1 line

However, please note that bit 15 and bit 31 are not available on AST2700 A0

and FW do not set either bit 15 and bit 31.

Quoted 1 line

AST2700 A0 was an engineering sample version. Given this, I plan to resend

the v3 patch with AST2700 A0 explicitly marked as unsupported.

Are you going to introduce an I2C property to distinguish the A0 implementation for the A1 ?

No. I want the I2C model to be as simple as possible, without adding any ""AST2700 A0"" specific changes. V1 patch work for AST2700 A1, AST2600, AST2500, AST1030, AST2500, AST2400 but not AST2700 A0.

Quoted 5 lines
Quoted 1 line

I prefer not to introduce workarounds specifically for AST2700 A0, as it is not

a production-grade silicon.

We can deprecate the AST2700 A0 machine too, See 56a37eda93ed, and change the ast2700-evb machine alias.

Will do.

Quoted 7 lines
Quoted 2 lines

I will resend the v3 patch with the same content as v1, since the only issue in

v1 was a functional test failure on AST2700 A0.

Quoted 1 line

Apologies for the inconvenience, and thank you for your understanding.

That's ok. Nothing is merged. Let's get it right first.

Thanks-Jamin

Quoted 147 lines

Thanks,

C.

Quoted 6 lines

Thanks-Jamin

************* Email Confidentiality Notice ******************** 免責聲明:
本信件(或其附件)可能包含機密資訊,並受法律保護。如 台端非指定之

收件者,請以電子郵件通知本電子郵件之發送者, 並請立即刪除本電子郵
件及其附件和銷毀所有複印件。謝謝您的合作!

Quoted 3 lines

DISCLAIMER:
This message (and any attachments) may contain legally privileged and/or

other confidential information. If you have received it in error, please notify the sender by reply e-mail and immediately delete the e-mail and any attachments without copying or disclosing the contents. Thank you.

Quoted 71 lines
Quoted 71 lines

-----Original Message-----
From: Jamin Lin <[email protected]>
Sent: Tuesday, April 8, 2025 4:25 PM
To: Cédric Le Goater <[email protected]>; Peter Maydell <[email protected]>; Steven Lee <[email protected]>; Troy Lee <[email protected]>; Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>; open list:ASPEED BMCs <[email protected]>; open list:All patches CC here <[email protected]>
Cc: Jamin Lin <[email protected]>; Troy Lee <[email protected]>
Subject: [PATCH v2] hw/i2c/aspeed: Fix wrong I2CC_DMA_LEN when I2CM_DMA_TX/RX_ADDR set first

In the previous design, the I2C model would update I2CC_DMA_LEN (0x54) based on the value of I2CM_DMA_LEN (0x1C) when the firmware set either I2CM_DMA_TX_ADDR
(0x30) or I2CM_DMA_RX_ADDR (0x34). However, this only worked correctly if the firmware set I2CM_DMA_LEN before setting I2CM_DMA_TX_ADDR or I2CM_DMA_RX_ADDR.

If the firmware instead set I2CM_DMA_TX_ADDR or I2CM_DMA_RX_ADDR before setting I2CM_DMA_LEN, the value written to I2CC_DMA_LEN would be incorrect.

Ideally, this issue should be resolved by updating the model to set I2CC_DMA_LEN (0x54) when the firmware writes to the I2CM_DMA_LEN (0x1C) register, instead of when it writes to I2CM_DMA_TX_ADDR (0x30) or I2CM_DMA_RX_ADDR (0x34).

Originally, the design of I2CM_DMA_LEN (0x1C) included buffer length write-enable bits for the current command:
Bit 31 enabled the RX buffer length update Bit 15 enabled the TX buffer length update

In other words, when the firmware set either bit 31 or bit 15, the I2C model could safely update I2CC_DMA_LEN (0x54) with the value in I2CM_DMA_LEN (0x1C).

However, starting with the AST2700, the design of the I2CM_DMA_LEN (0x1C) register was changed. The write-enable bits (bit 31 and bit
15) were removed, meaning there is no longer an explicit indication of whether the firmware intends to update the TX or RX length.

As a result, on AST2700 and newer SoCs, the model cannot reliably determine whether a write to I2CM_DMA_LEN was meant for TX or RX. This ambiguity is especially problematic when the value written is 0, which actually corresponds to a DMA length of 1.

To ensure consistent behavior across all SoCs, the model now updates I2CC_DMA_LEN when I2CM_CMD (0x18) is written, as this is the final command that initiates a TX or RX transfer and reflects the firmware’s intent more clearly.

Fixes ba2cccd (aspeed: i2c: Add new mode support)
---
  hw/i2c/aspeed_i2c.c | 18 ++++++++++++++----
  1 file changed, 14 insertions(+), 4 deletions(-)
hw/i2c/aspeed_i2c.c index renamed from hw/i2c/aspeed_i2c.c +0 -0

a8fbb9f44a..c659099e9a 100644

hw/i2c/aspeed_i2c.c +0 -0
@@ -634,6 +634,20 @@ static void

aspeed_i2c_bus_new_write(AspeedI2CBus
*bus, hwaddr offset,

              break;
          }
Quoted 4 lines

hw/i2c/aspeed_i2c.c static void aspeed_i2c_bus_new_write(AspeedI2CBus *bus, hwaddr offset,

Quoted 4 lines
hw/i2c/aspeed_i2c.c +4 -0
+        /* Handle DMA length */
+        if (SHARED_FIELD_EX32(value, TX_DMA_EN) &&
+            SHARED_FIELD_EX32(value, M_TX_CMD)) {
+            bus->regs[R_I2CC_DMA_LEN] =

ARRAY_FIELD_EX32(bus->regs,

Quoted 8 lines

hw/i2c/aspeed_i2c.c static void aspeed_i2c_bus_new_write(AspeedI2CBus *bus, hwaddr offset,

Quoted 8 lines

+
I2CM_DMA_LEN,
+
TX_BUF_LEN) + 1;

hw/i2c/aspeed_i2c.c +4 -0
+        }
+        if (SHARED_FIELD_EX32(value, RX_DMA_EN) &&
+            SHARED_FIELD_EX32(value, M_RX_CMD)) {
+            bus->regs[R_I2CC_DMA_LEN] =

ARRAY_FIELD_EX32(bus->regs,

Quoted 7 lines
Quoted 7 lines

+
I2CM_DMA_LEN,
+
RX_BUF_LEN) + 1;

hw/i2c/aspeed_i2c.c +2 -0
+        }
+
          if (bus->regs[R_I2CM_INTR_STS] & 0xffff0000) {
Quoted 8 lines
Quoted 8 lines

qemu_log_mask(LOG_UNIMP, "%s: Packet mode is not
implemented\n",

                            __func__); @@ -656,8 +670,6 @@ static
void aspeed_i2c_bus_new_write(AspeedI2CBus
*bus, hwaddr offset,
          bus->dma_dram_offset =
              deposit64(bus->dma_dram_offset, 0, 32,
                        FIELD_EX32(value, I2CM_DMA_TX_ADDR,

ADDR));

Quoted 3 lines
Quoted 3 lines

- bus->regs[R_I2CC_DMA_LEN] = ARRAY_FIELD_EX32(bus->regs,
I2CM_DMA_LEN,
-

TX_BUF_LEN)

Quoted 9 lines
Quoted 9 lines
+ 1;
          break;
      case A_I2CM_DMA_RX_ADDR:
          bus->regs[R_I2CM_DMA_RX_ADDR] = FIELD_EX32(value,
I2CM_DMA_RX_ADDR, @@ -665,8 +677,6 @@ static void
aspeed_i2c_bus_new_write(AspeedI2CBus *bus, hwaddr offset,
          bus->dma_dram_offset =
              deposit64(bus->dma_dram_offset, 0, 32,
                        FIELD_EX32(value, I2CM_DMA_RX_ADDR,

ADDR));

Quoted 3 lines
Quoted 3 lines

- bus->regs[R_I2CC_DMA_LEN] = ARRAY_FIELD_EX32(bus->regs,
I2CM_DMA_LEN,
-

RX_BUF_LEN)

Quoted 4 lines
Quoted 4 lines
+ 1;
          break;
      case A_I2CM_DMA_LEN:
          w1t = FIELD_EX32(value, I2CM_DMA_LEN, RX_BUF_LEN_W1T)

||

Quoted 3 lines
Quoted 2 lines

--
2.43.0

#4 lore raw
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines

After discussing with the I2C hardware designers, we confirmed that the I2c design in AST2600 and AST2700 A1 is the same.
The datasheet will be updated accordingly for AST2700.

However, please note that bit 15 and bit 31 are not available on AST2700 A0 and FW do not set either bit 15 and bit 31.
AST2700 A0 was an engineering sample version. Given this, I plan to resend the v3 patch with AST2700 A0 explicitly marked as unsupported.

Quoted 6 lines
Quoted 3 lines

Are you going to introduce an I2C property to distinguish the A0 implementation for the A1 ?

No. I want the I2C model to be as simple as possible, without adding any ""AST2700 A0"" specific changes. V1 patch work for AST2700 A1, AST2600, AST2500, AST1030, AST2500, AST2400 but not AST2700 A0.

ok. Please first adjust the ast2700 functional tests for the ast2700a0-evb machine (no I2C test) and deprecate ast2700a0-evb at the same time.

Thanks,

C.