14b88c673SAlexandre Belloni# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
24b88c673SAlexandre Belloni%YAML 1.2
34b88c673SAlexandre Belloni---
44b88c673SAlexandre Belloni$id: "http://devicetree.org/schemas/soc/microchip/atmel,at91rm9200-tcb.yaml#"
54b88c673SAlexandre Belloni$schema: "http://devicetree.org/meta-schemas/core.yaml#"
64b88c673SAlexandre Belloni
74b88c673SAlexandre Bellonititle: Atmel Timer Counter Block
84b88c673SAlexandre Belloni
94b88c673SAlexandre Bellonimaintainers:
104b88c673SAlexandre Belloni  - Alexandre Belloni <alexandre.belloni@bootlin.com>
114b88c673SAlexandre Belloni
124b88c673SAlexandre Bellonidescription: |
134b88c673SAlexandre Belloni  The Atmel (now Microchip) SoCs have timers named Timer Counter Block. Each
144b88c673SAlexandre Belloni  timer has three channels with two counters each.
154b88c673SAlexandre Belloni
164b88c673SAlexandre Belloniproperties:
174b88c673SAlexandre Belloni  compatible:
184b88c673SAlexandre Belloni    items:
194b88c673SAlexandre Belloni      - enum:
204b88c673SAlexandre Belloni          - atmel,at91rm9200-tcb
214b88c673SAlexandre Belloni          - atmel,at91sam9x5-tcb
223f07899fSAlexandre Belloni          - atmel,sama5d2-tcb
234b88c673SAlexandre Belloni      - const: simple-mfd
244b88c673SAlexandre Belloni      - const: syscon
254b88c673SAlexandre Belloni
264b88c673SAlexandre Belloni  reg:
274b88c673SAlexandre Belloni    maxItems: 1
284b88c673SAlexandre Belloni
294b88c673SAlexandre Belloni  interrupts:
304b88c673SAlexandre Belloni    description:
314b88c673SAlexandre Belloni      List of interrupts. One interrupt per TCB channel if available or one
324b88c673SAlexandre Belloni      interrupt for the TC block
334b88c673SAlexandre Belloni    minItems: 1
344b88c673SAlexandre Belloni    maxItems: 3
354b88c673SAlexandre Belloni
364b88c673SAlexandre Belloni  clock-names:
374b88c673SAlexandre Belloni    description:
384b88c673SAlexandre Belloni      List of clock names. Always includes t0_clk and slow clk. Also includes
394b88c673SAlexandre Belloni      t1_clk and t2_clk if a clock per channel is available.
404b88c673SAlexandre Belloni    minItems: 2
414b88c673SAlexandre Belloni    maxItems: 4
424b88c673SAlexandre Belloni
434b88c673SAlexandre Belloni  clocks:
444b88c673SAlexandre Belloni    minItems: 2
454b88c673SAlexandre Belloni    maxItems: 4
464b88c673SAlexandre Belloni
474b88c673SAlexandre Belloni  '#address-cells':
484b88c673SAlexandre Belloni    const: 1
494b88c673SAlexandre Belloni
504b88c673SAlexandre Belloni  '#size-cells':
514b88c673SAlexandre Belloni    const: 0
524b88c673SAlexandre Belloni
534b88c673SAlexandre BellonipatternProperties:
544b88c673SAlexandre Belloni  "^timer@[0-2]$":
557eb181cfSKamel Bouhara    description: The timer block channels that are used as timers or counters.
564b88c673SAlexandre Belloni    type: object
574b88c673SAlexandre Belloni    properties:
584b88c673SAlexandre Belloni      compatible:
597eb181cfSKamel Bouhara        items:
607eb181cfSKamel Bouhara          - enum:
617eb181cfSKamel Bouhara              - atmel,tcb-timer
62*cd6720baSAlexandre Belloni              - atmel,tcb-pwm
637eb181cfSKamel Bouhara              - microchip,tcb-capture
644b88c673SAlexandre Belloni      reg:
654b88c673SAlexandre Belloni        description:
667eb181cfSKamel Bouhara          List of channels to use for this particular timer. In Microchip TCB capture
677eb181cfSKamel Bouhara          mode channels are registered as a counter devices, for the qdec mode TCB0's
687eb181cfSKamel Bouhara          channel <0> and <1> are required.
697eb181cfSKamel Bouhara
704b88c673SAlexandre Belloni        minItems: 1
714b88c673SAlexandre Belloni        maxItems: 3
72*cd6720baSAlexandre Belloni    required:
73*cd6720baSAlexandre Belloni      - compatible
74*cd6720baSAlexandre Belloni      - reg
75*cd6720baSAlexandre Belloni
76*cd6720baSAlexandre Belloni  "^pwm@[0-2]$":
77*cd6720baSAlexandre Belloni    description: The timer block channels that are used as PWMs.
78*cd6720baSAlexandre Belloni    $ref: ../../pwm/pwm.yaml#
79*cd6720baSAlexandre Belloni    type: object
80*cd6720baSAlexandre Belloni    properties:
81*cd6720baSAlexandre Belloni      compatible:
82*cd6720baSAlexandre Belloni        const: atmel,tcb-pwm
83*cd6720baSAlexandre Belloni      reg:
84*cd6720baSAlexandre Belloni        description:
85*cd6720baSAlexandre Belloni          TCB channel to use for this PWM.
86*cd6720baSAlexandre Belloni        enum: [ 0, 1, 2 ]
87*cd6720baSAlexandre Belloni
88*cd6720baSAlexandre Belloni      "#pwm-cells":
89*cd6720baSAlexandre Belloni        description:
90*cd6720baSAlexandre Belloni          The only third cell flag supported by this binding is
91*cd6720baSAlexandre Belloni          PWM_POLARITY_INVERTED.
92*cd6720baSAlexandre Belloni        const: 3
934b88c673SAlexandre Belloni
944b88c673SAlexandre Belloni    required:
954b88c673SAlexandre Belloni      - compatible
964b88c673SAlexandre Belloni      - reg
97*cd6720baSAlexandre Belloni      - "#pwm-cells"
98*cd6720baSAlexandre Belloni
99*cd6720baSAlexandre Belloni    additionalProperties: false
100*cd6720baSAlexandre Belloni
1014b88c673SAlexandre Belloni
1023f07899fSAlexandre BelloniallOf:
1033f07899fSAlexandre Belloni  - if:
1043f07899fSAlexandre Belloni      properties:
1053f07899fSAlexandre Belloni        compatible:
1063f07899fSAlexandre Belloni          contains:
1073f07899fSAlexandre Belloni            const: atmel,sama5d2-tcb
1083f07899fSAlexandre Belloni    then:
1093f07899fSAlexandre Belloni      properties:
1103f07899fSAlexandre Belloni        clocks:
1113f07899fSAlexandre Belloni          minItems: 3
1123f07899fSAlexandre Belloni          maxItems: 3
1133f07899fSAlexandre Belloni        clock-names:
1143f07899fSAlexandre Belloni          items:
1153f07899fSAlexandre Belloni            - const: t0_clk
1163f07899fSAlexandre Belloni            - const: gclk
1173f07899fSAlexandre Belloni            - const: slow_clk
1183f07899fSAlexandre Belloni    else:
1193f07899fSAlexandre Belloni      properties:
1203f07899fSAlexandre Belloni        clocks:
1213f07899fSAlexandre Belloni          minItems: 2
1223f07899fSAlexandre Belloni          maxItems: 4
1233f07899fSAlexandre Belloni        clock-names:
1243f07899fSAlexandre Belloni          oneOf:
1253f07899fSAlexandre Belloni            - items:
1263f07899fSAlexandre Belloni                - const: t0_clk
1273f07899fSAlexandre Belloni                - const: slow_clk
1283f07899fSAlexandre Belloni            - items:
1293f07899fSAlexandre Belloni                - const: t0_clk
1303f07899fSAlexandre Belloni                - const: t1_clk
1313f07899fSAlexandre Belloni                - const: t2_clk
1323f07899fSAlexandre Belloni                - const: slow_clk
1333f07899fSAlexandre Belloni
1344b88c673SAlexandre Bellonirequired:
1354b88c673SAlexandre Belloni  - compatible
1364b88c673SAlexandre Belloni  - reg
1374b88c673SAlexandre Belloni  - interrupts
1384b88c673SAlexandre Belloni  - clocks
1394b88c673SAlexandre Belloni  - clock-names
1404b88c673SAlexandre Belloni  - '#address-cells'
1414b88c673SAlexandre Belloni  - '#size-cells'
1424b88c673SAlexandre Belloni
1434b88c673SAlexandre BelloniadditionalProperties: false
1444b88c673SAlexandre Belloni
1454b88c673SAlexandre Belloniexamples:
1464b88c673SAlexandre Belloni  - |
1474b88c673SAlexandre Belloni    /* One interrupt per TC block: */
1484b88c673SAlexandre Belloni        tcb0: timer@fff7c000 {
1494b88c673SAlexandre Belloni                compatible = "atmel,at91rm9200-tcb", "simple-mfd", "syscon";
1504b88c673SAlexandre Belloni                #address-cells = <1>;
1514b88c673SAlexandre Belloni                #size-cells = <0>;
1524b88c673SAlexandre Belloni                reg = <0xfff7c000 0x100>;
1534b88c673SAlexandre Belloni                interrupts = <18 4>;
1544b88c673SAlexandre Belloni                clocks = <&tcb0_clk>, <&clk32k>;
1554b88c673SAlexandre Belloni                clock-names = "t0_clk", "slow_clk";
1564b88c673SAlexandre Belloni
1574b88c673SAlexandre Belloni                timer@0 {
1584b88c673SAlexandre Belloni                        compatible = "atmel,tcb-timer";
1594b88c673SAlexandre Belloni                        reg = <0>, <1>;
1604b88c673SAlexandre Belloni                };
1614b88c673SAlexandre Belloni
1624b88c673SAlexandre Belloni                timer@2 {
1634b88c673SAlexandre Belloni                        compatible = "atmel,tcb-timer";
1644b88c673SAlexandre Belloni                        reg = <2>;
1654b88c673SAlexandre Belloni                };
1664b88c673SAlexandre Belloni        };
1674b88c673SAlexandre Belloni
1684b88c673SAlexandre Belloni    /* One interrupt per TC channel in a TC block: */
1694b88c673SAlexandre Belloni        tcb1: timer@fffdc000 {
1704b88c673SAlexandre Belloni                compatible = "atmel,at91rm9200-tcb", "simple-mfd", "syscon";
1714b88c673SAlexandre Belloni                #address-cells = <1>;
1724b88c673SAlexandre Belloni                #size-cells = <0>;
1734b88c673SAlexandre Belloni                reg = <0xfffdc000 0x100>;
1744b88c673SAlexandre Belloni                interrupts = <26 4>, <27 4>, <28 4>;
1754b88c673SAlexandre Belloni                clocks = <&tcb1_clk>, <&clk32k>;
1764b88c673SAlexandre Belloni                clock-names = "t0_clk", "slow_clk";
1774b88c673SAlexandre Belloni
1784b88c673SAlexandre Belloni                timer@0 {
1794b88c673SAlexandre Belloni                        compatible = "atmel,tcb-timer";
1804b88c673SAlexandre Belloni                        reg = <0>;
1814b88c673SAlexandre Belloni                };
1824b88c673SAlexandre Belloni
1834b88c673SAlexandre Belloni                timer@1 {
1844b88c673SAlexandre Belloni                        compatible = "atmel,tcb-timer";
1854b88c673SAlexandre Belloni                        reg = <1>;
1864b88c673SAlexandre Belloni                };
187*cd6720baSAlexandre Belloni
188*cd6720baSAlexandre Belloni                pwm@2 {
189*cd6720baSAlexandre Belloni                        compatible = "atmel,tcb-pwm";
190*cd6720baSAlexandre Belloni                        reg = <2>;
191*cd6720baSAlexandre Belloni                        #pwm-cells = <3>;
192*cd6720baSAlexandre Belloni                };
1934b88c673SAlexandre Belloni         };
1947eb181cfSKamel Bouhara    /* TCB0 Capture with QDEC: */
1957eb181cfSKamel Bouhara        timer@f800c000 {
1967eb181cfSKamel Bouhara                compatible = "atmel,at91rm9200-tcb", "simple-mfd", "syscon";
1977eb181cfSKamel Bouhara                #address-cells = <1>;
1987eb181cfSKamel Bouhara                #size-cells = <0>;
1997eb181cfSKamel Bouhara                reg = <0xfff7c000 0x100>;
2007eb181cfSKamel Bouhara                interrupts = <18 4>;
2017eb181cfSKamel Bouhara                clocks = <&tcb0_clk>, <&clk32k>;
2027eb181cfSKamel Bouhara                clock-names = "t0_clk", "slow_clk";
2037eb181cfSKamel Bouhara
2047eb181cfSKamel Bouhara                timer@0 {
2057eb181cfSKamel Bouhara                        compatible = "microchip,tcb-capture";
2067eb181cfSKamel Bouhara                        reg = <0>, <1>;
2077eb181cfSKamel Bouhara                };
2087eb181cfSKamel Bouhara
2097eb181cfSKamel Bouhara                timer@2 {
2107eb181cfSKamel Bouhara                        compatible = "atmel,tcb-timer";
2117eb181cfSKamel Bouhara                        reg = <2>;
2127eb181cfSKamel Bouhara                };
2137eb181cfSKamel Bouhara        };
214