1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/mfd/st,stm32-timers.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: STMicroelectronics STM32 Timers bindings
8
9description: |
10  This hardware block provides 3 types of timer along with PWM functionality:
11    - advanced-control timers consist of a 16-bit auto-reload counter driven
12      by a programmable prescaler, break input feature, PWM outputs and
13      complementary PWM outputs channels.
14    - general-purpose timers consist of a 16-bit or 32-bit auto-reload counter
15      driven by a programmable prescaler and PWM outputs.
16    - basic timers consist of a 16-bit auto-reload counter driven by a
17      programmable prescaler.
18
19maintainers:
20  - Fabrice Gasnier <fabrice.gasnier@foss.st.com>
21
22properties:
23  compatible:
24    const: st,stm32-timers
25
26  reg:
27    maxItems: 1
28
29  clocks:
30    maxItems: 1
31
32  clock-names:
33    items:
34      - const: int
35
36  resets:
37    maxItems: 1
38
39  dmas:
40    minItems: 1
41    maxItems: 7
42
43  dma-names:
44    items:
45      enum: [ ch1, ch2, ch3, ch4, up, trig, com ]
46    minItems: 1
47    maxItems: 7
48
49  interrupts:
50    oneOf:
51      - maxItems: 1
52      - maxItems: 4
53
54  interrupt-names:
55    oneOf:
56      - items:
57          - const: global
58      - items:
59          - const: brk
60          - const: up
61          - const: trg-com
62          - const: cc
63
64  "#address-cells":
65    const: 1
66
67  "#size-cells":
68    const: 0
69
70  pwm:
71    type: object
72
73    properties:
74      compatible:
75        const: st,stm32-pwm
76
77      "#pwm-cells":
78        const: 3
79
80      st,breakinput:
81        description:
82          One or two <index level filter> to describe break input
83          configurations.
84        $ref: /schemas/types.yaml#/definitions/uint32-matrix
85        items:
86          items:
87            - description: |
88                "index" indicates on which break input (0 or 1) the
89                configuration should be applied.
90              enum: [0, 1]
91            - description: |
92                "level" gives the active level (0=low or 1=high) of the
93                input signal for this configuration
94              enum: [0, 1]
95            - description: |
96                "filter" gives the filtering value (up to 15) to be applied.
97              maximum: 15
98        minItems: 1
99        maxItems: 2
100
101    required:
102      - "#pwm-cells"
103      - compatible
104
105  counter:
106    type: object
107
108    properties:
109      compatible:
110        const: st,stm32-timer-counter
111
112    required:
113      - compatible
114
115patternProperties:
116  "^timer@[0-9]+$":
117    type: object
118
119    properties:
120      compatible:
121        enum:
122          - st,stm32-timer-trigger
123          - st,stm32h7-timer-trigger
124
125      reg:
126        description: Identify trigger hardware block.
127        items:
128          minimum: 0
129          maximum: 16
130
131    required:
132      - compatible
133      - reg
134
135required:
136  - compatible
137  - reg
138  - clocks
139  - clock-names
140
141additionalProperties: false
142
143examples:
144  - |
145    #include <dt-bindings/clock/stm32mp1-clks.h>
146    timers2: timer@40000000 {
147      #address-cells = <1>;
148      #size-cells = <0>;
149      compatible = "st,stm32-timers";
150      reg = <0x40000000 0x400>;
151      clocks = <&rcc TIM2_K>;
152      clock-names = "int";
153      dmas = <&dmamux1 18 0x400 0x1>,
154             <&dmamux1 19 0x400 0x1>,
155             <&dmamux1 20 0x400 0x1>,
156             <&dmamux1 21 0x400 0x1>,
157             <&dmamux1 22 0x400 0x1>;
158      dma-names = "ch1", "ch2", "ch3", "ch4", "up";
159      pwm {
160        compatible = "st,stm32-pwm";
161        #pwm-cells = <3>;
162        st,breakinput = <0 1 5>;
163      };
164      timer@1 {
165        compatible = "st,stm32-timer-trigger";
166        reg = <1>;
167      };
168      counter {
169        compatible = "st,stm32-timer-counter";
170      };
171    };
172
173...
174