devicetree-org / dt-schema

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

schemas: i2c: Add the clock stretching property #103

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

v2 -> v3 Changed "i2c-scl-clk-low-timeout-ms" to "i2c-scl-clk-low-timeout-us" (milliseconds to microseconds) in order to reduce code impact and fix the inconsistency generated. (Thanks krzk!)

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.

ashyti commented 1 year ago

I'm not sure how to log things in github, but meantime I made 2 force pushes:

  1. fixed commit log where I forgot to replace /milliseconds/microseconds/
  2. added Krzysztof's r-b
robherring commented 1 year ago

In the future, please just rebase your branch instead of opening a new PR each time.