mirror of
https://gitlab.com/qemu-project/qemu.git
synced 2026-10-28 14:04:39 +08:00
An SMBus block read takes the block length from the first byte of the transfer, and firmware reads that byte back from a register rather than from the transfer buffer. The receive paths never updated those registers, so block reads reported a bogus length. On AST2600 the driver reads the length from the receive byte buffer, I2CC_MS_TXRX_BYTE_BUF[15:8]. The datasheet documents that field as valid while the DMA buffer is not enabled. The byte mode receive path already updated it, but the pool buffer path did not, and the driver selects buffer mode by default. On AST2700 the driver reads the length from offset 0x84 instead. Add I2CC_BYTE_DATA_LOG at 0x84 and latch received bytes into it. The pool buffer, DMA-to-pool and DMA-to-DRAM paths latch their first byte, the byte mode path latches every byte. Each latch also updates the receive byte buffer unless RX_DMA_EN is set, which is the datasheet condition and does not depend on FUNC_CFG_DMA_EN. The byte data log only exists on AST2700 and AST1040, so it is gated on a class flag. Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com> Tested-by: Mikail Sadic <mikail.sadic@ibm.com> Link: https://lore.kernel.org/qemu-devel/20260814020836.3119613-1-jamin_lin@aspeedtech.com Signed-off-by: Cédric Le Goater <clg@redhat.com>