Re: [PATCH v3 5/7] i2c: qcom-cci: Extend i2c read limits based on CCI revision

From: Konrad Dybcio

Date: Wed Oct 21 2026 - 06:52:30 EST


On 10/16/26 10:00 AM, Loic Poulain wrote:
> max_read_len was hardcoded to 12 bytes for all CCI revisions, but
> this does not reflect the actual hardware limits. Depending on the
> CCI version, the maximum read size is either 14 bytes (16 - 2) or
> 254 bytes (256 - 2), corresponding to FIFO_SIZE - 2. Two FIFO
> bytes are reserved by the hardware, with the first and last bytes
> used for metadata such as slave ID/address reporting.
>
> Add CCI_I2C_READ_MAX_LEN macro to derive max_read_len from each
> revision's FIFO size instead of hardcoding it and adjust the
> values according the hardware revisions.
>
> Improve the FIFO read procedure, read the first word, discard
> its ID-echo byte, then drain the remaining words in a plain loop.
> Switch to readl_relaxed() for the FIFO reads, since the preceding
> wait_for_completion_timeout() already orders them against the
> hardware's completion interrupt.
>
> Signed-off-by: Loic Poulain <loic.poulain@xxxxxxxxxxxxxxxx>
> ---

Reviewed-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>

Konrad