diff options
-rw-r--r-- | Documentation/devicetree/bindings/arm/coresight.txt | 2 | ||||
-rw-r--r-- | drivers/hwtracing/coresight/of_coresight.c | 43 | ||||
-rw-r--r-- | include/linux/coresight.h | 4 |
3 files changed, 49 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/arm/coresight.txt b/Documentation/devicetree/bindings/arm/coresight.txt index 598ce14b83ab..ffd9784a0c41 100644 --- a/Documentation/devicetree/bindings/arm/coresight.txt +++ b/Documentation/devicetree/bindings/arm/coresight.txt @@ -76,6 +76,8 @@ its hardware characteristcs. * arm,default-sink: represents the default compile time CoreSight sink + * coresight-ctis: represents flush and reset CTIs for TMC buffer + * Required property for TPDAs: * qcom,tpda-atid: must be present. Specifies the ATID for TPDA. diff --git a/drivers/hwtracing/coresight/of_coresight.c b/drivers/hwtracing/coresight/of_coresight.c index 6b935e1e3a20..061ddadd1122 100644 --- a/drivers/hwtracing/coresight/of_coresight.c +++ b/drivers/hwtracing/coresight/of_coresight.c @@ -22,6 +22,7 @@ #include <linux/platform_device.h> #include <linux/amba/bus.h> #include <linux/coresight.h> +#include <linux/coresight-cti.h> #include <linux/cpumask.h> #include <asm/smp_plat.h> @@ -194,3 +195,45 @@ struct coresight_platform_data *of_get_coresight_platform_data( return pdata; } EXPORT_SYMBOL_GPL(of_get_coresight_platform_data); + +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); diff --git a/include/linux/coresight.h b/include/linux/coresight.h index 82e185645cf3..903a8e852f5d 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -253,9 +253,13 @@ static inline int coresight_timeout(void __iomem *addr, u32 offset, #if defined(CONFIG_OF) && defined(CONFIG_CORESIGHT) extern struct coresight_platform_data *of_get_coresight_platform_data( struct device *dev, struct device_node *node); +extern struct coresight_cti_data *of_get_coresight_cti_data( + struct device *dev, struct device_node *node); #else static inline struct coresight_platform_data *of_get_coresight_platform_data( struct device *dev, struct device_node *node) { return NULL; } +static inline struct coresight_cti_data *of_get_coresight_cti_data( + struct device *dev, struct device_node *node) { return NULL; } #endif #ifdef CONFIG_PID_NS |