Skip to contentSkip to conversation

Provides support for Trigger Generation Unit

PATCH In review Songwei Chai 3 participants 15 messages May 29, 2025 – Jun 27, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v5 cover Provides support for Trigger Generation Unit

Provide support for the TGU (Trigger Generation Unit), which can be utilized to sense a plurality of signals and create a trigger into the CTI or generate interrupts to processors once the input signal meets the conditions. We can treat the TGU’s workflow as a flowsheet, it has some “steps” regions for customization. In each step region, we can set the signals that we want with priority in priority_group, set the conditions in each step via condition_decode, and set the resultant action by condition_select. Meanwhile, some TGUs (not all) also provide timer/counter functionality. Based on the characteristics described above, we consider the TGU as a helper in the CoreSight subsystem. Its master device is the TPDM, which can transmit signals from other subsystems, and we reuse the existing ports mechanism to link the TPDM to the connected TGU.

Here is a detailed example to explain how to use the TGU:

In this example, the TGU is configured to use 2 conditions, 2 steps, and the timer. The goal is to look for one of two patterns which are generated from TPDM, giving priority to one, and then generate a trigger once the timer reaches a certain value. In other words, two conditions are used for the first step to look for the two patterns, where the one with the highest priority is used in the first condition. Then, in the second step, the timer is enabled and set to be compared to the given value at each clock cycle. These steps are better shown below.

            |-----------------|
            |                 |
            |       TPDM      |
            |                 |
            |-----------------|
                     |
                     |
  --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ------
  |                  |                                                 |
  |                  |                          |--------------------| |
  |    |---- --->    |                          |  Go to next steps  | |
  |    |             |                |--- ---> |  Enable timer      | |
  |    |             v                |         |                    | |
  |    |    |-----------------|       |         |--------------------| |
  |    |    |                 |  Yes  |                    |           |
  |    |    |   inputs==0xB   | ----->|                    | <-------- |
  |    |    |                 |       |                    |      No | |
  | No |    |-----------------|       |                    v         | |
  |    |             |                |          |-----------------| | |
  |    |             |                |          |                 | | |
  |    |             |                |          |      timer>=3   |-- |
  |    |             v                |          |                 |   |
  |    |    |-----------------|       |          |-----------------|   |
  |    |    |                 |  Yes  |                    |           |
  |    |--- |   inputs==0xA   | ----->|                    | Yes       |
  |         |                 |                            |           |
  |         |-----------------|                            v           |
  |                                              |-----------------|   |
  |                                              |                 |   |
  |                                              |      Trigger    |   |
  |                                              |                 |   |
  |                                              |-----------------|   |
  |  TGU                                                   |           |
  |--- --- --- --- --- --- --- --- --- --- --- --- --- --- |--- --- -- |
                                                           |

v
|-----------------| |The controllers |
|which will use |
|triggers further | |-----------------|

steps:
1. Reset TGU /*it will disable tgu and reset dataset*/
- echo 1 > /sys/bus/coresight/devices/<tgu-name>/reset_tgu

2. Set the pattern match for priority0 to 0xA = 0b1010 and for priority 1 to 0xB = 0b1011.
- echo 0x11113232 > /sys/bus/coresight/devices/<tgu-name>/step0_priority0/reg0
- echo 0x11113233 > /sys/bus/coresight/devices/<tgu-name>/step0_priority1/reg0

Note:
Bit distribution diagram for each priority register
|-------------------------------------------------------------------|
| Bits | Field Nam | Description |
|-------------------------------------------------------------------|
| | | 00 = bypass for OR output |
| 29:28 | SEL_BIT7_TYPE2 | 01 = bypass for AND output |
| | | 10 = sense input '0' is true|
| | | 11 = sense input '1' is true|
|-------------------------------------------------------------------|
| | | 00 = bypass for OR output |
| 25:24 | SEL_BIT6_TYPE2 | 01 = bypass for AND output |
| | | 10 = sense input '0' is true|
| | | 11 = sense input '1' is true|
|-------------------------------------------------------------------|
| | | 00 = bypass for OR output |
| 21:20 | SEL_BIT5_TYPE2 | 01 = bypass for AND output |
| | | 10 = sense input '0' is true|
| | | 11 = sense input '1' is true|
|-------------------------------------------------------------------|
| | | 00 = bypass for OR output |
| 17:16 | SEL_BIT4_TYPE2 | 01 = bypass for AND output |
| | | 10 = sense input '0' is true|
| | | 11 = sense input '1' is true|
|-------------------------------------------------------------------|
| | | 00 = bypass for OR output |
| 13:12 | SEL_BIT3_TYPE2 | 01 = bypass for AND output |
| | | 10 = sense input '0' is true|
| | | 11 = sense input '1' is true|
|-------------------------------------------------------------------|
| | | 00 = bypass for OR output |
| 9:8 | SEL_BIT2_TYPE2 | 01 = bypass for AND output |
| | | 10 = sense input '0' is true|
| | | 11 = sense input '1' is true|
|-------------------------------------------------------------------|
| | | 00 = bypass for OR output |
| 5:4 | SEL_BIT1_TYPE2 | 01 = bypass for AND output |
| | | 10 = sense input '0' is true|
| | | 11 = sense input '1' is true|
|-------------------------------------------------------------------|
| | | 00 = bypass for OR output |
| 1:0 | SEL_BIT0_TYPE2 | 01 = bypass for AND output |
| | | 10 = sense input '0' is true|
| | | 11 = sense input '1' is true|
|-------------------------------------------------------------------|
These bits are used to identify the signals we want to sense, with a maximum signal number of 140. For example, to sense the signal 0xA (binary 1010), we set the value of bits 0 to 13 to 3232, which represents 1010. The remaining bits are set to 1, as we want to use AND gate to summarize all the signals we want to sense here. For rising or falling edge detection of any input to the priority, set the remaining bits to 0 to use an OR gate.

3. look for the pattern for priority_i i=0,1.
- echo 0x3 > /sys/bus/coresight/devices/<tgu-name>/step0_condition_decode/reg0
- echo 0x30 > /sys/bus/coresight/devices/<tgu-name>/step0_condition_decode/reg1

|-------------------------------------------------------------------------------|
| Bits | Field Nam | Description |
|-------------------------------------------------------------------------------|
| | |For each decoded condition, this |
| 24 | NOT |inverts the output. If the condition |
| | |decodes to true, and the NOT field |
| | |is '1', then the output is NOT true. |
|-------------------------------------------------------------------------------|
| | |When '1' the output from the associated|
| 21 | BC0_COMP_ACTIVE |comparator will be actively included in|
| | |the decoding of this particular |
| | |condition. |
|-------------------------------------------------------------------------------|
| | |When '1' the output from the associated|
| | |comparator will need to be 1 to affect |
| 20 | BC0_COMP_HIGH |the decoding of this condition. |
| | |Conversely, a '0' here requires a '0' |
| | |from the comparator |
|-------------------------------------------------------------------------------|
| | |When '1' the output from the associated|
| 17 | |comparator will be actively included in|
| | TC0_COMP_ACTIVE |the decoding of this particular |
| | |condition. |
|-------------------------------------------------------------------------------|
| | |When '1' the output from the associated|
| | |comparator will need to be 1 to affect |
| 16 | TC0_COMP_HIGH |the decoding of this particular |
| | |condition.Conversely, a 0 here |
| | |requires a '0' from the comparator |
|-------------------------------------------------------------------------------|
| | |When '1' the output from Priority_n |
| | |OR logic will be actively |
| 4n+3 | Priority_n_OR_ACTIVE|included in the decoding of |
| | (n=0,1,2,3) |this particular condition. |
| | | |
|-------------------------------------------------------------------------------|
| | |When '1' the output from Priority_n |
| | |will need to be '1' to affect the |
| 4n+2 | Priority_n_OR_HIGH |decoding of this particular |
| | (n=0,1,2,3) |condition. Conversely, a '0' here |
| | |requires a '0' from Priority_n OR logic|
|-------------------------------------------------------------------------------|
| | |When '1' the output from Priority_n |
| | |AND logic will be actively |
| 4n+1 |Priority_n_AND_ACTIVE|included in the decoding of this |
| | (n=0,1,2,3) |particular condition. |
| | | |
|-------------------------------------------------------------------------------|
| | |When '1' the output from Priority_n |
| | |AND logic will need to be '1' to |
| 4n | Priority_n_AND_HIGH |affect the decoding of this |
| | (n=0,1,2,3) |particular condition. Conversely, |
| | |a '0' here requires a '0' from |
| | |Priority_n AND logic. |
|-------------------------------------------------------------------------------|
Since we use priority_0 and priority_1 with an AND output in step 2, we set 0x3 and 0x30 here to activate them.

4. Set NEXT_STEP = 1 and TC0_ENABLE = 1 so that when the conditions are met then the next step will be step 1 and the timer will be enabled.
- echo 0x20008 > /sys/bus/coresight/devices/<tgu-name>/step0_condition_select/reg0
- echo 0x20008 > /sys/bus/coresight/devices/<tgu-name>/step0_condition_select/reg1

|-----------------------------------------------------------------------------|
| Bits | Field Nam | Description |
|-----------------------------------------------------------------------------|
| | |This field defines the next step the |
| 18:17 | NEXT_STEP |TGU will 'goto' for the associated |
| | |Condition and Step. |
|-----------------------------------------------------------------------------|
| | |For each possible output trigger |
| 13 | TRIGGER |available, set a '1' if you want |
| | |the trigger to go active for the |
| | |associated condition and Step. |
|-----------------------------------------------------------------------------|
| | |This will cause BC0 to increment if the|
| 9 | BC0_INC |associated Condition is decoded for |
| | |this step. |
|-----------------------------------------------------------------------------|
| | |This will cause BC0 to decrement if the|
| 8 | BC0_DEC |associated Condition is decoded for |
| | |this step. |
|-----------------------------------------------------------------------------|
| | |This will clear BC0 count value to 0 if|
| 7 | BC0_CLEAR |the associated Condition is decoded |
| | |for this step. |
|-----------------------------------------------------------------------------|
| | |This will cause TC0 to increment until |
| 3 | TC0_ENABLE |paused or cleared if the associated |
| | |Condition is decoded for this step. |
|-----------------------------------------------------------------------------|
| | |This will cause TC0 to pause until |
| 2 | TC0_PAUSE |enabled if the associated Condition |
| | |is decoded for this step. |
|-----------------------------------------------------------------------------|
| | |This will clear TC0 count value to 0 |
| 1 | TC0_CLEAR |if the associated Condition is |
| | |decoded for this step. |
|-----------------------------------------------------------------------------|
| | |This will set the done signal to the |
| 0 | DONE |TGU FSM if the associated Condition |
| | |is decoded for this step. |
|-----------------------------------------------------------------------------| Based on the distribution diagram, we set 0x20008 for priority0 and priority1 to achieve "jump to step 1 and enable TC0" once the signal is sensed.

5. activate the timer comparison for this step.
- echo 0x30000 > /sys/bus/coresight/devices/<tgu-name>/step1_condition_decode/reg0

|-------------------------------------------------------------------------------|
| | |When '1' the output from the associated|
| 17 | |comparator will be actively included in|
| | TC0_COMP_ACTIVE |the decoding of this particular |
| | |condition. |
|-------------------------------------------------------------------------------|
| | |When '1' the output from the associated|
| | |comparator will need to be 1 to affect |
| 16 | TC0_COMP_HIGH |the decoding of this particular |
| | |condition.Conversely, a 0 here |
| | |requires a '0' from the comparator |
|-------------------------------------------------------------------------------| Accroding to the decode distribution diagram , we give 0x30000 here to set 16th&17th bit to enable timer comparison.

6. Set the NEXT_STEP = 0 and TC0_PAUSE = 1 and TC0_CLEAR = 1 once the timer has reached the given value.
- echo 0x6 > /sys/bus/coresight/devices/<tgu-name>/step1_condition_select/reg0

7. Enable Trigger 0 for TGU when the condition 0 is met in step1, i.e. when the timer reaches 3.
- echo 0x2000 > /sys/bus/coresight/devices/<tgu-name>/step1_condition_select/default

Note:
1. 'default' register allows for establishing the resultant action for the default condition

2. Trigger:For each possible output trigger available from the Design document, there are three triggers: interrupts, CTI, and Cross-TGU mapping.All three triggers can occur, but the choice of which trigger to use depends on the user's needs.

8. Compare the timer to 3 in step 1.
- echo 0x3 > /sys/bus/coresight/devices/<tgu-name>/step1_timer/reg0

9. enale tgu
- echo 1 > /sys/bus/coresight/devices/<tgu-name>/enable_tgu

---
Link to V4: https://patchwork.kernel.org/project/linux-arm-msm/cover/[email protected]/

Changes in V5:
- Update publish date and kernel_version in "sysfs-bus-coresight-devices-tgu"
---
Link to V3: https://lore.kernel.org/all/[email protected]/

Changes in V4:
- Add changlog in coverletter.
- Correct 'year' in Copyright in patch1.
- Correct port mechansim description in patch1.
- Remove 'tgu-steps','tgu-regs','tgu-conditions','tgu-timer-counters' from dt-binding and set them through reading DEVID register as per Mike's suggestion.
- Modify tgu_disable func to make it have single return point in patch2 as per Mike's suggestion.
- Use sysfs_emit in enable_tgu_show func in ptach2.
- Remove redundant judgement in enable_tgu_store in patch2.
- Correct typo in description in patch3.
- Set default ret as SYSFS_GROUP_INVISIBLE, and returnret at end in pacth3 as per Mike's suggestion.
- Remove tgu_dataset_ro definition in patch3
- Use #define constants with explanations of what they are rather than arbitrary magic numbers in patch3 and patch4.
- Check -EINVAL before using 'calculate_array_location()' in array in patch4.
- Add 'default' in 'tgu_dataset_show''s switch part in patch4.
- Document the value needed to initiate the reset in pacth7.
- Check "value" in 'reset_tgu_store' and bail out with an error code if 0 in patch7.
- Remove dev_dbg in 'reset_tgu_store' in patch7.
---
Link to V2: https://lore.kernel.org/all/[email protected]/

Changes in V3:
- Correct typo and format in dt-binding in patch1
- Rebase to the latest kernel version
---
Link to V1: https://lore.kernel.org/all/[email protected]/

Changes in V2:
- Use real name instead of login name,
- Correct typo and format in dt-binding and code.
- Bring order in tgu_prob(declarations with and without assignments) as per
Krzysztof's suggestion.
- Add module device table in patch2.
- Set const for tgu_common_grp and tgu_ids in patch2.
- Initialize 'data' in tgu_ids to fix the warning in pacth2.
---

Songwei Chai (7):
dt-bindings: arm: Add support for Coresight TGU trace
coresight: Add coresight TGU driver
coresight-tgu: Add signal priority support
coresight-tgu: Add TGU decode support
coresight-tgu: add support to configure next action
coresight-tgu: add timer/counter functionality for TGU
coresight-tgu: add reset node to initialize

 .../testing/sysfs-bus-coresight-devices-tgu   |  51 ++
 .../bindings/arm/qcom,coresight-tgu.yaml      |  92 +++
 drivers/hwtracing/coresight/Kconfig           |  11 +
 drivers/hwtracing/coresight/Makefile          |   1 +
 drivers/hwtracing/coresight/coresight-tgu.c   | 780 ++++++++++++++++++
 drivers/hwtracing/coresight/coresight-tgu.h   | 255 ++++++
 6 files changed, 1190 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-coresight-devices-tgu
 create mode 100644 Documentation/devicetree/bindings/arm/qcom,coresight-tgu.yaml
 create mode 100644 drivers/hwtracing/coresight/coresight-tgu.c
 create mode 100644 drivers/hwtracing/coresight/coresight-tgu.h
#1 lore raw

PATCH v5 1/7 dt-bindings: arm: Add support for Coresight TGU trace

The Trigger Generation Unit (TGU) is designed to detect patterns or sequences within a specific region of the System on Chip (SoC). Once configured and activated, it monitors sense inputs and can detect a pre-programmed state or sequence across clock cycles, subsequently producing a trigger.

TGU configuration space
offset table
x-------------------------x

 |                         |
 |                         |
 |                         |                           Step configuration
 |                         |                             space layout
 |   coresight management  |                           x-------------x
 |        registers        |                     |---> |             |
 |                         |                     |     |  reserve    |
 |                         |                     |     |             |
 |-------------------------|                     |     |-------------|
 |                         |                     |     | priority[3] |
 |         step[7]         |<--                  |     |-------------|
 |-------------------------|   |                 |     | priority[2] |
 |                         |   |                 |     |-------------|
 |           ...           |   |Steps region     |     | priority[1] |
 |                         |   |                 |     |-------------|
 |-------------------------|   |                 |     | priority[0] |
 |                         |<--                  |     |-------------|
 |         step[0]         |-------------------->      |             |
 |-------------------------|                           |  condition  |
 |                         |                           |             |
 |     control and status  |                           x-------------x
 |           space         |                           |             |
 x-------------------------x                           |Timer/Counter|
                                                       |             |
						       x-------------x

TGU Configuration in Hardware

The TGU provides a step region for user configuration, similar to a flow chart. Each step region consists of three register clusters:

1.Priority Region: Sets the required signals with priority. 2.Condition Region: Defines specific requirements (e.g., signal A reaches three times) and the subsequent action once the requirement is met.
3.Timer/Counter (Optional): Provides timing or counting functionality.

Add a new coresight-tgu.yaml file to describe the bindings required to define the TGU in the device trees.

---
 .../bindings/arm/qcom,coresight-tgu.yaml      | 92 +++++++++++++++++++
 1 file changed, 92 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/qcom,coresight-tgu.yaml
Documentation/devicetree/bindings/arm/qcom,coresight-tgu.yaml new file +92 -0
new file mode 100644
index 000000000000..3576d3871126
@@ -0,0 +1,92 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+# Copyright (c) 2025 Qualcomm Innovation Center, Inc. All rights reserved.
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/arm/qcom,coresight-tgu.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Trigger Generation Unit - TGU
+
+description: |
+  The Trigger Generation Unit (TGU) is a Data Engine which can be utilized
+  to sense a plurality of signals and create a trigger into the CTI or
+  generate interrupts to processors. The TGU is like the trigger circuit
+  of a Logic Analyzer. The corresponding trigger logic can be realized by
+  configuring the conditions for each step after sensing the signal.
+  Once setup and enabled, it will observe sense inputs and based upon
+  the activity of those inputs, even over clock cycles, may detect a
+  preprogrammed state/sequence and then produce a trigger or interrupt.
+
+  The primary use case of the TGU is to detect patterns or sequences on a
+  given set of signals within some region to indentify the issue in time
+  once there is abnormal behavior in the subsystem.
+
+maintainers:
+  - Mao Jinlong <[email protected]>
+  - Sam Chai <[email protected]>
+
+# Need a custom select here or 'arm,primecell' will match on lots of nodes
+select:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - qcom,coresight-tgu
+  required:
+    - compatible
+
+properties:
+  compatible:
+    items:
+      - const: qcom,coresight-tgu
+      - const: arm,primecell
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  clock-names:
+    items:
+      - const: apb_pclk
+
+  in-ports:
+    $ref: /schemas/graph.yaml#/properties/ports
+    additionalProperties: false
+
+    properties:
+      port:
+        description:
+          The port mechanism here ensures the relationship between TGU and
+          TPDM, as TPDM is one of the inputs for TGU. It will allow TGU to
+          function as TPDM's helper and enable TGU when the connected
+          TPDM is enabled.
+        $ref: /schemas/graph.yaml#/properties/port
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+
+additionalProperties: false
+
+examples:
+  - |
+    tgu@10b0e000 {
+        compatible = "qcom,coresight-tgu", "arm,primecell";
+        reg = <0x10b0e000 0x1000>;
+
+        clocks = <&aoss_qmp>;
+        clock-names = "apb_pclk";
+
+        in-ports {
+            port {
+                tgu_in_tpdm_swao: endpoint{
+                    remote-endpoint = <&tpdm_swao_out_tgu>;
+                };
+            };
+        };
+    };
+...
maintainer Reviewed-by on v5 1/7
#2 lore raw

Re: [PATCH v5 1/7] dt-bindings: arm: Add support for Coresight TGU trace

Quoted 45 lines · Songwei Chai

The Trigger Generation Unit (TGU) is designed to detect patterns or sequences within a specific region of the System on Chip (SoC). Once configured and activated, it monitors sense inputs and can detect a pre-programmed state or sequence across clock cycles, subsequently producing a trigger.

TGU configuration space
offset table
x-------------------------x

 |                         |
 |                         |
 |                         |                           Step configuration
 |                         |                             space layout
 |   coresight management  |                           x-------------x
 |        registers        |                     |---> |             |
 |                         |                     |     |  reserve    |
 |                         |                     |     |             |
 |-------------------------|                     |     |-------------|
 |                         |                     |     | priority[3] |
 |         step[7]         |<--                  |     |-------------|
 |-------------------------|   |                 |     | priority[2] |
 |                         |   |                 |     |-------------|
 |           ...           |   |Steps region     |     | priority[1] |
 |                         |   |                 |     |-------------|
 |-------------------------|   |                 |     | priority[0] |
 |                         |<--                  |     |-------------|
 |         step[0]         |-------------------->      |             |
 |-------------------------|                           |  condition  |
 |                         |                           |             |
 |     control and status  |                           x-------------x
 |           space         |                           |             |
 x-------------------------x                           |Timer/Counter|
                                                       |             |
						       x-------------x

TGU Configuration in Hardware

The TGU provides a step region for user configuration, similar to a flow chart. Each step region consists of three register clusters:

1.Priority Region: Sets the required signals with priority. 2.Condition Region: Defines specific requirements (e.g., signal A reaches three times) and the subsequent action once the requirement is met.
3.Timer/Counter (Optional): Provides timing or counting functionality.

Quoted 9 lines

Add a new coresight-tgu.yaml file to describe the bindings required to define the TGU in the device trees.

---
 .../bindings/arm/qcom,coresight-tgu.yaml      | 92 +++++++++++++++++++
 1 file changed, 92 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/qcom,coresight-tgu.yaml
#3 lore raw

PATCH v5 2/7 coresight: Add coresight TGU driver

In reply to Songwei Chai

Add driver to support Coresight device TGU (Trigger Generation Unit). TGU is a Data Engine which can be utilized to sense a plurality of signals and create a trigger into the CTI or generate interrupts to processors. Add probe/enable/disable functions for tgu.

---
 .../testing/sysfs-bus-coresight-devices-tgu   |   9 +
 drivers/hwtracing/coresight/Kconfig           |  11 +
 drivers/hwtracing/coresight/Makefile          |   1 +
 drivers/hwtracing/coresight/coresight-tgu.c   | 213 ++++++++++++++++++
 drivers/hwtracing/coresight/coresight-tgu.h   |  37 +++
 5 files changed, 271 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-coresight-devices-tgu
 create mode 100644 drivers/hwtracing/coresight/coresight-tgu.c
 create mode 100644 drivers/hwtracing/coresight/coresight-tgu.h
Documentation/ABI/testing/sysfs-bus-coresight-devices-tgu new file +9 -0
new file mode 100644
index 000000000000..cccd11e44db9
@@ -0,0 +1,9 @@
+What:		/sys/bus/coresight/devices/<tgu-name>/enable_tgu
+Date:		May 2025
+KernelVersion	6.16
+Contact:	Jinlong Mao (QUIC) <[email protected]>, Sam Chai (QUIC) <[email protected]>
+Description:
+		(RW) Set/Get the enable/disable status of TGU
+		Accepts only one of the 2 values -  0 or 1.
+		0 : disable TGU.
+		1 : enable TGU.
drivers/hwtracing/coresight/Kconfig +11 -0
index ecd7086a5b83..f284cef80d2f 100644
@@ -259,4 +259,15 @@ config CORESIGHT_DUMMY
 
 	  To compile this driver as a module, choose M here: the module will be
 	  called coresight-dummy.
+
+config CORESIGHT_TGU
+	tristate "CoreSight Trigger Generation Unit driver"
+	help
+	  This driver provides support for Trigger Generation Unit that is
+	  used to detect patterns or sequences on a given set of signals.
+	  TGU is used to monitor a particular bus within a given region to
+	  detect illegal transaction sequences or slave responses. It is also
+	  used to monitor a data stream to detect protocol violations and to
+	  provide a trigger point for centering data around a specific event
+	  within the trace data buffer.
 endif
drivers/hwtracing/coresight/Makefile +1 -0
index 8e62c3150aeb..b24c8491bb1f 100644
@@ -51,5 +51,6 @@ coresight-cti-y := coresight-cti-core.o	coresight-cti-platform.o \
 		   coresight-cti-sysfs.o
 obj-$(CONFIG_ULTRASOC_SMB) += ultrasoc-smb.o
 obj-$(CONFIG_CORESIGHT_DUMMY) += coresight-dummy.o
+obj-$(CONFIG_CORESIGHT_TGU) += coresight-tgu.o
 obj-$(CONFIG_CORESIGHT_CTCU) += coresight-ctcu.o
 coresight-ctcu-y := coresight-ctcu-core.o
drivers/hwtracing/coresight/coresight-tgu.c new file +213 -0

213 lines not on this page · raw message

drivers/hwtracing/coresight/coresight-tgu.h new file +37 -0
new file mode 100644
index 000000000000..6c849a2f78fa
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2024-2025 Qualcomm Innovation Center, Inc. All rights reserved.
+ */
+
+#ifndef _CORESIGHT_TGU_H
+#define _CORESIGHT_TGU_H
+
+/* Register addresses */
+#define TGU_CONTROL 0x0000
+
+/* Register read/write */
+#define tgu_writel(drvdata, val, off) __raw_writel((val), drvdata->base + off)
+#define tgu_readl(drvdata, off) __raw_readl(drvdata->base + off)
+
+/**
+ * struct tgu_drvdata - Data structure for a TGU (Trigger Generator Unit)
+ * @base: Memory-mapped base address of the TGU device
+ * @dev: Pointer to the associated device structure
+ * @csdev: Pointer to the associated coresight device
+ * @spinlock: Spinlock for handling concurrent access
+ * @enable: Flag indicating whether the TGU device is enabled
+ *
+ * This structure defines the data associated with a TGU device,
+ * including its base address, device pointers, clock, spinlock for
+ * synchronization, trigger data pointers, maximum limits for various
+ * trigger-related parameters, and enable status.
+ */
+struct tgu_drvdata {
+	void __iomem *base;
+	struct device *dev;
+	struct coresight_device *csdev;
+	spinlock_t spinlock;
+	bool enable;
+};
+
+#endif
#4 lore raw

Re: [PATCH v5 2/7] coresight: Add coresight TGU driver

Quoted 6 lines · On Thu, 29 May 2025 16:19:43 +0800 Songwei Chai <[email protected]>…

Add driver to support Coresight device TGU (Trigger Generation Unit). TGU is a Data Engine which can be utilized to sense a plurality of signals and create a trigger into the CTI or generate interrupts to processors. Add probe/enable/disable functions for tgu.

Hi

Drive by review as I was curious and might as well comment whilst taking a look.

Jonathan

Quoted 9 lines
drivers/hwtracing/coresight/coresight-tgu.c new file +3 -0
new file mode 100644
index 000000000000..a1a02602f7b3
@@ -0,0 +1,213 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2024-2025 Qualcomm Innovation Center, Inc. All rights reserved.

drivers/hwtracing/coresight/coresight-tgu.c line 13

Quoted 10 lines
drivers/hwtracing/coresight/coresight-tgu.c new file +10 -0
+ */
+
+#include <linux/amba/bus.h>
+#include <linux/coresight.h>
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>

Why?

Probably after

#include <linux/mod_devicetable.h>
for struct amba_id

drivers/hwtracing/coresight/coresight-tgu.c line 33

Quoted 11 lines
drivers/hwtracing/coresight/coresight-tgu.c new file +10 -0
+
+#include "coresight-priv.h"
+#include "coresight-tgu.h"
 
+
+static int tgu_enable(struct coresight_device *csdev, enum cs_mode mode,
+		      void *data)
+{
+	struct tgu_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
+
+	spin_lock(&drvdata->spinlock);

Maybe consider use of cleanup.h and

	guard(spin_lock)(&drvdata->spinlock);
	if (drvdata->enable)
		return -EBUSY;

	tgu_write_all_hw_regs(drvdata);
	drvdata->enable = true;

	return 0;
Quoted 6 lines
drivers/hwtracing/coresight/coresight-tgu.c new file +6 -0
+
+	if (drvdata->enable) {
+		spin_unlock(&drvdata->spinlock);
+		return -EBUSY;
+	}
+	tgu_write_all_hw_regs(drvdata);

drivers/hwtracing/coresight/coresight-tgu.c line 65

Quoted 10 lines
drivers/hwtracing/coresight/coresight-tgu.c new file +9 -0
+	drvdata->enable = true;
+
+	spin_unlock(&drvdata->spinlock);
+	return 0;
+}
 
+static ssize_t enable_tgu_show(struct device *dev,
+			       struct device_attribute *attr, char *buf)
+{
+	bool enabled;

I'd drop this blank line for consistency with other bits of code in this file.

drivers/hwtracing/coresight/coresight-tgu.c line 123

Quoted 13 lines
drivers/hwtracing/coresight/coresight-tgu.c new file +12 -0
+
+	struct tgu_drvdata *drvdata = dev_get_drvdata(dev->parent);
+
+	spin_lock(&drvdata->spinlock);
+	enabled = drvdata->enable;
+	spin_unlock(&drvdata->spinlock);
+
+	return sysfs_emit(buf, "%d\n", enabled);
+}
 
+static const struct attribute_group tgu_common_grp = {
+	.attrs = tgu_common_attrs,
+	{ NULL },
	{ }

is a common simpler syntax for the same thing.

drivers/hwtracing/coresight/coresight-tgu.c line 128

Quoted 5 lines
drivers/hwtracing/coresight/coresight-tgu.c new file +5 -0
+};
+
+static const struct attribute_group *tgu_attr_groups[] = {
+	&tgu_common_grp,
+	NULL,

Common to not put , after terminating entries. The aim is to make it hard to put things incorrectly after these.

drivers/hwtracing/coresight/coresight-tgu.c line 186

Quoted 7 lines
drivers/hwtracing/coresight/coresight-tgu.c new file +6 -0
+};
 
+static void tgu_remove(struct amba_device *adev)
+{
+	struct tgu_drvdata *drvdata = dev_get_drvdata(&adev->dev);
+
+	coresight_unregister(drvdata->csdev);

Would probably benefit from a devm_ version allowing the dropping of the remove() call in this and other drivers.

More of a general comment than one specific to this driver though.

drivers/hwtracing/coresight/coresight-tgu.c line 195

Quoted 9 lines
drivers/hwtracing/coresight/coresight-tgu.c new file +9 -0
+}
+
+static const struct amba_id tgu_ids[] = {
+	{
+		.id = 0x000f0e00,
+		.mask = 0x000fffff,
+		.data = "TGU",
+	},
+	{ 0, 0, NULL },

{ }

Is effective the same an common form for code setting the sentinel at the end of an array like this.

Quoted 40 lines
drivers/hwtracing/coresight/coresight-tgu.c new file +18 -0
+};
+
+MODULE_DEVICE_TABLE(amba, tgu_ids);
+
+static struct amba_driver tgu_driver = {
+	.drv = {
+		.name = "coresight-tgu",
+		.suppress_bind_attrs = true,
+	},
+	.probe = tgu_probe,
+	.remove = tgu_remove,
+	.id_table = tgu_ids,
+};
+
+module_amba_driver(tgu_driver);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("CoreSight TGU driver");
drivers/hwtracing/coresight/coresight-tgu.h new file +16 -0
new file mode 100644
index 000000000000..6c849a2f78fa
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2024-2025 Qualcomm Innovation Center, Inc. All rights reserved.
+ */
+
+#ifndef _CORESIGHT_TGU_H
+#define _CORESIGHT_TGU_H
+
+/* Register addresses */
+#define TGU_CONTROL 0x0000
+
+/* Register read/write */
+#define tgu_writel(drvdata, val, off) __raw_writel((val), drvdata->base + off)
+#define tgu_readl(drvdata, off) __raw_readl(drvdata->base + off)
+
+/**

drivers/hwtracing/coresight/coresight-tgu.h line 26

Quoted 10 lines
drivers/hwtracing/coresight/coresight-tgu.h new file +10 -0
+ * struct tgu_drvdata - Data structure for a TGU (Trigger Generator Unit)
+ * @base: Memory-mapped base address of the TGU device
+ * @dev: Pointer to the associated device structure
+ * @csdev: Pointer to the associated coresight device
+ * @spinlock: Spinlock for handling concurrent access
+ * @enable: Flag indicating whether the TGU device is enabled
+ *
+ * This structure defines the data associated with a TGU device,
+ * including its base address, device pointers, clock, spinlock for
+ * synchronization, trigger data pointers, maximum limits for various

Not seeing any limits, trigger pointers etc...

Quoted 13 lines
drivers/hwtracing/coresight/coresight-tgu.h new file +11 -0
+ * trigger-related parameters, and enable status.
+ */
+struct tgu_drvdata {
+	void __iomem *base;
+	struct device *dev;
+	struct coresight_device *csdev;
+	spinlock_t spinlock;
+	bool enable;
+};
+
+#endif
#5 lore raw

PATCH v5 3/7 coresight-tgu: Add signal priority support

In reply to Songwei Chai

Like circuit of a Logic analyzer, in TGU, the requirement could be configured in each step and the trigger will be created once the requirements are met. Add priority functionality here to sort the signals into different priorities. The signal which is wanted could be configured in each step's priority node, the larger number means the higher priority and the signal with higher priority will be sensed more preferentially.

---
 .../testing/sysfs-bus-coresight-devices-tgu   |   7 +
 drivers/hwtracing/coresight/coresight-tgu.c   | 163 ++++++++++++++++++
 drivers/hwtracing/coresight/coresight-tgu.h   | 112 ++++++++++++
 3 files changed, 282 insertions(+)
Documentation/ABI/testing/sysfs-bus-coresight-devices-tgu +7 -0
index cccd11e44db9..ecd22214353b 100644
@@ -7,3 +7,10 @@ Description:
 		Accepts only one of the 2 values -  0 or 1.
 		0 : disable TGU.
 		1 : enable TGU.
+
+What:		/sys/bus/coresight/devices/<tgu-name>/step[0:7]_priority[0:3]/reg[0:17]
+Date:		May 2025
+KernelVersion	6.16
+Contact:	Jinlong Mao (QUIC) <[email protected]>, Sam Chai (QUIC) <[email protected]>
+Description:
+		(RW) Set/Get the sensed signal with specific step and priority for TGU.
drivers/hwtracing/coresight/coresight-tgu.c +163 -0

189 lines not on this page · raw message

drivers/hwtracing/coresight/coresight-tgu.h +112 -0

130 lines not on this page · raw message

#6 lore raw

Re: [PATCH v5 3/7] coresight-tgu: Add signal priority support

Quoted 16 lines · On Thu, 29 May 2025 16:19:44 +0800 Songwei Chai <[email protected]>…

Like circuit of a Logic analyzer, in TGU, the requirement could be configured in each step and the trigger will be created once the requirements are met. Add priority functionality here to sort the signals into different priorities. The signal which is wanted could be configured in each step's priority node, the larger number means the higher priority and the signal with higher priority will be sensed more preferentially.

drivers/hwtracing/coresight/coresight-tgu.h +0 -0
index 6c849a2f78fa..f07ead505365 100644

drivers/hwtracing/coresight/coresight-tgu.h line 18

Quoted 6 lines
drivers/hwtracing/coresight/coresight-tgu.h +5 -0
@@ -13,6 +13,112 @@
 
+enum operation_index {
+	TGU_PRIORITY0,
+	TGU_PRIORITY1,
+	TGU_PRIORITY2,
+	TGU_PRIORITY3

No blank line. Also convention on anything other than a terminating entry is to leave the trailing ,

Quoted 18 lines
drivers/hwtracing/coresight/coresight-tgu.h +6 -0
+
+};
 
+
 /**
  * struct tgu_drvdata - Data structure for a TGU (Trigger Generator Unit)
  * @base: Memory-mapped base address of the TGU device
@@ -20,6 +126,9 @@
  * @csdev: Pointer to the associated coresight device
  * @spinlock: Spinlock for handling concurrent access
  * @enable: Flag indicating whether the TGU device is enabled
+ * @value_table: Store given value based on relevant parameters.
+ * @max_reg: Maximum number of registers
+ * @max_step: Maximum step size
  *
  * This structure defines the data associated with a TGU device,
  * including its base address, device pointers, clock, spinlock for

drivers/hwtracing/coresight/coresight-tgu.h struct tgu_drvdata { · line 146

Quoted 6 lines
drivers/hwtracing/coresight/coresight-tgu.h +3 -0
@@ -32,6 +141,9 @@ struct tgu_drvdata {
 	struct coresight_device *csdev;
 	spinlock_t spinlock;
 	bool enable;
+	struct value_table *value_table;
+	int max_reg;
+	int max_step;

Ah. Here some of the bits missing in previous patch that make the description make more sense. Fair enough.

Quoted 5 lines
drivers/hwtracing/coresight/coresight-tgu.h +0 -0
 };
 
 #endif
author
#7 lore raw

Re: [PATCH v5 3/7] coresight-tgu: Add signal priority support

Quoted 13 lines · Jonathan Cameron
Quoted 9 lines · On Thu, 29 May 2025 16:19:44 +0800 Songwei Chai <[email protected]>…

Like circuit of a Logic analyzer, in TGU, the requirement could be configured in each step and the trigger will be created once the requirements are met. Add priority functionality here to sort the signals into different priorities. The signal which is wanted could be configured in each step's priority node, the larger number means the higher priority and the signal with higher priority will be sensed more preferentially.

Quoted 12 lines

drivers/hwtracing/coresight/coresight-tgu.h line 17

Quoted 10 lines
drivers/hwtracing/coresight/coresight-tgu.h +5 -0
index 6c849a2f78fa..f07ead505365 100644
@@ -13,6 +13,112 @@
+enum operation_index {
+	TGU_PRIORITY0,
+	TGU_PRIORITY1,
+	TGU_PRIORITY2,
+	TGU_PRIORITY3

No blank line. Also convention on anything other than a terminating entry is to leave the trailing ,

It will be adopted in the next version.

Quoted 17 lines
Quoted 17 lines
drivers/hwtracing/coresight/coresight-tgu.h +6 -0
+
+};
+
  /**
   * struct tgu_drvdata - Data structure for a TGU (Trigger Generator Unit)
   * @base: Memory-mapped base address of the TGU device
@@ -20,6 +126,9 @@
   * @csdev: Pointer to the associated coresight device
   * @spinlock: Spinlock for handling concurrent access
   * @enable: Flag indicating whether the TGU device is enabled
+ * @value_table: Store given value based on relevant parameters.
+ * @max_reg: Maximum number of registers
+ * @max_step: Maximum step size
   *
   * This structure defines the data associated with a TGU device,
   * including its base address, device pointers, clock, spinlock for
@@ -32,6 +141,9 @@ struct tgu_drvdata {
Quoted 8 lines

drivers/hwtracing/coresight/coresight-tgu.h struct tgu_drvdata { · line 146

Quoted 6 lines
drivers/hwtracing/coresight/coresight-tgu.h +3 -0
  	struct coresight_device *csdev;
  	spinlock_t spinlock;
  	bool enable;
+	struct value_table *value_table;
+	int max_reg;
+	int max_step;

Ah. Here some of the bits missing in previous patch that make the description make more sense. Fair enough.

Thanks.

Quoted 6 lines
Quoted 6 lines
drivers/hwtracing/coresight/coresight-tgu.h +0 -0
  };
 
  #endif
#8 lore raw

PATCH v5 4/7 coresight-tgu: Add TGU decode support

In reply to Songwei Chai

Decoding is when all the potential pieces for creating a trigger are brought together for a given step. Example - there may be a counter keeping track of some occurrences and a priority-group that is being used to detect a pattern on the sense inputs. These 2 inputs to condition_decode must be programmed, for a given step, to establish the condition for the trigger, or movement to another steps.

---
 .../testing/sysfs-bus-coresight-devices-tgu   |   7 +
 drivers/hwtracing/coresight/coresight-tgu.c   | 186 +++++++++++++++---
 drivers/hwtracing/coresight/coresight-tgu.h   |  29 ++-
 3 files changed, 196 insertions(+), 26 deletions(-)
Documentation/ABI/testing/sysfs-bus-coresight-devices-tgu +7 -0
index ecd22214353b..a98ceb5bfdd1 100644
@@ -14,3 +14,10 @@ KernelVersion	6.16
 Contact:	Jinlong Mao (QUIC) <[email protected]>, Sam Chai (QUIC) <[email protected]>
 Description:
 		(RW) Set/Get the sensed signal with specific step and priority for TGU.
+
+What:		/sys/bus/coresight/devices/<tgu-name>/step[0:7]_condition_decode/reg[0:3]
+Date:		May 2025
+KernelVersion	6.16
+Contact:	Jinlong Mao (QUIC) <[email protected]>, Sam Chai (QUIC) <[email protected]>
+Description:
+		(RW) Set/Get the decode mode with specific step for TGU.
drivers/hwtracing/coresight/coresight-tgu.c +161 -25

279 lines not on this page · raw message

drivers/hwtracing/coresight/coresight-tgu.h +28 -1
index f07ead505365..691da393ffa3 100644
@@ -15,6 +15,7 @@
 
 #define TGU_DEVID_SENSE_INPUT(devid_val) ((int) BMVAL(devid_val, 10, 17))
 #define TGU_DEVID_STEPS(devid_val) ((int)BMVAL(devid_val, 3, 6))
+#define TGU_DEVID_CONDITIONS(devid_val) ((int)BMVAL(devid_val, 0, 2))
 #define NUMBER_BITS_EACH_SIGNAL 4
 #define LENGTH_REGISTER 32
 
@@ -48,6 +49,7 @@
  */
 #define STEP_OFFSET 0x1D8
 #define PRIORITY_START_OFFSET 0x0074
+#define CONDITION_DECODE_OFFSET 0x0050
 #define PRIORITY_OFFSET 0x60
 #define REG_OFFSET 0x4
 
@@ -56,6 +58,9 @@
 	(PRIORITY_START_OFFSET + PRIORITY_OFFSET * priority +\
 	REG_OFFSET * reg + STEP_OFFSET * step)
 
+#define CONDITION_DECODE_STEP(step, decode) \
+	(CONDITION_DECODE_OFFSET + REG_OFFSET * decode + STEP_OFFSET * step)
+
 #define tgu_dataset_rw(name, step_index, type, reg_num)                  \
 	(&((struct tgu_attribute[]){ {                                   \
 		__ATTR(name, 0644, tgu_dataset_show, tgu_dataset_store), \
@@ -68,6 +73,9 @@
 	tgu_dataset_rw(reg##reg_num, step_index, TGU_PRIORITY##priority, \
 		       reg_num)
 
+#define STEP_DECODE(step_index, reg_num) \
+	tgu_dataset_rw(reg##reg_num, step_index, TGU_CONDITION_DECODE, reg_num)
+
 #define STEP_PRIORITY_LIST(step_index, priority)  \
 	{STEP_PRIORITY(step_index, 0, priority),  \
 	 STEP_PRIORITY(step_index, 1, priority),  \
@@ -90,6 +98,14 @@
 	 NULL			\
 	}
 
+#define STEP_DECODE_LIST(n) \
+	{STEP_DECODE(n, 0), \
+	 STEP_DECODE(n, 1), \
+	 STEP_DECODE(n, 2), \
+	 STEP_DECODE(n, 3), \
+	 NULL           \
+	}
+
 #define PRIORITY_ATTRIBUTE_GROUP_INIT(step, priority)\
 	(&(const struct attribute_group){\
 		.attrs = (struct attribute*[])STEP_PRIORITY_LIST(step, priority),\
@@ -97,11 +113,19 @@
 		.name = "step" #step "_priority" #priority \
 	})
 
+#define CONDITION_DECODE_ATTRIBUTE_GROUP_INIT(step)\
+	(&(const struct attribute_group){\
+		.attrs = (struct attribute*[])STEP_DECODE_LIST(step),\
+		.is_visible = tgu_node_visible,\
+		.name = "step" #step "_condition_decode" \
+	})
+
 enum operation_index {
 	TGU_PRIORITY0,
 	TGU_PRIORITY1,
 	TGU_PRIORITY2,
-	TGU_PRIORITY3
+	TGU_PRIORITY3,
+	TGU_CONDITION_DECODE
 
 };
 
@@ -117,6 +141,7 @@ struct tgu_attribute {
 
 struct value_table {
 	unsigned int *priority;
+	unsigned int *condition_decode;
 };
 
 /**
@@ -129,6 +154,7 @@ struct value_table {
  * @value_table: Store given value based on relevant parameters.
  * @max_reg: Maximum number of registers
  * @max_step: Maximum step size
+ * @max_condition_decode: Maximum number of condition_decode
  *
  * This structure defines the data associated with a TGU device,
  * including its base address, device pointers, clock, spinlock for
@@ -144,6 +170,7 @@ struct tgu_drvdata {
 	struct value_table *value_table;
 	int max_reg;
 	int max_step;
+	int max_condition_decode;
 };
 
 #endif
#9 lore raw

Re: [PATCH v5 4/7] coresight-tgu: Add TGU decode support

Quoted 15 lines · On Thu, 29 May 2025 16:19:45 +0800 Songwei Chai <[email protected]>…

Decoding is when all the potential pieces for creating a trigger are brought together for a given step. Example - there may be a counter keeping track of some occurrences and a priority-group that is being used to detect a pattern on the sense inputs. These 2 inputs to condition_decode must be programmed, for a given step, to establish the condition for the trigger, or movement to another steps.

drivers/hwtracing/coresight/coresight-tgu.c +0 -0
index 6dbfd4c604b1..8dbe8ab30174 100644

drivers/hwtracing/coresight/coresight-tgu.c static int calculate_array_location(struct tgu_drvdata *drvdata, · line 26

Quoted 6 lines
drivers/hwtracing/coresight/coresight-tgu.c +2 -0
@@ -21,13 +21,35 @@ static int calculate_array_location(struct tgu_drvdata *drvdata,
 
+
 static int tgu_enable(struct coresight_device *csdev, enum cs_mode mode,
 		      void *data)
 {
+	int ret = 0;

From what can be seen here, looks like ret is always set, so no need to init.

Quoted 24 lines
drivers/hwtracing/coresight/coresight-tgu.c +6 -2
 	struct tgu_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
 
 	spin_lock(&drvdata->spinlock);
@@ -150,11 +264,15 @@ static int tgu_enable(struct coresight_device *csdev, enum cs_mode mode,
 		spin_unlock(&drvdata->spinlock);
 		return -EBUSY;
 	}
-	tgu_write_all_hw_regs(drvdata);
+	ret = tgu_write_all_hw_regs(drvdata);
+
+	if (ret == -EINVAL)
+		goto exit;
 	drvdata->enable = true;
 
+exit:
 	spin_unlock(&drvdata->spinlock);
-	return 0;
+	return ret;
 }
 
drivers/hwtracing/coresight/coresight-tgu.h +0 -0
index f07ead505365..691da393ffa3 100644

drivers/hwtracing/coresight/coresight-tgu.h line 127

Quoted 7 lines
drivers/hwtracing/coresight/coresight-tgu.h +1 -1
 
 enum operation_index {
 	TGU_PRIORITY0,
 	TGU_PRIORITY1,
 	TGU_PRIORITY2,
-	TGU_PRIORITY3
+	TGU_PRIORITY3,

And here is why the previous patch should definitely have had the ,

Quoted 6 lines
drivers/hwtracing/coresight/coresight-tgu.h +1 -0
+	TGU_CONDITION_DECODE
 
 };
author
#10 lore raw

Re: [PATCH v5 4/7] coresight-tgu: Add TGU decode support

Quoted 11 lines · Jonathan Cameron
Quoted 8 lines · On Thu, 29 May 2025 16:19:45 +0800 Songwei Chai <[email protected]>…

Decoding is when all the potential pieces for creating a trigger are brought together for a given step. Example - there may be a counter keeping track of some occurrences and a priority-group that is being used to detect a pattern on the sense inputs. These 2 inputs to condition_decode must be programmed, for a given step, to establish the condition for the trigger, or movement to another steps.

Quoted 12 lines

drivers/hwtracing/coresight/coresight-tgu.c static int calculate_array_location(struct tgu_drvdata *drvdata, · line 25

Quoted 11 lines
drivers/hwtracing/coresight/coresight-tgu.c +2 -0
index 6dbfd4c604b1..8dbe8ab30174 100644
@@ -21,13 +21,35 @@ static int calculate_array_location(struct tgu_drvdata *drvdata,
+
  static int tgu_enable(struct coresight_device *csdev, enum cs_mode mode,
  		      void *data)
  {
+	int ret = 0;

From what can be seen here, looks like ret is always set, so no need to init.

Would this initialization improve the determinism of the code? :-)

Quoted 14 lines
Quoted 14 lines
drivers/hwtracing/coresight/coresight-tgu.c +4 -1
  	struct tgu_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
 
  	spin_lock(&drvdata->spinlock);
@@ -150,11 +264,15 @@ static int tgu_enable(struct coresight_device *csdev, enum cs_mode mode,
  		spin_unlock(&drvdata->spinlock);
  		return -EBUSY;
  	}
-	tgu_write_all_hw_regs(drvdata);
+	ret = tgu_write_all_hw_regs(drvdata);
+
+	if (ret == -EINVAL)
+		goto exit;
  	drvdata->enable = true;
 
Quoted 16 lines
Quoted 9 lines
drivers/hwtracing/coresight/coresight-tgu.c +2 -1
+exit:
  	spin_unlock(&drvdata->spinlock);
-	return 0;
+	return ret;
  }
drivers/hwtracing/coresight/coresight-tgu.h +0 -0
index f07ead505365..691da393ffa3 100644

drivers/hwtracing/coresight/coresight-tgu.h line 127

Quoted 6 lines
drivers/hwtracing/coresight/coresight-tgu.h +1 -1
  enum operation_index {
  	TGU_PRIORITY0,
  	TGU_PRIORITY1,
  	TGU_PRIORITY2,
-	TGU_PRIORITY3
+	TGU_PRIORITY3,

And here is why the previous patch should definitely have had the ,

Thanks for your clarification.

Quoted 5 lines
Quoted 5 lines
drivers/hwtracing/coresight/coresight-tgu.h +1 -0
+	TGU_CONDITION_DECODE
 
  };
#11 lore raw

PATCH v5 5/7 coresight-tgu: add support to configure next action

In reply to Songwei Chai

Add "select" node for each step to determine if another step is taken, trigger(s) are generated, counters/timers incremented/decremented, etc.

---
 .../testing/sysfs-bus-coresight-devices-tgu   |  7 +++
 drivers/hwtracing/coresight/coresight-tgu.c   | 59 +++++++++++++++++++
 drivers/hwtracing/coresight/coresight-tgu.h   | 30 +++++++++-
 3 files changed, 94 insertions(+), 2 deletions(-)
Documentation/ABI/testing/sysfs-bus-coresight-devices-tgu +7 -0
index a98ceb5bfdd1..374982f0e76a 100644
@@ -21,3 +21,10 @@ KernelVersion	6.16
 Contact:	Jinlong Mao (QUIC) <[email protected]>, Sam Chai (QUIC) <[email protected]>
 Description:
 		(RW) Set/Get the decode mode with specific step for TGU.
+
+What:		/sys/bus/coresight/devices/<tgu-name>/step[0:7]_condition_select/reg[0:3]
+Date:		May 2025
+KernelVersion	6.16
+Contact:	Jinlong Mao (QUIC) <[email protected]>, Sam Chai (QUIC) <[email protected]>
+Description:
+		(RW) Set/Get the next action with specific step for TGU.
drivers/hwtracing/coresight/coresight-tgu.c +59 -0

107 lines not on this page · raw message

drivers/hwtracing/coresight/coresight-tgu.h +28 -2
index 691da393ffa3..214ee67d1947 100644
@@ -50,6 +50,7 @@
 #define STEP_OFFSET 0x1D8
 #define PRIORITY_START_OFFSET 0x0074
 #define CONDITION_DECODE_OFFSET 0x0050
+#define CONDITION_SELECT_OFFSET 0x0060
 #define PRIORITY_OFFSET 0x60
 #define REG_OFFSET 0x4
 
@@ -61,6 +62,9 @@
 #define CONDITION_DECODE_STEP(step, decode) \
 	(CONDITION_DECODE_OFFSET + REG_OFFSET * decode + STEP_OFFSET * step)
 
+#define CONDITION_SELECT_STEP(step, select) \
+	(CONDITION_SELECT_OFFSET + REG_OFFSET * select + STEP_OFFSET * step)
+
 #define tgu_dataset_rw(name, step_index, type, reg_num)                  \
 	(&((struct tgu_attribute[]){ {                                   \
 		__ATTR(name, 0644, tgu_dataset_show, tgu_dataset_store), \
@@ -76,6 +80,9 @@
 #define STEP_DECODE(step_index, reg_num) \
 	tgu_dataset_rw(reg##reg_num, step_index, TGU_CONDITION_DECODE, reg_num)
 
+#define STEP_SELECT(step_index, reg_num) \
+	tgu_dataset_rw(reg##reg_num, step_index, TGU_CONDITION_SELECT, reg_num)
+
 #define STEP_PRIORITY_LIST(step_index, priority)  \
 	{STEP_PRIORITY(step_index, 0, priority),  \
 	 STEP_PRIORITY(step_index, 1, priority),  \
@@ -106,6 +113,15 @@
 	 NULL           \
 	}
 
+#define STEP_SELECT_LIST(n) \
+	{STEP_SELECT(n, 0), \
+	 STEP_SELECT(n, 1), \
+	 STEP_SELECT(n, 2), \
+	 STEP_SELECT(n, 3), \
+	 STEP_SELECT(n, 4), \
+	 NULL           \
+	}
+
 #define PRIORITY_ATTRIBUTE_GROUP_INIT(step, priority)\
 	(&(const struct attribute_group){\
 		.attrs = (struct attribute*[])STEP_PRIORITY_LIST(step, priority),\
@@ -120,13 +136,20 @@
 		.name = "step" #step "_condition_decode" \
 	})
 
+#define CONDITION_SELECT_ATTRIBUTE_GROUP_INIT(step)\
+	(&(const struct attribute_group){\
+		.attrs = (struct attribute*[])STEP_SELECT_LIST(step),\
+		.is_visible = tgu_node_visible,\
+		.name = "step" #step "_condition_select" \
+	})
+
 enum operation_index {
 	TGU_PRIORITY0,
 	TGU_PRIORITY1,
 	TGU_PRIORITY2,
 	TGU_PRIORITY3,
-	TGU_CONDITION_DECODE
-
+	TGU_CONDITION_DECODE,
+	TGU_CONDITION_SELECT
 };
 
 /* Maximum priority that TGU supports */
@@ -142,6 +165,7 @@ struct tgu_attribute {
 struct value_table {
 	unsigned int *priority;
 	unsigned int *condition_decode;
+	unsigned int *condition_select;
 };
 
 /**
@@ -155,6 +179,7 @@ struct value_table {
  * @max_reg: Maximum number of registers
  * @max_step: Maximum step size
  * @max_condition_decode: Maximum number of condition_decode
+ * @max_condition_select: Maximum number of condition_select
  *
  * This structure defines the data associated with a TGU device,
  * including its base address, device pointers, clock, spinlock for
@@ -171,6 +196,7 @@ struct tgu_drvdata {
 	int max_reg;
 	int max_step;
 	int max_condition_decode;
+	int max_condition_select;
 };
 
 #endif
#12 lore raw

PATCH v5 6/7 coresight-tgu: add timer/counter functionality for TGU

In reply to Songwei Chai

Add counter and timer node for each step which could be programed if they are to be utilized in trigger event/sequence.

---
 .../testing/sysfs-bus-coresight-devices-tgu   |  14 ++
 drivers/hwtracing/coresight/coresight-tgu.c   | 134 ++++++++++++++++++
 drivers/hwtracing/coresight/coresight-tgu.h   |  57 +++++++-
 3 files changed, 203 insertions(+), 2 deletions(-)
Documentation/ABI/testing/sysfs-bus-coresight-devices-tgu +14 -0
index 374982f0e76a..cfdc80ab1cea 100644
@@ -28,3 +28,17 @@ KernelVersion	6.16
 Contact:	Jinlong Mao (QUIC) <[email protected]>, Sam Chai (QUIC) <[email protected]>
 Description:
 		(RW) Set/Get the next action with specific step for TGU.
+
+What:		/sys/bus/coresight/devices/<tgu-name>/step[0:7]_timer/reg[0:1]
+Date:		May 2025
+KernelVersion	6.16
+Contact:	Jinlong Mao (QUIC) <[email protected]>, Sam Chai (QUIC) <[email protected]>
+Description:
+		(RW) Set/Get the timer value with specific step for TGU.
+
+What:		/sys/bus/coresight/devices/<tgu-name>/step[0:7]_counter/reg[0:1]
+Date:		May 2025
+KernelVersion	6.16
+Contact:	Jinlong Mao (QUIC) <[email protected]>, Sam Chai (QUIC) <[email protected]>
+Description:
+		(RW) Set/Get the counter value with specific step for TGU.
drivers/hwtracing/coresight/coresight-tgu.c +134 -0

188 lines not on this page · raw message

drivers/hwtracing/coresight/coresight-tgu.h +55 -2

123 lines not on this page · raw message

#13 lore raw

PATCH v5 7/7 coresight-tgu: add reset node to initialize

In reply to Songwei Chai

Add reset node to initialize the value of priority/condition_decode/condition_select/timer/counter nodes.

---
 .../testing/sysfs-bus-coresight-devices-tgu   |  7 ++
 drivers/hwtracing/coresight/coresight-tgu.c   | 75 +++++++++++++++++++
 2 files changed, 82 insertions(+)
Documentation/ABI/testing/sysfs-bus-coresight-devices-tgu +7 -0
index cfdc80ab1cea..be83ec9c5da6 100644
@@ -42,3 +42,10 @@ KernelVersion	6.16
 Contact:	Jinlong Mao (QUIC) <[email protected]>, Sam Chai (QUIC) <[email protected]>
 Description:
 		(RW) Set/Get the counter value with specific step for TGU.
+
+What:		/sys/bus/coresight/devices/<tgu-name>/reset_tgu
+Date:		May 2025
+KernelVersion	6.16
+Contact:	Jinlong Mao (QUIC) <[email protected]>, Sam Chai (QUIC) <[email protected]>
+Description:
+		(Write) Write 1 to reset the dataset for TGU.
drivers/hwtracing/coresight/coresight-tgu.c +75 -0

87 lines not on this page · raw message

#14 lore raw
In reply to Songwei Chai

Hope this message finds you well.

Just following up on my previous message - I'd greatly appreciate your response when you have a moment.

Looking forward to hearing from you. :-)

BRs,
Songwei

Quoted 350 lines · Songwei Chai

Provide support for the TGU (Trigger Generation Unit), which can be utilized to sense a plurality of signals and create a trigger into the CTI or generate interrupts to processors once the input signal meets the conditions. We can treat the TGU’s workflow as a flowsheet, it has some “steps” regions for customization. In each step region, we can set the signals that we want with priority in priority_group, set the conditions in each step via condition_decode, and set the resultant action by condition_select. Meanwhile, some TGUs (not all) also provide timer/counter functionality. Based on the characteristics described above, we consider the TGU as a helper in the CoreSight subsystem. Its master device is the TPDM, which can transmit signals from other subsystems, and we reuse the existing ports mechanism to link the TPDM to the connected TGU.

Here is a detailed example to explain how to use the TGU:

In this example, the TGU is configured to use 2 conditions, 2 steps, and the timer. The goal is to look for one of two patterns which are generated from TPDM, giving priority to one, and then generate a trigger once the timer reaches a certain value. In other words, two conditions are used for the first step to look for the two patterns, where the one with the highest priority is used in the first condition. Then, in the second step, the timer is enabled and set to be compared to the given value at each clock cycle. These steps are better shown below.

             |-----------------|
             |                 |
             |       TPDM      |
             |                 |
             |-----------------|
                      |
                      |
   --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ------
   |                  |                                                 |
   |                  |                          |--------------------| |
   |    |---- --->    |                          |  Go to next steps  | |
   |    |             |                |--- ---> |  Enable timer      | |
   |    |             v                |         |                    | |
   |    |    |-----------------|       |         |--------------------| |
   |    |    |                 |  Yes  |                    |           |
   |    |    |   inputs==0xB   | ----->|                    | <-------- |
   |    |    |                 |       |                    |      No | |
   | No |    |-----------------|       |                    v         | |
   |    |             |                |          |-----------------| | |
   |    |             |                |          |                 | | |
   |    |             |                |          |      timer>=3   |-- |
   |    |             v                |          |                 |   |
   |    |    |-----------------|       |          |-----------------|   |
   |    |    |                 |  Yes  |                    |           |
   |    |--- |   inputs==0xA   | ----->|                    | Yes       |
   |         |                 |                            |           |
   |         |-----------------|                            v           |
   |                                              |-----------------|   |
   |                                              |                 |   |
   |                                              |      Trigger    |   |
   |                                              |                 |   |
   |                                              |-----------------|   |
   |  TGU                                                   |           |
   |--- --- --- --- --- --- --- --- --- --- --- --- --- --- |--- --- -- |
                                                            |

v
|-----------------| |The controllers |
|which will use |
|triggers further | |-----------------|

steps:
1. Reset TGU /*it will disable tgu and reset dataset*/
- echo 1 > /sys/bus/coresight/devices/<tgu-name>/reset_tgu

2. Set the pattern match for priority0 to 0xA = 0b1010 and for priority 1 to 0xB = 0b1011.
- echo 0x11113232 > /sys/bus/coresight/devices/<tgu-name>/step0_priority0/reg0
- echo 0x11113233 > /sys/bus/coresight/devices/<tgu-name>/step0_priority1/reg0

Note:
Bit distribution diagram for each priority register
|-------------------------------------------------------------------|
| Bits | Field Nam | Description |
|-------------------------------------------------------------------|
| | | 00 = bypass for OR output |
| 29:28 | SEL_BIT7_TYPE2 | 01 = bypass for AND output |
| | | 10 = sense input '0' is true|
| | | 11 = sense input '1' is true|
|-------------------------------------------------------------------|
| | | 00 = bypass for OR output |
| 25:24 | SEL_BIT6_TYPE2 | 01 = bypass for AND output |
| | | 10 = sense input '0' is true|
| | | 11 = sense input '1' is true|
|-------------------------------------------------------------------|
| | | 00 = bypass for OR output |
| 21:20 | SEL_BIT5_TYPE2 | 01 = bypass for AND output |
| | | 10 = sense input '0' is true|
| | | 11 = sense input '1' is true|
|-------------------------------------------------------------------|
| | | 00 = bypass for OR output |
| 17:16 | SEL_BIT4_TYPE2 | 01 = bypass for AND output |
| | | 10 = sense input '0' is true|
| | | 11 = sense input '1' is true|
|-------------------------------------------------------------------|
| | | 00 = bypass for OR output |
| 13:12 | SEL_BIT3_TYPE2 | 01 = bypass for AND output |
| | | 10 = sense input '0' is true|
| | | 11 = sense input '1' is true|
|-------------------------------------------------------------------|
| | | 00 = bypass for OR output |
| 9:8 | SEL_BIT2_TYPE2 | 01 = bypass for AND output |
| | | 10 = sense input '0' is true|
| | | 11 = sense input '1' is true|
|-------------------------------------------------------------------|
| | | 00 = bypass for OR output |
| 5:4 | SEL_BIT1_TYPE2 | 01 = bypass for AND output |
| | | 10 = sense input '0' is true|
| | | 11 = sense input '1' is true|
|-------------------------------------------------------------------|
| | | 00 = bypass for OR output |
| 1:0 | SEL_BIT0_TYPE2 | 01 = bypass for AND output |
| | | 10 = sense input '0' is true|
| | | 11 = sense input '1' is true|
|-------------------------------------------------------------------|
These bits are used to identify the signals we want to sense, with a maximum signal number of 140. For example, to sense the signal 0xA (binary 1010), we set the value of bits 0 to 13 to 3232, which represents 1010. The remaining bits are set to 1, as we want to use AND gate to summarize all the signals we want to sense here. For rising or falling edge detection of any input to the priority, set the remaining bits to 0 to use an OR gate.

3. look for the pattern for priority_i i=0,1.
- echo 0x3 > /sys/bus/coresight/devices/<tgu-name>/step0_condition_decode/reg0
- echo 0x30 > /sys/bus/coresight/devices/<tgu-name>/step0_condition_decode/reg1

|-------------------------------------------------------------------------------|
| Bits | Field Nam | Description |
|-------------------------------------------------------------------------------|
| | |For each decoded condition, this |
| 24 | NOT |inverts the output. If the condition |
| | |decodes to true, and the NOT field |
| | |is '1', then the output is NOT true. |
|-------------------------------------------------------------------------------|
| | |When '1' the output from the associated|
| 21 | BC0_COMP_ACTIVE |comparator will be actively included in|
| | |the decoding of this particular |
| | |condition. |
|-------------------------------------------------------------------------------|
| | |When '1' the output from the associated|
| | |comparator will need to be 1 to affect |
| 20 | BC0_COMP_HIGH |the decoding of this condition. |
| | |Conversely, a '0' here requires a '0' |
| | |from the comparator |
|-------------------------------------------------------------------------------|
| | |When '1' the output from the associated|
| 17 | |comparator will be actively included in|
| | TC0_COMP_ACTIVE |the decoding of this particular |
| | |condition. |
|-------------------------------------------------------------------------------|
| | |When '1' the output from the associated|
| | |comparator will need to be 1 to affect |
| 16 | TC0_COMP_HIGH |the decoding of this particular |
| | |condition.Conversely, a 0 here |
| | |requires a '0' from the comparator |
|-------------------------------------------------------------------------------|
| | |When '1' the output from Priority_n |
| | |OR logic will be actively |
| 4n+3 | Priority_n_OR_ACTIVE|included in the decoding of |
| | (n=0,1,2,3) |this particular condition. |
| | | |
|-------------------------------------------------------------------------------|
| | |When '1' the output from Priority_n |
| | |will need to be '1' to affect the |
| 4n+2 | Priority_n_OR_HIGH |decoding of this particular |
| | (n=0,1,2,3) |condition. Conversely, a '0' here |
| | |requires a '0' from Priority_n OR logic|
|-------------------------------------------------------------------------------|
| | |When '1' the output from Priority_n |
| | |AND logic will be actively |
| 4n+1 |Priority_n_AND_ACTIVE|included in the decoding of this |
| | (n=0,1,2,3) |particular condition. |
| | | |
|-------------------------------------------------------------------------------|
| | |When '1' the output from Priority_n |
| | |AND logic will need to be '1' to |
| 4n | Priority_n_AND_HIGH |affect the decoding of this |
| | (n=0,1,2,3) |particular condition. Conversely, |
| | |a '0' here requires a '0' from |
| | |Priority_n AND logic. |
|-------------------------------------------------------------------------------|
Since we use priority_0 and priority_1 with an AND output in step 2, we set 0x3 and 0x30 here to activate them.

4. Set NEXT_STEP = 1 and TC0_ENABLE = 1 so that when the conditions are met then the next step will be step 1 and the timer will be enabled.
- echo 0x20008 > /sys/bus/coresight/devices/<tgu-name>/step0_condition_select/reg0
- echo 0x20008 > /sys/bus/coresight/devices/<tgu-name>/step0_condition_select/reg1

|-----------------------------------------------------------------------------|
| Bits | Field Nam | Description |
|-----------------------------------------------------------------------------|
| | |This field defines the next step the |
| 18:17 | NEXT_STEP |TGU will 'goto' for the associated |
| | |Condition and Step. |
|-----------------------------------------------------------------------------|
| | |For each possible output trigger |
| 13 | TRIGGER |available, set a '1' if you want |
| | |the trigger to go active for the |
| | |associated condition and Step. |
|-----------------------------------------------------------------------------|
| | |This will cause BC0 to increment if the|
| 9 | BC0_INC |associated Condition is decoded for |
| | |this step. |
|-----------------------------------------------------------------------------|
| | |This will cause BC0 to decrement if the|
| 8 | BC0_DEC |associated Condition is decoded for |
| | |this step. |
|-----------------------------------------------------------------------------|
| | |This will clear BC0 count value to 0 if|
| 7 | BC0_CLEAR |the associated Condition is decoded |
| | |for this step. |
|-----------------------------------------------------------------------------|
| | |This will cause TC0 to increment until |
| 3 | TC0_ENABLE |paused or cleared if the associated |
| | |Condition is decoded for this step. |
|-----------------------------------------------------------------------------|
| | |This will cause TC0 to pause until |
| 2 | TC0_PAUSE |enabled if the associated Condition |
| | |is decoded for this step. |
|-----------------------------------------------------------------------------|
| | |This will clear TC0 count value to 0 |
| 1 | TC0_CLEAR |if the associated Condition is |
| | |decoded for this step. |
|-----------------------------------------------------------------------------|
| | |This will set the done signal to the |
| 0 | DONE |TGU FSM if the associated Condition |
| | |is decoded for this step. |
|-----------------------------------------------------------------------------| Based on the distribution diagram, we set 0x20008 for priority0 and priority1 to achieve "jump to step 1 and enable TC0" once the signal is sensed.

5. activate the timer comparison for this step.
- echo 0x30000 > /sys/bus/coresight/devices/<tgu-name>/step1_condition_decode/reg0

|-------------------------------------------------------------------------------|
| | |When '1' the output from the associated|
| 17 | |comparator will be actively included in|
| | TC0_COMP_ACTIVE |the decoding of this particular |
| | |condition. |
|-------------------------------------------------------------------------------|
| | |When '1' the output from the associated|
| | |comparator will need to be 1 to affect |
| 16 | TC0_COMP_HIGH |the decoding of this particular |
| | |condition.Conversely, a 0 here |
| | |requires a '0' from the comparator |
|-------------------------------------------------------------------------------| Accroding to the decode distribution diagram , we give 0x30000 here to set 16th&17th bit to enable timer comparison.

6. Set the NEXT_STEP = 0 and TC0_PAUSE = 1 and TC0_CLEAR = 1 once the timer has reached the given value.
- echo 0x6 > /sys/bus/coresight/devices/<tgu-name>/step1_condition_select/reg0

7. Enable Trigger 0 for TGU when the condition 0 is met in step1, i.e. when the timer reaches 3.
- echo 0x2000 > /sys/bus/coresight/devices/<tgu-name>/step1_condition_select/default

Note:
1. 'default' register allows for establishing the resultant action for the default condition

2. Trigger:For each possible output trigger available from the Design document, there are three triggers: interrupts, CTI, and Cross-TGU mapping.All three triggers can occur, but the choice of which trigger to use depends on the user's needs.

8. Compare the timer to 3 in step 1.
- echo 0x3 > /sys/bus/coresight/devices/<tgu-name>/step1_timer/reg0

9. enale tgu
- echo 1 > /sys/bus/coresight/devices/<tgu-name>/enable_tgu

---
Link to V4: https://patchwork.kernel.org/project/linux-arm-msm/cover/[email protected]/

Changes in V5:
- Update publish date and kernel_version in "sysfs-bus-coresight-devices-tgu"
---
Link to V3: https://lore.kernel.org/all/[email protected]/

Changes in V4:
- Add changlog in coverletter.
- Correct 'year' in Copyright in patch1.
- Correct port mechansim description in patch1.
- Remove 'tgu-steps','tgu-regs','tgu-conditions','tgu-timer-counters' from dt-binding and set them through reading DEVID register as per Mike's suggestion.
- Modify tgu_disable func to make it have single return point in patch2 as per Mike's suggestion.
- Use sysfs_emit in enable_tgu_show func in ptach2.
- Remove redundant judgement in enable_tgu_store in patch2.
- Correct typo in description in patch3.
- Set default ret as SYSFS_GROUP_INVISIBLE, and returnret at end in pacth3 as per Mike's suggestion.
- Remove tgu_dataset_ro definition in patch3
- Use #define constants with explanations of what they are rather than arbitrary magic numbers in patch3 and patch4.
- Check -EINVAL before using 'calculate_array_location()' in array in patch4.
- Add 'default' in 'tgu_dataset_show''s switch part in patch4.
- Document the value needed to initiate the reset in pacth7.
- Check "value" in 'reset_tgu_store' and bail out with an error code if 0 in patch7.
- Remove dev_dbg in 'reset_tgu_store' in patch7.
---
Link to V2: https://lore.kernel.org/all/[email protected]/

Changes in V3:
- Correct typo and format in dt-binding in patch1
- Rebase to the latest kernel version
---
Link to V1: https://lore.kernel.org/all/[email protected]/

Changes in V2:
- Use real name instead of login name,
- Correct typo and format in dt-binding and code.
- Bring order in tgu_prob(declarations with and without assignments) as per
Krzysztof's suggestion.
- Add module device table in patch2.
- Set const for tgu_common_grp and tgu_ids in patch2.
- Initialize 'data' in tgu_ids to fix the warning in pacth2.
---

Songwei Chai (7):
dt-bindings: arm: Add support for Coresight TGU trace
coresight: Add coresight TGU driver
coresight-tgu: Add signal priority support
coresight-tgu: Add TGU decode support
coresight-tgu: add support to configure next action
coresight-tgu: add timer/counter functionality for TGU
coresight-tgu: add reset node to initialize

  .../testing/sysfs-bus-coresight-devices-tgu   |  51 ++
  .../bindings/arm/qcom,coresight-tgu.yaml      |  92 +++
  drivers/hwtracing/coresight/Kconfig           |  11 +
  drivers/hwtracing/coresight/Makefile          |   1 +
  drivers/hwtracing/coresight/coresight-tgu.c   | 780 ++++++++++++++++++
  drivers/hwtracing/coresight/coresight-tgu.h   | 255 ++++++
  6 files changed, 1190 insertions(+)

create mode 100644 Documentation/ABI/testing/sysfs-bus-coresight-devices-tgu create mode 100644 Documentation/devicetree/bindings/arm/qcom,coresight-tgu.yaml create mode 100644 drivers/hwtracing/coresight/coresight-tgu.c create mode 100644 drivers/hwtracing/coresight/coresight-tgu.h