devicetree-org / dt-schema

Devicetree schema tools
http://www.devicetree.org
BSD 2-Clause "Simplified" License
67 stars 64 forks source link

schemas: i2c: Add the clock stretching property #102

Closed ashyti closed 1 year ago

ashyti commented 1 year ago

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:

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.

ashyti commented 1 year ago

Changelog:

v1 -> v2 Added the allOf as recommended by Krzsysztof and added the "type: boolean" under the "i2c-scl-has-clk-low-timeout" that I forgot.

krzk commented 1 year ago

You made the property as in milliseconds, not microseconds how existing Linux kernel drivers uses it. What are the ranges? Timeouts lower than 1 ms are not expected?