public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Shyti <andi.shyti@kernel.org>
To: linux-i2c@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: Wolfram Sang <wsa@kernel.org>, Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Chris Packham <chris.packham@alliedtelesis.co.nz>,
	Ryan Chen <ryan_chen@aspeedtech.com>,
	Andi Shyti <andi.shyti@kernel.org>
Subject: [PATCH 1/2] dt-bindings: i2c: Add the clock stretching property
Date: Sun, 12 Mar 2023 14:19:32 +0100	[thread overview]
Message-ID: <20230312131933.248715-2-andi.shyti@kernel.org> (raw)
In-Reply-To: <20230312131933.248715-1-andi.shyti@kernel.org>

The I2C specification allows for the clock line to be held low
for a specified timeout to force the slave device into a 'wait'
mode. This feature is known as 'Clock stretching' and is
optional.

In the NXP I2C specification, clock stretching is described as
the process of pausing a transaction by holding the SCL line LOW.
The transaction can only continue when the line is released HIGH
again.[*] However, most target devices do not include an SCL
driver and are therefore unable to stretch the clock.

Add the following properties:

 - i2c-scl-clk-low-timeout-ms: This property specifies the
   duration, in milliseconds, for which the clock is kept low and
   a client needs to detect a forced waiting state.

 - i2c-scl-has-clk-low-timeout: This property specifies whether
    the I2C controller implements the clock stretching property.

It's important to note that this feature should not be confused
with the SMBUS clock timeout, which serves a similar function but
specifies a timeout of 25-35ms. The I2C specification does not
recommend any specific timeout.

[*] NXP, UM10204 - I2C-bus specification and user manual
    Rev. 7.0, 1 October 2021, chapter 3.1.9.

Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
---
 Documentation/devicetree/bindings/i2c/i2c.txt | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/Documentation/devicetree/bindings/i2c/i2c.txt b/Documentation/devicetree/bindings/i2c/i2c.txt
index fc3dd7ec0445..12c311f0e831 100644
--- a/Documentation/devicetree/bindings/i2c/i2c.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c.txt
@@ -45,6 +45,15 @@ wants to support one of the below features, it should adapt these bindings.
 	Number of nanoseconds the SCL signal takes to rise; t(r) in the I2C
 	specification.
 
+- i2c-scl-clk-low-timeout-ms
+	Number of miliseconds the clock line needs to be pulled down in order
+	to force a waiting state.
+
+- i2c-scl-has-clk-low-timeout
+	Boolean value that indicates whether the controller implements the
+	feature of wait induction through SCL low, with the timeout being
+	implemented internally by the controller.
+
 - i2c-sda-falling-time-ns
 	Number of nanoseconds the SDA signal takes to fall; t(f) in the I2C
 	specification.
-- 
2.39.2


  reply	other threads:[~2023-03-12 13:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-12 13:19 [PATCH 0/2] Add the clock stretching i2c property Andi Shyti
2023-03-12 13:19 ` Andi Shyti [this message]
2023-03-12 13:43   ` [PATCH 1/2] dt-bindings: i2c: Add the clock stretching property Krzysztof Kozlowski
2023-03-12 13:19 ` [PATCH 2/2] i2c: mpc: Use the i2c-scl-clk-low-timeout-ms property Andi Shyti
2023-03-12 13:44   ` Krzysztof Kozlowski
2023-03-12 13:44   ` Krzysztof Kozlowski
2023-03-12 13:48     ` Andi Shyti

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=20230312131933.248715-2-andi.shyti@kernel.org \
    --to=andi.shyti@kernel.org \
    --cc=chris.packham@alliedtelesis.co.nz \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=ryan_chen@aspeedtech.com \
    --cc=wsa@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