1c66ec88fSEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2c66ec88fSEmmanuel Vadot%YAML 1.2
3c66ec88fSEmmanuel Vadot---
4b97ee269SEmmanuel Vadot$id: http://devicetree.org/schemas/soc/microchip/atmel,at91rm9200-tcb.yaml#
5b97ee269SEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
6c66ec88fSEmmanuel Vadot
7c66ec88fSEmmanuel Vadottitle: Atmel Timer Counter Block
8c66ec88fSEmmanuel Vadot
9c66ec88fSEmmanuel Vadotmaintainers:
10c66ec88fSEmmanuel Vadot  - Alexandre Belloni <alexandre.belloni@bootlin.com>
11c66ec88fSEmmanuel Vadot
12c66ec88fSEmmanuel Vadotdescription: |
13c66ec88fSEmmanuel Vadot  The Atmel (now Microchip) SoCs have timers named Timer Counter Block. Each
14c66ec88fSEmmanuel Vadot  timer has three channels with two counters each.
15c66ec88fSEmmanuel Vadot
16c66ec88fSEmmanuel Vadotproperties:
17c66ec88fSEmmanuel Vadot  compatible:
18c66ec88fSEmmanuel Vadot    items:
19c66ec88fSEmmanuel Vadot      - enum:
20c66ec88fSEmmanuel Vadot          - atmel,at91rm9200-tcb
21c66ec88fSEmmanuel Vadot          - atmel,at91sam9x5-tcb
22c66ec88fSEmmanuel Vadot          - atmel,sama5d2-tcb
23c66ec88fSEmmanuel Vadot      - const: simple-mfd
24c66ec88fSEmmanuel Vadot      - const: syscon
25c66ec88fSEmmanuel Vadot
26c66ec88fSEmmanuel Vadot  reg:
27c66ec88fSEmmanuel Vadot    maxItems: 1
28c66ec88fSEmmanuel Vadot
29c66ec88fSEmmanuel Vadot  interrupts:
30c66ec88fSEmmanuel Vadot    description:
31c66ec88fSEmmanuel Vadot      List of interrupts. One interrupt per TCB channel if available or one
32c66ec88fSEmmanuel Vadot      interrupt for the TC block
33c66ec88fSEmmanuel Vadot    minItems: 1
34c66ec88fSEmmanuel Vadot    maxItems: 3
35c66ec88fSEmmanuel Vadot
36c66ec88fSEmmanuel Vadot  clock-names:
37c66ec88fSEmmanuel Vadot    description:
38c66ec88fSEmmanuel Vadot      List of clock names. Always includes t0_clk and slow clk. Also includes
39c66ec88fSEmmanuel Vadot      t1_clk and t2_clk if a clock per channel is available.
40c66ec88fSEmmanuel Vadot    minItems: 2
41c66ec88fSEmmanuel Vadot    maxItems: 4
42c66ec88fSEmmanuel Vadot
43c66ec88fSEmmanuel Vadot  clocks:
44c66ec88fSEmmanuel Vadot    minItems: 2
45c66ec88fSEmmanuel Vadot    maxItems: 4
46c66ec88fSEmmanuel Vadot
47c66ec88fSEmmanuel Vadot  '#address-cells':
48c66ec88fSEmmanuel Vadot    const: 1
49c66ec88fSEmmanuel Vadot
50c66ec88fSEmmanuel Vadot  '#size-cells':
51c66ec88fSEmmanuel Vadot    const: 0
52c66ec88fSEmmanuel Vadot
53c66ec88fSEmmanuel VadotpatternProperties:
54c66ec88fSEmmanuel Vadot  "^timer@[0-2]$":
55c66ec88fSEmmanuel Vadot    description: The timer block channels that are used as timers or counters.
56c66ec88fSEmmanuel Vadot    type: object
57*fac71e4eSEmmanuel Vadot    additionalProperties: false
58c66ec88fSEmmanuel Vadot    properties:
59c66ec88fSEmmanuel Vadot      compatible:
60c66ec88fSEmmanuel Vadot        items:
61c66ec88fSEmmanuel Vadot          - enum:
62c66ec88fSEmmanuel Vadot              - atmel,tcb-timer
635def4c47SEmmanuel Vadot              - atmel,tcb-pwm
64c66ec88fSEmmanuel Vadot              - microchip,tcb-capture
65c66ec88fSEmmanuel Vadot      reg:
66c66ec88fSEmmanuel Vadot        description:
67c66ec88fSEmmanuel Vadot          List of channels to use for this particular timer. In Microchip TCB capture
68c66ec88fSEmmanuel Vadot          mode channels are registered as a counter devices, for the qdec mode TCB0's
69c66ec88fSEmmanuel Vadot          channel <0> and <1> are required.
70c66ec88fSEmmanuel Vadot
71c66ec88fSEmmanuel Vadot        minItems: 1
72c66ec88fSEmmanuel Vadot        maxItems: 3
735def4c47SEmmanuel Vadot    required:
745def4c47SEmmanuel Vadot      - compatible
755def4c47SEmmanuel Vadot      - reg
765def4c47SEmmanuel Vadot
775def4c47SEmmanuel Vadot  "^pwm@[0-2]$":
785def4c47SEmmanuel Vadot    description: The timer block channels that are used as PWMs.
79b97ee269SEmmanuel Vadot    $ref: /schemas/pwm/pwm.yaml#
805def4c47SEmmanuel Vadot    type: object
815def4c47SEmmanuel Vadot    properties:
825def4c47SEmmanuel Vadot      compatible:
835def4c47SEmmanuel Vadot        const: atmel,tcb-pwm
845def4c47SEmmanuel Vadot      reg:
855def4c47SEmmanuel Vadot        description:
865def4c47SEmmanuel Vadot          TCB channel to use for this PWM.
875def4c47SEmmanuel Vadot        enum: [ 0, 1, 2 ]
885def4c47SEmmanuel Vadot
895def4c47SEmmanuel Vadot      "#pwm-cells":
905def4c47SEmmanuel Vadot        description:
915def4c47SEmmanuel Vadot          The only third cell flag supported by this binding is
925def4c47SEmmanuel Vadot          PWM_POLARITY_INVERTED.
935def4c47SEmmanuel Vadot        const: 3
94c66ec88fSEmmanuel Vadot
95c66ec88fSEmmanuel Vadot    required:
96c66ec88fSEmmanuel Vadot      - compatible
97c66ec88fSEmmanuel Vadot      - reg
985def4c47SEmmanuel Vadot      - "#pwm-cells"
995def4c47SEmmanuel Vadot
1005def4c47SEmmanuel Vadot    additionalProperties: false
1015def4c47SEmmanuel Vadot
102c66ec88fSEmmanuel Vadot
103c66ec88fSEmmanuel VadotallOf:
104c66ec88fSEmmanuel Vadot  - if:
105c66ec88fSEmmanuel Vadot      properties:
106c66ec88fSEmmanuel Vadot        compatible:
107c66ec88fSEmmanuel Vadot          contains:
108c66ec88fSEmmanuel Vadot            const: atmel,sama5d2-tcb
109c66ec88fSEmmanuel Vadot    then:
110c66ec88fSEmmanuel Vadot      properties:
111c66ec88fSEmmanuel Vadot        clocks:
112c66ec88fSEmmanuel Vadot          minItems: 3
113c66ec88fSEmmanuel Vadot          maxItems: 3
114c66ec88fSEmmanuel Vadot        clock-names:
115c66ec88fSEmmanuel Vadot          items:
116c66ec88fSEmmanuel Vadot            - const: t0_clk
117c66ec88fSEmmanuel Vadot            - const: gclk
118c66ec88fSEmmanuel Vadot            - const: slow_clk
119c66ec88fSEmmanuel Vadot    else:
120c66ec88fSEmmanuel Vadot      properties:
121c66ec88fSEmmanuel Vadot        clocks:
122c66ec88fSEmmanuel Vadot          minItems: 2
123c66ec88fSEmmanuel Vadot          maxItems: 4
124c66ec88fSEmmanuel Vadot        clock-names:
125c66ec88fSEmmanuel Vadot          oneOf:
126c66ec88fSEmmanuel Vadot            - items:
127c66ec88fSEmmanuel Vadot                - const: t0_clk
128c66ec88fSEmmanuel Vadot                - const: slow_clk
129c66ec88fSEmmanuel Vadot            - items:
130c66ec88fSEmmanuel Vadot                - const: t0_clk
131c66ec88fSEmmanuel Vadot                - const: t1_clk
132c66ec88fSEmmanuel Vadot                - const: t2_clk
133c66ec88fSEmmanuel Vadot                - const: slow_clk
134c66ec88fSEmmanuel Vadot
135c66ec88fSEmmanuel Vadotrequired:
136c66ec88fSEmmanuel Vadot  - compatible
137c66ec88fSEmmanuel Vadot  - reg
138c66ec88fSEmmanuel Vadot  - interrupts
139c66ec88fSEmmanuel Vadot  - clocks
140c66ec88fSEmmanuel Vadot  - clock-names
141c66ec88fSEmmanuel Vadot  - '#address-cells'
142c66ec88fSEmmanuel Vadot  - '#size-cells'
143c66ec88fSEmmanuel Vadot
144c66ec88fSEmmanuel VadotadditionalProperties: false
145c66ec88fSEmmanuel Vadot
146c66ec88fSEmmanuel Vadotexamples:
147c66ec88fSEmmanuel Vadot  - |
148c66ec88fSEmmanuel Vadot    /* One interrupt per TC block: */
149c66ec88fSEmmanuel Vadot        tcb0: timer@fff7c000 {
150c66ec88fSEmmanuel Vadot                compatible = "atmel,at91rm9200-tcb", "simple-mfd", "syscon";
151c66ec88fSEmmanuel Vadot                #address-cells = <1>;
152c66ec88fSEmmanuel Vadot                #size-cells = <0>;
153c66ec88fSEmmanuel Vadot                reg = <0xfff7c000 0x100>;
154c66ec88fSEmmanuel Vadot                interrupts = <18 4>;
155c66ec88fSEmmanuel Vadot                clocks = <&tcb0_clk>, <&clk32k>;
156c66ec88fSEmmanuel Vadot                clock-names = "t0_clk", "slow_clk";
157c66ec88fSEmmanuel Vadot
158c66ec88fSEmmanuel Vadot                timer@0 {
159c66ec88fSEmmanuel Vadot                        compatible = "atmel,tcb-timer";
160c66ec88fSEmmanuel Vadot                        reg = <0>, <1>;
161c66ec88fSEmmanuel Vadot                };
162c66ec88fSEmmanuel Vadot
163c66ec88fSEmmanuel Vadot                timer@2 {
164c66ec88fSEmmanuel Vadot                        compatible = "atmel,tcb-timer";
165c66ec88fSEmmanuel Vadot                        reg = <2>;
166c66ec88fSEmmanuel Vadot                };
167c66ec88fSEmmanuel Vadot        };
168c66ec88fSEmmanuel Vadot
169c66ec88fSEmmanuel Vadot    /* One interrupt per TC channel in a TC block: */
170c66ec88fSEmmanuel Vadot        tcb1: timer@fffdc000 {
171c66ec88fSEmmanuel Vadot                compatible = "atmel,at91rm9200-tcb", "simple-mfd", "syscon";
172c66ec88fSEmmanuel Vadot                #address-cells = <1>;
173c66ec88fSEmmanuel Vadot                #size-cells = <0>;
174c66ec88fSEmmanuel Vadot                reg = <0xfffdc000 0x100>;
175c66ec88fSEmmanuel Vadot                interrupts = <26 4>, <27 4>, <28 4>;
176c66ec88fSEmmanuel Vadot                clocks = <&tcb1_clk>, <&clk32k>;
177c66ec88fSEmmanuel Vadot                clock-names = "t0_clk", "slow_clk";
178c66ec88fSEmmanuel Vadot
179c66ec88fSEmmanuel Vadot                timer@0 {
180c66ec88fSEmmanuel Vadot                        compatible = "atmel,tcb-timer";
181c66ec88fSEmmanuel Vadot                        reg = <0>;
182c66ec88fSEmmanuel Vadot                };
183c66ec88fSEmmanuel Vadot
184c66ec88fSEmmanuel Vadot                timer@1 {
185c66ec88fSEmmanuel Vadot                        compatible = "atmel,tcb-timer";
186c66ec88fSEmmanuel Vadot                        reg = <1>;
187c66ec88fSEmmanuel Vadot                };
1885def4c47SEmmanuel Vadot
1895def4c47SEmmanuel Vadot                pwm@2 {
1905def4c47SEmmanuel Vadot                        compatible = "atmel,tcb-pwm";
1915def4c47SEmmanuel Vadot                        reg = <2>;
1925def4c47SEmmanuel Vadot                        #pwm-cells = <3>;
1935def4c47SEmmanuel Vadot                };
194c66ec88fSEmmanuel Vadot         };
195c66ec88fSEmmanuel Vadot    /* TCB0 Capture with QDEC: */
196c66ec88fSEmmanuel Vadot        timer@f800c000 {
197c66ec88fSEmmanuel Vadot                compatible = "atmel,at91rm9200-tcb", "simple-mfd", "syscon";
198c66ec88fSEmmanuel Vadot                #address-cells = <1>;
199c66ec88fSEmmanuel Vadot                #size-cells = <0>;
200c66ec88fSEmmanuel Vadot                reg = <0xfff7c000 0x100>;
201c66ec88fSEmmanuel Vadot                interrupts = <18 4>;
202c66ec88fSEmmanuel Vadot                clocks = <&tcb0_clk>, <&clk32k>;
203c66ec88fSEmmanuel Vadot                clock-names = "t0_clk", "slow_clk";
204c66ec88fSEmmanuel Vadot
205c66ec88fSEmmanuel Vadot                timer@0 {
206c66ec88fSEmmanuel Vadot                        compatible = "microchip,tcb-capture";
207c66ec88fSEmmanuel Vadot                        reg = <0>, <1>;
208c66ec88fSEmmanuel Vadot                };
209c66ec88fSEmmanuel Vadot
210c66ec88fSEmmanuel Vadot                timer@2 {
211c66ec88fSEmmanuel Vadot                        compatible = "atmel,tcb-timer";
212c66ec88fSEmmanuel Vadot                        reg = <2>;
213c66ec88fSEmmanuel Vadot                };
214c66ec88fSEmmanuel Vadot        };
215