Documentation/arch/mips/ingenic-tcu.rst
.. SPDX-License-Identifier: GPL-2.0
The Timer/Counter Unit (TCU) in Ingenic JZ47xx SoCs is a multi-function hardware block. It features up to eight channels, that can be used as counters, timers, or PWM.
JZ4725B, JZ4750, JZ4755 only have six TCU channels. The other SoCs all have eight channels.
JZ4725B introduced a separate channel, called Operating System Timer (OST). It is a 32-bit programmable timer. On JZ4760B and above, it is 64-bit.
Each one of the TCU channels has its own clock, which can be reparented to three different clocks (pclk, ext, rtc), gated, and reclocked, through their TCSR register.
Each TCU channel works in one of two modes:
The mode of each TCU channel depends on the SoC used:
Each channel can generate an interrupt. Some channels share an interrupt line, some don't, and this changes between SoC versions:
The functionalities of the TCU hardware are spread across multiple drivers:
=========== ===== clocks drivers/clk/ingenic/tcu.c interrupts drivers/irqchip/irq-ingenic-tcu.c timers drivers/clocksource/ingenic-timer.c OST drivers/clocksource/ingenic-ost.c PWM drivers/pwm/pwm-jz4740.c watchdog drivers/watchdog/jz4740_wdt.c =========== =====
Because various functionalities of the TCU that belong to different drivers and frameworks can be controlled from the same registers, all of these drivers access their registers through the same regmap.
For more information regarding the devicetree bindings of the TCU drivers, have a look at Documentation/devicetree/bindings/timer/ingenic,tcu.yaml.