[PATCH 3/3] hw/i2c/aspeed_i2c: Remove assert

Cédric Le Goater posted 3 patches 1 week, 5 days ago
There is a newer version of this series
[PATCH 3/3] hw/i2c/aspeed_i2c: Remove assert
Posted by Cédric Le Goater 1 week, 5 days ago
According to the Aspeed datasheet, the RX_BUF_LEN_W1T and
TX_BUF_LEN_W1T bits of the A_I2CS_DMA_LEN (0x2c) register allow
firmware to program the TX and RX DMA length (TX_BUF_LEN and
RX_BUF_LEN fields of the same register) separately without the need to
read/modify/write the value.  If RX_BUF_LEN_W1T and TX_BUF_LEN_W1T
bits are 0, then both TX and RX DMA length will be written.

When setting the RX_BUF_LEN field, the TX_BUF_LEN field being set is
not an invalid condition. Remove the assert.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3315
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
 hw/i2c/aspeed_i2c.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/hw/i2c/aspeed_i2c.c b/hw/i2c/aspeed_i2c.c
index ad6342bec0d4..5d18f8d49ea4 100644
--- a/hw/i2c/aspeed_i2c.c
+++ b/hw/i2c/aspeed_i2c.c
@@ -780,7 +780,6 @@ static void aspeed_i2c_bus_new_write(AspeedI2CBus *bus, hwaddr offset,
         bus->regs[R_I2CS_DMA_RX_ADDR] = value;
         break;
     case A_I2CS_DMA_LEN:
-        assert(FIELD_EX32(value, I2CS_DMA_LEN, TX_BUF_LEN) == 0);
         if (FIELD_EX32(value, I2CS_DMA_LEN, RX_BUF_LEN_W1T)) {
             ARRAY_FIELD_DP32(bus->regs, I2CS_DMA_LEN, RX_BUF_LEN,
                              FIELD_EX32(value, I2CS_DMA_LEN, RX_BUF_LEN));
-- 
2.53.0


RE: [PATCH 3/3] hw/i2c/aspeed_i2c: Remove assert
Posted by Jamin Lin 1 week, 4 days ago
> -----Original Message-----
> From: Cédric Le Goater <clg@redhat.com>
> Sent: Monday, March 23, 2026 5:58 AM
> To: qemu-devel@nongnu.org
> Cc: qemu-arm@nongnu.org; Peter Maydell <peter.maydell@linaro.org>; Jamin
> Lin <jamin_lin@aspeedtech.com>; Kane Chen <kane_chen@aspeedtech.com>;
> Cédric Le Goater <clg@redhat.com>
> Subject: [PATCH 3/3] hw/i2c/aspeed_i2c: Remove assert
> 
> According to the Aspeed datasheet, the RX_BUF_LEN_W1T and
> TX_BUF_LEN_W1T bits of the A_I2CS_DMA_LEN (0x2c) register allow
> firmware to program the TX and RX DMA length (TX_BUF_LEN and
> RX_BUF_LEN fields of the same register) separately without the need to
> read/modify/write the value.  If RX_BUF_LEN_W1T and TX_BUF_LEN_W1T
> bits are 0, then both TX and RX DMA length will be written.
> 
> When setting the RX_BUF_LEN field, the TX_BUF_LEN field being set is not an
> invalid condition. Remove the assert.
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3315
> Signed-off-by: Cédric Le Goater <clg@redhat.com>
> ---
>  hw/i2c/aspeed_i2c.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/hw/i2c/aspeed_i2c.c b/hw/i2c/aspeed_i2c.c index
> ad6342bec0d4..5d18f8d49ea4 100644
> --- a/hw/i2c/aspeed_i2c.c
> +++ b/hw/i2c/aspeed_i2c.c
> @@ -780,7 +780,6 @@ static void aspeed_i2c_bus_new_write(AspeedI2CBus
> *bus, hwaddr offset,
>          bus->regs[R_I2CS_DMA_RX_ADDR] = value;
>          break;
>      case A_I2CS_DMA_LEN:
> -        assert(FIELD_EX32(value, I2CS_DMA_LEN, TX_BUF_LEN) == 0);
>          if (FIELD_EX32(value, I2CS_DMA_LEN, RX_BUF_LEN_W1T)) {
>              ARRAY_FIELD_DP32(bus->regs, I2CS_DMA_LEN, RX_BUF_LEN,
>                               FIELD_EX32(value, I2CS_DMA_LEN,
> RX_BUF_LEN));
> --
> 2.53.0

Reviewed-by: Jamin Lin <jamin_lin@aspeedtech.com>

Thanks,
Jamin