xref: /freebsd/sys/contrib/device-tree/Bindings/i2c/st,stm32-i2c.yaml (revision 8d13bc63c0e1d50bc9e47ac1f26329c999bfecf0)
1c66ec88fSEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2c66ec88fSEmmanuel Vadot%YAML 1.2
3c66ec88fSEmmanuel Vadot---
4c66ec88fSEmmanuel Vadot$id: http://devicetree.org/schemas/i2c/st,stm32-i2c.yaml#
5c66ec88fSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
6c66ec88fSEmmanuel Vadot
7c66ec88fSEmmanuel Vadottitle: I2C controller embedded in STMicroelectronics STM32 I2C platform
8c66ec88fSEmmanuel Vadot
9c66ec88fSEmmanuel Vadotmaintainers:
108cc087a1SEmmanuel Vadot  - Pierre-Yves MORDRET <pierre-yves.mordret@foss.st.com>
11c66ec88fSEmmanuel Vadot
12c66ec88fSEmmanuel VadotallOf:
13c66ec88fSEmmanuel Vadot  - $ref: /schemas/i2c/i2c-controller.yaml#
14c66ec88fSEmmanuel Vadot  - if:
15c66ec88fSEmmanuel Vadot      properties:
16c66ec88fSEmmanuel Vadot        compatible:
17c66ec88fSEmmanuel Vadot          contains:
18c66ec88fSEmmanuel Vadot            enum:
19c66ec88fSEmmanuel Vadot              - st,stm32f7-i2c
20b97ee269SEmmanuel Vadot              - st,stm32mp13-i2c
21c66ec88fSEmmanuel Vadot              - st,stm32mp15-i2c
22*8d13bc63SEmmanuel Vadot              - st,stm32mp25-i2c
23c66ec88fSEmmanuel Vadot    then:
24c66ec88fSEmmanuel Vadot      properties:
25c66ec88fSEmmanuel Vadot        i2c-scl-rising-time-ns:
26c66ec88fSEmmanuel Vadot          default: 25
27c66ec88fSEmmanuel Vadot
28c66ec88fSEmmanuel Vadot        i2c-scl-falling-time-ns:
29c66ec88fSEmmanuel Vadot          default: 10
30c9ccf3a3SEmmanuel Vadot    else:
31c9ccf3a3SEmmanuel Vadot      properties:
32c9ccf3a3SEmmanuel Vadot        st,syscfg-fmp: false
33c66ec88fSEmmanuel Vadot
34c66ec88fSEmmanuel Vadot  - if:
35c66ec88fSEmmanuel Vadot      properties:
36c66ec88fSEmmanuel Vadot        compatible:
37c66ec88fSEmmanuel Vadot          contains:
38c66ec88fSEmmanuel Vadot            enum:
39c66ec88fSEmmanuel Vadot              - st,stm32f4-i2c
40c66ec88fSEmmanuel Vadot    then:
41c66ec88fSEmmanuel Vadot      properties:
42c66ec88fSEmmanuel Vadot        clock-frequency:
43c66ec88fSEmmanuel Vadot          enum: [100000, 400000]
44c66ec88fSEmmanuel Vadot
45*8d13bc63SEmmanuel Vadot  - if:
46*8d13bc63SEmmanuel Vadot      properties:
47*8d13bc63SEmmanuel Vadot        compatible:
48*8d13bc63SEmmanuel Vadot          contains:
49*8d13bc63SEmmanuel Vadot            enum:
50*8d13bc63SEmmanuel Vadot              - st,stm32f4-i2c
51*8d13bc63SEmmanuel Vadot              - st,stm32f7-i2c
52*8d13bc63SEmmanuel Vadot              - st,stm32mp13-i2c
53*8d13bc63SEmmanuel Vadot              - st,stm32mp15-i2c
54*8d13bc63SEmmanuel Vadot    then:
55*8d13bc63SEmmanuel Vadot      properties:
56*8d13bc63SEmmanuel Vadot        interrupts:
57*8d13bc63SEmmanuel Vadot          minItems: 2
58*8d13bc63SEmmanuel Vadot
59*8d13bc63SEmmanuel Vadot        interrupt-names:
60*8d13bc63SEmmanuel Vadot          minItems: 2
61*8d13bc63SEmmanuel Vadot    else:
62*8d13bc63SEmmanuel Vadot      properties:
63*8d13bc63SEmmanuel Vadot        interrupts:
64*8d13bc63SEmmanuel Vadot          maxItems: 1
65*8d13bc63SEmmanuel Vadot
66*8d13bc63SEmmanuel Vadot        interrupt-names:
67*8d13bc63SEmmanuel Vadot          maxItems: 1
68*8d13bc63SEmmanuel Vadot
69c66ec88fSEmmanuel Vadotproperties:
70c66ec88fSEmmanuel Vadot  compatible:
71c66ec88fSEmmanuel Vadot    enum:
72c66ec88fSEmmanuel Vadot      - st,stm32f4-i2c
73c66ec88fSEmmanuel Vadot      - st,stm32f7-i2c
74b97ee269SEmmanuel Vadot      - st,stm32mp13-i2c
75c66ec88fSEmmanuel Vadot      - st,stm32mp15-i2c
76*8d13bc63SEmmanuel Vadot      - st,stm32mp25-i2c
77c66ec88fSEmmanuel Vadot
78c66ec88fSEmmanuel Vadot  reg:
79c66ec88fSEmmanuel Vadot    maxItems: 1
80c66ec88fSEmmanuel Vadot
81c66ec88fSEmmanuel Vadot  interrupts:
82c66ec88fSEmmanuel Vadot    items:
83c66ec88fSEmmanuel Vadot      - description: interrupt ID for I2C event
84c66ec88fSEmmanuel Vadot      - description: interrupt ID for I2C error
85*8d13bc63SEmmanuel Vadot    minItems: 1
86c66ec88fSEmmanuel Vadot
87b97ee269SEmmanuel Vadot  interrupt-names:
88b97ee269SEmmanuel Vadot    items:
89b97ee269SEmmanuel Vadot      - const: event
90b97ee269SEmmanuel Vadot      - const: error
91*8d13bc63SEmmanuel Vadot    minItems: 1
92b97ee269SEmmanuel Vadot
93c66ec88fSEmmanuel Vadot  resets:
94c66ec88fSEmmanuel Vadot    maxItems: 1
95c66ec88fSEmmanuel Vadot
96c66ec88fSEmmanuel Vadot  clocks:
97c66ec88fSEmmanuel Vadot    maxItems: 1
98c66ec88fSEmmanuel Vadot
99c66ec88fSEmmanuel Vadot  dmas:
100c66ec88fSEmmanuel Vadot    items:
101c66ec88fSEmmanuel Vadot      - description: RX DMA Channel phandle
102c66ec88fSEmmanuel Vadot      - description: TX DMA Channel phandle
103c66ec88fSEmmanuel Vadot
104c66ec88fSEmmanuel Vadot  dma-names:
105c66ec88fSEmmanuel Vadot    items:
106c66ec88fSEmmanuel Vadot      - const: rx
107c66ec88fSEmmanuel Vadot      - const: tx
108c66ec88fSEmmanuel Vadot
109c66ec88fSEmmanuel Vadot  clock-frequency:
110c66ec88fSEmmanuel Vadot    description: Desired I2C bus clock frequency in Hz. If not specified,
111c66ec88fSEmmanuel Vadot                 the default 100 kHz frequency will be used.
112c66ec88fSEmmanuel Vadot                 For STM32F7, STM32H7 and STM32MP1 SoCs, if timing parameters
113c66ec88fSEmmanuel Vadot                 match, the bus clock frequency can be from 1Hz to 1MHz.
114c66ec88fSEmmanuel Vadot    default: 100000
115c66ec88fSEmmanuel Vadot    minimum: 1
116c66ec88fSEmmanuel Vadot    maximum: 1000000
117c66ec88fSEmmanuel Vadot
118c9ccf3a3SEmmanuel Vadot  st,syscfg-fmp:
119c9ccf3a3SEmmanuel Vadot    description: Use to set Fast Mode Plus bit within SYSCFG when Fast Mode
120c9ccf3a3SEmmanuel Vadot      Plus speed is selected by slave.
121fac71e4eSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/phandle-array
122c9ccf3a3SEmmanuel Vadot    items:
123c9ccf3a3SEmmanuel Vadot      - items:
124c9ccf3a3SEmmanuel Vadot          - description: phandle to syscfg
125c9ccf3a3SEmmanuel Vadot          - description: register offset within syscfg
126c9ccf3a3SEmmanuel Vadot          - description: register bitmask for FMP bit
127c9ccf3a3SEmmanuel Vadot
128b97ee269SEmmanuel Vadot  wakeup-source: true
129b97ee269SEmmanuel Vadot
130c66ec88fSEmmanuel Vadotrequired:
131c66ec88fSEmmanuel Vadot  - compatible
132c66ec88fSEmmanuel Vadot  - reg
133c66ec88fSEmmanuel Vadot  - interrupts
134c66ec88fSEmmanuel Vadot  - resets
135c66ec88fSEmmanuel Vadot  - clocks
136c66ec88fSEmmanuel Vadot
1376be33864SEmmanuel VadotunevaluatedProperties: false
1386be33864SEmmanuel Vadot
139c66ec88fSEmmanuel Vadotexamples:
140c66ec88fSEmmanuel Vadot  - |
141c66ec88fSEmmanuel Vadot    #include <dt-bindings/mfd/stm32f7-rcc.h>
142c66ec88fSEmmanuel Vadot    #include <dt-bindings/clock/stm32fx-clock.h>
143c66ec88fSEmmanuel Vadot    //Example 1 (with st,stm32f4-i2c compatible)
144c66ec88fSEmmanuel Vadot      i2c@40005400 {
145c66ec88fSEmmanuel Vadot          compatible = "st,stm32f4-i2c";
146c66ec88fSEmmanuel Vadot          #address-cells = <1>;
147c66ec88fSEmmanuel Vadot          #size-cells = <0>;
148c66ec88fSEmmanuel Vadot          reg = <0x40005400 0x400>;
149c66ec88fSEmmanuel Vadot          interrupts = <31>,
150c66ec88fSEmmanuel Vadot                       <32>;
151c66ec88fSEmmanuel Vadot          resets = <&rcc 277>;
152c66ec88fSEmmanuel Vadot          clocks = <&rcc 0 149>;
153c66ec88fSEmmanuel Vadot      };
154c66ec88fSEmmanuel Vadot
155e67e8565SEmmanuel Vadot  - |
156e67e8565SEmmanuel Vadot    #include <dt-bindings/mfd/stm32f7-rcc.h>
157e67e8565SEmmanuel Vadot    #include <dt-bindings/clock/stm32fx-clock.h>
158c66ec88fSEmmanuel Vadot    //Example 2 (with st,stm32f7-i2c compatible)
159c66ec88fSEmmanuel Vadot      i2c@40005800 {
160c66ec88fSEmmanuel Vadot          compatible = "st,stm32f7-i2c";
161c66ec88fSEmmanuel Vadot          #address-cells = <1>;
162c66ec88fSEmmanuel Vadot          #size-cells = <0>;
163c66ec88fSEmmanuel Vadot          reg = <0x40005800 0x400>;
164c66ec88fSEmmanuel Vadot          interrupts = <31>,
165c66ec88fSEmmanuel Vadot                       <32>;
166c66ec88fSEmmanuel Vadot          resets = <&rcc STM32F7_APB1_RESET(I2C1)>;
167c66ec88fSEmmanuel Vadot          clocks = <&rcc 1 CLK_I2C1>;
168c66ec88fSEmmanuel Vadot      };
169c66ec88fSEmmanuel Vadot
170e67e8565SEmmanuel Vadot  - |
171e67e8565SEmmanuel Vadot    #include <dt-bindings/mfd/stm32f7-rcc.h>
172e67e8565SEmmanuel Vadot    #include <dt-bindings/clock/stm32fx-clock.h>
173c66ec88fSEmmanuel Vadot    //Example 3 (with st,stm32mp15-i2c compatible on stm32mp)
174c66ec88fSEmmanuel Vadot    #include <dt-bindings/interrupt-controller/arm-gic.h>
175c66ec88fSEmmanuel Vadot    #include <dt-bindings/clock/stm32mp1-clks.h>
176c66ec88fSEmmanuel Vadot    #include <dt-bindings/reset/stm32mp1-resets.h>
177c66ec88fSEmmanuel Vadot      i2c@40013000 {
178c66ec88fSEmmanuel Vadot          compatible = "st,stm32mp15-i2c";
179c66ec88fSEmmanuel Vadot          #address-cells = <1>;
180c66ec88fSEmmanuel Vadot          #size-cells = <0>;
181c66ec88fSEmmanuel Vadot          reg = <0x40013000 0x400>;
182c66ec88fSEmmanuel Vadot          interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>,
183c66ec88fSEmmanuel Vadot                       <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
184c66ec88fSEmmanuel Vadot          clocks = <&rcc I2C2_K>;
185c66ec88fSEmmanuel Vadot          resets = <&rcc I2C2_R>;
186c66ec88fSEmmanuel Vadot          i2c-scl-rising-time-ns = <185>;
187c66ec88fSEmmanuel Vadot          i2c-scl-falling-time-ns = <20>;
188c66ec88fSEmmanuel Vadot          st,syscfg-fmp = <&syscfg 0x4 0x2>;
189c66ec88fSEmmanuel Vadot      };
190