14b88c673SAlexandre Belloni# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
24b88c673SAlexandre Belloni%YAML 1.2
34b88c673SAlexandre Belloni---
443f45415SKrzysztof Kozlowski$id: http://devicetree.org/schemas/soc/microchip/atmel,at91rm9200-tcb.yaml#
543f45415SKrzysztof Kozlowski$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
57*e62fc182SRob Herring    additionalProperties: false
584b88c673SAlexandre Belloni    properties:
594b88c673SAlexandre Belloni      compatible:
607eb181cfSKamel Bouhara        items:
617eb181cfSKamel Bouhara          - enum:
627eb181cfSKamel Bouhara              - atmel,tcb-timer
63cd6720baSAlexandre Belloni              - atmel,tcb-pwm
647eb181cfSKamel Bouhara              - microchip,tcb-capture
654b88c673SAlexandre Belloni      reg:
664b88c673SAlexandre Belloni        description:
677eb181cfSKamel Bouhara          List of channels to use for this particular timer. In Microchip TCB capture
687eb181cfSKamel Bouhara          mode channels are registered as a counter devices, for the qdec mode TCB0's
697eb181cfSKamel Bouhara          channel <0> and <1> are required.
707eb181cfSKamel Bouhara
714b88c673SAlexandre Belloni        minItems: 1
724b88c673SAlexandre Belloni        maxItems: 3
73cd6720baSAlexandre Belloni    required:
74cd6720baSAlexandre Belloni      - compatible
75cd6720baSAlexandre Belloni      - reg
76cd6720baSAlexandre Belloni
77cd6720baSAlexandre Belloni  "^pwm@[0-2]$":
78cd6720baSAlexandre Belloni    description: The timer block channels that are used as PWMs.
79e48ef9a9SKrzysztof Kozlowski    $ref: /schemas/pwm/pwm.yaml#
80cd6720baSAlexandre Belloni    type: object
81cd6720baSAlexandre Belloni    properties:
82cd6720baSAlexandre Belloni      compatible:
83cd6720baSAlexandre Belloni        const: atmel,tcb-pwm
84cd6720baSAlexandre Belloni      reg:
85cd6720baSAlexandre Belloni        description:
86cd6720baSAlexandre Belloni          TCB channel to use for this PWM.
87cd6720baSAlexandre Belloni        enum: [ 0, 1, 2 ]
88cd6720baSAlexandre Belloni
89cd6720baSAlexandre Belloni      "#pwm-cells":
90cd6720baSAlexandre Belloni        description:
91cd6720baSAlexandre Belloni          The only third cell flag supported by this binding is
92cd6720baSAlexandre Belloni          PWM_POLARITY_INVERTED.
93cd6720baSAlexandre Belloni        const: 3
944b88c673SAlexandre Belloni
954b88c673SAlexandre Belloni    required:
964b88c673SAlexandre Belloni      - compatible
974b88c673SAlexandre Belloni      - reg
98cd6720baSAlexandre Belloni      - "#pwm-cells"
99cd6720baSAlexandre Belloni
100cd6720baSAlexandre Belloni    additionalProperties: false
101cd6720baSAlexandre Belloni
1024b88c673SAlexandre Belloni
1033f07899fSAlexandre BelloniallOf:
1043f07899fSAlexandre Belloni  - if:
1053f07899fSAlexandre Belloni      properties:
1063f07899fSAlexandre Belloni        compatible:
1073f07899fSAlexandre Belloni          contains:
1083f07899fSAlexandre Belloni            const: atmel,sama5d2-tcb
1093f07899fSAlexandre Belloni    then:
1103f07899fSAlexandre Belloni      properties:
1113f07899fSAlexandre Belloni        clocks:
1123f07899fSAlexandre Belloni          minItems: 3
1133f07899fSAlexandre Belloni          maxItems: 3
1143f07899fSAlexandre Belloni        clock-names:
1153f07899fSAlexandre Belloni          items:
1163f07899fSAlexandre Belloni            - const: t0_clk
1173f07899fSAlexandre Belloni            - const: gclk
1183f07899fSAlexandre Belloni            - const: slow_clk
1193f07899fSAlexandre Belloni    else:
1203f07899fSAlexandre Belloni      properties:
1213f07899fSAlexandre Belloni        clocks:
1223f07899fSAlexandre Belloni          minItems: 2
1233f07899fSAlexandre Belloni          maxItems: 4
1243f07899fSAlexandre Belloni        clock-names:
1253f07899fSAlexandre Belloni          oneOf:
1263f07899fSAlexandre Belloni            - items:
1273f07899fSAlexandre Belloni                - const: t0_clk
1283f07899fSAlexandre Belloni                - const: slow_clk
1293f07899fSAlexandre Belloni            - items:
1303f07899fSAlexandre Belloni                - const: t0_clk
1313f07899fSAlexandre Belloni                - const: t1_clk
1323f07899fSAlexandre Belloni                - const: t2_clk
1333f07899fSAlexandre Belloni                - const: slow_clk
1343f07899fSAlexandre Belloni
1354b88c673SAlexandre Bellonirequired:
1364b88c673SAlexandre Belloni  - compatible
1374b88c673SAlexandre Belloni  - reg
1384b88c673SAlexandre Belloni  - interrupts
1394b88c673SAlexandre Belloni  - clocks
1404b88c673SAlexandre Belloni  - clock-names
1414b88c673SAlexandre Belloni  - '#address-cells'
1424b88c673SAlexandre Belloni  - '#size-cells'
1434b88c673SAlexandre Belloni
1444b88c673SAlexandre BelloniadditionalProperties: false
1454b88c673SAlexandre Belloni
1464b88c673SAlexandre Belloniexamples:
1474b88c673SAlexandre Belloni  - |
1484b88c673SAlexandre Belloni    /* One interrupt per TC block: */
1494b88c673SAlexandre Belloni        tcb0: timer@fff7c000 {
1504b88c673SAlexandre Belloni                compatible = "atmel,at91rm9200-tcb", "simple-mfd", "syscon";
1514b88c673SAlexandre Belloni                #address-cells = <1>;
1524b88c673SAlexandre Belloni                #size-cells = <0>;
1534b88c673SAlexandre Belloni                reg = <0xfff7c000 0x100>;
1544b88c673SAlexandre Belloni                interrupts = <18 4>;
1554b88c673SAlexandre Belloni                clocks = <&tcb0_clk>, <&clk32k>;
1564b88c673SAlexandre Belloni                clock-names = "t0_clk", "slow_clk";
1574b88c673SAlexandre Belloni
1584b88c673SAlexandre Belloni                timer@0 {
1594b88c673SAlexandre Belloni                        compatible = "atmel,tcb-timer";
1604b88c673SAlexandre Belloni                        reg = <0>, <1>;
1614b88c673SAlexandre Belloni                };
1624b88c673SAlexandre Belloni
1634b88c673SAlexandre Belloni                timer@2 {
1644b88c673SAlexandre Belloni                        compatible = "atmel,tcb-timer";
1654b88c673SAlexandre Belloni                        reg = <2>;
1664b88c673SAlexandre Belloni                };
1674b88c673SAlexandre Belloni        };
1684b88c673SAlexandre Belloni
1694b88c673SAlexandre Belloni    /* One interrupt per TC channel in a TC block: */
1704b88c673SAlexandre Belloni        tcb1: timer@fffdc000 {
1714b88c673SAlexandre Belloni                compatible = "atmel,at91rm9200-tcb", "simple-mfd", "syscon";
1724b88c673SAlexandre Belloni                #address-cells = <1>;
1734b88c673SAlexandre Belloni                #size-cells = <0>;
1744b88c673SAlexandre Belloni                reg = <0xfffdc000 0x100>;
1754b88c673SAlexandre Belloni                interrupts = <26 4>, <27 4>, <28 4>;
1764b88c673SAlexandre Belloni                clocks = <&tcb1_clk>, <&clk32k>;
1774b88c673SAlexandre Belloni                clock-names = "t0_clk", "slow_clk";
1784b88c673SAlexandre Belloni
1794b88c673SAlexandre Belloni                timer@0 {
1804b88c673SAlexandre Belloni                        compatible = "atmel,tcb-timer";
1814b88c673SAlexandre Belloni                        reg = <0>;
1824b88c673SAlexandre Belloni                };
1834b88c673SAlexandre Belloni
1844b88c673SAlexandre Belloni                timer@1 {
1854b88c673SAlexandre Belloni                        compatible = "atmel,tcb-timer";
1864b88c673SAlexandre Belloni                        reg = <1>;
1874b88c673SAlexandre Belloni                };
188cd6720baSAlexandre Belloni
189cd6720baSAlexandre Belloni                pwm@2 {
190cd6720baSAlexandre Belloni                        compatible = "atmel,tcb-pwm";
191cd6720baSAlexandre Belloni                        reg = <2>;
192cd6720baSAlexandre Belloni                        #pwm-cells = <3>;
193cd6720baSAlexandre Belloni                };
1944b88c673SAlexandre Belloni         };
1957eb181cfSKamel Bouhara    /* TCB0 Capture with QDEC: */
1967eb181cfSKamel Bouhara        timer@f800c000 {
1977eb181cfSKamel Bouhara                compatible = "atmel,at91rm9200-tcb", "simple-mfd", "syscon";
1987eb181cfSKamel Bouhara                #address-cells = <1>;
1997eb181cfSKamel Bouhara                #size-cells = <0>;
2007eb181cfSKamel Bouhara                reg = <0xfff7c000 0x100>;
2017eb181cfSKamel Bouhara                interrupts = <18 4>;
2027eb181cfSKamel Bouhara                clocks = <&tcb0_clk>, <&clk32k>;
2037eb181cfSKamel Bouhara                clock-names = "t0_clk", "slow_clk";
2047eb181cfSKamel Bouhara
2057eb181cfSKamel Bouhara                timer@0 {
2067eb181cfSKamel Bouhara                        compatible = "microchip,tcb-capture";
2077eb181cfSKamel Bouhara                        reg = <0>, <1>;
2087eb181cfSKamel Bouhara                };
2097eb181cfSKamel Bouhara
2107eb181cfSKamel Bouhara                timer@2 {
2117eb181cfSKamel Bouhara                        compatible = "atmel,tcb-timer";
2127eb181cfSKamel Bouhara                        reg = <2>;
2137eb181cfSKamel Bouhara                };
2147eb181cfSKamel Bouhara        };
215