forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/hwtracing/intel_th/intel_th.h
....@@ -8,6 +8,8 @@
88 #ifndef __INTEL_TH_H__
99 #define __INTEL_TH_H__
1010
11
+#include <linux/irqreturn.h>
12
+
1113 /* intel_th_device device types */
1214 enum {
1315 /* Devices that generate trace data */
....@@ -18,6 +20,8 @@
1820 INTEL_TH_SWITCH,
1921 };
2022
23
+struct intel_th_device;
24
+
2125 /**
2226 * struct intel_th_output - descriptor INTEL_TH_OUTPUT type devices
2327 * @port: output port number, assigned by the switch
....@@ -25,6 +29,7 @@
2529 * @scratchpad: scratchpad bits to flag when this output is enabled
2630 * @multiblock: true for multiblock output configuration
2731 * @active: true when this output is enabled
32
+ * @wait_empty: wait for device pipeline to be empty
2833 *
2934 * Output port descriptor, used by switch driver to tell which output
3035 * port this output device corresponds to. Filled in at output device's
....@@ -42,10 +47,14 @@
4247 /**
4348 * struct intel_th_drvdata - describes hardware capabilities and quirks
4449 * @tscu_enable: device needs SW to enable time stamping unit
50
+ * @multi_is_broken: device has multiblock mode is broken
51
+ * @has_mintctl: device has interrupt control (MINTCTL) register
4552 * @host_mode_only: device can only operate in 'host debugger' mode
4653 */
4754 struct intel_th_drvdata {
4855 unsigned int tscu_enable : 1,
56
+ multi_is_broken : 1,
57
+ has_mintctl : 1,
4958 host_mode_only : 1;
5059 };
5160
....@@ -160,10 +169,13 @@
160169 struct intel_th_output *output);
161170 void (*enable)(struct intel_th_device *thdev,
162171 struct intel_th_output *output);
172
+ void (*trig_switch)(struct intel_th_device *thdev,
173
+ struct intel_th_output *output);
163174 void (*disable)(struct intel_th_device *thdev,
164175 struct intel_th_output *output);
165176 /* output ops */
166
- void (*irq)(struct intel_th_device *thdev);
177
+ irqreturn_t (*irq)(struct intel_th_device *thdev);
178
+ void (*wait_empty)(struct intel_th_device *thdev);
167179 int (*activate)(struct intel_th_device *thdev);
168180 void (*deactivate)(struct intel_th_device *thdev);
169181 /* file_operations for those who want a device node */
....@@ -216,21 +228,23 @@
216228
217229 struct intel_th *
218230 intel_th_alloc(struct device *dev, struct intel_th_drvdata *drvdata,
219
- struct resource *devres, unsigned int ndevres, int irq);
231
+ struct resource *devres, unsigned int ndevres);
220232 void intel_th_free(struct intel_th *th);
221233
222234 int intel_th_driver_register(struct intel_th_driver *thdrv);
223235 void intel_th_driver_unregister(struct intel_th_driver *thdrv);
224236
225237 int intel_th_trace_enable(struct intel_th_device *thdev);
238
+int intel_th_trace_switch(struct intel_th_device *thdev);
226239 int intel_th_trace_disable(struct intel_th_device *thdev);
227240 int intel_th_set_output(struct intel_th_device *thdev,
228241 unsigned int master);
229242 int intel_th_output_enable(struct intel_th *th, unsigned int otype);
230243
231
-enum {
244
+enum th_mmio_idx {
232245 TH_MMIO_CONFIG = 0,
233
- TH_MMIO_SW = 2,
246
+ TH_MMIO_SW = 1,
247
+ TH_MMIO_RTIT = 2,
234248 TH_MMIO_END,
235249 };
236250
....@@ -240,6 +254,9 @@
240254 #define TH_CONFIGURABLE_MASTERS 256
241255 #define TH_MSC_MAX 2
242256
257
+/* Maximum IRQ vectors */
258
+#define TH_NVEC_MAX 8
259
+
243260 /**
244261 * struct intel_th - Intel TH controller
245262 * @dev: driver core's device
....@@ -247,8 +264,9 @@
247264 * @hub: "switch" subdevice (GTH)
248265 * @resource: resources of the entire controller
249266 * @num_thdevs: number of devices in the @thdev array
250
- * @num_resources: number or resources in the @resource array
267
+ * @num_resources: number of resources in the @resource array
251268 * @irq: irq number
269
+ * @num_irqs: number of IRQs is use
252270 * @id: this Intel TH controller's device ID in the system
253271 * @major: device node major for output devices
254272 */
....@@ -259,12 +277,13 @@
259277 struct intel_th_device *hub;
260278 struct intel_th_drvdata *drvdata;
261279
262
- struct resource *resource;
280
+ struct resource resource[TH_MMIO_END];
263281 int (*activate)(struct intel_th *);
264282 void (*deactivate)(struct intel_th *);
265283 unsigned int num_thdevs;
266284 unsigned int num_resources;
267285 int irq;
286
+ int num_irqs;
268287
269288 int id;
270289 int major;
....@@ -299,6 +318,9 @@
299318 REG_TSCU_OFFSET = 0x2000,
300319 REG_TSCU_LENGTH = 0x1000,
301320
321
+ REG_CTS_OFFSET = 0x3000,
322
+ REG_CTS_LENGTH = 0x1000,
323
+
302324 /* Software Trace Hub (STH) [0x4000..0x4fff] */
303325 REG_STH_OFFSET = 0x4000,
304326 REG_STH_LENGTH = 0x2000,