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