linux/drivers/i3c
Billy Tsai 81e4a54676 i3c: mipi-i3c-hci: fix IBI payload length calculation for final status
[ Upstream commit d35a6db887 ]

In DMA mode, the IBI status descriptor encodes the payload using
CHUNKS (number of chunks) and DATA_LENGTH (valid bytes in the last
chunk). All preceding chunks are implicitly full-sized.

The current code accumulates full chunk sizes for non-final status
descriptors, but for the final status descriptor it only adds
DATA_LENGTH. This ignores the contribution of the preceding full
chunks described by the same final status entry.

As a result, the computed IBI payload length is truncated whenever
the final status spans multiple chunks. For example, with a chunk
size of 4 bytes, CHUNKS=2 and DATA_LENGTH=1 should result in a total
payload size of 5 bytes, but the current code reports only 1 byte.

Fix the calculation by adding the size of (CHUNKS - 1) full chunks
plus DATA_LENGTH for the last chunk.

Fixes: 9ad9a52cce ("i3c/master: introduce the mipi-i3c-hci driver")
Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260407-i3c-hci-dma-v2-1-a583187b9d22@aspeedtech.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2026-06-01 17:35:35 +02:00
..
master i3c: mipi-i3c-hci: fix IBI payload length calculation for final status 2026-06-01 17:35:35 +02:00
device.c i3c: Handle drivers without probe or remove callback 2021-02-02 00:16:57 +01:00
internals.h i3c: add missing include to internal header 2025-08-28 16:24:24 +02:00
Kconfig i3c: Add core I3C infrastructure 2018-11-12 10:33:49 +01:00
Makefile i3c: Add core I3C infrastructure 2018-11-12 10:33:49 +01:00
master.c i3c: fix uninitialized variable use in i2c setup 2026-06-01 17:35:03 +02:00