1c66ec88fSEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2c66ec88fSEmmanuel Vadot%YAML 1.2
3c66ec88fSEmmanuel Vadot---
4*b97ee269SEmmanuel Vadot$id: http://devicetree.org/schemas/soc/microchip/atmel,at91rm9200-tcb.yaml#
5*b97ee269SEmmanuel 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
57c66ec88fSEmmanuel Vadot    properties:
58c66ec88fSEmmanuel Vadot      compatible:
59c66ec88fSEmmanuel Vadot        items:
60c66ec88fSEmmanuel Vadot          - enum:
61c66ec88fSEmmanuel Vadot              - atmel,tcb-timer
625def4c47SEmmanuel Vadot              - atmel,tcb-pwm
63c66ec88fSEmmanuel Vadot              - microchip,tcb-capture
64c66ec88fSEmmanuel Vadot      reg:
65c66ec88fSEmmanuel Vadot        description:
66c66ec88fSEmmanuel Vadot          List of channels to use for this particular timer. In Microchip TCB capture
67c66ec88fSEmmanuel Vadot          mode channels are registered as a counter devices, for the qdec mode TCB0's
68c66ec88fSEmmanuel Vadot          channel <0> and <1> are required.
69c66ec88fSEmmanuel Vadot
70c66ec88fSEmmanuel Vadot        minItems: 1
71c66ec88fSEmmanuel Vadot        maxItems: 3
725def4c47SEmmanuel Vadot    required:
735def4c47SEmmanuel Vadot      - compatible
745def4c47SEmmanuel Vadot      - reg
755def4c47SEmmanuel Vadot
765def4c47SEmmanuel Vadot  "^pwm@[0-2]$":
775def4c47SEmmanuel Vadot    description: The timer block channels that are used as PWMs.
78*b97ee269SEmmanuel Vadot    $ref: /schemas/pwm/pwm.yaml#
795def4c47SEmmanuel Vadot    type: object
805def4c47SEmmanuel Vadot    properties:
815def4c47SEmmanuel Vadot      compatible:
825def4c47SEmmanuel Vadot        const: atmel,tcb-pwm
835def4c47SEmmanuel Vadot      reg:
845def4c47SEmmanuel Vadot        description:
855def4c47SEmmanuel Vadot          TCB channel to use for this PWM.
865def4c47SEmmanuel Vadot        enum: [ 0, 1, 2 ]
875def4c47SEmmanuel Vadot
885def4c47SEmmanuel Vadot      "#pwm-cells":
895def4c47SEmmanuel Vadot        description:
905def4c47SEmmanuel Vadot          The only third cell flag supported by this binding is
915def4c47SEmmanuel Vadot          PWM_POLARITY_INVERTED.
925def4c47SEmmanuel Vadot        const: 3
93c66ec88fSEmmanuel Vadot
94c66ec88fSEmmanuel Vadot    required:
95c66ec88fSEmmanuel Vadot      - compatible
96c66ec88fSEmmanuel Vadot      - reg
975def4c47SEmmanuel Vadot      - "#pwm-cells"
985def4c47SEmmanuel Vadot
995def4c47SEmmanuel Vadot    additionalProperties: false
1005def4c47SEmmanuel Vadot
101c66ec88fSEmmanuel Vadot
102c66ec88fSEmmanuel VadotallOf:
103c66ec88fSEmmanuel Vadot  - if:
104c66ec88fSEmmanuel Vadot      properties:
105c66ec88fSEmmanuel Vadot        compatible:
106c66ec88fSEmmanuel Vadot          contains:
107c66ec88fSEmmanuel Vadot            const: atmel,sama5d2-tcb
108c66ec88fSEmmanuel Vadot    then:
109c66ec88fSEmmanuel Vadot      properties:
110c66ec88fSEmmanuel Vadot        clocks:
111c66ec88fSEmmanuel Vadot          minItems: 3
112c66ec88fSEmmanuel Vadot          maxItems: 3
113c66ec88fSEmmanuel Vadot        clock-names:
114c66ec88fSEmmanuel Vadot          items:
115c66ec88fSEmmanuel Vadot            - const: t0_clk
116c66ec88fSEmmanuel Vadot            - const: gclk
117c66ec88fSEmmanuel Vadot            - const: slow_clk
118c66ec88fSEmmanuel Vadot    else:
119c66ec88fSEmmanuel Vadot      properties:
120c66ec88fSEmmanuel Vadot        clocks:
121c66ec88fSEmmanuel Vadot          minItems: 2
122c66ec88fSEmmanuel Vadot          maxItems: 4
123c66ec88fSEmmanuel Vadot        clock-names:
124c66ec88fSEmmanuel Vadot          oneOf:
125c66ec88fSEmmanuel Vadot            - items:
126c66ec88fSEmmanuel Vadot                - const: t0_clk
127c66ec88fSEmmanuel Vadot                - const: slow_clk
128c66ec88fSEmmanuel Vadot            - items:
129c66ec88fSEmmanuel Vadot                - const: t0_clk
130c66ec88fSEmmanuel Vadot                - const: t1_clk
131c66ec88fSEmmanuel Vadot                - const: t2_clk
132c66ec88fSEmmanuel Vadot                - const: slow_clk
133c66ec88fSEmmanuel Vadot
134c66ec88fSEmmanuel Vadotrequired:
135c66ec88fSEmmanuel Vadot  - compatible
136c66ec88fSEmmanuel Vadot  - reg
137c66ec88fSEmmanuel Vadot  - interrupts
138c66ec88fSEmmanuel Vadot  - clocks
139c66ec88fSEmmanuel Vadot  - clock-names
140c66ec88fSEmmanuel Vadot  - '#address-cells'
141c66ec88fSEmmanuel Vadot  - '#size-cells'
142c66ec88fSEmmanuel Vadot
143c66ec88fSEmmanuel VadotadditionalProperties: false
144c66ec88fSEmmanuel Vadot
145c66ec88fSEmmanuel Vadotexamples:
146c66ec88fSEmmanuel Vadot  - |
147c66ec88fSEmmanuel Vadot    /* One interrupt per TC block: */
148c66ec88fSEmmanuel Vadot        tcb0: timer@fff7c000 {
149c66ec88fSEmmanuel Vadot                compatible = "atmel,at91rm9200-tcb", "simple-mfd", "syscon";
150c66ec88fSEmmanuel Vadot                #address-cells = <1>;
151c66ec88fSEmmanuel Vadot                #size-cells = <0>;
152c66ec88fSEmmanuel Vadot                reg = <0xfff7c000 0x100>;
153c66ec88fSEmmanuel Vadot                interrupts = <18 4>;
154c66ec88fSEmmanuel Vadot                clocks = <&tcb0_clk>, <&clk32k>;
155c66ec88fSEmmanuel Vadot                clock-names = "t0_clk", "slow_clk";
156c66ec88fSEmmanuel Vadot
157c66ec88fSEmmanuel Vadot                timer@0 {
158c66ec88fSEmmanuel Vadot                        compatible = "atmel,tcb-timer";
159c66ec88fSEmmanuel Vadot                        reg = <0>, <1>;
160c66ec88fSEmmanuel Vadot                };
161c66ec88fSEmmanuel Vadot
162c66ec88fSEmmanuel Vadot                timer@2 {
163c66ec88fSEmmanuel Vadot                        compatible = "atmel,tcb-timer";
164c66ec88fSEmmanuel Vadot                        reg = <2>;
165c66ec88fSEmmanuel Vadot                };
166c66ec88fSEmmanuel Vadot        };
167c66ec88fSEmmanuel Vadot
168c66ec88fSEmmanuel Vadot    /* One interrupt per TC channel in a TC block: */
169c66ec88fSEmmanuel Vadot        tcb1: timer@fffdc000 {
170c66ec88fSEmmanuel Vadot                compatible = "atmel,at91rm9200-tcb", "simple-mfd", "syscon";
171c66ec88fSEmmanuel Vadot                #address-cells = <1>;
172c66ec88fSEmmanuel Vadot                #size-cells = <0>;
173c66ec88fSEmmanuel Vadot                reg = <0xfffdc000 0x100>;
174c66ec88fSEmmanuel Vadot                interrupts = <26 4>, <27 4>, <28 4>;
175c66ec88fSEmmanuel Vadot                clocks = <&tcb1_clk>, <&clk32k>;
176c66ec88fSEmmanuel Vadot                clock-names = "t0_clk", "slow_clk";
177c66ec88fSEmmanuel Vadot
178c66ec88fSEmmanuel Vadot                timer@0 {
179c66ec88fSEmmanuel Vadot                        compatible = "atmel,tcb-timer";
180c66ec88fSEmmanuel Vadot                        reg = <0>;
181c66ec88fSEmmanuel Vadot                };
182c66ec88fSEmmanuel Vadot
183c66ec88fSEmmanuel Vadot                timer@1 {
184c66ec88fSEmmanuel Vadot                        compatible = "atmel,tcb-timer";
185c66ec88fSEmmanuel Vadot                        reg = <1>;
186c66ec88fSEmmanuel Vadot                };
1875def4c47SEmmanuel Vadot
1885def4c47SEmmanuel Vadot                pwm@2 {
1895def4c47SEmmanuel Vadot                        compatible = "atmel,tcb-pwm";
1905def4c47SEmmanuel Vadot                        reg = <2>;
1915def4c47SEmmanuel Vadot                        #pwm-cells = <3>;
1925def4c47SEmmanuel Vadot                };
193c66ec88fSEmmanuel Vadot         };
194c66ec88fSEmmanuel Vadot    /* TCB0 Capture with QDEC: */
195c66ec88fSEmmanuel Vadot        timer@f800c000 {
196c66ec88fSEmmanuel Vadot                compatible = "atmel,at91rm9200-tcb", "simple-mfd", "syscon";
197c66ec88fSEmmanuel Vadot                #address-cells = <1>;
198c66ec88fSEmmanuel Vadot                #size-cells = <0>;
199c66ec88fSEmmanuel Vadot                reg = <0xfff7c000 0x100>;
200c66ec88fSEmmanuel Vadot                interrupts = <18 4>;
201c66ec88fSEmmanuel Vadot                clocks = <&tcb0_clk>, <&clk32k>;
202c66ec88fSEmmanuel Vadot                clock-names = "t0_clk", "slow_clk";
203c66ec88fSEmmanuel Vadot
204c66ec88fSEmmanuel Vadot                timer@0 {
205c66ec88fSEmmanuel Vadot                        compatible = "microchip,tcb-capture";
206c66ec88fSEmmanuel Vadot                        reg = <0>, <1>;
207c66ec88fSEmmanuel Vadot                };
208c66ec88fSEmmanuel Vadot
209c66ec88fSEmmanuel Vadot                timer@2 {
210c66ec88fSEmmanuel Vadot                        compatible = "atmel,tcb-timer";
211c66ec88fSEmmanuel Vadot                        reg = <2>;
212c66ec88fSEmmanuel Vadot                };
213c66ec88fSEmmanuel Vadot        };
214