Avoid calling aspeed_i2c_set_tx_dma_dram_offset twice in non-packet mode where this function is called first in aspeed_i2c_get_addr. Also fix writing to I2CD_DMA_ADDR in old register mode.
Signed-off-by: Timur Maksimov [email protected] --- hw/i2c/aspeed_i2c.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/i2c/aspeed_i2c.c b/hw/i2c/aspeed_i2c.c index ec46f6c94c..376e113e58 100644 --- a/hw/i2c/aspeed_i2c.c +++ b/hw/i2c/aspeed_i2c.c @@ -416,7 +416,9 @@ static int aspeed_i2c_bus_send(AspeedI2CBus *bus, bool send_addr) if (aspeed_i2c_is_new_mode(bus->controller)) { ARRAY_FIELD_DP32(bus->regs, I2CM_DMA_LEN_STS, TX_LEN, 0); } - aspeed_i2c_set_tx_dma_dram_offset(bus); + if (!send_addr) { + aspeed_i2c_set_tx_dma_dram_offset(bus); + } while (bus->regs[reg_dma_len]) { uint8_t data; ret = aspeed_i2c_dma_read(bus, &data); @@ -1070,11 +1072,13 @@ static void aspeed_i2c_bus_old_write(AspeedI2CBus *bus, hwaddr offset, bus->pending_intr_sts |= old_intr & cmd_intr; aspeed_i2c_bus_raise_interrupt(bus); break; + case A_I2CD_DMA_ADDR: if (!aic->has_dma) { qemu_log_mask(LOG_GUEST_ERROR, "%s: No DMA support\n", __func__); break; } + bus->regs[R_I2CD_DMA_ADDR] = value; break; case A_I2CD_DMA_LEN: -- 2.53.0
