Debian Codegraph @

drivers/hwtracing/coresight/coresight-tpda.h

raw
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Copyright (c) 2023,2025 Qualcomm Innovation Center, Inc. All rights reserved.
4 */
5
6 #ifndef _CORESIGHT_CORESIGHT_TPDA_H
7 #define _CORESIGHT_CORESIGHT_TPDA_H
8
9 #define TPDA_CR (0x000)
10 #define TPDA_Pn_CR(n) (0x004 + (n * 4))
11 #define TPDA_FPID_CR (0x084)
12 #define TPDA_SYNCR (0x08C)
13 #define TPDA_FLUSH_CR (0x090)
14
15 /* Cross trigger global (all ports) flush request bit */
16 #define TPDA_CR_FLREQ BIT(0)
17 /* Cross trigger FREQ packets timestamp bit */
18 #define TPDA_CR_FREQTS BIT(2)
19 /* Cross trigger FREQ packet request bit */
20 #define TPDA_CR_FRIE BIT(3)
21 /* Cross trigger FLAG packet request interface bit */
22 #define TPDA_CR_FLRIE BIT(4)
23 /* Cross trigger synchronization bit */
24 #define TPDA_CR_SRIE BIT(5)
25 /* Bits 6 ~ 12 is for atid value */
26 #define TPDA_CR_ATID GENMASK(12, 6)
27 /*
28 * Channel mode bit of the packetization of CMB/MCB traffic
29 * 0 - raw channel mapping mode
30 * 1 - channel pair marking mode
31 */
32 #define TPDA_CR_CMBCHANMODE BIT(20)
33
34 /* Aggregator port enable bit */
35 #define TPDA_Pn_CR_ENA BIT(0)
36 /* Aggregator port CMB data set element size bit */
37 #define TPDA_Pn_CR_CMBSIZE GENMASK(7, 6)
38 /* Aggregator port DSB data set element size bit */
39 #define TPDA_Pn_CR_DSBSIZE BIT(8)
40
41 /* TPDA_SYNCR count mask */
42 #define TPDA_SYNCR_COUNT_MASK GENMASK(11, 0)
43 /* TPDA_SYNCR mode control bit */
44 #define TPDA_SYNCR_MODE_CTRL_MASK GENMASK(12, 12)
45
46 #define TPDA_MAX_INPORTS 32
47
48 /**
49 * struct tpda_drvdata - specifics associated to an TPDA component
50 * @base: memory mapped base address for this component.
51 * @dev: The device entity associated to this component.
52 * @csdev: component vitals needed by the framework.
53 * @spinlock: lock for the drvdata value.
54 * @enable: enable status of the component.
55 * @dsb_esize Record the DSB element size.
56 * @cmb_esize Record the CMB element size.
57 * @trig_async: Enable/disable cross trigger synchronization sequence interface.
58 * @trig_flag_ts: Enable/disable cross trigger FLAG packet request interface.
59 * @trig_freq: Enable/disable cross trigger FREQ packet request interface.
60 * @freq_ts: Enable/disable the timestamp for all FREQ packets.
61 * @cmbchan_mode: Configure the CMB/MCMB channel mode.
62 * @syncr_mode: Setting the mode for counting packets.
63 * @syncr_count: Setting the value of the count.
64 */
65 struct tpda_drvdata {
66 void __iomem *base;
67 struct device *dev;
68 struct coresight_device *csdev;
69 spinlock_t spinlock;
70 u8 atid;
71 u32 dsb_esize;
72 u32 cmb_esize;
73 bool trig_async;
74 bool trig_flag_ts;
75 bool trig_freq;
76 bool freq_ts;
77 bool cmbchan_mode;
78 bool syncr_mode;
79 u32 syncr_count;
80 };
81
82 /* Enumerate members of global control register(cr) */
83 enum tpda_cr_mem {
84 FREQTS,
85 FRIE,
86 FLRIE,
87 SRIE,
88 CMBCHANMODE
89 };
90
91 /**
92 * struct tpda_trig_sysfs_attribute - Record the member variables of cross
93 * trigger register that need to be operated by sysfs file
94 * @attr: The device attribute
95 * @mem: The member in the control register data structure
96 */
97 struct tpda_trig_sysfs_attribute {
98 struct device_attribute attr;
99 enum tpda_cr_mem mem;
100 };
101
102 #define tpda_trig_sysfs_rw(name, mem) \
103 (&((struct tpda_trig_sysfs_attribute[]) { \
104 { \
105 __ATTR(name, 0644, tpda_trig_sysfs_show, \
106 tpda_trig_sysfs_store), \
107 mem, \
108 } \
109 })[0].attr.attr)
110
111 #endif /* _CORESIGHT_CORESIGHT_TPDA_H */