1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/timer/ingenic,tcu.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Ingenic SoCs Timer/Counter Unit (TCU) devicetree bindings
8
9description: |
10  For a description of the TCU hardware and drivers, have a look at
11  Documentation/mips/ingenic-tcu.rst.
12
13maintainers:
14  - Paul Cercueil <paul@crapouillou.net>
15
16select:
17  properties:
18    compatible:
19      contains:
20        enum:
21          - ingenic,jz4740-tcu
22          - ingenic,jz4725b-tcu
23          - ingenic,jz4760-tcu
24          - ingenic,jz4760b-tcu
25          - ingenic,jz4770-tcu
26          - ingenic,jz4780-tcu
27          - ingenic,x1000-tcu
28  required:
29    - compatible
30
31properties:
32  $nodename:
33    pattern: "^timer@[0-9a-f]+$"
34
35  "#address-cells":
36    const: 1
37
38  "#size-cells":
39    const: 1
40
41  "#clock-cells":
42    const: 1
43
44  "#interrupt-cells":
45    const: 1
46
47  interrupt-controller: true
48
49  ranges: true
50
51  compatible:
52    oneOf:
53      - items:
54          - enum:
55              - ingenic,jz4740-tcu
56              - ingenic,jz4725b-tcu
57              - ingenic,jz4760-tcu
58              - ingenic,x1000-tcu
59          - const: simple-mfd
60      - items:
61          - enum:
62              - ingenic,jz4780-tcu
63              - ingenic,jz4770-tcu
64              - ingenic,jz4760b-tcu
65          - const: ingenic,jz4760-tcu
66          - const: simple-mfd
67
68  reg:
69    maxItems: 1
70
71  clocks:
72    items:
73      - description: RTC clock
74      - description: EXT clock
75      - description: PCLK clock
76      - description: TCU clock
77    minItems: 3
78
79  clock-names:
80    items:
81      - const: rtc
82      - const: ext
83      - const: pclk
84      - const: tcu
85    minItems: 3
86
87  interrupts:
88    items:
89      - description: TCU0 interrupt
90      - description: TCU1 interrupt
91      - description: TCU2 interrupt
92    minItems: 1
93
94  assigned-clocks:
95    minItems: 1
96    maxItems: 8
97
98  assigned-clock-parents:
99    minItems: 1
100    maxItems: 8
101
102  assigned-clock-rates:
103    minItems: 1
104    maxItems: 8
105
106  ingenic,pwm-channels-mask:
107    description: Bitmask of TCU channels reserved for PWM use.
108    $ref: /schemas/types.yaml#/definitions/uint32
109    minimum: 0x00
110    maximum: 0xff
111    default: 0xfc
112
113patternProperties:
114  "^watchdog@[a-f0-9]+$":
115    type: object
116    $ref: ../watchdog/watchdog.yaml#
117    properties:
118      compatible:
119        oneOf:
120          - enum:
121              - ingenic,jz4740-watchdog
122              - ingenic,jz4780-watchdog
123          - items:
124              - enum:
125                  - ingenic,jz4770-watchdog
126                  - ingenic,jz4760b-watchdog
127                  - ingenic,jz4760-watchdog
128                  - ingenic,jz4725b-watchdog
129              - const: ingenic,jz4740-watchdog
130
131      reg:
132        maxItems: 1
133
134      clocks:
135        maxItems: 1
136
137      clock-names:
138        const: wdt
139
140    required:
141      - compatible
142      - reg
143      - clocks
144      - clock-names
145
146  "^pwm@[a-f0-9]+$":
147    type: object
148    $ref: ../pwm/pwm.yaml#
149    properties:
150      compatible:
151        oneOf:
152          - enum:
153              - ingenic,jz4740-pwm
154              - ingenic,jz4725b-pwm
155          - items:
156              - enum:
157                  - ingenic,jz4760-pwm
158                  - ingenic,jz4760b-pwm
159                  - ingenic,jz4770-pwm
160                  - ingenic,jz4780-pwm
161              - const: ingenic,jz4740-pwm
162
163      reg:
164        maxItems: 1
165
166      clocks:
167        minItems: 6
168        maxItems: 8
169
170      clock-names:
171        items:
172          - const: timer0
173          - const: timer1
174          - const: timer2
175          - const: timer3
176          - const: timer4
177          - const: timer5
178          - const: timer6
179          - const: timer7
180        minItems: 6
181
182    required:
183      - compatible
184      - reg
185      - clocks
186      - clock-names
187
188  "^timer@[a-f0-9]+$":
189    type: object
190    properties:
191      compatible:
192        oneOf:
193          - enum:
194              - ingenic,jz4725b-ost
195              - ingenic,jz4760b-ost
196          - items:
197              - const: ingenic,jz4760-ost
198              - const: ingenic,jz4725b-ost
199          - items:
200              - enum:
201                  - ingenic,jz4780-ost
202                  - ingenic,jz4770-ost
203              - const: ingenic,jz4760b-ost
204
205      reg:
206        maxItems: 1
207
208      clocks:
209        maxItems: 1
210
211      clock-names:
212        const: ost
213
214      interrupts:
215        maxItems: 1
216
217    required:
218      - compatible
219      - reg
220      - clocks
221      - clock-names
222      - interrupts
223
224    additionalProperties: false
225
226required:
227  - "#clock-cells"
228  - "#interrupt-cells"
229  - interrupt-controller
230  - compatible
231  - reg
232  - clocks
233  - clock-names
234  - interrupts
235
236additionalProperties: false
237
238examples:
239  - |
240    #include <dt-bindings/clock/ingenic,jz4770-cgu.h>
241    #include <dt-bindings/clock/ingenic,tcu.h>
242    tcu: timer@10002000 {
243      compatible = "ingenic,jz4770-tcu", "ingenic,jz4760-tcu", "simple-mfd";
244      reg = <0x10002000 0x1000>;
245      #address-cells = <1>;
246      #size-cells = <1>;
247      ranges = <0x0 0x10002000 0x1000>;
248
249      #clock-cells = <1>;
250
251      clocks = <&cgu JZ4770_CLK_RTC>,
252               <&cgu JZ4770_CLK_EXT>,
253               <&cgu JZ4770_CLK_PCLK>;
254      clock-names = "rtc", "ext", "pclk";
255
256      interrupt-controller;
257      #interrupt-cells = <1>;
258
259      interrupt-parent = <&intc>;
260      interrupts = <27 26 25>;
261
262      watchdog: watchdog@0 {
263        compatible = "ingenic,jz4770-watchdog", "ingenic,jz4740-watchdog";
264        reg = <0x0 0xc>;
265
266        clocks = <&tcu TCU_CLK_WDT>;
267        clock-names = "wdt";
268      };
269
270      pwm: pwm@40 {
271        compatible = "ingenic,jz4770-pwm", "ingenic,jz4740-pwm";
272        reg = <0x40 0x80>;
273
274        #pwm-cells = <3>;
275
276        clocks = <&tcu TCU_CLK_TIMER0>,
277                 <&tcu TCU_CLK_TIMER1>,
278                 <&tcu TCU_CLK_TIMER2>,
279                 <&tcu TCU_CLK_TIMER3>,
280                 <&tcu TCU_CLK_TIMER4>,
281                 <&tcu TCU_CLK_TIMER5>,
282                 <&tcu TCU_CLK_TIMER6>,
283                 <&tcu TCU_CLK_TIMER7>;
284        clock-names = "timer0", "timer1", "timer2", "timer3",
285                "timer4", "timer5", "timer6", "timer7";
286      };
287
288      ost: timer@e0 {
289        compatible = "ingenic,jz4770-ost", "ingenic,jz4760b-ost";
290        reg = <0xe0 0x20>;
291
292        clocks = <&tcu TCU_CLK_OST>;
293        clock-names = "ost";
294
295        interrupts = <15>;
296      };
297    };
298