162306a36Sopenharmony_ci# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
262306a36Sopenharmony_ci%YAML 1.2
362306a36Sopenharmony_ci---
462306a36Sopenharmony_ci$id: http://devicetree.org/schemas/timer/renesas,rz-mtu3.yaml#
562306a36Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml#
662306a36Sopenharmony_ci
762306a36Sopenharmony_cititle: Renesas RZ/G2L Multi-Function Timer Pulse Unit 3 (MTU3a)
862306a36Sopenharmony_ci
962306a36Sopenharmony_cimaintainers:
1062306a36Sopenharmony_ci  - Biju Das <biju.das.jz@bp.renesas.com>
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_cidescription: |
1362306a36Sopenharmony_ci  This hardware block consists of eight 16-bit timer channels and one
1462306a36Sopenharmony_ci  32- bit timer channel. It supports the following specifications:
1562306a36Sopenharmony_ci    - Pulse input/output: 28 lines max.
1662306a36Sopenharmony_ci    - Pulse input 3 lines
1762306a36Sopenharmony_ci    - Count clock 11 clocks for each channel (14 clocks for MTU0, 12 clocks
1862306a36Sopenharmony_ci      for MTU2, and 10 clocks for MTU5, four clocks for MTU1-MTU2 combination
1962306a36Sopenharmony_ci      (when LWA = 1))
2062306a36Sopenharmony_ci    - Operating frequency Up to 100 MHz
2162306a36Sopenharmony_ci    - Available operations [MTU0 to MTU4, MTU6, MTU7, and MTU8]
2262306a36Sopenharmony_ci        - Waveform output on compare match
2362306a36Sopenharmony_ci        - Input capture function (noise filter setting available)
2462306a36Sopenharmony_ci        - Counter-clearing operation
2562306a36Sopenharmony_ci        - Simultaneous writing to multiple timer counters (TCNT)
2662306a36Sopenharmony_ci          (excluding MTU8).
2762306a36Sopenharmony_ci        - Simultaneous clearing on compare match or input capture
2862306a36Sopenharmony_ci          (excluding MTU8).
2962306a36Sopenharmony_ci        - Simultaneous input and output to registers in synchronization with
3062306a36Sopenharmony_ci          counter operations           (excluding MTU8).
3162306a36Sopenharmony_ci        - Up to 12-phase PWM output in combination with synchronous operation
3262306a36Sopenharmony_ci          (excluding MTU8)
3362306a36Sopenharmony_ci    - [MTU0 MTU3, MTU4, MTU6, MTU7, and MTU8]
3462306a36Sopenharmony_ci        - Buffer operation specifiable
3562306a36Sopenharmony_ci    - [MTU1, MTU2]
3662306a36Sopenharmony_ci        - Phase counting mode can be specified independently
3762306a36Sopenharmony_ci        - 32-bit phase counting mode can be specified for interlocked operation
3862306a36Sopenharmony_ci          of MTU1 and MTU2 (when TMDR3.LWA = 1)
3962306a36Sopenharmony_ci        - Cascade connection operation available
4062306a36Sopenharmony_ci    - [MTU3, MTU4, MTU6, and MTU7]
4162306a36Sopenharmony_ci        - Through interlocked operation of MTU3/4 and MTU6/7, the positive and
4262306a36Sopenharmony_ci          negative signals in six phases (12 phases in total) can be output in
4362306a36Sopenharmony_ci          complementary PWM and reset-synchronized PWM operation.
4462306a36Sopenharmony_ci        - In complementary PWM mode, values can be transferred from buffer
4562306a36Sopenharmony_ci          registers to temporary registers at crests and troughs of the timer-
4662306a36Sopenharmony_ci          counter values or when the buffer registers (TGRD registers in MTU4
4762306a36Sopenharmony_ci          and MTU7) are written to.
4862306a36Sopenharmony_ci        - Double-buffering selectable in complementary PWM mode.
4962306a36Sopenharmony_ci    - [MTU3 and MTU4]
5062306a36Sopenharmony_ci        - Through interlocking with MTU0, a mode for driving AC synchronous
5162306a36Sopenharmony_ci          motors (brushless DC motors) by using complementary PWM output and
5262306a36Sopenharmony_ci          reset-synchronized PWM output is settable and allows the selection
5362306a36Sopenharmony_ci          of two types of waveform output (chopping or level).
5462306a36Sopenharmony_ci    - [MTU5]
5562306a36Sopenharmony_ci        - Capable of operation as a dead-time compensation counter.
5662306a36Sopenharmony_ci    - [MTU0/MTU5, MTU1, MTU2, and MTU8]
5762306a36Sopenharmony_ci        - 32-bit phase counting mode specifiable by combining MTU1 and MTU2 and
5862306a36Sopenharmony_ci          through interlocked operation with MTU0/MTU5 and MTU8.
5962306a36Sopenharmony_ci    - Interrupt-skipping function
6062306a36Sopenharmony_ci        - In complementary PWM mode, interrupts on crests and troughs of counter
6162306a36Sopenharmony_ci          values and triggers to start conversion by the A/D converter can be
6262306a36Sopenharmony_ci          skipped.
6362306a36Sopenharmony_ci    - Interrupt sources: 43 sources.
6462306a36Sopenharmony_ci    - Buffer operation:
6562306a36Sopenharmony_ci        - Automatic transfer of register data (transfer from the buffer
6662306a36Sopenharmony_ci          register to the timer register).
6762306a36Sopenharmony_ci    - Trigger generation
6862306a36Sopenharmony_ci        - A/D converter start triggers can be generated
6962306a36Sopenharmony_ci        - A/D converter start request delaying function enables A/D converter
7062306a36Sopenharmony_ci          to be started with any desired timing and to be synchronized with
7162306a36Sopenharmony_ci          PWM output.
7262306a36Sopenharmony_ci    - Low power consumption function
7362306a36Sopenharmony_ci        - The MTU3a can be placed in the module-stop state.
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ci    There are two phase counting modes. 16-bit phase counting mode in which
7662306a36Sopenharmony_ci    MTU1 and MTU2 operate independently, and cascade connection 32-bit phase
7762306a36Sopenharmony_ci    counting mode in which MTU1 and MTU2 are cascaded.
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci    In phase counting mode, the phase difference between two external input
8062306a36Sopenharmony_ci    clocks is detected and the corresponding TCNT is incremented or
8162306a36Sopenharmony_ci    decremented.
8262306a36Sopenharmony_ci    The below counters are supported
8362306a36Sopenharmony_ci      count0 - MTU1 16-bit phase counting
8462306a36Sopenharmony_ci      count1 - MTU2 16-bit phase counting
8562306a36Sopenharmony_ci      count2 - MTU1+ MTU2 32-bit phase counting
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ci    The module supports PWM mode{1,2}, Reset-synchronized PWM mode and
8862306a36Sopenharmony_ci    complementary PWM mode{1,2,3}.
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_ci    In complementary PWM mode, six positive-phase and six negative-phase PWM
9162306a36Sopenharmony_ci    waveforms (12 phases in total) with dead time can be output by
9262306a36Sopenharmony_ci    combining MTU{3,4} and MTU{6,7}.
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ci    The below pwm channels are supported in pwm mode 1.
9562306a36Sopenharmony_ci      pwm0  - MTU0.MTIOC0A PWM mode 1
9662306a36Sopenharmony_ci      pwm1  - MTU0.MTIOC0C PWM mode 1
9762306a36Sopenharmony_ci      pwm2  - MTU1.MTIOC1A PWM mode 1
9862306a36Sopenharmony_ci      pwm3  - MTU2.MTIOC2A PWM mode 1
9962306a36Sopenharmony_ci      pwm4  - MTU3.MTIOC3A PWM mode 1
10062306a36Sopenharmony_ci      pwm5  - MTU3.MTIOC3C PWM mode 1
10162306a36Sopenharmony_ci      pwm6  - MTU4.MTIOC4A PWM mode 1
10262306a36Sopenharmony_ci      pwm7  - MTU4.MTIOC4C PWM mode 1
10362306a36Sopenharmony_ci      pwm8  - MTU6.MTIOC6A PWM mode 1
10462306a36Sopenharmony_ci      pwm9  - MTU6.MTIOC6C PWM mode 1
10562306a36Sopenharmony_ci      pwm10 - MTU7.MTIOC7A PWM mode 1
10662306a36Sopenharmony_ci      pwm11 - MTU7.MTIOC7C PWM mode 1
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ciproperties:
10962306a36Sopenharmony_ci  compatible:
11062306a36Sopenharmony_ci    items:
11162306a36Sopenharmony_ci      - enum:
11262306a36Sopenharmony_ci          - renesas,r9a07g044-mtu3  # RZ/G2{L,LC}
11362306a36Sopenharmony_ci          - renesas,r9a07g054-mtu3  # RZ/V2L
11462306a36Sopenharmony_ci      - const: renesas,rz-mtu3
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ci  reg:
11762306a36Sopenharmony_ci    maxItems: 1
11862306a36Sopenharmony_ci
11962306a36Sopenharmony_ci  interrupts:
12062306a36Sopenharmony_ci    items:
12162306a36Sopenharmony_ci      - description: MTU0.TGRA input capture/compare match
12262306a36Sopenharmony_ci      - description: MTU0.TGRB input capture/compare match
12362306a36Sopenharmony_ci      - description: MTU0.TGRC input capture/compare match
12462306a36Sopenharmony_ci      - description: MTU0.TGRD input capture/compare match
12562306a36Sopenharmony_ci      - description: MTU0.TCNT overflow
12662306a36Sopenharmony_ci      - description: MTU0.TGRE compare match
12762306a36Sopenharmony_ci      - description: MTU0.TGRF compare match
12862306a36Sopenharmony_ci      - description: MTU1.TGRA input capture/compare match
12962306a36Sopenharmony_ci      - description: MTU1.TGRB input capture/compare match
13062306a36Sopenharmony_ci      - description: MTU1.TCNT overflow
13162306a36Sopenharmony_ci      - description: MTU1.TCNT underflow
13262306a36Sopenharmony_ci      - description: MTU2.TGRA input capture/compare match
13362306a36Sopenharmony_ci      - description: MTU2.TGRB input capture/compare match
13462306a36Sopenharmony_ci      - description: MTU2.TCNT overflow
13562306a36Sopenharmony_ci      - description: MTU2.TCNT underflow
13662306a36Sopenharmony_ci      - description: MTU3.TGRA input capture/compare match
13762306a36Sopenharmony_ci      - description: MTU3.TGRB input capture/compare match
13862306a36Sopenharmony_ci      - description: MTU3.TGRC input capture/compare match
13962306a36Sopenharmony_ci      - description: MTU3.TGRD input capture/compare match
14062306a36Sopenharmony_ci      - description: MTU3.TCNT overflow
14162306a36Sopenharmony_ci      - description: MTU4.TGRA input capture/compare match
14262306a36Sopenharmony_ci      - description: MTU4.TGRB input capture/compare match
14362306a36Sopenharmony_ci      - description: MTU4.TGRC input capture/compare match
14462306a36Sopenharmony_ci      - description: MTU4.TGRD input capture/compare match
14562306a36Sopenharmony_ci      - description: MTU4.TCNT overflow/underflow
14662306a36Sopenharmony_ci      - description: MTU5.TGRU input capture/compare match
14762306a36Sopenharmony_ci      - description: MTU5.TGRV input capture/compare match
14862306a36Sopenharmony_ci      - description: MTU5.TGRW input capture/compare match
14962306a36Sopenharmony_ci      - description: MTU6.TGRA input capture/compare match
15062306a36Sopenharmony_ci      - description: MTU6.TGRB input capture/compare match
15162306a36Sopenharmony_ci      - description: MTU6.TGRC input capture/compare match
15262306a36Sopenharmony_ci      - description: MTU6.TGRD input capture/compare match
15362306a36Sopenharmony_ci      - description: MTU6.TCNT overflow
15462306a36Sopenharmony_ci      - description: MTU7.TGRA input capture/compare match
15562306a36Sopenharmony_ci      - description: MTU7.TGRB input capture/compare match
15662306a36Sopenharmony_ci      - description: MTU7.TGRC input capture/compare match
15762306a36Sopenharmony_ci      - description: MTU7.TGRD input capture/compare match
15862306a36Sopenharmony_ci      - description: MTU7.TCNT overflow/underflow
15962306a36Sopenharmony_ci      - description: MTU8.TGRA input capture/compare match
16062306a36Sopenharmony_ci      - description: MTU8.TGRB input capture/compare match
16162306a36Sopenharmony_ci      - description: MTU8.TGRC input capture/compare match
16262306a36Sopenharmony_ci      - description: MTU8.TGRD input capture/compare match
16362306a36Sopenharmony_ci      - description: MTU8.TCNT overflow
16462306a36Sopenharmony_ci      - description: MTU8.TCNT underflow
16562306a36Sopenharmony_ci
16662306a36Sopenharmony_ci  interrupt-names:
16762306a36Sopenharmony_ci    items:
16862306a36Sopenharmony_ci      - const: tgia0
16962306a36Sopenharmony_ci      - const: tgib0
17062306a36Sopenharmony_ci      - const: tgic0
17162306a36Sopenharmony_ci      - const: tgid0
17262306a36Sopenharmony_ci      - const: tciv0
17362306a36Sopenharmony_ci      - const: tgie0
17462306a36Sopenharmony_ci      - const: tgif0
17562306a36Sopenharmony_ci      - const: tgia1
17662306a36Sopenharmony_ci      - const: tgib1
17762306a36Sopenharmony_ci      - const: tciv1
17862306a36Sopenharmony_ci      - const: tciu1
17962306a36Sopenharmony_ci      - const: tgia2
18062306a36Sopenharmony_ci      - const: tgib2
18162306a36Sopenharmony_ci      - const: tciv2
18262306a36Sopenharmony_ci      - const: tciu2
18362306a36Sopenharmony_ci      - const: tgia3
18462306a36Sopenharmony_ci      - const: tgib3
18562306a36Sopenharmony_ci      - const: tgic3
18662306a36Sopenharmony_ci      - const: tgid3
18762306a36Sopenharmony_ci      - const: tciv3
18862306a36Sopenharmony_ci      - const: tgia4
18962306a36Sopenharmony_ci      - const: tgib4
19062306a36Sopenharmony_ci      - const: tgic4
19162306a36Sopenharmony_ci      - const: tgid4
19262306a36Sopenharmony_ci      - const: tciv4
19362306a36Sopenharmony_ci      - const: tgiu5
19462306a36Sopenharmony_ci      - const: tgiv5
19562306a36Sopenharmony_ci      - const: tgiw5
19662306a36Sopenharmony_ci      - const: tgia6
19762306a36Sopenharmony_ci      - const: tgib6
19862306a36Sopenharmony_ci      - const: tgic6
19962306a36Sopenharmony_ci      - const: tgid6
20062306a36Sopenharmony_ci      - const: tciv6
20162306a36Sopenharmony_ci      - const: tgia7
20262306a36Sopenharmony_ci      - const: tgib7
20362306a36Sopenharmony_ci      - const: tgic7
20462306a36Sopenharmony_ci      - const: tgid7
20562306a36Sopenharmony_ci      - const: tciv7
20662306a36Sopenharmony_ci      - const: tgia8
20762306a36Sopenharmony_ci      - const: tgib8
20862306a36Sopenharmony_ci      - const: tgic8
20962306a36Sopenharmony_ci      - const: tgid8
21062306a36Sopenharmony_ci      - const: tciv8
21162306a36Sopenharmony_ci      - const: tciu8
21262306a36Sopenharmony_ci
21362306a36Sopenharmony_ci  clocks:
21462306a36Sopenharmony_ci    maxItems: 1
21562306a36Sopenharmony_ci
21662306a36Sopenharmony_ci  power-domains:
21762306a36Sopenharmony_ci    maxItems: 1
21862306a36Sopenharmony_ci
21962306a36Sopenharmony_ci  resets:
22062306a36Sopenharmony_ci    maxItems: 1
22162306a36Sopenharmony_ci
22262306a36Sopenharmony_ci  "#pwm-cells":
22362306a36Sopenharmony_ci    const: 2
22462306a36Sopenharmony_ci
22562306a36Sopenharmony_cirequired:
22662306a36Sopenharmony_ci  - compatible
22762306a36Sopenharmony_ci  - reg
22862306a36Sopenharmony_ci  - interrupts
22962306a36Sopenharmony_ci  - interrupt-names
23062306a36Sopenharmony_ci  - clocks
23162306a36Sopenharmony_ci  - power-domains
23262306a36Sopenharmony_ci  - resets
23362306a36Sopenharmony_ci
23462306a36Sopenharmony_ciadditionalProperties: false
23562306a36Sopenharmony_ci
23662306a36Sopenharmony_ciexamples:
23762306a36Sopenharmony_ci  - |
23862306a36Sopenharmony_ci    #include <dt-bindings/clock/r9a07g044-cpg.h>
23962306a36Sopenharmony_ci    #include <dt-bindings/interrupt-controller/arm-gic.h>
24062306a36Sopenharmony_ci
24162306a36Sopenharmony_ci    mtu3: timer@10001200 {
24262306a36Sopenharmony_ci      compatible = "renesas,r9a07g044-mtu3", "renesas,rz-mtu3";
24362306a36Sopenharmony_ci      reg = <0x10001200 0xb00>;
24462306a36Sopenharmony_ci      interrupts = <GIC_SPI 170 IRQ_TYPE_EDGE_RISING>,
24562306a36Sopenharmony_ci                   <GIC_SPI 171 IRQ_TYPE_EDGE_RISING>,
24662306a36Sopenharmony_ci                   <GIC_SPI 172 IRQ_TYPE_EDGE_RISING>,
24762306a36Sopenharmony_ci                   <GIC_SPI 173 IRQ_TYPE_EDGE_RISING>,
24862306a36Sopenharmony_ci                   <GIC_SPI 174 IRQ_TYPE_EDGE_RISING>,
24962306a36Sopenharmony_ci                   <GIC_SPI 175 IRQ_TYPE_EDGE_RISING>,
25062306a36Sopenharmony_ci                   <GIC_SPI 176 IRQ_TYPE_EDGE_RISING>,
25162306a36Sopenharmony_ci                   <GIC_SPI 177 IRQ_TYPE_EDGE_RISING>,
25262306a36Sopenharmony_ci                   <GIC_SPI 178 IRQ_TYPE_EDGE_RISING>,
25362306a36Sopenharmony_ci                   <GIC_SPI 179 IRQ_TYPE_EDGE_RISING>,
25462306a36Sopenharmony_ci                   <GIC_SPI 180 IRQ_TYPE_EDGE_RISING>,
25562306a36Sopenharmony_ci                   <GIC_SPI 181 IRQ_TYPE_EDGE_RISING>,
25662306a36Sopenharmony_ci                   <GIC_SPI 182 IRQ_TYPE_EDGE_RISING>,
25762306a36Sopenharmony_ci                   <GIC_SPI 183 IRQ_TYPE_EDGE_RISING>,
25862306a36Sopenharmony_ci                   <GIC_SPI 184 IRQ_TYPE_EDGE_RISING>,
25962306a36Sopenharmony_ci                   <GIC_SPI 185 IRQ_TYPE_EDGE_RISING>,
26062306a36Sopenharmony_ci                   <GIC_SPI 186 IRQ_TYPE_EDGE_RISING>,
26162306a36Sopenharmony_ci                   <GIC_SPI 187 IRQ_TYPE_EDGE_RISING>,
26262306a36Sopenharmony_ci                   <GIC_SPI 188 IRQ_TYPE_EDGE_RISING>,
26362306a36Sopenharmony_ci                   <GIC_SPI 189 IRQ_TYPE_EDGE_RISING>,
26462306a36Sopenharmony_ci                   <GIC_SPI 190 IRQ_TYPE_EDGE_RISING>,
26562306a36Sopenharmony_ci                   <GIC_SPI 191 IRQ_TYPE_EDGE_RISING>,
26662306a36Sopenharmony_ci                   <GIC_SPI 192 IRQ_TYPE_EDGE_RISING>,
26762306a36Sopenharmony_ci                   <GIC_SPI 193 IRQ_TYPE_EDGE_RISING>,
26862306a36Sopenharmony_ci                   <GIC_SPI 194 IRQ_TYPE_EDGE_RISING>,
26962306a36Sopenharmony_ci                   <GIC_SPI 195 IRQ_TYPE_EDGE_RISING>,
27062306a36Sopenharmony_ci                   <GIC_SPI 196 IRQ_TYPE_EDGE_RISING>,
27162306a36Sopenharmony_ci                   <GIC_SPI 197 IRQ_TYPE_EDGE_RISING>,
27262306a36Sopenharmony_ci                   <GIC_SPI 198 IRQ_TYPE_EDGE_RISING>,
27362306a36Sopenharmony_ci                   <GIC_SPI 199 IRQ_TYPE_EDGE_RISING>,
27462306a36Sopenharmony_ci                   <GIC_SPI 200 IRQ_TYPE_EDGE_RISING>,
27562306a36Sopenharmony_ci                   <GIC_SPI 201 IRQ_TYPE_EDGE_RISING>,
27662306a36Sopenharmony_ci                   <GIC_SPI 202 IRQ_TYPE_EDGE_RISING>,
27762306a36Sopenharmony_ci                   <GIC_SPI 203 IRQ_TYPE_EDGE_RISING>,
27862306a36Sopenharmony_ci                   <GIC_SPI 204 IRQ_TYPE_EDGE_RISING>,
27962306a36Sopenharmony_ci                   <GIC_SPI 205 IRQ_TYPE_EDGE_RISING>,
28062306a36Sopenharmony_ci                   <GIC_SPI 206 IRQ_TYPE_EDGE_RISING>,
28162306a36Sopenharmony_ci                   <GIC_SPI 207 IRQ_TYPE_EDGE_RISING>,
28262306a36Sopenharmony_ci                   <GIC_SPI 208 IRQ_TYPE_EDGE_RISING>,
28362306a36Sopenharmony_ci                   <GIC_SPI 209 IRQ_TYPE_EDGE_RISING>,
28462306a36Sopenharmony_ci                   <GIC_SPI 210 IRQ_TYPE_EDGE_RISING>,
28562306a36Sopenharmony_ci                   <GIC_SPI 211 IRQ_TYPE_EDGE_RISING>,
28662306a36Sopenharmony_ci                   <GIC_SPI 212 IRQ_TYPE_EDGE_RISING>,
28762306a36Sopenharmony_ci                   <GIC_SPI 213 IRQ_TYPE_EDGE_RISING>;
28862306a36Sopenharmony_ci      interrupt-names = "tgia0", "tgib0", "tgic0", "tgid0", "tciv0", "tgie0",
28962306a36Sopenharmony_ci                        "tgif0",
29062306a36Sopenharmony_ci                        "tgia1", "tgib1", "tciv1", "tciu1",
29162306a36Sopenharmony_ci                        "tgia2", "tgib2", "tciv2", "tciu2",
29262306a36Sopenharmony_ci                        "tgia3", "tgib3", "tgic3", "tgid3", "tciv3",
29362306a36Sopenharmony_ci                        "tgia4", "tgib4", "tgic4", "tgid4", "tciv4",
29462306a36Sopenharmony_ci                        "tgiu5", "tgiv5", "tgiw5",
29562306a36Sopenharmony_ci                        "tgia6", "tgib6", "tgic6", "tgid6", "tciv6",
29662306a36Sopenharmony_ci                        "tgia7", "tgib7", "tgic7", "tgid7", "tciv7",
29762306a36Sopenharmony_ci                        "tgia8", "tgib8", "tgic8", "tgid8", "tciv8", "tciu8";
29862306a36Sopenharmony_ci      clocks = <&cpg CPG_MOD R9A07G044_MTU_X_MCK_MTU3>;
29962306a36Sopenharmony_ci      power-domains = <&cpg>;
30062306a36Sopenharmony_ci      resets = <&cpg R9A07G044_MTU_X_PRESET_MTU3>;
30162306a36Sopenharmony_ci      #pwm-cells = <2>;
30262306a36Sopenharmony_ci    };
303