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