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. Theinstances: ^^Drop "The"quoted
+both GTEs instances get the timestamp from the system counter TSC which hasBothquoted
+31.25MHz clock rate, and the driver converts clock tick rate to nano secondsnanosecondsquoted
+before storing it as timestamp value. + +GPIO GTE +-------- + +This GTE instance timestamps GPIO in real time, for that to happen GPIOtime. Forquoted
+needs to be configured as input and IRQ needs to ba enabled. The only always onbequoted
+(AON) gpio controller instance supports timestamping GPIOs in realtime and itGPIO 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 latterquoted
+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``, whichspecified calls. Refer toquoted
+returns the timestamp in nano second.nanoseconds.quoted
+ +LIC IRQ GTE +----------- + +This GTE instance timestamp LIC IRQ lines in real time. There are 352 IRQtimestamps ^^^^^^^^^ {be consistent} (also (repeating a prior email) define "LIC")quoted
+lines which this instance can help timestamp realtime. The hte devicetreecan add timestamps to in realtime.quoted
+binding described at ``Documentation/devicetree/bindings/hte/`` gives outprovides anquoted
+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 isspecify the IRQ numberquoted
+no userspace consumer support for this GTE instance. The sample test code +hte-tegra194-irq-test.c, located in ``drivers/hte/`` directory,in thequoted
+demonstrates how to use IRQ GTE instance. The below is sample device treehow 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 atlocatedquoted
+``drivers/hte/hte-tegra194.c``. +