dt-bindings: i2c: convert davinci i2c to dt-schema
PATCH v4 1/1 dt-bindings: i2c: convert davinci i2c to dt-schema
Convert the Texas Instruments DaVinci and Keystone I2C controller bindings from legacy text format to modern dt-schema (YAML).
During the conversion, the interrupts property was made required to match the strict requirement in the driver probe function. The custom ti,has-pfunc and power-domains properties were also properly defined to match SoC-specific hardware features.
---
Changes in v4:
- Added conditional allOf block to enforce power-domains requirement for ti,keystone-i2c compatible.
- Dropped automated bot tags from commit message per maintainer feedback.
Changes in v3:
- Fixed a typo in the author's email address within the YAML maintainers block.
Changes in v2:
- Updated MAINTAINERS file to point to the new ti,davinci-i2c.yaml file instead of the deleted .txt file.
.../devicetree/bindings/i2c/i2c-davinci.txt | 43 ------------ .../bindings/i2c/ti,davinci-i2c.yaml | 70 +++++++++++++++++++ MAINTAINERS | 2 +- 3 files changed, 71 insertions(+), 44 deletions(-) delete mode 100644 Documentation/devicetree/bindings/i2c/i2c-davinci.txt create mode 100644 Documentation/devicetree/bindings/i2c/ti,davinci-i2c.yaml
Documentation/devicetree/bindings/i2c/i2c-davinci.txt deleted +0 -43
@@ -1,43 +0,0 @@ -* Texas Instruments Davinci/Keystone I2C - -This file provides information, what the device node for the -davinci/keystone i2c interface contains. - -Required properties: -- compatible: "ti,davinci-i2c" or "ti,keystone-i2c"; -- reg : Offset and length of the register set for the device -- clocks: I2C functional clock phandle. - For 66AK2G this property should be set per binding, - Documentation/devicetree/bindings/clock/ti,sci-clk.yaml - -SoC-specific Required Properties: - -The following are mandatory properties for Keystone 2 66AK2G SoCs only: - -- power-domains: Should contain a phandle to a PM domain provider node - and an args specifier containing the I2C device id - value. This property is as per the binding, - Documentation/devicetree/bindings/soc/ti/sci-pm-domain.yaml - -Recommended properties : -- interrupts : standard interrupt property. -- clock-frequency : desired I2C bus clock frequency in Hz. -- ti,has-pfunc: boolean; if defined, it indicates that SoC supports PFUNC - registers. PFUNC registers allow to switch I2C pins to function as - GPIOs, so they can be toggled manually. - -Example (enbw_cmc board): - i2c@1c22000 { - compatible = "ti,davinci-i2c"; - reg = <0x22000 0x1000>; - clock-frequency = <100000>; - interrupts = <15>; - interrupt-parent = <&intc>; - #address-cells = <1>; - #size-cells = <0>; - - dtt@48 { - compatible = "national,lm75"; - reg = <0x48>; - }; - };
Documentation/devicetree/bindings/i2c/ti,davinci-i2c.yaml new file +70 -0
70 lines not on this page · raw message
MAINTAINERS +1 -1
@@ -26396,7 +26396,7 @@ M: Bartosz Golaszewski <[email protected]> L: [email protected] (moderated for non-subscribers) S: Maintained T: git git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git -F: Documentation/devicetree/bindings/i2c/i2c-davinci.txt +F: Documentation/devicetree/bindings/i2c/ti,davinci-i2c.yaml F: arch/arm/boot/dts/ti/davinci/ F: arch/arm/mach-davinci/ F: drivers/i2c/busses/i2c-davinci.c
Signature · 1 line
2.43.0
Quoted 4 lines · Chaitanya Sabnis
Convert the Texas Instruments DaVinci and Keystone I2C controller bindings from legacy text format to modern dt-schema (YAML).
Quoted 8 lines
During the conversion, the
interruptsproperty was made required to match the strict requirement in the driver probe function. The customti,has-pfuncandpower-domainsproperties were also properly defined to match SoC-specific hardware features.Signed-off-by Chaitanya Sabnis <[email protected]>Reviewed-by Rob Herring (Arm) <[email protected]>---
I left my Ack under v3. Please keep tags when resending.
Hi Chaitanya,
Quoted 10 lines · Chaitanya Sabnis
Convert the Texas Instruments DaVinci and Keystone I2C controller bindings from legacy text format to modern dt-schema (YAML).
During the conversion, the
interruptsproperty was made required to match the strict requirement in the driver probe function. The customti,has-pfuncandpower-domainsproperties were also properly defined to match SoC-specific hardware features.Signed-off-by Chaitanya Sabnis <[email protected]>Reviewed-by Rob Herring (Arm) <[email protected]>
merged to i2c/i2c-host.
Thanks,
Andi
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] Omitting the 'clock-frequency' property from the device tree causes a deterministic…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Omitting the 'clock-frequency' property from the device tree causes a deterministic division-by-zero crash in the driver. --
commit 75f02e0195256a57df4b6d329b0206def30928b6
Author: Chaitanya Sabnis <[email protected]>
dt-bindings: i2c: convert davinci i2c to dt-schema
This commit converts the Texas Instruments DaVinci and Keystone I2C controller bindings from legacy text format to modern dt-schema (YAML). It also makes the interrupts property required and adds definitions for SoC-specific hardware features.
Quoted 5 lines
Documentation/devicetree/bindings/i2c/ti,davinci-i2c.yaml new file +0
-0
[ ... ]
Documentation/devicetree/bindings/i2c/ti,davinci-i2c.yaml line 51
Quoted 5 lines
Documentation/devicetree/bindings/i2c/ti,davinci-i2c.yaml new file +5
-0+required: + - compatible + - reg + - interrupts + - clocks
Should clock-frequency be included in the required list here?
Omitting the clock-frequency property from the device tree causes a regression resulting in a division-by-zero crash in the driver.
When clock-frequency is omitted, davinci_i2c_probe() falls back to DAVINCI_I2C_DEFAULT_BUS_FREQ (100) and calculates dev->bus_freq:
drivers/i2c/busses/i2c-davinci.c:davinci_i2c_probe() {
...
dev->bus_freq = prop / 1000;
...
}Due to integer truncation, dev->bus_freq becomes 0. The driver then calls i2c_davinci_calc_clk_dividers(), which divides by dev->bus_freq:
drivers/i2c/busses/i2c-davinci.c:i2c_davinci_calc_clk_dividers() {
...
clk = ((input_clock / (psc + 1)) / (dev->bus_freq * 1000));
...
}This executes a division by zero during device probe. Either the C driver's fallback logic must be corrected, or clock-frequency must be explicitly required in the schema to prevent this regression.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1