xref: /freebsd/sys/contrib/device-tree/Bindings/timer/ingenic,tcu.yaml (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
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: /schemas/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: /schemas/pwm/pwm.yaml#
149    properties:
150      compatible:
151        oneOf:
152          - enum:
153              - ingenic,jz4740-pwm
154              - ingenic,jz4725b-pwm
155              - ingenic,x1000-pwm
156          - items:
157              - enum:
158                  - ingenic,jz4760-pwm
159                  - ingenic,jz4760b-pwm
160                  - ingenic,jz4770-pwm
161                  - ingenic,jz4780-pwm
162              - const: ingenic,jz4740-pwm
163
164      reg:
165        maxItems: 1
166
167      clocks:
168        minItems: 6
169        maxItems: 8
170
171      clock-names:
172        items:
173          - const: timer0
174          - const: timer1
175          - const: timer2
176          - const: timer3
177          - const: timer4
178          - const: timer5
179          - const: timer6
180          - const: timer7
181        minItems: 6
182
183    required:
184      - compatible
185      - reg
186      - clocks
187      - clock-names
188
189  "^timer@[a-f0-9]+$":
190    type: object
191    properties:
192      compatible:
193        oneOf:
194          - enum:
195              - ingenic,jz4725b-ost
196              - ingenic,jz4760b-ost
197          - items:
198              - const: ingenic,jz4760-ost
199              - const: ingenic,jz4725b-ost
200          - items:
201              - enum:
202                  - ingenic,jz4780-ost
203                  - ingenic,jz4770-ost
204              - const: ingenic,jz4760b-ost
205
206      reg:
207        maxItems: 1
208
209      clocks:
210        maxItems: 1
211
212      clock-names:
213        const: ost
214
215      interrupts:
216        maxItems: 1
217
218    required:
219      - compatible
220      - reg
221      - clocks
222      - clock-names
223      - interrupts
224
225    additionalProperties: false
226
227required:
228  - "#clock-cells"
229  - "#interrupt-cells"
230  - interrupt-controller
231  - compatible
232  - reg
233  - clocks
234  - clock-names
235  - interrupts
236
237additionalProperties: false
238
239examples:
240  - |
241    #include <dt-bindings/clock/ingenic,jz4770-cgu.h>
242    #include <dt-bindings/clock/ingenic,tcu.h>
243    tcu: timer@10002000 {
244      compatible = "ingenic,jz4770-tcu", "ingenic,jz4760-tcu", "simple-mfd";
245      reg = <0x10002000 0x1000>;
246      #address-cells = <1>;
247      #size-cells = <1>;
248      ranges = <0x0 0x10002000 0x1000>;
249
250      #clock-cells = <1>;
251
252      clocks = <&cgu JZ4770_CLK_RTC>,
253               <&cgu JZ4770_CLK_EXT>,
254               <&cgu JZ4770_CLK_PCLK>;
255      clock-names = "rtc", "ext", "pclk";
256
257      interrupt-controller;
258      #interrupt-cells = <1>;
259
260      interrupt-parent = <&intc>;
261      interrupts = <27 26 25>;
262
263      watchdog: watchdog@0 {
264        compatible = "ingenic,jz4770-watchdog", "ingenic,jz4740-watchdog";
265        reg = <0x0 0xc>;
266
267        clocks = <&tcu TCU_CLK_WDT>;
268        clock-names = "wdt";
269      };
270
271      pwm: pwm@40 {
272        compatible = "ingenic,jz4770-pwm", "ingenic,jz4740-pwm";
273        reg = <0x40 0x80>;
274
275        #pwm-cells = <3>;
276
277        clocks = <&tcu TCU_CLK_TIMER0>,
278                 <&tcu TCU_CLK_TIMER1>,
279                 <&tcu TCU_CLK_TIMER2>,
280                 <&tcu TCU_CLK_TIMER3>,
281                 <&tcu TCU_CLK_TIMER4>,
282                 <&tcu TCU_CLK_TIMER5>,
283                 <&tcu TCU_CLK_TIMER6>,
284                 <&tcu TCU_CLK_TIMER7>;
285        clock-names = "timer0", "timer1", "timer2", "timer3",
286                "timer4", "timer5", "timer6", "timer7";
287      };
288
289      ost: timer@e0 {
290        compatible = "ingenic,jz4770-ost", "ingenic,jz4760b-ost";
291        reg = <0xe0 0x20>;
292
293        clocks = <&tcu TCU_CLK_OST>;
294        clock-names = "ost";
295
296        interrupts = <15>;
297      };
298    };
299