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