On Thu, Jun 04, 2020 at 09:49:18AM +0800, Anson Huang wrote: > Convert the i.MX I2C binding to DT schema format using json-schema, > some improvements applied, such as update example based on latest DT > file, add more compatible for existing SoCs, and remove unnecessary > common property "pinctrl". > > Signed-off-by: Anson Huang <Anson.Huang@xxxxxxx> > --- > Changes since V1: > - add "additionalProperties: false". > --- > Documentation/devicetree/bindings/i2c/i2c-imx.txt | 49 --------- > Documentation/devicetree/bindings/i2c/i2c-imx.yaml | 119 +++++++++++++++++++++ > 2 files changed, 119 insertions(+), 49 deletions(-) > delete mode 100644 Documentation/devicetree/bindings/i2c/i2c-imx.txt > create mode 100644 Documentation/devicetree/bindings/i2c/i2c-imx.yaml > > diff --git a/Documentation/devicetree/bindings/i2c/i2c-imx.txt b/Documentation/devicetree/bindings/i2c/i2c-imx.txt > deleted file mode 100644 > index b967544..0000000 > --- a/Documentation/devicetree/bindings/i2c/i2c-imx.txt > +++ /dev/null > @@ -1,49 +0,0 @@ > -* Freescale Inter IC (I2C) and High Speed Inter IC (HS-I2C) for i.MX > - > -Required properties: > -- compatible : > - - "fsl,imx1-i2c" for I2C compatible with the one integrated on i.MX1 SoC > - - "fsl,imx21-i2c" for I2C compatible with the one integrated on i.MX21 SoC > - - "fsl,vf610-i2c" for I2C compatible with the one integrated on Vybrid vf610 SoC > -- reg : Should contain I2C/HS-I2C registers location and length > -- interrupts : Should contain I2C/HS-I2C interrupt > -- clocks : Should contain the I2C/HS-I2C clock specifier > - > -Optional properties: > -- clock-frequency : Constains desired I2C/HS-I2C bus clock frequency in Hz. > - The absence of the property indicates the default frequency 100 kHz. > -- dmas: A list of two dma specifiers, one for each entry in dma-names. > -- dma-names: should contain "tx" and "rx". > -- scl-gpios: specify the gpio related to SCL pin > -- sda-gpios: specify the gpio related to SDA pin > -- pinctrl: add extra pinctrl to configure i2c pins to gpio function for i2c > - bus recovery, call it "gpio" state > - > -Examples: > - > -i2c@83fc4000 { /* I2C2 on i.MX51 */ > - compatible = "fsl,imx51-i2c", "fsl,imx21-i2c"; > - reg = <0x83fc4000 0x4000>; > - interrupts = <63>; > -}; > - > -i2c@70038000 { /* HS-I2C on i.MX51 */ > - compatible = "fsl,imx51-i2c", "fsl,imx21-i2c"; > - reg = <0x70038000 0x4000>; > - interrupts = <64>; > - clock-frequency = <400000>; > -}; > - > -i2c0: i2c@40066000 { /* i2c0 on vf610 */ > - compatible = "fsl,vf610-i2c"; > - reg = <0x40066000 0x1000>; > - interrupts =<0 71 0x04>; > - dmas = <&edma0 0 50>, > - <&edma0 0 51>; > - dma-names = "rx","tx"; > - pinctrl-names = "default", "gpio"; > - pinctrl-0 = <&pinctrl_i2c1>; > - pinctrl-1 = <&pinctrl_i2c1_gpio>; > - scl-gpios = <&gpio5 26 GPIO_ACTIVE_HIGH>; > - sda-gpios = <&gpio5 27 GPIO_ACTIVE_HIGH>; > -}; > diff --git a/Documentation/devicetree/bindings/i2c/i2c-imx.yaml b/Documentation/devicetree/bindings/i2c/i2c-imx.yaml > new file mode 100644 > index 0000000..63cceab > --- /dev/null > +++ b/Documentation/devicetree/bindings/i2c/i2c-imx.yaml > @@ -0,0 +1,119 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/i2c/i2c-imx.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Freescale Inter IC (I2C) and High Speed Inter IC (HS-I2C) for i.MX > + > +maintainers: > + - Wolfram Sang <wolfram@xxxxxxxxxxxxx> > + > +properties: > + compatible: > + oneOf: > + - const: fsl,imx1-i2c > + - const: fsl,imx21-i2c > + - const: fsl,vf610-i2c > + - items: > + - const: fsl,imx35-i2c > + - const: fsl,imx1-i2c > + - items: > + - enum: > + - fsl,imx25-i2c > + - fsl,imx27-i2c > + - fsl,imx31-i2c > + - fsl,imx50-i2c > + - fsl,imx51-i2c > + - fsl,imx53-i2c > + - fsl,imx6q-i2c > + - fsl,imx6sl-i2c > + - fsl,imx6sx-i2c > + - fsl,imx6sll-i2c > + - fsl,imx6ul-i2c > + - fsl,imx7s-i2c > + - fsl,imx8mq-i2c > + - fsl,imx8mm-i2c > + - fsl,imx8mn-i2c > + - fsl,imx8mp-i2c > + - const: fsl,imx21-i2c > + > + reg: > + maxItems: 1 > + > + interrupts: > + maxItems: 1 > + > + clocks: > + maxItems: 1 > + > + clock-names: > + const: ipg > + > + clock-frequency: > + $ref: /schemas/types.yaml#/definitions/uint32 Already has a type. > + description: | > + Constains desired I2C/HS-I2C bus clock frequency in Hz. > + The absence of the property indicates the default frequency 100 kHz. > + default: 100000 The bus default is up to 3MHz. Is that valid here? > + > + dmas: > + items: > + - description: DMA controller phandle and request line for RX > + - description: DMA controller phandle and request line for TX > + > + dma-names: > + items: > + - const: rx > + - const: tx > + > + sda-gpios: > + $ref: '/schemas/types.yaml#/definitions/phandle' *-gpios already has a type > + description: | > + gpio used for the sda signal, this should be flagged as > + active high using open drain with (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN) > + from <dt-bindings/gpio/gpio.h> since the signal is by definition > + open drain. > + maxItems: 1 > + > + scl-gpios: > + $ref: '/schemas/types.yaml#/definitions/phandle' > + description: | > + gpio used for the scl signal, this should be flagged as > + active high using open drain with (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN) > + from <dt-bindings/gpio/gpio.h> since the signal is by definition > + open drain. > + maxItems: 1 > + > +required: > + - compatible > + - reg > + - interrupts > + - clocks > + > +additionalProperties: false > + > +examples: > + - | > + #include <dt-bindings/clock/imx5-clock.h> > + #include <dt-bindings/clock/vf610-clock.h> > + #include <dt-bindings/gpio/gpio.h> > + #include <dt-bindings/interrupt-controller/arm-gic.h> > + > + i2c@83fc4000 { > + compatible = "fsl,imx51-i2c", "fsl,imx21-i2c"; > + reg = <0x83fc4000 0x4000>; > + interrupts = <63>; > + clocks = <&clks IMX5_CLK_I2C2_GATE>; > + }; > + > + i2c@40066000 { > + compatible = "fsl,vf610-i2c"; > + reg = <0x40066000 0x1000>; > + interrupts = <71 IRQ_TYPE_LEVEL_HIGH>; > + clocks = <&clks VF610_CLK_I2C0>; > + clock-names = "ipg"; > + dmas = <&edma0 0 50>, > + <&edma0 0 51>; > + dma-names = "rx","tx"; space ^ > + }; > -- > 2.7.4 >