Skip to content

i2c: qcom-cci: Runtime capability detection and improved read/write

Loic Poulain linux-arm-msm linux-i2c lkml 4 versions – New

Get series with b4
b4 am [email protected] change-id 20260929-cci-imp-8ba384309942

Versions newest first

  1. v4 Latest7 patches 0 repliesNew
  2. v37 patches 7 repliesSuperseded
  3. v26 patches 4 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v15 patches7 repliesSuperseded

Changes in v4 from the cover letter

- Reject an oversized write with -EINVAL instead of -EOPNOTSUPP (Konrad)
- Burst read: terminate the drain loop on RD_DONE instead of on the
expected byte count, so the transfer is never left in flight when the
last bytes arrive on a threshold interrupt (Konrad)
- Burst read: restore the short-read sanity check that was dropped,
now comparing bytes read against bytes expected so it covers the
threshold and the legacy path alike (Konrad)
- Burst read: disable the RD_THRESHOLD interrupt on the error exits as
well, not only on completion (Konrad)
- Burst read: bound the fifo drain loop by the expected word count, so
a bogus hardware fifo level cannot turn it into an unbounded loop
- Link to v3: https://lore.kernel.org/r/[email protected]

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7i2c: qcom-cci: Factor out write command queue programmingdrivers/i2c/busses/i2c-qcom-cci.c+25 -190 replies
2/7i2c: qcom-cci: Handle and report queue overflow/underflow interruptsdrivers/i2c/busses/i2c-qcom-cci.c+30 -40 replies
3/7i2c: qcom-cci: Detect capabilities from CCI_HW_VERSION at runtimedrivers/i2c/busses/i2c-qcom-cci.c+106 -560 replies
4/7i2c: qcom-cci: Add burst write supportdrivers/i2c/busses/i2c-qcom-cci.c+31 -80 replies
5/7i2c: qcom-cci: Extend i2c read limits based on CCI revisiondrivers/i2c/busses/i2c-qcom-cci.c+17 -200 replies
6/7i2c: qcom-cci: Add burst read supportdrivers/i2c/busses/i2c-qcom-cci.c+183 -230 replies
7/7i2c: qcom-cci: Build command words with FIELD_PREP()drivers/i2c/busses/i2c-qcom-cci.c+23 -80 replies

Reviews trailers per patch

6 of 7 patches have a Reviewed-by or Acked-by.

PatchBryan O'DonoghueKonrad Dybcio
1/7R-b
2/7R-b R-b
3/7R-b
4/7R-b
5/7R-b
6/7
7/7R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/7] i2c: qcom-cci: Runtime capability detection and improved read/write

Improves the Qualcomm CCI I2C driver read/write in different ways:

- Capabilities (queue sizes, max transfer lengths, supported I2C mode) are currently hardcoded per DT compatible string in a handful of cci_data instances. Replace the static per-compatible structs with a single version-sorted capability catalog resolved at runtime from CCI_HW_VERSION.

- The driver only supported single-command writes, capped at 11 bytes regardless of how much space the command queue actually has. Factor out the write-command queueing into a reusable helper and then add burst-write support, chunking longer writes across the whole queue instead of a single command's payload.

- The FIFO read path hardcoded a fixed 12-byte limit unrelated to the actual per-revision FIFO size, with a special-cased drain loop. Simplify the FIFO read/drain loop and derive the read-side limits from each revision's FIFO size.

- Add burst-read support using threshold interrupts, allowing reads of arbitrary size by draining the FIFO incrementally during the transfer.

Also add overflow and underflow IRQ reporting, as queue/fifo limits are now derived from the hardware capabilities and exercised more aggressively.

Unbounded writes, which refill the command queue while the transfer is still in flight and so lift the queue-depth limit on the write side, build on this series and will be posted separately.

Reads up to 4 KiB and writes up to the full command queue depth (451 bytes on this part) were exercised on an imx219 behind CCI v1.8 (128-word queue, 400 kHz).

---
Changes in v4:
- Reject an oversized write with -EINVAL instead of -EOPNOTSUPP (Konrad)
- Burst read: terminate the drain loop on RD_DONE instead of on the
expected byte count, so the transfer is never left in flight when the
last bytes arrive on a threshold interrupt (Konrad)
- Burst read: restore the short-read sanity check that was dropped,
now comparing bytes read against bytes expected so it covers the
threshold and the legacy path alike (Konrad)
- Burst read: disable the RD_THRESHOLD interrupt on the error exits as
well, not only on completion (Konrad)
- Burst read: bound the fifo drain loop by the expected word count, so
a bogus hardware fifo level cannot turn it into an unbounded loop
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Reject a write longer than the advertised limit with an error rather
than ignoring it. (Bryan)
- Build the command words with FIELD_PREP() instead of open-coded
shifts, which also documents the per-opcode field widths (Konrad)
- Actually program CCI_IRQ_MASK_1, the RD_PAUSE bits were being ORed
into the value written to CCI_IRQ_MASK_0 and so never took effect
- Clear the per-transfer status on entry and stop reinitialising the completion in the read drain loop, as RD_DONE can fire while the
fifo is being drained
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Split the HALT_ACK reset fix out into its own patch (Andi)
- Fix a typo in the "Detect capabilities from CCI_HW_VERSION" commit
message (Andi)
- Use GENMASK()/FIELD_GET() to decode the CCI_HW_VERSION fields (Konrad)
- Derive the number of masters from the DT i2c-bus subnodes instead of encoding it per compatible string (Konrad)
- Add burst read support via RD_THRESHOLD/RD_PAUSE IRQs
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Loic Poulain (7):
i2c: qcom-cci: Factor out write command queue programming
i2c: qcom-cci: Handle and report queue overflow/underflow interrupts
i2c: qcom-cci: Detect capabilities from CCI_HW_VERSION at runtime
i2c: qcom-cci: Add burst write support
i2c: qcom-cci: Extend i2c read limits based on CCI revision
i2c: qcom-cci: Add burst read support
i2c: qcom-cci: Build command words with FIELD_PREP()

 drivers/i2c/busses/i2c-qcom-cci.c | 495 +++++++++++++++++++++++++++++---------
 1 file changed, 386 insertions(+), 109 deletions(-)

---
base-commit: 00fb8097ca5a4fcf0e0cc1550075aa7313bbd32a
change-id: 20260929-cci-imp-8ba384309942

Best regards,

Signature · 1 line
Loic Poulain <[email protected]>