From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
To: Loic Poulain <loic.poulain@oss.qualcomm.com>,
Robert Foss <rfoss@kernel.org>,
Andi Shyti <andi.shyti@kernel.org>
Cc: linux-i2c@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 6/7] i2c: qcom-cci: Add burst read support
Date: Wed, 21 Oct 2026 13:01:07 +0200 [thread overview]
Message-ID: <59888512-9938-4982-9869-5f1d0e3770be@oss.qualcomm.com> (raw)
In-Reply-To: <20261016-cci-imp-v3-6-5ee7ec1ea1a1@oss.qualcomm.com>
On 10/16/26 10:00 AM, Loic Poulain wrote:
> CCI_I2C_READ transfers are currently limited by max_read_len to the
> amount of data that fits in the read FIFO, as the driver only drains
> the FIFO once after receiving RD_DONE. On current hardware this limits
> reads to at most 254 bytes.
>
> CCI v1.7 and later support reads larger than the FIFO depth by
> generating RD_THRESHOLD interrupts as the FIFO fills, allowing software
> to drain data while the transfer is still in progress. When the FIFO
> becomes full, the hardware can also apply backpressure by stretching
> SCL and reports this condition through RD_PAUSE_IRQ.
>
> Program CCI_I2C_Mm_RD_THRESHOLD to half the FIFO depth on hardware that
> supports RD_THRESHOLD and update the read path to drain the FIFO on
> each threshold interrupt until the final RD_DONE event is received.
>
> Older hardware revisions do not support RD_THRESHOLD, keep their read
> size limited to the FIFO depth and continue relying solely on RD_DONE
> for completion.
>
> Also emit a warning when RD_PAUSE_IRQ is observed, as FIFO backpressure
> is unexpected under normal conditions and may indicate that software is
> not draining the FIFO quickly enough.
>
> Signed-off-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
> ---
[...]
> +#define CCI_IRQ_MASK_1 0xc10
This exists all the way back to 8974, nice
[...]
> - ret = cci_run_queue(cci, master, queue);
> - if (ret < 0)
> - return ret;
> + val = readl(cci->base + CCI_I2C_Mm_Qn_CUR_WORD_CNT(master, queue));
> + writel(val, cci->base + CCI_I2C_Mm_Qn_EXEC_WORD_CNT(master, queue));
>
> - words_read = readl(cci->base + CCI_I2C_Mm_READ_BUF_LEVEL(master));
> - words_exp = len / 4 + 1;
GPT says: can we keep this check for the legacy case?
> - if (words_read != words_exp) {
> - dev_err(cci->dev, "words read = %d, words expected = %d\n",
> - words_read, words_exp);
> - return -EIO;
> - }
> + reinit_completion(&cci->master[master].irq_complete);
> +
> + cci_set_rd_threshold_irq(cci, master, true);
> +
> + val = BIT(master * 2 + queue);
> + writel(val, cci->base + CCI_QUEUE_START);
> +
> + /*
> + * Hardware supporting RD_THRESHOLD can handle reads larger than the FIFO size.
> + * The FIFO is drained each time an RD_THRESHOLD interrupt is received, until
> + * the final RD_DONE interrupt completes the transfer.
> + * On hardware lacking RD_THRESHOLD support, reads are limited to the FIFO
> + * size and only one completion (RD_DONE interrupt) is expected.
> + */
> + while (index < len) {
GPT says: the last transfer isn't waiting for RD_DONE
> + if (!wait_for_completion_timeout(&cci->master[master].irq_complete,
> + CCI_TIMEOUT)) {
> + dev_err(cci->dev, "master %d queue %d read timeout\n",
> + master, queue);
> + cci_reset(cci);
> + return -ETIMEDOUT;
GPT says: disable the threshold irq here?
Konrad
next prev parent reply other threads:[~2026-10-21 11:01 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 8:00 [PATCH v3 0/7] i2c: qcom-cci: Runtime capability detection and improved read/write Loic Poulain
2026-10-16 8:00 ` [PATCH v3 1/7] i2c: qcom-cci: Factor out write command queue programming Loic Poulain
2026-10-21 13:48 ` Konrad Dybcio
2026-10-16 8:00 ` [PATCH v3 2/7] i2c: qcom-cci: Handle and report queue overflow/underflow interrupts Loic Poulain
2026-10-21 10:40 ` Konrad Dybcio
2026-10-16 8:00 ` [PATCH v3 3/7] i2c: qcom-cci: Detect capabilities from CCI_HW_VERSION at runtime Loic Poulain
2026-10-21 10:42 ` Konrad Dybcio
2026-10-16 8:00 ` [PATCH v3 4/7] i2c: qcom-cci: Add burst write support Loic Poulain
2026-10-21 10:45 ` Konrad Dybcio
2026-10-16 8:00 ` [PATCH v3 5/7] i2c: qcom-cci: Extend i2c read limits based on CCI revision Loic Poulain
2026-10-21 10:50 ` Konrad Dybcio
2026-10-16 8:00 ` [PATCH v3 6/7] i2c: qcom-cci: Add burst read support Loic Poulain
2026-10-21 11:01 ` Konrad Dybcio [this message]
2026-10-16 8:00 ` [PATCH v3 7/7] i2c: qcom-cci: Build command words with FIELD_PREP() Loic Poulain
2026-10-21 11:03 ` Konrad Dybcio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=59888512-9938-4982-9869-5f1d0e3770be@oss.qualcomm.com \
--to=konrad.dybcio@oss.qualcomm.com \
--cc=andi.shyti@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=loic.poulain@oss.qualcomm.com \
--cc=rfoss@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®