Thread (32 messages) 32 messages, 5 authors, 2021-11-03

Re: [RFC v2 03/11] hte: Add tegra194 HTE kernel provider

From: Dipen Patel <dipenp@nvidia.com>
Date: 2021-11-03 01:15:06
Also in: linux-doc, linux-gpio, linux-tegra, lkml

Hi Randy,

Thanks for the comments. I will implement changes in RFC V3.

Best Regards,

Dipen Patel

On 10/1/21 5:07 PM, Randy Dunlap wrote:
On 9/30/21 4:26 PM, Dipen Patel wrote:
quoted
diff --git a/Documentation/hte/tegra194-hte.rst b/Documentation/hte/tegra194-hte.rst
new file mode 100644
index 000000000000..fb229bda2408
--- /dev/null
+++ b/Documentation/hte/tegra194-hte.rst
@@ -0,0 +1,56 @@
+HTE Kernel provider driver
+==========================
+
+Description
+-----------
+The Nvidia tegra194 HTE provider driver implements two GTE
+(Generic Timestamping Engine) instances 1) GPIO GTE and 2) LIC IRQ GTE. The
                                 instances:                                ^^Drop "The"
quoted
+both GTEs instances get the timestamp from the system counter TSC which has
   Both
quoted
+31.25MHz clock rate, and the driver converts clock tick rate to nano seconds
                                                                   nanoseconds
quoted
+before storing it as timestamp value.
+
+GPIO GTE
+--------
+
+This GTE instance timestamps GPIO in real time, for that to happen GPIO
                                             time. For
quoted
+needs to be configured as input and IRQ needs to ba enabled. The only always on
                                                    be
quoted
+(AON) gpio controller instance supports timestamping GPIOs in realtime and it
         GPIO                                                    real time {or change
                           the instance 3 lines above to be "realtime"}
quoted
+has 39 GPIO lines. The GPIO GTE and AON GPIO controller are tightly coupled as
+it requires very specific bits to be set in GPIO config register before GPIO> +GTE can be used. The GPIO GTE functionality is accessed from the GPIOLIB
+framework for the in kernel and userspace consumers. In the later case,
                     in-kernel                                 latter
quoted
+requests go through GPIOLIB CDEV framework. The below APIs are added in GPIOLIB
+framework to access HTE subsystem and GPIO GTE.
+
+.. kernel-doc:: drivers/gpio/gpiolib.c
+   :functions: gpiod_req_hw_timestamp_ns gpiod_rel_hw_timestamp_ns
+
+There is hte-tegra194-gpio-test.c, located in ``drivers/hte/`` directory, test
+driver which demonstrates above APIs for the Jetson AGX platform.
+
+For userspace consumers, GPIO_V2_LINE_FLAG_EVENT_CLOCK_HARDWARE flag must be
+specifed during IOCTL calls, refer ``tools/gpio/gpio-event-mon.c``, which
   specified             calls. Refer to
quoted
+returns the timestamp in nano second.
                            nanoseconds.
quoted
+
+LIC IRQ GTE
+-----------
+
+This GTE instance timestamp LIC IRQ lines in real time. There are 352 IRQ
                     timestamps                 ^^^^^^^^^ {be consistent}
  (also (repeating a prior email) define "LIC")
quoted
+lines which this instance can help timestamp realtime. The hte devicetree
                             can add timestamps to in realtime.
quoted
+binding described at ``Documentation/devicetree/bindings/hte/`` gives out
                                                                   provides an
quoted
+example how consumer can request IRQ line, since it is one to one mapping,
   example of how a consumer can request an IRQ line. Since it is a one-to-one mapping,
quoted
+consumers can simply specify IRQ number that they are interested in. There is
                        specify the IRQ number
quoted
+no userspace consumer support for this GTE instance. The sample test code
+hte-tegra194-irq-test.c, located in ``drivers/hte/`` directory,
                                    in the
quoted
+demonstrates how to use IRQ GTE instance. The below is sample device tree
                how to use an IRQ GTE instance.
quoted
+snippet code for the test driver::
+
+ tegra_hte_irq_test {
+        compatible = "nvidia,tegra194-hte-irq-test";
+        htes = <&tegra_hte_lic 0x19>;
+        hte-names = "hte-lic";
+ };
+
+The provider source code of both IRQ and GPIO GTE instances is locate at
                                                                  located
quoted
+``drivers/hte/hte-tegra194.c``.
+
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help