The Coresight Slave Register(CSR) device hosts miscellaneous configuration registers to control various features related to TMC ETR device. The CSR device works as a helper device physically connected to the TMC ETR device. --------------------------------------------------------- |ETR0| |ETR1| . \ / . . \ / . . \ / . . \ / . --------------------------------------------------- ETR0ATID0-ETR0ATID3 CSR ETR1ATID0-ETR1ATID3 --------------------------------------------------- Each ETR has four ATID registers with 128 bits long in total. e.g. ETR0ATID0-ETR0ATID3 registers are used by ETR0 device. Based on the trace id which is programed in CSR ATID register of specific ETR, trace data with that trace id can get into ETR's buffer while other trace data gets ignored. CSR may contain several ATID registers. Each ATID register is associated with an ETR device. To achieve this function, the trace id is obtained and stored in the related ETR device's driver data just before enabling the CSR. Then, the CSR device can easily obtain the trace ID from the ETR's driver data because the ETR's driver data is passed to the CSR's enable/disable functions. Ensure that every source device has already allocated a trace ID in its probe session because the sink device should always be the first device to enable when operating coresight_enable_path function. As a helper device of the ETR, the CSR device will program the ATID register of a specific ETR according to the trace id to enable data filter function at a very early stage. Without the correct trace ID, the enablement session will not work. Each CSR's enable session will set one bit in the ATID register. Every CSR's disbale seesion will reset all bits of the ATID register. This patch only supports sysfs mode. I will send the perf mode part patch once it is ready. Looking forward to receiving comments as this is a new driver. Thanks! Jie Gan (3): dt-bindings: arm: Add binding document for Coresight Slave Register device. coresight: Add coresight slave register driver to support data filter function in sysfs mode arm64: dts: qcom: Add CSR and ETR nodes for SA8775p .../bindings/arm/arm,coresight-tmc.yaml | 8 + .../bindings/arm/qcom,coresight-csr.yaml | 49 +++ arch/arm64/boot/dts/qcom/sa8775p.dtsi | 167 ++++++++++ drivers/hwtracing/coresight/Kconfig | 6 + drivers/hwtracing/coresight/Makefile | 1 + drivers/hwtracing/coresight/coresight-core.c | 6 +- drivers/hwtracing/coresight/coresight-csr.c | 315 ++++++++++++++++++ drivers/hwtracing/coresight/coresight-csr.h | 24 ++ .../coresight/coresight-etm4x-core.c | 1 + drivers/hwtracing/coresight/coresight-stm.c | 50 --- drivers/hwtracing/coresight/coresight-sysfs.c | 45 ++- .../hwtracing/coresight/coresight-tmc-core.c | 1 + drivers/hwtracing/coresight/coresight-tmc.h | 2 + include/linux/coresight-stm.h | 44 +++ 14 files changed, 665 insertions(+), 54 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/qcom,coresight-csr.yaml create mode 100644 drivers/hwtracing/coresight/coresight-csr.c create mode 100644 drivers/hwtracing/coresight/coresight-csr.h -- 2.34.1