Skip to content

Commit 994aa99

Browse files
rootroot
authored andcommitted
feat: Linux: drivers: Add initial DM-Timer documentation
This patch adds initial documentation for DM-Timer found on K3 SoCs. Signed-off-by: "Judith Mendez <[email protected]>"
1 parent f462d72 commit 994aa99

File tree

7 files changed

+145
-0
lines changed

7 files changed

+145
-0
lines changed

configs/AM62AX/AM62AX_linux_toc.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ linux/Foundational_Components/Kernel/Kernel_Drivers/PWM
7070
linux/Foundational_Components/Kernel/Kernel_Drivers/SPI
7171
linux/Foundational_Components/Kernel/Kernel_Drivers/QSPI
7272
linux/Foundational_Components/Kernel/Kernel_Drivers/Storage/MMC-SD
73+
linux/Foundational_Components/Kernel/Kernel_Drivers/DM-Timer
7374
linux/Foundational_Components/Kernel/Kernel_Drivers/UART
7475
linux/Foundational_Components/Kernel/Kernel_Drivers/UBIFS
7576
linux/Foundational_Components/Kernel/Kernel_Drivers/USB/AM62_DWC3

configs/AM62PX/AM62PX_linux_toc.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ linux/Foundational_Components/Kernel/Kernel_Drivers/SPI
7373
linux/Foundational_Components/Kernel/Kernel_Drivers/QSPI
7474
linux/Foundational_Components/Kernel/Kernel_Drivers/Storage/MMC-SD
7575
linux/Foundational_Components/Kernel/Kernel_Drivers/Storage/NAND
76+
linux/Foundational_Components/Kernel/Kernel_Drivers/DM-Timer
7677
linux/Foundational_Components/Kernel/Kernel_Drivers/UART
7778
linux/Foundational_Components/Kernel/Kernel_Drivers/UBIFS
7879
linux/Foundational_Components/Kernel/Kernel_Drivers/USB/AM62_DWC3

configs/AM62X/AM62X_linux_toc.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ linux/Foundational_Components/Kernel/Kernel_Drivers/SPI
7272
linux/Foundational_Components/Kernel/Kernel_Drivers/QSPI
7373
linux/Foundational_Components/Kernel/Kernel_Drivers/Storage/MMC-SD
7474
linux/Foundational_Components/Kernel/Kernel_Drivers/Storage/NAND
75+
linux/Foundational_Components/Kernel/Kernel_Drivers/DM-Timer
7576
linux/Foundational_Components/Kernel/Kernel_Drivers/UART
7677
linux/Foundational_Components/Kernel/Kernel_Drivers/UBIFS
7778
linux/Foundational_Components/Kernel/Kernel_Drivers/USB/AM62_DWC3

configs/AM64X/AM64X_linux_toc.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ linux/Foundational_Components/Kernel/Kernel_Drivers/SERDES/SERDES
6464
linux/Foundational_Components/Kernel/Kernel_Drivers/QSPI
6565
linux/Foundational_Components/Kernel/Kernel_Drivers/Storage/MMC-SD
6666
linux/Foundational_Components/Kernel/Kernel_Drivers/Storage/NAND
67+
linux/Foundational_Components/Kernel/Kernel_Drivers/DM-Timer
6768
linux/Foundational_Components/Kernel/Kernel_Drivers/UART
6869
linux/Foundational_Components/Kernel/Kernel_Drivers/UBIFS
6970
linux/Foundational_Components/Kernel/Kernel_Drivers/USB/CDNS3
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
########
2+
DM TIMER
3+
########
4+
5+
- This guide covers a general overview on DM Timer.
6+
It supports timers found on TI's |__PART_FAMILY_NAME__| SoCs.
7+
8+
- Each timer contains a free-running upward counter with autoreload capability on overflow.
9+
Each timer includes compare logic to allow an interrupt event on a programmable counter
10+
matching value. A dedicated output signal can be pulsed/toggled on an overflow or a match
11+
event. This offers time-stamp trigger signaling or PWM signal sources. A dedicated input
12+
signal can be used to trigger an automatic timer counter capture or an interrupt event on a
13+
programmable input signal transition.
14+
15+
- Each timer comes with pins that can be used as Timer Capture interrupts
16+
or as timer PWM outputs.
17+
18+
- For more detailed information on timers, please refer to the:
19+
``Peripherals/Timer Modules/Timers`` section of the device specific TRM.
20+
21+
**************
22+
Driver Sources
23+
**************
24+
25+
- Driver source location: :file:`drivers/clocksource/ti,timer-dm.c`
26+
- Binding source location: :file:`Documentation/device-tree/bindings/timer/ti,timer-dm.yaml`
27+
28+
PWM mode:
29+
30+
- Driver source location: :file:`drivers/pwm/pwm-omap-dmtimer.c`
31+
- Binding source location: :file:`Documentation/devicetree/bindings/pwm/pwm-omap-dmtimer.txt`
32+
33+
********************
34+
Kernel Configuration
35+
********************
36+
37+
Configs to be enabled in kernel:
38+
39+
.. code-block:: menuconfig
40+
41+
Device Drivers --->
42+
-> Clock Source drivers
43+
-> OMAP dual-mode timer driver (OMAP_DM_TIMER [=y])
44+
45+
PWM mode:
46+
47+
.. code-block:: menuconfig
48+
49+
Device Drivers --->
50+
Pulse-Width Modulation (PWM) Support (PWM [=y])
51+
-> OMAP Dual-Mode Timer PWM support (PWM_OMAP_DMTIMER [=m])
52+
53+
.. rubric:: Device tree configuration example
54+
55+
In this example, we take am62x SK DT node as an example. In general all the timer nodes
56+
should be described in its appropriate domain .dtsi file, for example the following node
57+
can be found in k3-am62-main.dtsi:
58+
59+
.. code-block:: dts
60+
61+
main_timer3: timer@2430000 {
62+
compatible = "ti,am654-timer";
63+
reg = <0x00 0x2430000 0x00 0x400>;
64+
interrupts = <GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>;
65+
clocks = <&k3_clks 39 2>;
66+
clock-names = "fck";
67+
assigned-clocks = <&k3_clks 39 2>;
68+
assigned-clock-parents = <&k3_clks 39 3>;
69+
power-domains = <&k3_pds 39 TI_SCI_PD_EXCLUSIVE>;
70+
ti,timer-pwm;
71+
};
72+
73+
PWM mode:
74+
75+
The "ti,timer-pwm" DT attribute is required in the timer node in order to use this timer instance
76+
in PWM mode, if the timer supports PWM mode.
77+
78+
An additional DT node is required to enable timer in PWM mode as shown below. The
79+
``main_timer3_pins_default`` is also required and not listed here, use sysconfig tool to get pinumux
80+
configuration.
81+
82+
.. code-block:: dts
83+
84+
main_pwm3: dmtimer-main-pwm-3 {
85+
compatible = "ti,omap-dmtimer-pwm";
86+
#pwm-cells = <3>;
87+
ti,timers = <&main_timer3>;
88+
pinctrl-names = "default";
89+
pinctrl-0 = <&main_timer3_pins_default>;
90+
};
91+
92+
************
93+
Driver Usage
94+
************
95+
96+
For information on using DM timer in non-PWM mode, please refer to the detailed
97+
descriptions in the TRM ``Timers Functional Description`` and ``Low-Level Programming Models``
98+
under ``Peripherals/Timers Modules/Timers``.
99+
100+
Timers in non-PWM mode should be enabled by default in Linux DT.
101+
102+
.. ifconfig:: CONFIG_part_variant in ('AM62X', 'AM62AX', 'AM62PX')
103+
104+
In MAIN domain:
105+
106+
- 8 DM timers in MAIN domain
107+
108+
In MCU domain:
109+
110+
- 4 DM timers in MCU domain
111+
112+
.. ifconfig:: CONFIG_part_variant in ('AM64X')
113+
114+
In MAIN domain:
115+
116+
- 12 DM timers in MAIN domain
117+
118+
In MCU domain:
119+
120+
- 4 DM timers in MCU domain
121+
122+
PWM mode
123+
124+
Once the driver is probed, each device is exposed as a PWM device
125+
by kernel to be used by userspace in :file:`/sys/class/pwm`.
126+
127+
For controlling the PWM chip via sysfs interface please refer to the official Linux
128+
documentation: `here <https://docs.kernel.org/driver-api/pwm.html#using-pwms-with-the-sysfs-interface>`__
129+
or go to :ref:`Using-PWM-with-sysfs`.
130+
131+
********
132+
Examples
133+
********
134+
135+
To enable DM timer in PWM mode, there is an example DT overlay found in
136+
Linux source: :file:`arch/arm64/boot/dts/ti/k3-am62x-sk-dmtimer-pwm.dtso`
137+
that applied for am62x family devices and can be referenced for other K3
138+
Sitara devices.

source/linux/Foundational_Components/Kernel/Kernel_Drivers/PWM.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ of the Pulse-Width Modulation Subsystem (PWMSS).
4646
.. rubric:: Driver Usage
4747
:name: driver-usage-pwm
4848

49+
.. _Using-PWM-with-sysfs:
50+
4951
.. rubric:: Using PWM with the sysfs interface
5052
:name: using-pwm-with-sysfs-interface
5153

source/linux/Foundational_Components_Kernel_Drivers.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Kernel Drivers
4040
Foundational_Components/Kernel/Kernel_Drivers/Storage/SATA
4141
Foundational_Components/Kernel/Kernel_Drivers/Storage/NAND
4242
Foundational_Components/Kernel/Kernel_Drivers/Storage/MMC-SD
43+
Foundational_Components/Kernel/Kernel_Drivers/DM-Timer
4344
Foundational_Components/Kernel/Kernel_Drivers/UART
4445
Foundational_Components/Kernel/Kernel_Drivers/UBIFS
4546
Foundational_Components/Kernel/Kernel_Drivers/UFS

0 commit comments

Comments
 (0)