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