Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Cory Keitz via B4 Relay <devnull+ckeitz.amazon.com@kernel.org>
To: Loic Poulain <loic.poulain@oss.qualcomm.com>,
	 Robert Foss <rfoss@kernel.org>,
	Andi Shyti <andi.shyti@kernel.org>,
	 Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>
Cc: linux-arm-msm@vger.kernel.org, linux-i2c@vger.kernel.org,
	 devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Cory Keitz <ckeitz@amazon.com>
Subject: [PATCH 2/2] i2c: qcom-cci: Add DT property for SCL clock stretching
Date: Thu, 05 Mar 2026 14:40:13 +0000	[thread overview]
Message-ID: <20260305-cci-scl-stretch-v1-2-8412abc65745@amazon.com> (raw)
In-Reply-To: <20260305-cci-scl-stretch-v1-0-8412abc65745@amazon.com>

From: Cory Keitz <ckeitz@amazon.com>

The CCI hardware supports an SCL clock stretch enable bit in the
MISC_CTL register, but the driver hardcodes it off for most SoC
variants. This makes the bus driver unstable for configurations which
rely on clock stretching. Notably, GMSL uses clock stretching to absorb
the latency of transaction forwarding across the link.

Add a per-master "qcom,scl-stretch-enable" boolean DT property that
ORs with the existing hw_params default, allowing clock stretching to
be enabled on individual CCI masters without affecting others.

Signed-off-by: Cory Keitz <ckeitz@amazon.com>
---
 drivers/i2c/busses/i2c-qcom-cci.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-qcom-cci.c b/drivers/i2c/busses/i2c-qcom-cci.c
index 884055df1560..022c10b310a0 100644
--- a/drivers/i2c/busses/i2c-qcom-cci.c
+++ b/drivers/i2c/busses/i2c-qcom-cci.c
@@ -111,6 +111,7 @@ struct cci_master {
 	struct i2c_adapter adap;
 	u16 master;
 	u8 mode;
+	bool scl_stretch_en;
 	int status;
 	struct completion irq_complete;
 	struct cci *cci;
@@ -284,7 +285,8 @@ static int cci_init(struct cci *cci)
 		val = hw->tbuf;
 		writel(val, cci->base + CCI_I2C_Mm_SDA_CTL_2(i));
 
-		val = hw->scl_stretch_en << 8 | hw->trdhld << 4 | hw->tsp;
+		val = (hw->scl_stretch_en | cci->master[i].scl_stretch_en) << 8 |
+			hw->trdhld << 4 | hw->tsp;
 		writel(val, cci->base + CCI_I2C_Mm_MISC_CTL(i));
 	}
 
@@ -572,6 +574,9 @@ static int cci_probe(struct platform_device *pdev)
 				master->mode = I2C_MODE_FAST_PLUS;
 		}
 
+		master->scl_stretch_en =
+			of_property_read_bool(child, "qcom,scl-stretch-enable");
+
 		init_completion(&master->irq_complete);
 	}
 

-- 
2.47.3



  parent reply	other threads:[~2026-03-05 14:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-05 14:40 [PATCH 0/2] i2c: qcom-cci: Add DT property for SCL clock stretching Cory Keitz via B4 Relay
2026-03-05 14:40 ` [PATCH 1/2] dt-bindings: i2c: qcom-cci: Document qcom,scl-stretch-enable property Cory Keitz via B4 Relay
2026-03-05 15:18   ` Krzysztof Kozlowski
2026-03-05 23:04     ` Cory Keitz
2026-03-05 14:40 ` Cory Keitz via B4 Relay [this message]
2026-03-05 15:16 ` [PATCH 0/2] i2c: qcom-cci: Add DT property for SCL clock stretching Loic Poulain
2026-03-05 23:01   ` Cory Keitz
2026-03-11 13:18   ` 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=20260305-cci-scl-stretch-v1-2-8412abc65745@amazon.com \
    --to=devnull+ckeitz.amazon.com@kernel.org \
    --cc=andi.shyti@kernel.org \
    --cc=ckeitz@amazon.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@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 \
    --cc=robh@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