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

Commit 09b9f72c authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "coresight: add support to read cti data"

parents c87362fb 49a4830c
Loading
Loading
Loading
Loading
+43 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@
#include <linux/coresight.h>
#include <linux/cpumask.h>
#include <asm/smp_plat.h>

#include <linux/coresight-cti.h>

static int of_dev_node_match(struct device *dev, void *data)
{
@@ -216,3 +216,45 @@ int of_get_coresight_csr_name(struct device_node *node, const char **csr_name)
	return 0;
}
EXPORT_SYMBOL(of_get_coresight_csr_name);

struct coresight_cti_data *of_get_coresight_cti_data(
				struct device *dev, struct device_node *node)
{
	int i, ret;
	uint32_t ctis_len;
	struct device_node *child_node;
	struct coresight_cti_data *ctidata;

	ctidata = devm_kzalloc(dev, sizeof(*ctidata), GFP_KERNEL);
	if (!ctidata)
		return ERR_PTR(-ENOMEM);

	if (of_get_property(node, "coresight-ctis", &ctis_len))
		ctidata->nr_ctis = ctis_len/sizeof(uint32_t);
	else
		return ERR_PTR(-EINVAL);

	if (ctidata->nr_ctis) {
		ctidata->names = devm_kzalloc(dev, ctidata->nr_ctis *
					      sizeof(*ctidata->names),
					      GFP_KERNEL);
		if (!ctidata->names)
			return ERR_PTR(-ENOMEM);

		for (i = 0; i < ctidata->nr_ctis; i++) {
			child_node = of_parse_phandle(node, "coresight-ctis",
						      i);
			if (!child_node)
				return ERR_PTR(-EINVAL);

			ret = of_property_read_string(child_node,
						      "coresight-name",
						      &ctidata->names[i]);
			of_node_put(child_node);
			if (ret)
				return ERR_PTR(ret);
		}
	}
	return ctidata;
}
EXPORT_SYMBOL(of_get_coresight_cti_data);
+4 −0
Original line number Diff line number Diff line
@@ -290,6 +290,8 @@ of_get_coresight_platform_data(struct device *dev,
extern int of_get_coresight_csr_name(struct device_node *node,
				const char **csr_name);

extern struct coresight_cti_data *of_get_coresight_cti_data(
				struct device *dev, struct device_node *node);
#else
static inline int of_coresight_get_cpu(const struct device_node *node)
{ return 0; }
@@ -297,6 +299,8 @@ static inline struct coresight_platform_data *of_get_coresight_platform_data(
	struct device *dev, const struct device_node *node) { return NULL; }
static inline int of_get_coresight_csr_name(struct device_node *node,
		const char **csr_name){ return -EINVAL; }
static inlint struct coresight_cti_data *of_get_coresight_cti_data(
		struct device *dev, struct device_node *node) { return NULL; }
#endif

#endif