On Wed, Jan 09, 2019 at 10:54:37PM +0000, Mike Leach wrote:
Adds in functions to allow CTI devices to extract standard Coresight information from device trees.
Adds in function to allow location of a registered Coresight device given the device tree node data.
Signed-off-by: Mike Leach mike.leach@linaro.org
drivers/hwtracing/coresight/of_coresight.c | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+)
diff --git a/drivers/hwtracing/coresight/of_coresight.c b/drivers/hwtracing/coresight/of_coresight.c index 89092f83567e..1d6adfc0057c 100644 --- a/drivers/hwtracing/coresight/of_coresight.c +++ b/drivers/hwtracing/coresight/of_coresight.c @@ -295,3 +295,68 @@ of_get_coresight_platform_data(struct device *dev, return pdata; } EXPORT_SYMBOL_GPL(of_get_coresight_platform_data);
+struct coresight_platform_data * +of_get_coresight_ect_platform_data(struct device *dev,
const struct device_node *node)
+{
- struct coresight_platform_data *pdata;
- pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
- if (!pdata)
return ERR_PTR(-ENOMEM);
- /* Use device name as sysfs handle */
- pdata->name = dev_name(dev);
The above is already done in of_get_coresight_platform_data() and as such I wonder why it needs to be replicated here.
- return pdata;
+} +EXPORT_SYMBOL_GPL(of_get_coresight_ect_platform_data);
+int of_coresight_ect_get_cpu(const struct device_node *node) +{
- int cpu;
- struct device_node *dn;
- dn = of_parse_phandle(node, "cpu", 0);
- /* CTI Affinity defaults to no cpu */
- if (!dn)
return -1;
- cpu = of_cpu_node_to_id(dn);
- of_node_put(dn);
- /* No Affinity if no cpu nodes are found */
- return (cpu < 0) ? -1 : cpu;
+} +EXPORT_SYMBOL_GPL(of_coresight_ect_get_cpu);
+/*
- Find a registered coresight device from the device_node.
- The node info is associated with the AMBA parent, so we
- search this first to find a name, and use the name to find
- the device on the coresight bus as they are always named the same.
- */
+struct coresight_device * +of_coresight_get_cs_device_by_node(struct device_node *node) +{
- struct device *dev, *adev;
- struct coresight_device *csdev = NULL;
- const char *amba_dev_name = NULL;
- if (!node)
return NULL;
- adev = bus_find_device(&amba_bustype, NULL, node, of_dev_node_match);
- if (adev) {
amba_dev_name = dev_name(adev);
dev = bus_find_device_by_name(&coresight_bustype, NULL,
amba_dev_name);
if (dev) {
csdev = to_coresight_device(dev);
put_device(dev);
}
put_device(adev);
- }
- return csdev;
Humm... This means the @csdev associated with @node has already been scanned and added to the coresight_bus, which may not always be true. For now I can't say more since I don't know how it will be used.
+}
+EXPORT_SYMBOL_GPL(of_coresight_get_cs_device_by_node);
2.19.1
CoreSight mailing list CoreSight@lists.linaro.org https://lists.linaro.org/mailman/listinfo/coresight