Back to home page

OSCL-LXR

 
 

    


0001 .. SPDX-License-Identifier: GPL-2.0+
0002 
0003 HTE Kernel provider driver
0004 ==========================
0005 
0006 Description
0007 -----------
0008 The Nvidia tegra194 HTE provider driver implements two GTE
0009 (Generic Timestamping Engine) instances: 1) GPIO GTE and 2) LIC
0010 (Legacy Interrupt Controller) IRQ GTE. Both GTE instances get the
0011 timestamp from the system counter TSC which has 31.25MHz clock rate, and the
0012 driver converts clock tick rate to nanoseconds before storing it as timestamp
0013 value.
0014 
0015 GPIO GTE
0016 --------
0017 
0018 This GTE instance timestamps GPIO in real time. For that to happen GPIO
0019 needs to be configured as input. The always on (AON) GPIO controller instance
0020 supports timestamping GPIOs in real time and it has 39 GPIO lines. The GPIO GTE
0021 and AON GPIO controller are tightly coupled as it requires very specific bits
0022 to be set in GPIO config register before GPIO GTE can be used, for that GPIOLIB
0023 adds two optional APIs as below. The GPIO GTE code supports both kernel
0024 and userspace consumers. The kernel space consumers can directly talk to HTE
0025 subsystem while userspace consumers timestamp requests go through GPIOLIB CDEV
0026 framework to HTE subsystem.
0027 
0028 See gpiod_enable_hw_timestamp_ns() and gpiod_disable_hw_timestamp_ns().
0029 
0030 For userspace consumers, GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE flag must be
0031 specified during IOCTL calls. Refer to ``tools/gpio/gpio-event-mon.c``, which
0032 returns the timestamp in nanoseconds.
0033 
0034 LIC (Legacy Interrupt Controller) IRQ GTE
0035 -----------------------------------------
0036 
0037 This GTE instance timestamps LIC IRQ lines in real time. There are 352 IRQ
0038 lines which this instance can add timestamps to in real time. The hte
0039 devicetree binding described at ``Documentation/devicetree/bindings/timestamp``
0040 provides an example of how a consumer can request an IRQ line. Since it is a
0041 one-to-one mapping with IRQ GTE provider, consumers can simply specify the IRQ
0042 number that they are interested in. There is no userspace consumer support for
0043 this GTE instance in the HTE framework.
0044 
0045 The provider source code of both IRQ and GPIO GTE instances is located at
0046 ``drivers/hte/hte-tegra194.c``. The test driver
0047 ``drivers/hte/hte-tegra194-test.c`` demonstrates HTE API usage for both IRQ
0048 and GPIO GTE.