Skip to contentSkip to conversation

dt-bindings: i2c: Move i2c-omap.txt to YAML format

PATCH Superseded Vignesh Raghavendra 3 participants 4 messages May 5, 2021

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Vignesh Raghavendra

author maintainer
#0 lore raw

PATCH 1/1 dt-bindings: i2c: Move i2c-omap.txt to YAML format

Convert i2c-omap.txt to YAML schema for better checks and documentation.

Following properties were used in DT but were not documented in txt bindings and has been included in YAML schema:
1. Include ti,am4372-i2c compatible
2. Include dmas property used in few OMAP dts files
3. Document clocks property

---
 .../devicetree/bindings/i2c/i2c-omap.txt      | 37 ---------
 .../devicetree/bindings/i2c/ti,omap4-i2c.yaml | 75 +++++++++++++++++++
 2 files changed, 75 insertions(+), 37 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/i2c/i2c-omap.txt
 create mode 100644 Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml
Documentation/devicetree/bindings/i2c/i2c-omap.txt deleted +0 -37
deleted file mode 100644
index a425b91af48f..000000000000
@@ -1,37 +0,0 @@
-I2C for OMAP platforms
-
-Required properties :
-- compatible : Must be
-	"ti,omap2420-i2c" for OMAP2420 SoCs
-	"ti,omap2430-i2c" for OMAP2430 SoCs
-	"ti,omap3-i2c" for OMAP3 SoCs
-	"ti,omap4-i2c" for OMAP4+ SoCs
-	"ti,am654-i2c", "ti,omap4-i2c" for AM654 SoCs
-	"ti,j721e-i2c", "ti,omap4-i2c" for J721E SoCs
-	"ti,am64-i2c", "ti,omap4-i2c" for AM64 SoCs
-- ti,hwmods : Must be "i2c<n>", n being the instance number (1-based)
-- #address-cells = <1>;
-- #size-cells = <0>;
-
-Recommended properties :
-- clock-frequency : Desired I2C bus clock frequency in Hz. Otherwise
-  the default 100 kHz frequency will be used.
-
-Optional properties:
-- Child nodes conforming to i2c bus binding
-
-Note: Current implementation will fetch base address, irq and dma
-from omap hwmod data base during device registration.
-Future plan is to migrate hwmod data base contents into device tree
-blob so that, all the required data will be used from device tree dts
-file.
-
-Examples :
-
-i2c1: i2c@0 {
-    compatible = "ti,omap3-i2c";
-    #address-cells = <1>;
-    #size-cells = <0>;
-    ti,hwmods = "i2c1";
-    clock-frequency = <400000>;
-};
Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml new file +75 -0

75 lines not on this page · raw message

Signature · 1 line
2.31.1
#1 lore raw

Hi,

Quoted 1 line · Vignesh Raghavendra

Convert i2c-omap.txt to YAML schema for better checks and documentation.

Nice to see this happening, few minor comments below on handling the legacy devices.

Quoted 4 lines
Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml new file +4 -0
+properties:
+  compatible:
+    oneOf:
+      - const: ti,omap2420-i2c

Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml line 28

Quoted 10 lines
Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml new file +10 -0
+      - const: ti,omap2430-i2c
+      - const: ti,omap3-i2c
+      - const: ti,omap4-i2c
+      - items:
+          - enum:
+              - ti,am4372-i2c
+              - ti,am64-i2c
+              - ti,am654-i2c
+              - ti,j721e-i2c
+          - const: ti,omap4-i2c

I wonder if we should just add all the compatible options to the driver, and have all these as oneOf?

Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml line 35

Quoted 6 lines
Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml new file +6 -0
+  ti,hwmods:
+    description:
+      Must be "i2c<n>", n being the instance number (1-based)
+    $ref: /schemas/types.yaml#/definitions/string
+    items:
+      - pattern: "^i2c([1-9])$"

The ti,hwmods is a legacy property that is only needed for omap2/3 and ti81xx. At least the description should mention that to avoid folks adding it accidentally.

Regards,

Tony

author maintainer
#2 lore raw

Hi,

Quoted 23 lines · Tony Lindgren

Hi,

Quoted 1 line · Vignesh Raghavendra

Convert i2c-omap.txt to YAML schema for better checks and documentation.

Nice to see this happening, few minor comments below on handling the legacy devices.

Quoted 4 lines
Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml new file +4 -0
+properties:
+  compatible:
+    oneOf:
+      - const: ti,omap2420-i2c

Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml line 28

Quoted 10 lines
Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml new file +10 -0
+      - const: ti,omap2430-i2c
+      - const: ti,omap3-i2c
+      - const: ti,omap4-i2c
+      - items:
+          - enum:
+              - ti,am4372-i2c
+              - ti,am64-i2c
+              - ti,am654-i2c
+              - ti,j721e-i2c
+          - const: ti,omap4-i2c
Quoted 3 lines

I wonder if we should just add all the compatible options to the driver, and have all these as oneOf?

This would also need updates to dts files too. Also not a fan of adding all compatibles to driver code unless required.

Quoted 11 lines

Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml line 35

Quoted 6 lines
Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml new file +6 -0
+  ti,hwmods:
+    description:
+      Must be "i2c<n>", n being the instance number (1-based)
+    $ref: /schemas/types.yaml#/definitions/string
+    items:
+      - pattern: "^i2c([1-9])$"

The ti,hwmods is a legacy property that is only needed for omap2/3 and ti81xx. At least the description should mention that to avoid folks adding it accidentally.

Sure, will do in v2. Thanks for the review!

Regards
Vignesh

maintainer
#3 lore raw
In reply to Vignesh Raghavendra
Quoted 8 lines · Vignesh Raghavendra

Convert i2c-omap.txt to YAML schema for better checks and documentation.

Following properties were used in DT but were not documented in txt bindings and has been included in YAML schema:
1. Include ti,am4372-i2c compatible
2. Include dmas property used in few OMAP dts files
3. Document clocks property

Quoted 8 lines
---
 .../devicetree/bindings/i2c/i2c-omap.txt      | 37 ---------
 .../devicetree/bindings/i2c/ti,omap4-i2c.yaml | 75 +++++++++++++++++++
 2 files changed, 75 insertions(+), 37 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/i2c/i2c-omap.txt
 create mode 100644 Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Error: Documentation/devicetree/bindings/i2c/ti,omap4-i2c.example.dts:22.31-32 syntax error FATAL ERROR: Unable to parse input tree
make[1]: *** [scripts/Makefile.lib:377: Documentation/devicetree/bindings/i2c/ti,omap4-i2c.example.dt.yaml] Error 1 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1414: dt_binding_check] Error 2

See https://patchwork.ozlabs.org/patch/1474101

This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit.