Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 485329fc authored by Tingwei Zhang's avatar Tingwei Zhang
Browse files

coresight: csr: Add multiple CSR devices support



Add a CSR device list in CSR driver to support multiple CSR devices. CSR
device structure is initialized in probe and added to the list. Add CSR
device structure as parameter of CSR function. Change the caller of CSR
functions to align with this change.

Change-Id: I15e979a517204ac37dbcc5defd78a0214f44ade8
Signed-off-by: default avatarTingwei Zhang <tingwei@codeaurora.org>
parent 63fc6f1d
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -23,6 +23,14 @@ extern int coresight_csr_hwctrl_set(struct coresight_csr *csr, uint64_t addr,
extern void coresight_csr_set_byte_cntr(struct coresight_csr *csr,
				 uint32_t count);
extern struct coresight_csr *coresight_csr_get(const char *name);
#if IS_ENABLED(CONFIG_OF)
extern int of_get_coresight_csr_name(struct device_node *node,
				const char **csr_name);
#else
static inline int of_get_coresight_csr_name(struct device_node *node,
		const char **csr_name){ return -EINVAL; }
#endif

#else
static inline void msm_qdss_csr_enable_bam_to_usb(struct coresight_csr *csr) {}
static inline void msm_qdss_csr_disable_bam_to_usb(struct coresight_csr *csr) {}
@@ -33,6 +41,8 @@ static inline void coresight_csr_set_byte_cntr(struct coresight_csr *csr,
					   uint32_t count) {}
static inline struct coresight_csr *coresight_csr_get(const char *name)
					{ return NULL; }
static inline int of_get_coresight_csr_name(struct device_node *node,
		const char **csr_name){ return -EINVAL; }
#endif

#endif
+15 −0
Original line number Diff line number Diff line
@@ -248,6 +248,21 @@ struct coresight_csr *coresight_csr_get(const char *name)
}
EXPORT_SYMBOL(coresight_csr_get);

int of_get_coresight_csr_name(struct device_node *node, const char **csr_name)
{
	int ret;
	struct device_node *csr_node;

	csr_node = of_parse_phandle(node, "coresight-csr", 0);
	if (!csr_node)
		return -EINVAL;

	ret = of_property_read_string(csr_node, "coresight-name", csr_name);
	of_node_put(csr_node);
	return ret;
}
EXPORT_SYMBOL(of_get_coresight_csr_name);

static ssize_t timestamp_show(struct device *dev,
				struct device_attribute *attr,
				char *buf)
+12 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012,2017,2019 The Linux Foundation. All rights reserved.
 *
 * Description: CoreSight Trace Memory Controller driver
 */
@@ -432,6 +432,17 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id)
	else
		drvdata->size = readl_relaxed(drvdata->base + TMC_RSZ) * 4;

	ret = of_get_coresight_csr_name(adev->dev.of_node, &drvdata->csr_name);
	if (ret)
		dev_dbg(dev, "No csr data\n");
	else {
		drvdata->csr = coresight_csr_get(drvdata->csr_name);
		if (IS_ERR(drvdata->csr)) {
			dev_dbg(dev, "failed to get csr, defer probe\n");
			return -EPROBE_DEFER;
		}
	}

	desc.dev = dev;
	desc.groups = coresight_tmc_groups;

+2 −0
Original line number Diff line number Diff line
@@ -203,6 +203,8 @@ struct tmc_drvdata {
	struct mutex		idr_mutex;
	struct etr_buf		*sysfs_buf;
	void			*perf_data;
	struct coresight_csr	*csr;
	const char		*csr_name;
};

struct etr_buf_operations {