dt-bindings: i2c: Move i2c-omap.txt to YAML format
Subsystems (3)
Vignesh Raghavendra
maintainerPATCH v2 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
---
v2:
Fix issues with make dt_bindings_check
Add description on usage of ti,hwmods
.../devicetree/bindings/i2c/i2c-omap.txt | 37 --------- .../devicetree/bindings/i2c/ti,omap4-i2c.yaml | 80 +++++++++++++++++++ 2 files changed, 80 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
@@ -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 +80 -0
80 lines not on this page · raw message
Signature · 1 line
2.31.1
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 6 lines
Signed-off-by Vignesh Raghavendra <[email protected]>---
v2:
Fix issues with makedt_bindings_check
Add description on usage of ti,hwmods
please add a link to V1 to be nice to folks like me coming in for a review at the point on v2 patch ;)
https://lore.kernel.org/linux-arm-kernel/?q=i2c-omap was'nt too helpful either :(
Quoted 83 lines
.../devicetree/bindings/i2c/i2c-omap.txt | 37 --------- .../devicetree/bindings/i2c/ti,omap4-i2c.yaml | 80 +++++++++++++++++++ 2 files changed, 80 insertions(+), 37 deletions(-) delete mode 100644 Documentation/devicetree/bindings/i2c/i2c-omap.txt create mode 100644 Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yamlDocumentation/devicetree/bindings/i2c/i2c-omap.txt deleted +0
-37@@ -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 +27
-0@@ -0,0 +1,80 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/i2c/ti,omap4-i2c.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Bindings for I2C controllers on TI's OMAP and K3 SoCs + +maintainers: + - Vignesh Raghavendra <[email protected]> + +allOf: + - $ref: /schemas/i2c/i2c-controller.yaml# + +properties: + compatible: + oneOf: + - const: ti,omap2420-i2c + - 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
Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml line 37
Quoted 10 lines
Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml new file +10
-0+ - const: ti,omap4-i2c + + ti,hwmods: + description: + (DEPRECATED) Must be "i2c<n>", n being the instance number (1-based). + This property is applicable only on legacy platforms mainly omap2/3 + and ti81xx and should not be used on other platforms. + $ref: /schemas/types.yaml#/definitions/string + items: + - pattern: "^i2c([1-9])$"
https://lore.kernel.org/linux-devicetree/[email protected]/
Can we control it with if?
Quoted 20 lines
Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml new file +20
-0+ + dmas: + minItems: 1 + maxItems: 2 + + dma-names: + items: + - const: tx + - const: rx + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names:
Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml line 67
Quoted 10 lines
Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml new file +10
-0+ const: fck + + clock-frequency: true + +required: + - compatible + - reg + - interrupts + +unevaluatedProperties: false
I wonder if we should go with additionalProperties: false instead of unevaluatedProperties..
For example:
Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml line 77
Quoted 10 lines
Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml new file +10
-0+ +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + + main_i2c0: i2c@2000000 { + compatible = "ti,j721e-i2c", "ti,omap4-i2c"; + reg = <0x2000000 0x100>; + interrupts = <GIC_SPI 200 IRQ_TYPE_LEVEL_HIGH>;
If I add a ridiculous property system-controller; -> no problems what so
ever..
Quoted 6 lines
Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml new file +3
-0+ #address-cells = <1>; + #size-cells = <0>; + };Signature · 1 line
2.31.1
Signature · 3 lines
Regards, Nishanth Menon Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3 1A34 DDB5 849D 1736 249D
Quoted 6 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
The DMA is not supported by i2c-omap driver, so wouldn't be better to just drop dmas from DTBs to avoid confusions? It can be added later.
Quoted 144 lines
3. Document clocks property
Signed-off-by Vignesh Raghavendra <[email protected]>---
v2:
Fix issues with makedt_bindings_check
Add description on usage of ti,hwmods.../devicetree/bindings/i2c/i2c-omap.txt | 37 --------- .../devicetree/bindings/i2c/ti,omap4-i2c.yaml | 80 +++++++++++++++++++ 2 files changed, 80 insertions(+), 37 deletions(-)delete mode 100644
Documentation/devicetree/bindings/i2c/i2c-omap.txtcreate mode 100644Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yamlDocumentation/devicetree/bindings/i2c/i2c-omap.txt deleted +0
-37@@ -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 +80
-0@@ -0,0 +1,80 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/i2c/ti,omap4-i2c.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Bindings for I2C controllers on TI's OMAP and K3 SoCs + +maintainers: + - Vignesh Raghavendra <[email protected]> + +allOf: + - $ref: /schemas/i2c/i2c-controller.yaml# + +properties: + compatible: + oneOf: + - const: ti,omap2420-i2c + - 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 + + ti,hwmods: + description: + (DEPRECATED) Must be "i2c<n>", n being the instance number (1-based). + This property is applicable only on legacy platforms mainly omap2/3 + and ti81xx and should not be used on other platforms. + $ref: /schemas/types.yaml#/definitions/string + items: + - pattern: "^i2c([1-9])$" + + dmas: + minItems: 1 + maxItems: 2 + + dma-names: + items: + - const: tx + - const: rx + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + const: fck + + clock-frequency: true + +required: + - compatible + - reg + - interrupts + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + + main_i2c0: i2c@2000000 { + compatible = "ti,j721e-i2c", "ti,omap4-i2c"; + reg = <0x2000000 0x100>; + interrupts = <GIC_SPI 200 IRQ_TYPE_LEVEL_HIGH>; + #address-cells = <1>; + #size-cells = <0>; + };
Signature · 2 lines
Best regards, grygorii
Vignesh Raghavendra
maintainerQuoted 5 lines · Grygorii Strashko
Quoted 2 lines · Vignesh Raghavendra
Convert i2c-omap.txt to YAML schema for better checks and documentation.
Quoted 9 lines
Quoted 4 lines
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 filesThe DMA is not supported by i2c-omap driver, so wouldn't be better to just drop dmas from DTBs to avoid confusions?
It can be added later.
Will do.. I will also send patches dropping dmas from dts that currently have them populated.
Regards
Vignesh
Quoted 11 lines · On Fri, 7 May 2021 19:45:45 +0530 Vignesh Raghavendra <[email protected]> wrote:
Quoted 10 lines · Grygorii Strashko
Quoted 6 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
Quoted 8 lines
Quoted 4 lines
The DMA is not supported by i2c-omap driver, so wouldn't be better to just drop dmas from DTBs to avoid confusions?
It can be added later.Will do.. I will also send patches dropping dmas from dts that currently have them populated.
hmm, we have
- DO attempt to make bindings complete even if a driver doesn't support some features. For example, if a device has an interrupt, then include the 'interrupts' property even if the driver is only polled mode.
in Documentation/devicetree/bindings/writing-bindings.rst Shouln't the dma stay there if the hardware supports it? Devicetree should describe the hardware not the driver if I understood things right.
Regards,
Andreas
Quoted 27 lines · Andreas Kemnade
Quoted 11 lines · On Fri, 7 May 2021 19:45:45 +0530 Vignesh Raghavendra <[email protected]> wrote:
Quoted 10 lines · Grygorii Strashko
Quoted 6 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 filesQuoted 8 lines
Quoted 4 lines
The DMA is not supported by i2c-omap driver, so wouldn't be better to just drop dmas from DTBs to avoid confusions?
It can be added later.Will do.. I will also send patches dropping dmas from dts that currently have them populated.
hmm, we have
- DO attempt to make bindings complete even if a driver doesn't support some features. For example, if a device has an interrupt, then include the 'interrupts' property even if the driver is only polled mode.
Quoted 4 lines
in
Documentation/devicetree/bindings/writing-bindings.rstShouln't the dma stay there if the hardware supports it? Devicetree should describe the hardware not the driver if I understood things right.
True. But my above statement is also valid - it introduces confusion from user point of view. More over, 'dmas' is not part of original binding and were randomly added to some SoCs. And it's much more easy to extend binding (in the future) then remove something after.
I leave it to Vignesh, Tony to decide.
Signature · 2 lines
Best regards, grygorii
Rob Herring
maintainerQuoted 29 lines · Grygorii Strashko
Quoted 26 lines · Andreas Kemnade
Quoted 11 lines · On Fri, 7 May 2021 19:45:45 +0530 Vignesh Raghavendra <[email protected]> wrote:
Quoted 10 lines · Grygorii Strashko
Quoted 6 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 filesQuoted 7 lines
Quoted 3 lines
The DMA is not supported by i2c-omap driver, so wouldn't be better to just drop dmas from DTBs to avoid confusions?
It can be added later.Will do.. I will also send patches dropping dmas from dts that currently have them populated.
hmm, we have
- DO attempt to make bindings complete even if a driver doesn't support some features. For example, if a device has an interrupt, then include the 'interrupts' property even if the driver is only polled mode.
Quoted 6 lines
Quoted 4 lines
in
Documentation/devicetree/bindings/writing-bindings.rstShouln't the dma stay there if the hardware supports it? Devicetree should describe the hardware not the driver if I understood things right.True. But my above statement is also valid - it introduces confusion from user point of view.
In my OS, 'robOS', the driver supports DMA.
Quoted 2 lines
More over, 'dmas' is not part of original binding and were randomly added to some SoCs. And it's much more easy to extend binding (in the future) then remove something after.
In this case, probably given that how it would be extended is already known, but it depends how you extend a binding. My above statement was born out of incomplete MFD and system controller bindings for the most part.
Quoted 1 line
I leave it to Vignesh, Tony to decide.
Fine with me.
Actually, for DMA with I2C I'd like to see someone show a usecase and data where it's actually beneficial.
Rob
Quoted 3 lines
Actually, for DMA with I2C I'd like to see someone show a usecase and data where it's actually beneficial.
The usecase I mostly hear is transferring firmware from/to the i2c client. Something up to 1MB sent in 64KB chunks. Haven't had this myself on the desk, though.
Vignesh Raghavendra
maintainerHi Tony,
Quoted 37 lines · Grygorii Strashko
Quoted 29 lines · Andreas Kemnade
Quoted 12 lines · On Fri, 7 May 2021 19:45:45 +0530 Vignesh Raghavendra <[email protected]> wrote:
Quoted 11 lines · Grygorii Strashko
Quoted 7 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 filesQuoted 8 lines
Quoted 4 lines
The DMA is not supported by i2c-omap driver, so wouldn't be better to just drop dmas from DTBs to avoid confusions?
It can be added later.Will do.. I will also send patches dropping dmas from dts that currently have them populated.
hmm, we have
- DO attempt to make bindings complete even if a driver doesn't support some
features. For example, if a device has an interrupt, then include the 'interrupts' property even if the driver is only polled mode.Quoted 4 lines
in
Documentation/devicetree/bindings/writing-bindings.rstShouln't the dma stay there if the hardware supports it? Devicetree should describe the hardware not the driver if I understood things right.
Quoted 9 lines
True. But my above statement is also valid - it introduces confusion from user point of view.
More over, 'dmas' is not part of original binding and were randomly added to some SoCs.
And it's much more easy to extend binding (in the future) then remove something after.I leave it to Vignesh, Tony to decide.
What do you prefer here? Removing dmas from schema would mean I would have to delete dmas property from omap2/3 dtsi files that list dmas property today? Note that driver does not support DMA mode today.
Regards
Vignesh
Quoted 3 lines · Vignesh Raghavendra
What do you prefer here? Removing dmas from schema would mean I would have to delete dmas property from omap2/3 dtsi files that list dmas property today? Note that driver does not support DMA mode today.
If the dma channels are not used by the driver, and not in the binding, it's unlikely they will ever get used. Sure the dma channels describe the hardware, and there's a slim chance some other OS needs them, but I doubt it.
It seems weird we stop describing hardware in the devicetree to avoid binding check warnings though. Up to you to figure out what you want to do as far as I'm concerned.
Regards,
Tony
Rob Herring
maintainerQuoted 38 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 propertySigned-off-by Vignesh Raghavendra <[email protected]>---
v2:
Fix issues with makedt_bindings_check
Add description on usage of ti,hwmods.../devicetree/bindings/i2c/i2c-omap.txt | 37 --------- .../devicetree/bindings/i2c/ti,omap4-i2c.yaml | 80 +++++++++++++++++++ 2 files changed, 80 insertions(+), 37 deletions(-) delete mode 100644 Documentation/devicetree/bindings/i2c/i2c-omap.txt create mode 100644 Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yamlDocumentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml new file +11
-0@@ -0,0 +1,80 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/i2c/ti,omap4-i2c.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Bindings for I2C controllers on TI's OMAP and K3 SoCs + +maintainers: + - Vignesh Raghavendra <[email protected]> +
Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml line 21
Quoted 10 lines
Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml new file +10
-0+allOf: + - $ref: /schemas/i2c/i2c-controller.yaml# + +properties: + compatible: + oneOf: + - const: ti,omap2420-i2c + - const: ti,omap2430-i2c + - const: ti,omap3-i2c + - const: ti,omap4-i2c
These 4 can be a single 'enum'.
Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml line 32
Quoted 11 lines
Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml new file +11
-0+ - items: + - enum: + - ti,am4372-i2c + - ti,am64-i2c + - ti,am654-i2c + - ti,j721e-i2c + - const: ti,omap4-i2c + + ti,hwmods: + description: + (DEPRECATED) Must be "i2c<n>", n being the instance number (1-based).
There's a keyword to mark things deprecated. It's 'deprecated'.
Quoted 51 lines
Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml new file +48
-0+ This property is applicable only on legacy platforms mainly omap2/3 + and ti81xx and should not be used on other platforms. + $ref: /schemas/types.yaml#/definitions/string + items: + - pattern: "^i2c([1-9])$" + + dmas: + minItems: 1 + maxItems: 2 + + dma-names: + items: + - const: tx + - const: rx + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + const: fck + + clock-frequency: true + +required: + - compatible + - reg + - interrupts + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + + main_i2c0: i2c@2000000 { + compatible = "ti,j721e-i2c", "ti,omap4-i2c"; + reg = <0x2000000 0x100>; + interrupts = <GIC_SPI 200 IRQ_TYPE_LEVEL_HIGH>; + #address-cells = <1>; + #size-cells = <0>; + };Signature · 1 line
2.31.1