xref: /linux-6.15/include/linux/coresight.h (revision 9cae77cf)
1ad0dfdfdSMathieu Poirier /* SPDX-License-Identifier: GPL-2.0 */
2ad0dfdfdSMathieu Poirier /*
3ad0dfdfdSMathieu Poirier  * Copyright (c) 2012, The Linux Foundation. All rights reserved.
4a06ae860SPratik Patel  */
5a06ae860SPratik Patel 
6a06ae860SPratik Patel #ifndef _LINUX_CORESIGHT_H
7a06ae860SPratik Patel #define _LINUX_CORESIGHT_H
8a06ae860SPratik Patel 
973d779a0SAnshuman Khandual #include <linux/amba/bus.h>
1073d779a0SAnshuman Khandual #include <linux/clk.h>
11a06ae860SPratik Patel #include <linux/device.h>
126e736c60SSuzuki K Poulose #include <linux/io.h>
13882d5e11SMathieu Poirier #include <linux/perf_event.h>
14ff63ec13SMark Brown #include <linux/sched.h>
15a06ae860SPratik Patel 
16a06ae860SPratik Patel /* Peripheral id registers (0xFD0-0xFEC) */
17a06ae860SPratik Patel #define CORESIGHT_PERIPHIDR4	0xfd0
18a06ae860SPratik Patel #define CORESIGHT_PERIPHIDR5	0xfd4
19a06ae860SPratik Patel #define CORESIGHT_PERIPHIDR6	0xfd8
20a06ae860SPratik Patel #define CORESIGHT_PERIPHIDR7	0xfdC
21a06ae860SPratik Patel #define CORESIGHT_PERIPHIDR0	0xfe0
22a06ae860SPratik Patel #define CORESIGHT_PERIPHIDR1	0xfe4
23a06ae860SPratik Patel #define CORESIGHT_PERIPHIDR2	0xfe8
24a06ae860SPratik Patel #define CORESIGHT_PERIPHIDR3	0xfeC
25a06ae860SPratik Patel /* Component id registers (0xFF0-0xFFC) */
26a06ae860SPratik Patel #define CORESIGHT_COMPIDR0	0xff0
27a06ae860SPratik Patel #define CORESIGHT_COMPIDR1	0xff4
28a06ae860SPratik Patel #define CORESIGHT_COMPIDR2	0xff8
29a06ae860SPratik Patel #define CORESIGHT_COMPIDR3	0xffC
30a06ae860SPratik Patel 
31a06ae860SPratik Patel #define ETM_ARCH_V3_3		0x23
32a06ae860SPratik Patel #define ETM_ARCH_V3_5		0x25
33a06ae860SPratik Patel #define PFT_ARCH_V1_0		0x30
34a06ae860SPratik Patel #define PFT_ARCH_V1_1		0x31
35a06ae860SPratik Patel 
36a06ae860SPratik Patel #define CORESIGHT_UNLOCK	0xc5acce55
37a06ae860SPratik Patel 
38dd95255dSGreg Kroah-Hartman extern const struct bus_type coresight_bustype;
39a06ae860SPratik Patel 
40a06ae860SPratik Patel enum coresight_dev_type {
41a06ae860SPratik Patel 	CORESIGHT_DEV_TYPE_SINK,
42a06ae860SPratik Patel 	CORESIGHT_DEV_TYPE_LINK,
43a06ae860SPratik Patel 	CORESIGHT_DEV_TYPE_LINKSINK,
44a06ae860SPratik Patel 	CORESIGHT_DEV_TYPE_SOURCE,
458a091d84SSuzuki K Poulose 	CORESIGHT_DEV_TYPE_HELPER,
461b5b1646SJames Clark 	CORESIGHT_DEV_TYPE_MAX
47a06ae860SPratik Patel };
48a06ae860SPratik Patel 
49a06ae860SPratik Patel enum coresight_dev_subtype_sink {
509d3ba0b6SHao Zhang 	CORESIGHT_DEV_SUBTYPE_SINK_DUMMY,
51a06ae860SPratik Patel 	CORESIGHT_DEV_SUBTYPE_SINK_PORT,
52a06ae860SPratik Patel 	CORESIGHT_DEV_SUBTYPE_SINK_BUFFER,
530336bdfdSMike Leach 	CORESIGHT_DEV_SUBTYPE_SINK_SYSMEM,
542cd87a7bSAnshuman Khandual 	CORESIGHT_DEV_SUBTYPE_SINK_PERCPU_SYSMEM,
55a06ae860SPratik Patel };
56a06ae860SPratik Patel 
57a06ae860SPratik Patel enum coresight_dev_subtype_link {
58a06ae860SPratik Patel 	CORESIGHT_DEV_SUBTYPE_LINK_MERG,
59a06ae860SPratik Patel 	CORESIGHT_DEV_SUBTYPE_LINK_SPLIT,
60a06ae860SPratik Patel 	CORESIGHT_DEV_SUBTYPE_LINK_FIFO,
61a06ae860SPratik Patel };
62a06ae860SPratik Patel 
63a06ae860SPratik Patel enum coresight_dev_subtype_source {
64a06ae860SPratik Patel 	CORESIGHT_DEV_SUBTYPE_SOURCE_PROC,
65a06ae860SPratik Patel 	CORESIGHT_DEV_SUBTYPE_SOURCE_BUS,
66a06ae860SPratik Patel 	CORESIGHT_DEV_SUBTYPE_SOURCE_SOFTWARE,
67f7f965c9STao Zhang 	CORESIGHT_DEV_SUBTYPE_SOURCE_TPDM,
68b3c71626SMao Jinlong 	CORESIGHT_DEV_SUBTYPE_SOURCE_OTHERS,
69a06ae860SPratik Patel };
70a06ae860SPratik Patel 
718a091d84SSuzuki K Poulose enum coresight_dev_subtype_helper {
72fcacb5c1SSuzuki K Poulose 	CORESIGHT_DEV_SUBTYPE_HELPER_CATU,
731b5b1646SJames Clark 	CORESIGHT_DEV_SUBTYPE_HELPER_ECT_CTI
74835d722bSMike Leach };
75835d722bSMike Leach 
76a06ae860SPratik Patel /**
7700b78e8bSSuzuki K Poulose  * union coresight_dev_subtype - further characterisation of a type
78a06ae860SPratik Patel  * @sink_subtype:	type of sink this component is, as defined
7900b78e8bSSuzuki K Poulose  *			by @coresight_dev_subtype_sink.
80a06ae860SPratik Patel  * @link_subtype:	type of link this component is, as defined
8100b78e8bSSuzuki K Poulose  *			by @coresight_dev_subtype_link.
82a06ae860SPratik Patel  * @source_subtype:	type of source this component is, as defined
8300b78e8bSSuzuki K Poulose  *			by @coresight_dev_subtype_source.
848a091d84SSuzuki K Poulose  * @helper_subtype:	type of helper this component is, as defined
858a091d84SSuzuki K Poulose  *			by @coresight_dev_subtype_helper.
86a06ae860SPratik Patel  */
8700b78e8bSSuzuki K Poulose union coresight_dev_subtype {
8800b78e8bSSuzuki K Poulose 	/* We have some devices which acts as LINK and SINK */
8900b78e8bSSuzuki K Poulose 	struct {
90a06ae860SPratik Patel 		enum coresight_dev_subtype_sink sink_subtype;
91a06ae860SPratik Patel 		enum coresight_dev_subtype_link link_subtype;
9200b78e8bSSuzuki K Poulose 	};
93a06ae860SPratik Patel 	enum coresight_dev_subtype_source source_subtype;
948a091d84SSuzuki K Poulose 	enum coresight_dev_subtype_helper helper_subtype;
95a06ae860SPratik Patel };
96a06ae860SPratik Patel 
97a06ae860SPratik Patel /**
98d375b356SSuzuki K Poulose  * struct coresight_platform_data - data harvested from the firmware
99d375b356SSuzuki K Poulose  * specification.
100d375b356SSuzuki K Poulose  *
10181d0ea76SJames Clark  * @nr_inconns: Number of elements for the input connections.
10281d0ea76SJames Clark  * @nr_outconns: Number of elements for the output connections.
1034e8fe7e5SJames Clark  * @out_conns: Array of nr_outconns pointers to connections from this
1044e8fe7e5SJames Clark  *	       component.
105e3f4e687SJames Clark  * @in_conns: Sparse array of pointers to input connections. Sparse
106e3f4e687SJames Clark  *            because the source device owns the connection so when it's
107e3f4e687SJames Clark  *            unloaded the connection leaves an empty slot.
108a06ae860SPratik Patel  */
109a06ae860SPratik Patel struct coresight_platform_data {
11081d0ea76SJames Clark 	int nr_inconns;
11181d0ea76SJames Clark 	int nr_outconns;
1124e8fe7e5SJames Clark 	struct coresight_connection **out_conns;
113e3f4e687SJames Clark 	struct coresight_connection **in_conns;
114a06ae860SPratik Patel };
115a06ae860SPratik Patel 
116a06ae860SPratik Patel /**
1176e736c60SSuzuki K Poulose  * struct csdev_access - Abstraction of a CoreSight device access.
1186e736c60SSuzuki K Poulose  *
1196e736c60SSuzuki K Poulose  * @io_mem	: True if the device has memory mapped I/O
1206e736c60SSuzuki K Poulose  * @base	: When io_mem == true, base address of the component
1216e736c60SSuzuki K Poulose  * @read	: Read from the given "offset" of the given instance.
1226e736c60SSuzuki K Poulose  * @write	: Write "val" to the given "offset".
1236e736c60SSuzuki K Poulose  */
1246e736c60SSuzuki K Poulose struct csdev_access {
1256e736c60SSuzuki K Poulose 	bool io_mem;
1266e736c60SSuzuki K Poulose 	union {
1276e736c60SSuzuki K Poulose 		void __iomem *base;
1286e736c60SSuzuki K Poulose 		struct {
1296e736c60SSuzuki K Poulose 			u64 (*read)(u32 offset, bool relaxed, bool _64bit);
1306e736c60SSuzuki K Poulose 			void (*write)(u64 val, u32 offset, bool relaxed,
1316e736c60SSuzuki K Poulose 				      bool _64bit);
1326e736c60SSuzuki K Poulose 		};
1336e736c60SSuzuki K Poulose 	};
1346e736c60SSuzuki K Poulose };
1356e736c60SSuzuki K Poulose 
1366e736c60SSuzuki K Poulose #define CSDEV_ACCESS_IOMEM(_addr)		\
1376e736c60SSuzuki K Poulose 	((struct csdev_access)	{		\
1386e736c60SSuzuki K Poulose 		.io_mem		= true,		\
1396e736c60SSuzuki K Poulose 		.base		= (_addr),	\
1406e736c60SSuzuki K Poulose 	})
1416e736c60SSuzuki K Poulose 
1426e736c60SSuzuki K Poulose /**
143a06ae860SPratik Patel  * struct coresight_desc - description of a component required from drivers
144a06ae860SPratik Patel  * @type:	as defined by @coresight_dev_type.
145a06ae860SPratik Patel  * @subtype:	as defined by @coresight_dev_subtype.
146a06ae860SPratik Patel  * @ops:	generic operations for this component, as defined
1472ede79a6SSuzuki K Poulose  *		by @coresight_ops.
148a06ae860SPratik Patel  * @pdata:	platform data collected from DT.
149a06ae860SPratik Patel  * @dev:	The device entity associated to this component.
150a06ae860SPratik Patel  * @groups:	operations specific to this component. These will end up
1512ede79a6SSuzuki K Poulose  *		in the component's sysfs sub-directory.
1522ede79a6SSuzuki K Poulose  * @name:	name for the coresight device, also shown under sysfs.
1536e736c60SSuzuki K Poulose  * @access:	Describe access to the device
154a06ae860SPratik Patel  */
155a06ae860SPratik Patel struct coresight_desc {
156a06ae860SPratik Patel 	enum coresight_dev_type type;
15700b78e8bSSuzuki K Poulose 	union coresight_dev_subtype subtype;
158a06ae860SPratik Patel 	const struct coresight_ops *ops;
159a06ae860SPratik Patel 	struct coresight_platform_data *pdata;
160a06ae860SPratik Patel 	struct device *dev;
161a06ae860SPratik Patel 	const struct attribute_group **groups;
1622ede79a6SSuzuki K Poulose 	const char *name;
1636e736c60SSuzuki K Poulose 	struct csdev_access access;
164a06ae860SPratik Patel };
165a06ae860SPratik Patel 
166a06ae860SPratik Patel /**
167a06ae860SPratik Patel  * struct coresight_connection - representation of a single connection
168d49c9cf1SJames Clark  * @src_port:	a connection's output port number.
169d49c9cf1SJames Clark  * @dest_port:	destination's input port number @src_port is connected to.
170d49c9cf1SJames Clark  * @dest_fwnode: destination component's fwnode handle.
171d49c9cf1SJames Clark  * @dest_dev:	a @coresight_device representation of the component
172d49c9cf1SJames Clark 		connected to @src_port. NULL until the device is created
1738a7365c2SSuzuki K Poulose  * @link: Representation of the connection as a sysfs link.
174e3f4e687SJames Clark  *
175e3f4e687SJames Clark  * The full connection structure looks like this, where in_conns store
176e3f4e687SJames Clark  * references to same connection as the source device's out_conns.
177e3f4e687SJames Clark  *
178e3f4e687SJames Clark  * +-----------------------------+   +-----------------------------+
179e3f4e687SJames Clark  * |coresight_device             |   |coresight_connection         |
180e3f4e687SJames Clark  * |-----------------------------|   |-----------------------------|
181e3f4e687SJames Clark  * |                             |   |                             |
182e3f4e687SJames Clark  * |                             |   |                    dest_dev*|<--
183e3f4e687SJames Clark  * |pdata->out_conns[nr_outconns]|<->|src_dev*                     |   |
184e3f4e687SJames Clark  * |                             |   |                             |   |
185e3f4e687SJames Clark  * +-----------------------------+   +-----------------------------+   |
186e3f4e687SJames Clark  *                                                                     |
187e3f4e687SJames Clark  *                                   +-----------------------------+   |
188e3f4e687SJames Clark  *                                   |coresight_device             |   |
189e3f4e687SJames Clark  *                                   |------------------------------   |
190e3f4e687SJames Clark  *                                   |                             |   |
191e3f4e687SJames Clark  *                                   |  pdata->in_conns[nr_inconns]|<--
192e3f4e687SJames Clark  *                                   |                             |
193e3f4e687SJames Clark  *                                   +-----------------------------+
194a06ae860SPratik Patel  */
195a06ae860SPratik Patel struct coresight_connection {
196d49c9cf1SJames Clark 	int src_port;
197d49c9cf1SJames Clark 	int dest_port;
198d49c9cf1SJames Clark 	struct fwnode_handle *dest_fwnode;
199d49c9cf1SJames Clark 	struct coresight_device *dest_dev;
2008a7365c2SSuzuki K Poulose 	struct coresight_sysfs_link *link;
201e3f4e687SJames Clark 	struct coresight_device *src_dev;
202ae7f2b5aSJames Clark 	atomic_t src_refcnt;
203ae7f2b5aSJames Clark 	atomic_t dest_refcnt;
204a06ae860SPratik Patel };
205a06ae860SPratik Patel 
206a06ae860SPratik Patel /**
20780961525SMike Leach  * struct coresight_sysfs_link - representation of a connection in sysfs.
20880961525SMike Leach  * @orig:		Originating (master) coresight device for the link.
20980961525SMike Leach  * @orig_name:		Name to use for the link orig->target.
21080961525SMike Leach  * @target:		Target (slave) coresight device for the link.
21180961525SMike Leach  * @target_name:	Name to use for the link target->orig.
21280961525SMike Leach  */
21380961525SMike Leach struct coresight_sysfs_link {
21480961525SMike Leach 	struct coresight_device *orig;
21580961525SMike Leach 	const char *orig_name;
21680961525SMike Leach 	struct coresight_device *target;
21780961525SMike Leach 	const char *target_name;
21880961525SMike Leach };
21980961525SMike Leach 
22080961525SMike Leach /**
221a06ae860SPratik Patel  * struct coresight_device - representation of a device as used by the framework
222b77e3ed0SSuzuki K Poulose  * @pdata:	Platform data with device connections associated to this device.
223a06ae860SPratik Patel  * @type:	as defined by @coresight_dev_type.
224a06ae860SPratik Patel  * @subtype:	as defined by @coresight_dev_subtype.
225a06ae860SPratik Patel  * @ops:	generic operations for this component, as defined
2266e736c60SSuzuki K Poulose  *		by @coresight_ops.
2276e736c60SSuzuki K Poulose  * @access:	Device i/o access abstraction for this device.
228a06ae860SPratik Patel  * @dev:	The device entity associated to this component.
229*9cae77cfSJames Clark  * @mode:	This tracer's mode, i.e sysFS, Perf or disabled. This is
230*9cae77cfSJames Clark  *		actually an 'enum cs_mode', but is stored in an atomic type.
231*9cae77cfSJames Clark  *		This is always accessed through local_read() and local_set(),
232*9cae77cfSJames Clark  *		but wherever it's done from within the Coresight device's lock,
233*9cae77cfSJames Clark  *		a non-atomic read would also work.
234a06ae860SPratik Patel  * @refcnt:	keep track of what is in use.
235a06ae860SPratik Patel  * @orphan:	true if the component has connections that haven't been linked.
236a06ae860SPratik Patel  * @enable:	'true' if component is currently part of an active path.
237a0fef3f0SJames Clark  * @sysfs_sink_activated: 'true' when a sink has been selected for use via sysfs
238a0fef3f0SJames Clark  *		by writing a 1 to the 'enable_sink' file.  A sink can be
239a0fef3f0SJames Clark  *		activated but not yet enabled.  Enabling for a _sink_ happens
240a0fef3f0SJames Clark  *		when a source has been selected and a path is enabled from
241a0fef3f0SJames Clark  *		source to that sink. A sink can also become enabled but not
242a0fef3f0SJames Clark  *		activated if it's used via Perf.
243bb8e370bSMathieu Poirier  * @ea:		Device attribute for sink representation under PMU directory.
2440336bdfdSMike Leach  * @def_sink:	cached reference to default sink found for this device.
24580961525SMike Leach  * @nr_links:   number of sysfs links created to other components from this
24680961525SMike Leach  *		device. These will appear in the "connections" group.
24780961525SMike Leach  * @has_conns_grp: Have added a "connections" group for sysfs links.
24842ff700fSMike Leach  * @feature_csdev_list: List of complex feature programming added to the device.
24942ff700fSMike Leach  * @config_csdev_list:  List of system configurations added to the device.
25042ff700fSMike Leach  * @cscfg_csdev_lock:	Protect the lists of configurations and features.
251f8cce2ffSMike Leach  * @active_cscfg_ctxt:  Context information for current active system configuration.
252a06ae860SPratik Patel  */
253a06ae860SPratik Patel struct coresight_device {
254b77e3ed0SSuzuki K Poulose 	struct coresight_platform_data *pdata;
255a06ae860SPratik Patel 	enum coresight_dev_type type;
25600b78e8bSSuzuki K Poulose 	union coresight_dev_subtype subtype;
257a06ae860SPratik Patel 	const struct coresight_ops *ops;
2586e736c60SSuzuki K Poulose 	struct csdev_access access;
259a06ae860SPratik Patel 	struct device dev;
260*9cae77cfSJames Clark 	local_t	mode;
261ae7f2b5aSJames Clark 	atomic_t refcnt;
262a06ae860SPratik Patel 	bool orphan;
263a0fef3f0SJames Clark 	bool enable;
264bb8e370bSMathieu Poirier 	/* sink specific fields */
265a0fef3f0SJames Clark 	bool sysfs_sink_activated;
266bb8e370bSMathieu Poirier 	struct dev_ext_attribute *ea;
2670336bdfdSMike Leach 	struct coresight_device *def_sink;
26880961525SMike Leach 	/* sysfs links between components */
26980961525SMike Leach 	int nr_links;
27080961525SMike Leach 	bool has_conns_grp;
27142ff700fSMike Leach 	/* system configuration and feature lists */
27242ff700fSMike Leach 	struct list_head feature_csdev_list;
27342ff700fSMike Leach 	struct list_head config_csdev_list;
27442ff700fSMike Leach 	spinlock_t cscfg_csdev_lock;
275f8cce2ffSMike Leach 	void *active_cscfg_ctxt;
276a06ae860SPratik Patel };
277a06ae860SPratik Patel 
2780f5f9b6bSSuzuki K Poulose /*
2790f5f9b6bSSuzuki K Poulose  * coresight_dev_list - Mapping for devices to "name" index for device
2800f5f9b6bSSuzuki K Poulose  * names.
2810f5f9b6bSSuzuki K Poulose  *
2820f5f9b6bSSuzuki K Poulose  * @nr_idx:		Number of entries already allocated.
2830f5f9b6bSSuzuki K Poulose  * @pfx:		Prefix pattern for device name.
2840f5f9b6bSSuzuki K Poulose  * @fwnode_list:	Array of fwnode_handles associated with each allocated
2850f5f9b6bSSuzuki K Poulose  *			index, upto nr_idx entries.
2860f5f9b6bSSuzuki K Poulose  */
2870f5f9b6bSSuzuki K Poulose struct coresight_dev_list {
2880f5f9b6bSSuzuki K Poulose 	int			nr_idx;
2890f5f9b6bSSuzuki K Poulose 	const char		*pfx;
2900f5f9b6bSSuzuki K Poulose 	struct fwnode_handle	**fwnode_list;
2910f5f9b6bSSuzuki K Poulose };
2920f5f9b6bSSuzuki K Poulose 
2930f5f9b6bSSuzuki K Poulose #define DEFINE_CORESIGHT_DEVLIST(var, dev_pfx)				\
2940f5f9b6bSSuzuki K Poulose static struct coresight_dev_list (var) = {				\
2950f5f9b6bSSuzuki K Poulose 						.pfx = dev_pfx,		\
2960f5f9b6bSSuzuki K Poulose 						.nr_idx = 0,		\
2970f5f9b6bSSuzuki K Poulose 						.fwnode_list = NULL,	\
2980f5f9b6bSSuzuki K Poulose }
2990f5f9b6bSSuzuki K Poulose 
300a06ae860SPratik Patel #define to_coresight_device(d) container_of(d, struct coresight_device, dev)
301a06ae860SPratik Patel 
3029fa36828SJames Clark enum cs_mode {
3039fa36828SJames Clark 	CS_MODE_DISABLED,
3049fa36828SJames Clark 	CS_MODE_SYSFS,
3059fa36828SJames Clark 	CS_MODE_PERF,
3069fa36828SJames Clark };
3079fa36828SJames Clark 
308a06ae860SPratik Patel #define source_ops(csdev)	csdev->ops->source_ops
309a06ae860SPratik Patel #define sink_ops(csdev)		csdev->ops->sink_ops
310a06ae860SPratik Patel #define link_ops(csdev)		csdev->ops->link_ops
3118a091d84SSuzuki K Poulose #define helper_ops(csdev)	csdev->ops->helper_ops
312835d722bSMike Leach #define ect_ops(csdev)		csdev->ops->ect_ops
313a06ae860SPratik Patel 
314a06ae860SPratik Patel /**
315a06ae860SPratik Patel  * struct coresight_ops_sink - basic operations for a sink
316a06ae860SPratik Patel  * Operations available for sinks
317a06ae860SPratik Patel  * @enable:		enables the sink.
318a06ae860SPratik Patel  * @disable:		disables the sink.
3192997aa40SMathieu Poirier  * @alloc_buffer:	initialises perf's ring buffer for trace collection.
3202997aa40SMathieu Poirier  * @free_buffer:	release memory allocated in @get_config.
3212997aa40SMathieu Poirier  * @update_buffer:	update buffer pointers after a trace session.
322a06ae860SPratik Patel  */
323a06ae860SPratik Patel struct coresight_ops_sink {
3249fa36828SJames Clark 	int (*enable)(struct coresight_device *csdev, enum cs_mode mode,
3259fa36828SJames Clark 		      void *data);
3266c817a95SMathieu Poirier 	int (*disable)(struct coresight_device *csdev);
327a0f08a6aSMathieu Poirier 	void *(*alloc_buffer)(struct coresight_device *csdev,
328a0f08a6aSMathieu Poirier 			      struct perf_event *event, void **pages,
329a0f08a6aSMathieu Poirier 			      int nr_pages, bool overwrite);
3302997aa40SMathieu Poirier 	void (*free_buffer)(void *config);
3317ec786adSSuzuki K Poulose 	unsigned long (*update_buffer)(struct coresight_device *csdev,
3322997aa40SMathieu Poirier 			      struct perf_output_handle *handle,
3332997aa40SMathieu Poirier 			      void *sink_config);
334a06ae860SPratik Patel };
335a06ae860SPratik Patel 
336a06ae860SPratik Patel /**
337a06ae860SPratik Patel  * struct coresight_ops_link - basic operations for a link
338a06ae860SPratik Patel  * Operations available for links.
339a06ae860SPratik Patel  * @enable:	enables flow between iport and oport.
340a06ae860SPratik Patel  * @disable:	disables flow between iport and oport.
341a06ae860SPratik Patel  */
342a06ae860SPratik Patel struct coresight_ops_link {
343ae7f2b5aSJames Clark 	int (*enable)(struct coresight_device *csdev,
344ae7f2b5aSJames Clark 		      struct coresight_connection *in,
345ae7f2b5aSJames Clark 		      struct coresight_connection *out);
346ae7f2b5aSJames Clark 	void (*disable)(struct coresight_device *csdev,
347ae7f2b5aSJames Clark 			struct coresight_connection *in,
348ae7f2b5aSJames Clark 			struct coresight_connection *out);
349a06ae860SPratik Patel };
350a06ae860SPratik Patel 
351a06ae860SPratik Patel /**
352a06ae860SPratik Patel  * struct coresight_ops_source - basic operations for a source
353a06ae860SPratik Patel  * Operations available for sources.
35452210c87SMathieu Poirier  * @cpu_id:	returns the value of the CPU number this component
35552210c87SMathieu Poirier  *		is associated to.
3561d27ff5aSMathieu Poirier  * @enable:	enables tracing for a source.
357a06ae860SPratik Patel  * @disable:	disables tracing for a source.
358a06ae860SPratik Patel  */
359a06ae860SPratik Patel struct coresight_ops_source {
36052210c87SMathieu Poirier 	int (*cpu_id)(struct coresight_device *csdev);
3619fa36828SJames Clark 	int (*enable)(struct coresight_device *csdev, struct perf_event *event,
3629fa36828SJames Clark 		      enum cs_mode mode);
36368905d73SMathieu Poirier 	void (*disable)(struct coresight_device *csdev,
36468905d73SMathieu Poirier 			struct perf_event *event);
365a06ae860SPratik Patel };
366a06ae860SPratik Patel 
3678a091d84SSuzuki K Poulose /**
3688a091d84SSuzuki K Poulose  * struct coresight_ops_helper - Operations for a helper device.
3698a091d84SSuzuki K Poulose  *
3708a091d84SSuzuki K Poulose  * All operations could pass in a device specific data, which could
3718a091d84SSuzuki K Poulose  * help the helper device to determine what to do.
3728a091d84SSuzuki K Poulose  *
3738a091d84SSuzuki K Poulose  * @enable	: Enable the device
3748a091d84SSuzuki K Poulose  * @disable	: Disable the device
3758a091d84SSuzuki K Poulose  */
3768a091d84SSuzuki K Poulose struct coresight_ops_helper {
37761486528SJames Clark 	int (*enable)(struct coresight_device *csdev, enum cs_mode mode,
37861486528SJames Clark 		      void *data);
3798a091d84SSuzuki K Poulose 	int (*disable)(struct coresight_device *csdev, void *data);
3808a091d84SSuzuki K Poulose };
3818a091d84SSuzuki K Poulose 
382a06ae860SPratik Patel struct coresight_ops {
383a06ae860SPratik Patel 	const struct coresight_ops_sink *sink_ops;
384a06ae860SPratik Patel 	const struct coresight_ops_link *link_ops;
385a06ae860SPratik Patel 	const struct coresight_ops_source *source_ops;
3868a091d84SSuzuki K Poulose 	const struct coresight_ops_helper *helper_ops;
387a06ae860SPratik Patel };
388a06ae860SPratik Patel 
389b8127113SKim Phillips #if IS_ENABLED(CONFIG_CORESIGHT)
3906e736c60SSuzuki K Poulose 
3916e736c60SSuzuki K Poulose static inline u32 csdev_access_relaxed_read32(struct csdev_access *csa,
3926e736c60SSuzuki K Poulose 					      u32 offset)
3936e736c60SSuzuki K Poulose {
3946e736c60SSuzuki K Poulose 	if (likely(csa->io_mem))
3956e736c60SSuzuki K Poulose 		return readl_relaxed(csa->base + offset);
3966e736c60SSuzuki K Poulose 
3976e736c60SSuzuki K Poulose 	return csa->read(offset, true, false);
3986e736c60SSuzuki K Poulose }
3996e736c60SSuzuki K Poulose 
40073d779a0SAnshuman Khandual #define CORESIGHT_CIDRn(i)	(0xFF0 + ((i) * 4))
40173d779a0SAnshuman Khandual 
40273d779a0SAnshuman Khandual static inline u32 coresight_get_cid(void __iomem *base)
40373d779a0SAnshuman Khandual {
40473d779a0SAnshuman Khandual 	u32 i, cid = 0;
40573d779a0SAnshuman Khandual 
40673d779a0SAnshuman Khandual 	for (i = 0; i < 4; i++)
40773d779a0SAnshuman Khandual 		cid |= readl(base + CORESIGHT_CIDRn(i)) << (i * 8);
40873d779a0SAnshuman Khandual 
40973d779a0SAnshuman Khandual 	return cid;
41073d779a0SAnshuman Khandual }
41173d779a0SAnshuman Khandual 
41273d779a0SAnshuman Khandual static inline bool is_coresight_device(void __iomem *base)
41373d779a0SAnshuman Khandual {
41473d779a0SAnshuman Khandual 	u32 cid = coresight_get_cid(base);
41573d779a0SAnshuman Khandual 
41673d779a0SAnshuman Khandual 	return cid == CORESIGHT_CID;
41773d779a0SAnshuman Khandual }
41873d779a0SAnshuman Khandual 
41973d779a0SAnshuman Khandual /*
42073d779a0SAnshuman Khandual  * Attempt to find and enable "APB clock" for the given device
42173d779a0SAnshuman Khandual  *
42273d779a0SAnshuman Khandual  * Returns:
42373d779a0SAnshuman Khandual  *
42473d779a0SAnshuman Khandual  * clk   - Clock is found and enabled
42573d779a0SAnshuman Khandual  * NULL  - clock is not found
42673d779a0SAnshuman Khandual  * ERROR - Clock is found but failed to enable
42773d779a0SAnshuman Khandual  */
42873d779a0SAnshuman Khandual static inline struct clk *coresight_get_enable_apb_pclk(struct device *dev)
42973d779a0SAnshuman Khandual {
43073d779a0SAnshuman Khandual 	struct clk *pclk;
43173d779a0SAnshuman Khandual 	int ret;
43273d779a0SAnshuman Khandual 
43373d779a0SAnshuman Khandual 	pclk = clk_get(dev, "apb_pclk");
43473d779a0SAnshuman Khandual 	if (IS_ERR(pclk))
43573d779a0SAnshuman Khandual 		return NULL;
43673d779a0SAnshuman Khandual 
43773d779a0SAnshuman Khandual 	ret = clk_prepare_enable(pclk);
43873d779a0SAnshuman Khandual 	if (ret) {
43973d779a0SAnshuman Khandual 		clk_put(pclk);
44073d779a0SAnshuman Khandual 		return ERR_PTR(ret);
44173d779a0SAnshuman Khandual 	}
44273d779a0SAnshuman Khandual 	return pclk;
44373d779a0SAnshuman Khandual }
44473d779a0SAnshuman Khandual 
4455a1c7097SAnshuman Khandual #define CORESIGHT_PIDRn(i)	(0xFE0 + ((i) * 4))
4465a1c7097SAnshuman Khandual 
4475a1c7097SAnshuman Khandual static inline u32 coresight_get_pid(struct csdev_access *csa)
4485a1c7097SAnshuman Khandual {
4495a1c7097SAnshuman Khandual 	u32 i, pid = 0;
4505a1c7097SAnshuman Khandual 
4515a1c7097SAnshuman Khandual 	for (i = 0; i < 4; i++)
4525a1c7097SAnshuman Khandual 		pid |= csdev_access_relaxed_read32(csa, CORESIGHT_PIDRn(i)) << (i * 8);
4535a1c7097SAnshuman Khandual 
4545a1c7097SAnshuman Khandual 	return pid;
4555a1c7097SAnshuman Khandual }
4565a1c7097SAnshuman Khandual 
457b6df1cbbSJames Clark static inline u64 csdev_access_relaxed_read_pair(struct csdev_access *csa,
4580a98181fSJames Clark 						 u32 lo_offset, u32 hi_offset)
459b6df1cbbSJames Clark {
460b6df1cbbSJames Clark 	if (likely(csa->io_mem)) {
4610a98181fSJames Clark 		return readl_relaxed(csa->base + lo_offset) |
4620a98181fSJames Clark 			((u64)readl_relaxed(csa->base + hi_offset) << 32);
463b6df1cbbSJames Clark 	}
464b6df1cbbSJames Clark 
4650a98181fSJames Clark 	return csa->read(lo_offset, true, false) | (csa->read(hi_offset, true, false) << 32);
4660a98181fSJames Clark }
4670a98181fSJames Clark 
4680a98181fSJames Clark static inline void csdev_access_relaxed_write_pair(struct csdev_access *csa, u64 val,
4690a98181fSJames Clark 						   u32 lo_offset, u32 hi_offset)
4700a98181fSJames Clark {
4710a98181fSJames Clark 	if (likely(csa->io_mem)) {
4720a98181fSJames Clark 		writel_relaxed((u32)val, csa->base + lo_offset);
4730a98181fSJames Clark 		writel_relaxed((u32)(val >> 32), csa->base + hi_offset);
4740a98181fSJames Clark 	} else {
4750a98181fSJames Clark 		csa->write((u32)val, lo_offset, true, false);
4760a98181fSJames Clark 		csa->write((u32)(val >> 32), hi_offset, true, false);
4770a98181fSJames Clark 	}
478b6df1cbbSJames Clark }
479b6df1cbbSJames Clark 
4806e736c60SSuzuki K Poulose static inline u32 csdev_access_read32(struct csdev_access *csa, u32 offset)
4816e736c60SSuzuki K Poulose {
4826e736c60SSuzuki K Poulose 	if (likely(csa->io_mem))
4836e736c60SSuzuki K Poulose 		return readl(csa->base + offset);
4846e736c60SSuzuki K Poulose 
4856e736c60SSuzuki K Poulose 	return csa->read(offset, false, false);
4866e736c60SSuzuki K Poulose }
4876e736c60SSuzuki K Poulose 
4886e736c60SSuzuki K Poulose static inline void csdev_access_relaxed_write32(struct csdev_access *csa,
4896e736c60SSuzuki K Poulose 						u32 val, u32 offset)
4906e736c60SSuzuki K Poulose {
4916e736c60SSuzuki K Poulose 	if (likely(csa->io_mem))
4926e736c60SSuzuki K Poulose 		writel_relaxed(val, csa->base + offset);
4936e736c60SSuzuki K Poulose 	else
4946e736c60SSuzuki K Poulose 		csa->write(val, offset, true, false);
4956e736c60SSuzuki K Poulose }
4966e736c60SSuzuki K Poulose 
4976e736c60SSuzuki K Poulose static inline void csdev_access_write32(struct csdev_access *csa, u32 val, u32 offset)
4986e736c60SSuzuki K Poulose {
4996e736c60SSuzuki K Poulose 	if (likely(csa->io_mem))
5006e736c60SSuzuki K Poulose 		writel(val, csa->base + offset);
5016e736c60SSuzuki K Poulose 	else
5026e736c60SSuzuki K Poulose 		csa->write(val, offset, false, false);
5036e736c60SSuzuki K Poulose }
5046e736c60SSuzuki K Poulose 
5056e736c60SSuzuki K Poulose #ifdef CONFIG_64BIT
5066e736c60SSuzuki K Poulose 
5076e736c60SSuzuki K Poulose static inline u64 csdev_access_relaxed_read64(struct csdev_access *csa,
5086e736c60SSuzuki K Poulose 					      u32 offset)
5096e736c60SSuzuki K Poulose {
5106e736c60SSuzuki K Poulose 	if (likely(csa->io_mem))
5116e736c60SSuzuki K Poulose 		return readq_relaxed(csa->base + offset);
5126e736c60SSuzuki K Poulose 
5136e736c60SSuzuki K Poulose 	return csa->read(offset, true, true);
5146e736c60SSuzuki K Poulose }
5156e736c60SSuzuki K Poulose 
5166e736c60SSuzuki K Poulose static inline u64 csdev_access_read64(struct csdev_access *csa, u32 offset)
5176e736c60SSuzuki K Poulose {
5186e736c60SSuzuki K Poulose 	if (likely(csa->io_mem))
5196e736c60SSuzuki K Poulose 		return readq(csa->base + offset);
5206e736c60SSuzuki K Poulose 
5216e736c60SSuzuki K Poulose 	return csa->read(offset, false, true);
5226e736c60SSuzuki K Poulose }
5236e736c60SSuzuki K Poulose 
5246e736c60SSuzuki K Poulose static inline void csdev_access_relaxed_write64(struct csdev_access *csa,
5256e736c60SSuzuki K Poulose 						u64 val, u32 offset)
5266e736c60SSuzuki K Poulose {
5276e736c60SSuzuki K Poulose 	if (likely(csa->io_mem))
5286e736c60SSuzuki K Poulose 		writeq_relaxed(val, csa->base + offset);
5296e736c60SSuzuki K Poulose 	else
5306e736c60SSuzuki K Poulose 		csa->write(val, offset, true, true);
5316e736c60SSuzuki K Poulose }
5326e736c60SSuzuki K Poulose 
5336e736c60SSuzuki K Poulose static inline void csdev_access_write64(struct csdev_access *csa, u64 val, u32 offset)
5346e736c60SSuzuki K Poulose {
5356e736c60SSuzuki K Poulose 	if (likely(csa->io_mem))
5366e736c60SSuzuki K Poulose 		writeq(val, csa->base + offset);
5376e736c60SSuzuki K Poulose 	else
5386e736c60SSuzuki K Poulose 		csa->write(val, offset, false, true);
5396e736c60SSuzuki K Poulose }
5406e736c60SSuzuki K Poulose 
5416e736c60SSuzuki K Poulose #else	/* !CONFIG_64BIT */
5426e736c60SSuzuki K Poulose 
5436e736c60SSuzuki K Poulose static inline u64 csdev_access_relaxed_read64(struct csdev_access *csa,
5446e736c60SSuzuki K Poulose 					      u32 offset)
5456e736c60SSuzuki K Poulose {
5466e736c60SSuzuki K Poulose 	WARN_ON(1);
5476e736c60SSuzuki K Poulose 	return 0;
5486e736c60SSuzuki K Poulose }
5496e736c60SSuzuki K Poulose 
5506e736c60SSuzuki K Poulose static inline u64 csdev_access_read64(struct csdev_access *csa, u32 offset)
5516e736c60SSuzuki K Poulose {
5526e736c60SSuzuki K Poulose 	WARN_ON(1);
5536e736c60SSuzuki K Poulose 	return 0;
5546e736c60SSuzuki K Poulose }
5556e736c60SSuzuki K Poulose 
5566e736c60SSuzuki K Poulose static inline void csdev_access_relaxed_write64(struct csdev_access *csa,
5576e736c60SSuzuki K Poulose 						u64 val, u32 offset)
5586e736c60SSuzuki K Poulose {
5596e736c60SSuzuki K Poulose 	WARN_ON(1);
5606e736c60SSuzuki K Poulose }
5616e736c60SSuzuki K Poulose 
5626e736c60SSuzuki K Poulose static inline void csdev_access_write64(struct csdev_access *csa, u64 val, u32 offset)
5636e736c60SSuzuki K Poulose {
5646e736c60SSuzuki K Poulose 	WARN_ON(1);
5656e736c60SSuzuki K Poulose }
5666e736c60SSuzuki K Poulose #endif	/* CONFIG_64BIT */
5676e736c60SSuzuki K Poulose 
5682cd87a7bSAnshuman Khandual static inline bool coresight_is_percpu_source(struct coresight_device *csdev)
5692cd87a7bSAnshuman Khandual {
5702cd87a7bSAnshuman Khandual 	return csdev && (csdev->type == CORESIGHT_DEV_TYPE_SOURCE) &&
5712cd87a7bSAnshuman Khandual 	       (csdev->subtype.source_subtype == CORESIGHT_DEV_SUBTYPE_SOURCE_PROC);
5722cd87a7bSAnshuman Khandual }
5732cd87a7bSAnshuman Khandual 
5742cd87a7bSAnshuman Khandual static inline bool coresight_is_percpu_sink(struct coresight_device *csdev)
5752cd87a7bSAnshuman Khandual {
5762cd87a7bSAnshuman Khandual 	return csdev && (csdev->type == CORESIGHT_DEV_TYPE_SINK) &&
5772cd87a7bSAnshuman Khandual 	       (csdev->subtype.sink_subtype == CORESIGHT_DEV_SUBTYPE_SINK_PERCPU_SYSMEM);
5782cd87a7bSAnshuman Khandual }
5792cd87a7bSAnshuman Khandual 
580a06ae860SPratik Patel extern struct coresight_device *
581a06ae860SPratik Patel coresight_register(struct coresight_desc *desc);
582a06ae860SPratik Patel extern void coresight_unregister(struct coresight_device *csdev);
583a06ae860SPratik Patel extern int coresight_enable(struct coresight_device *csdev);
584a06ae860SPratik Patel extern void coresight_disable(struct coresight_device *csdev);
58502005282SSuzuki K Poulose extern int coresight_timeout(struct csdev_access *csa, u32 offset,
586a06ae860SPratik Patel 			     int position, int value);
5872478a6aeSSuzuki K Poulose 
5888ce00296SSuzuki K Poulose extern int coresight_claim_device(struct coresight_device *csdev);
5898ce00296SSuzuki K Poulose extern int coresight_claim_device_unlocked(struct coresight_device *csdev);
5902478a6aeSSuzuki K Poulose 
5918ce00296SSuzuki K Poulose extern void coresight_disclaim_device(struct coresight_device *csdev);
5928ce00296SSuzuki K Poulose extern void coresight_disclaim_device_unlocked(struct coresight_device *csdev);
5930f5f9b6bSSuzuki K Poulose extern char *coresight_alloc_device_name(struct coresight_dev_list *devs,
5940f5f9b6bSSuzuki K Poulose 					 struct device *dev);
595f188b5e7SAndrew Murray 
596f188b5e7SAndrew Murray extern bool coresight_loses_context_with_cpu(struct device *dev);
5976e736c60SSuzuki K Poulose 
5986e736c60SSuzuki K Poulose u32 coresight_relaxed_read32(struct coresight_device *csdev, u32 offset);
5996e736c60SSuzuki K Poulose u32 coresight_read32(struct coresight_device *csdev, u32 offset);
6006e736c60SSuzuki K Poulose void coresight_write32(struct coresight_device *csdev, u32 val, u32 offset);
6016e736c60SSuzuki K Poulose void coresight_relaxed_write32(struct coresight_device *csdev,
6026e736c60SSuzuki K Poulose 			       u32 val, u32 offset);
6036e736c60SSuzuki K Poulose u64 coresight_relaxed_read64(struct coresight_device *csdev, u32 offset);
6046e736c60SSuzuki K Poulose u64 coresight_read64(struct coresight_device *csdev, u32 offset);
6056e736c60SSuzuki K Poulose void coresight_relaxed_write64(struct coresight_device *csdev,
6066e736c60SSuzuki K Poulose 			       u64 val, u32 offset);
6076e736c60SSuzuki K Poulose void coresight_write64(struct coresight_device *csdev, u64 val, u32 offset);
6086e736c60SSuzuki K Poulose 
609a06ae860SPratik Patel #else
610a06ae860SPratik Patel static inline struct coresight_device *
611a06ae860SPratik Patel coresight_register(struct coresight_desc *desc) { return NULL; }
612a06ae860SPratik Patel static inline void coresight_unregister(struct coresight_device *csdev) {}
613a06ae860SPratik Patel static inline int
614a06ae860SPratik Patel coresight_enable(struct coresight_device *csdev) { return -ENOSYS; }
615a06ae860SPratik Patel static inline void coresight_disable(struct coresight_device *csdev) {}
61602005282SSuzuki K Poulose 
61702005282SSuzuki K Poulose static inline int coresight_timeout(struct csdev_access *csa, u32 offset,
61802005282SSuzuki K Poulose 				    int position, int value)
61902005282SSuzuki K Poulose {
62002005282SSuzuki K Poulose 	return 1;
62102005282SSuzuki K Poulose }
62202005282SSuzuki K Poulose 
6238ce00296SSuzuki K Poulose static inline int coresight_claim_device_unlocked(struct coresight_device *csdev)
6242478a6aeSSuzuki K Poulose {
6252478a6aeSSuzuki K Poulose 	return -EINVAL;
6262478a6aeSSuzuki K Poulose }
6272478a6aeSSuzuki K Poulose 
6288ce00296SSuzuki K Poulose static inline int coresight_claim_device(struct coresight_device *csdev)
6292478a6aeSSuzuki K Poulose {
6302478a6aeSSuzuki K Poulose 	return -EINVAL;
6312478a6aeSSuzuki K Poulose }
6322478a6aeSSuzuki K Poulose 
6338ce00296SSuzuki K Poulose static inline void coresight_disclaim_device(struct coresight_device *csdev) {}
6348ce00296SSuzuki K Poulose static inline void coresight_disclaim_device_unlocked(struct coresight_device *csdev) {}
6352478a6aeSSuzuki K Poulose 
636f188b5e7SAndrew Murray static inline bool coresight_loses_context_with_cpu(struct device *dev)
637f188b5e7SAndrew Murray {
638f188b5e7SAndrew Murray 	return false;
639f188b5e7SAndrew Murray }
6406e736c60SSuzuki K Poulose 
6416e736c60SSuzuki K Poulose static inline u32 coresight_relaxed_read32(struct coresight_device *csdev, u32 offset)
6426e736c60SSuzuki K Poulose {
6436e736c60SSuzuki K Poulose 	WARN_ON_ONCE(1);
6446e736c60SSuzuki K Poulose 	return 0;
6456e736c60SSuzuki K Poulose }
6466e736c60SSuzuki K Poulose 
6476e736c60SSuzuki K Poulose static inline u32 coresight_read32(struct coresight_device *csdev, u32 offset)
6486e736c60SSuzuki K Poulose {
6496e736c60SSuzuki K Poulose 	WARN_ON_ONCE(1);
6506e736c60SSuzuki K Poulose 	return 0;
6516e736c60SSuzuki K Poulose }
6526e736c60SSuzuki K Poulose 
6536e736c60SSuzuki K Poulose static inline void coresight_write32(struct coresight_device *csdev, u32 val, u32 offset)
6546e736c60SSuzuki K Poulose {
6556e736c60SSuzuki K Poulose }
6566e736c60SSuzuki K Poulose 
6576e736c60SSuzuki K Poulose static inline void coresight_relaxed_write32(struct coresight_device *csdev,
6586e736c60SSuzuki K Poulose 					     u32 val, u32 offset)
6596e736c60SSuzuki K Poulose {
6606e736c60SSuzuki K Poulose }
6616e736c60SSuzuki K Poulose 
6626e736c60SSuzuki K Poulose static inline u64 coresight_relaxed_read64(struct coresight_device *csdev,
6636e736c60SSuzuki K Poulose 					   u32 offset)
6646e736c60SSuzuki K Poulose {
6656e736c60SSuzuki K Poulose 	WARN_ON_ONCE(1);
6666e736c60SSuzuki K Poulose 	return 0;
6676e736c60SSuzuki K Poulose }
6686e736c60SSuzuki K Poulose 
6696e736c60SSuzuki K Poulose static inline u64 coresight_read64(struct coresight_device *csdev, u32 offset)
6706e736c60SSuzuki K Poulose {
6716e736c60SSuzuki K Poulose 	WARN_ON_ONCE(1);
6726e736c60SSuzuki K Poulose 	return 0;
6736e736c60SSuzuki K Poulose }
6746e736c60SSuzuki K Poulose 
6756e736c60SSuzuki K Poulose static inline void coresight_relaxed_write64(struct coresight_device *csdev,
6766e736c60SSuzuki K Poulose 					     u64 val, u32 offset)
6776e736c60SSuzuki K Poulose {
6786e736c60SSuzuki K Poulose }
6796e736c60SSuzuki K Poulose 
6806e736c60SSuzuki K Poulose static inline void coresight_write64(struct coresight_device *csdev, u64 val, u32 offset)
6816e736c60SSuzuki K Poulose {
6826e736c60SSuzuki K Poulose }
6836e736c60SSuzuki K Poulose 
6846e736c60SSuzuki K Poulose #endif		/* IS_ENABLED(CONFIG_CORESIGHT) */
685c61c4b5dSMathieu Poirier 
68691824db2SSuzuki K Poulose extern int coresight_get_cpu(struct device *dev);
687a06ae860SPratik Patel 
688f03631daSSuzuki K Poulose struct coresight_platform_data *coresight_get_platform_data(struct device *dev);
6893d4ff657SJames Clark struct coresight_connection *
6903d4ff657SJames Clark coresight_add_out_conn(struct device *dev,
6913d4ff657SJames Clark 		       struct coresight_platform_data *pdata,
6923d4ff657SJames Clark 		       const struct coresight_connection *new_conn);
693e3f4e687SJames Clark int coresight_add_in_conn(struct coresight_connection *conn);
69461486528SJames Clark struct coresight_device *
69561486528SJames Clark coresight_find_input_type(struct coresight_platform_data *pdata,
69661486528SJames Clark 			  enum coresight_dev_type type,
69761486528SJames Clark 			  union coresight_dev_subtype subtype);
69861486528SJames Clark struct coresight_device *
69961486528SJames Clark coresight_find_output_type(struct coresight_platform_data *pdata,
70061486528SJames Clark 			   enum coresight_dev_type type,
70161486528SJames Clark 			   union coresight_dev_subtype subtype);
702f03631daSSuzuki K Poulose 
7036e736c60SSuzuki K Poulose #endif		/* _LINUX_COREISGHT_H */
704