tegra194-hte.rst 2.1 KB

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