Skip to content

Commit 09574cc

Browse files
pateldipen1984-nvthierryreding
authored andcommitted
hte: Add Tegra194 HTE kernel provider
Tegra194 device has multiple HTE instances also known as GTE (Generic Hardware Timestamping Engine) which can timestamp subset of SoC lines and signals. This provider driver focuses on IRQ and GPIO lines and exposes timestamping ability on those lines to the consumers through HTE subsystem. Also, with this patch, added: - documentation about this provider and its capabilities at Documentation/hte. - Compilation support in Makefile and Kconfig Signed-off-by: Dipen Patel <[email protected]> Reported-by: kernel test robot <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent 31ab09b commit 09574cc

File tree

6 files changed

+815
-0
lines changed

6 files changed

+815
-0
lines changed

Documentation/hte/index.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.. SPDX-License-Identifier: GPL-2.0
2+
3+
============================================
4+
The Linux Hardware Timestamping Engine (HTE)
5+
============================================
6+
7+
The HTE Subsystem
8+
=================
9+
10+
.. toctree::
11+
:maxdepth: 1
12+
13+
hte
14+
15+
HTE Tegra Provider
16+
==================
17+
18+
.. toctree::
19+
:maxdepth: 1
20+
21+
tegra194-hte
22+

Documentation/hte/tegra194-hte.rst

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
.. SPDX-License-Identifier: GPL-2.0+
2+
3+
HTE Kernel provider driver
4+
==========================
5+
6+
Description
7+
-----------
8+
The Nvidia tegra194 HTE provider driver implements two GTE
9+
(Generic Timestamping Engine) instances: 1) GPIO GTE and 2) LIC
10+
(Legacy Interrupt Controller) IRQ GTE. Both GTE instances get the
11+
timestamp from the system counter TSC which has 31.25MHz clock rate, and the
12+
driver converts clock tick rate to nanoseconds before storing it as timestamp
13+
value.
14+
15+
GPIO GTE
16+
--------
17+
18+
This GTE instance timestamps GPIO in real time. For that to happen GPIO
19+
needs to be configured as input. The always on (AON) GPIO controller instance
20+
supports timestamping GPIOs in real time and it has 39 GPIO lines. The GPIO GTE
21+
and AON GPIO controller are tightly coupled as it requires very specific bits
22+
to be set in GPIO config register before GPIO GTE can be used, for that GPIOLIB
23+
adds two optional APIs as below. The GPIO GTE code supports both kernel
24+
and userspace consumers. The kernel space consumers can directly talk to HTE
25+
subsystem while userspace consumers timestamp requests go through GPIOLIB CDEV
26+
framework to HTE subsystem.
27+
28+
.. kernel-doc:: drivers/gpio/gpiolib.c
29+
:functions: gpiod_enable_hw_timestamp_ns gpiod_disable_hw_timestamp_ns
30+
31+
For userspace consumers, GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE flag must be
32+
specified during IOCTL calls. Refer to ``tools/gpio/gpio-event-mon.c``, which
33+
returns the timestamp in nanoseconds.
34+
35+
LIC (Legacy Interrupt Controller) IRQ GTE
36+
-----------------------------------------
37+
38+
This GTE instance timestamps LIC IRQ lines in real time. There are 352 IRQ
39+
lines which this instance can add timestamps to in real time. The hte
40+
devicetree binding described at ``Documentation/devicetree/bindings/hte/``
41+
provides an example of how a consumer can request an IRQ line. Since it is a
42+
one-to-one mapping with IRQ GTE provider, consumers can simply specify the IRQ
43+
number that they are interested in. There is no userspace consumer support for
44+
this GTE instance in the HTE framework.
45+
46+
The provider source code of both IRQ and GPIO GTE instances is located at
47+
``drivers/hte/hte-tegra194.c``. The test driver
48+
``drivers/hte/hte-tegra194-test.c`` demonstrates HTE API usage for both IRQ
49+
and GPIO GTE.

Documentation/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ needed).
139139
mhi/index
140140
tty/index
141141
peci/index
142+
hte/index
142143

143144
Architecture-agnostic documentation
144145
-----------------------------------

drivers/hte/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,15 @@ menuconfig HTE
1212

1313
If unsure, say no.
1414

15+
if HTE
16+
17+
config HTE_TEGRA194
18+
tristate "NVIDIA Tegra194 HTE Support"
19+
depends on ARCH_TEGRA_194_SOC
20+
help
21+
Enable this option for integrated hardware timestamping engine also
22+
known as generic timestamping engine (GTE) support on NVIDIA Tegra194
23+
systems-on-chip. The driver supports 352 LIC IRQs and 39 AON GPIOs
24+
lines for timestamping in realtime.
25+
26+
endif

drivers/hte/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
obj-$(CONFIG_HTE) += hte.o
2+
obj-$(CONFIG_HTE_TEGRA194) += hte-tegra194.o
23

0 commit comments

Comments
 (0)