Loading Documentation/devicetree/bindings/arm/coresight.txt +9 −15 Original line number Diff line number Diff line Loading @@ -73,9 +73,6 @@ its hardware characteristcs. AMBA markee): - "arm,coresight-replicator" - "qcom,coresight-csr" - "arm,coresight-cti" - "qcom,coresight-tpda" - "qcom,coresight-tpdm" - "qcom,coresight-remote-etm" - "qcom,coresight-hwevent" - "qcom,coresight-dummy" Loading Loading @@ -264,7 +261,7 @@ Example: }; tpda_mss: tpda@7043000 { compatible = "qcom,coresight-tpda"; compatible = "qcom,coresight-tpda", "arm,primecell"; reg = <0x7043000 0x1000>; reg-names = "tpda-base"; Loading @@ -274,9 +271,8 @@ Example: qcom,dsb-elem-size = <0 32>; qcom,cmb-elem-size = <0 32>; clocks = <&clock_gcc clk_qdss_clk>, <&clock_gcc clk_qdss_a_clk>; clock-names = "core_clk", "core_a_clk"; clocks = <&clock_aop clk_qdss_clk>; clock-names = "apb_pclk"; ports { #address-cells = <1>; Loading Loading @@ -345,15 +341,14 @@ Example: }; tpdm_mss: tpdm@7042000 { compatible = "qcom,coresight-tpdm"; compatible = "qcom,coresight-tpdm", "arm,primecell"; reg = <0x7042000 0x1000>; reg-names = "tpdm-base"; coresight-name = "coresight-tpdm-mss"; clocks = <&clock_gcc clk_qdss_clk>, <&clock_gcc clk_qdss_a_clk>; clock-names = "core_clk", "core_a_clk"; clocks = <&clock_aop qdss_clk>; clock-names = "apb_pclk"; port{ tpdm_mss_out_tpda_mss: endpoint { Loading @@ -364,15 +359,14 @@ Example: 4. CTIs cti0: cti@6010000 { compatible = "arm,coresight-cti"; compatible = "arm,coresight-cti", "arm,primecell"; reg = <0x6010000 0x1000>; reg-names = "cti-base"; coresight-name = "coresight-cti0"; clocks = <&clock_gcc clk_qdss_clk>, <&clock_gcc clk_qdss_a_clk>; clock-names = "core_clk", "core_a_clk"; clocks = <&clock_aop qdss_clk>; clock-names = "apb_pclk"; }; [1]. There is currently two version of STM: STM32 and STM500. Both Loading drivers/hwtracing/coresight/coresight-cti.c +39 −73 Original line number Diff line number Diff line /* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading @@ -19,7 +19,7 @@ #include <linux/err.h> #include <linux/slab.h> #include <linux/mutex.h> #include <linux/clk.h> #include <linux/amba/bus.h> #include <linux/cpu_pm.h> #include <linux/topology.h> #include <linux/of.h> Loading Loading @@ -379,7 +379,7 @@ int coresight_cti_map_trigin(struct coresight_cti *cti, int trig, int ch) * within the mutex lock region in addition to within the spinlock. */ if (drvdata->refcnt == 0) { ret = clk_prepare_enable(drvdata->clk); ret = pm_runtime_get_sync(drvdata->dev); if (ret) goto err1; } Loading @@ -402,7 +402,7 @@ int coresight_cti_map_trigin(struct coresight_cti *cti, int trig, int ch) * adjusting its value. */ if (drvdata->refcnt == 0) clk_disable_unprepare(drvdata->clk); pm_runtime_put(drvdata->dev); err1: cti_trigin_gpio_disable(drvdata); err0: Loading Loading @@ -463,7 +463,7 @@ int coresight_cti_map_trigout(struct coresight_cti *cti, int trig, int ch) * within the mutex lock region in addition to within the spinlock. */ if (drvdata->refcnt == 0) { ret = clk_prepare_enable(drvdata->clk); ret = pm_runtime_get_sync(drvdata->dev); if (ret) goto err1; } Loading @@ -485,7 +485,7 @@ int coresight_cti_map_trigout(struct coresight_cti *cti, int trig, int ch) * __cti_map_trigout so it is safe to check it against 0. */ if (drvdata->refcnt == 0) clk_disable_unprepare(drvdata->clk); pm_runtime_put(drvdata->dev); err1: cti_trigout_gpio_disable(drvdata); err0: Loading Loading @@ -563,7 +563,7 @@ void coresight_cti_unmap_trigin(struct coresight_cti *cti, int trig, int ch) * within the mutex lock region in addition to within the spinlock. */ if (drvdata->refcnt == 0) clk_disable_unprepare(drvdata->clk); pm_runtime_put(drvdata->dev); if (drvdata->gpio_trigin->trig == trig) cti_trigin_gpio_disable(drvdata); Loading Loading @@ -632,7 +632,7 @@ void coresight_cti_unmap_trigout(struct coresight_cti *cti, int trig, int ch) * within the mutex lock region in addition to within the spinlock. */ if (drvdata->refcnt == 0) clk_disable_unprepare(drvdata->clk); pm_runtime_put(drvdata->dev); if (drvdata->gpio_trigout->trig == trig) cti_trigout_gpio_disable(drvdata); Loading Loading @@ -1388,34 +1388,29 @@ static struct notifier_block cti_cpu_pm_notifier = { .notifier_call = cti_cpu_pm_callback, }; static int cti_probe(struct platform_device *pdev) static int cti_probe(struct amba_device *adev, const struct amba_id *id) { int ret; int trig; struct device *dev = &pdev->dev; struct device *dev = &adev->dev; struct coresight_platform_data *pdata; struct cti_drvdata *drvdata; struct resource *res; struct coresight_desc *desc; struct device_node *cpu_node; pdata = of_get_coresight_platform_data(dev, pdev->dev.of_node); pdata = of_get_coresight_platform_data(dev, adev->dev.of_node); if (IS_ERR(pdata)) return PTR_ERR(pdata); pdev->dev.platform_data = pdata; adev->dev.platform_data = pdata; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) return -ENOMEM; /* Store the driver data pointer for use in exported functions */ drvdata->dev = &pdev->dev; platform_set_drvdata(pdev, drvdata); drvdata->dev = &adev->dev; dev_set_drvdata(dev, drvdata); res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cti-base"); if (!res) return -ENODEV; drvdata->base = devm_ioremap(dev, res->start, resource_size(res)); drvdata->base = devm_ioremap_resource(dev, &adev->res); if (!drvdata->base) return -ENOMEM; Loading @@ -1423,21 +1418,13 @@ static int cti_probe(struct platform_device *pdev) mutex_init(&drvdata->mutex); drvdata->clk = devm_clk_get(dev, "core_clk"); if (IS_ERR(drvdata->clk)) return PTR_ERR(drvdata->clk); ret = clk_set_rate(drvdata->clk, CORESIGHT_CLK_RATE_TRACE); if (ret) return ret; drvdata->gpio_trigin = devm_kzalloc(dev, sizeof(struct cti_pctrl), GFP_KERNEL); if (!drvdata->gpio_trigin) return -ENOMEM; drvdata->gpio_trigin->trig = -1; ret = of_property_read_u32(pdev->dev.of_node, ret = of_property_read_u32(adev->dev.of_node, "qcom,cti-gpio-trigin", &trig); if (!ret) drvdata->gpio_trigin->trig = trig; Loading @@ -1450,7 +1437,7 @@ static int cti_probe(struct platform_device *pdev) return -ENOMEM; drvdata->gpio_trigout->trig = -1; ret = of_property_read_u32(pdev->dev.of_node, ret = of_property_read_u32(adev->dev.of_node, "qcom,cti-gpio-trigout", &trig); if (!ret) drvdata->gpio_trigout->trig = trig; Loading @@ -1458,7 +1445,7 @@ static int cti_probe(struct platform_device *pdev) return ret; drvdata->cpu = -1; cpu_node = of_parse_phandle(pdev->dev.of_node, "cpu", 0); cpu_node = of_parse_phandle(adev->dev.of_node, "cpu", 0); if (cpu_node) { drvdata->cpu = pdata ? pdata->cpu : -1; if (drvdata->cpu == -1) { Loading @@ -1468,7 +1455,7 @@ static int cti_probe(struct platform_device *pdev) } if (!cti_save_disable) drvdata->cti_save = of_property_read_bool(pdev->dev.of_node, drvdata->cti_save = of_property_read_bool(adev->dev.of_node, "qcom,cti-save"); if (drvdata->cti_save) { drvdata->state = devm_kzalloc(dev, sizeof(struct cti_state), Loading @@ -1476,18 +1463,18 @@ static int cti_probe(struct platform_device *pdev) if (!drvdata->state) return -ENOMEM; drvdata->cti_hwclk = of_property_read_bool(pdev->dev.of_node, drvdata->cti_hwclk = of_property_read_bool(adev->dev.of_node, "qcom,cti-hwclk"); } if (drvdata->cti_save && !drvdata->cti_hwclk) { ret = clk_prepare_enable(drvdata->clk); ret = pm_runtime_get_sync(drvdata->dev); if (ret) return ret; } mutex_lock(&cti_lock); drvdata->cti.name = ((struct coresight_platform_data *) (pdev->dev.platform_data))->name; (adev->dev.platform_data))->name; list_add_tail(&drvdata->cti.link, &cti_list); mutex_unlock(&cti_lock); Loading @@ -1497,8 +1484,8 @@ static int cti_probe(struct platform_device *pdev) goto err; } desc->type = CORESIGHT_DEV_TYPE_NONE; desc->pdata = pdev->dev.platform_data; desc->dev = &pdev->dev; desc->pdata = adev->dev.platform_data; desc->dev = &adev->dev; desc->groups = cti_attr_grps; drvdata->csdev = coresight_register(desc); if (IS_ERR(drvdata->csdev)) { Loading @@ -1511,56 +1498,35 @@ static int cti_probe(struct platform_device *pdev) cpu_pm_register_notifier(&cti_cpu_pm_notifier); registered++; } pm_runtime_put(&adev->dev); dev_dbg(dev, "CTI initialized\n"); return 0; err: if (drvdata->cti_save && !drvdata->cti_hwclk) clk_disable_unprepare(drvdata->clk); pm_runtime_put(&adev->dev); return ret; } static int cti_remove(struct platform_device *pdev) static struct amba_id cti_ids[] = { { struct cti_drvdata *drvdata = platform_get_drvdata(pdev); if (drvdata->cti_save) { registered--; if (!registered) cpu_pm_unregister_notifier(&cti_cpu_pm_notifier); } coresight_unregister(drvdata->csdev); if (drvdata->cti_save && !drvdata->cti_hwclk) clk_disable_unprepare(drvdata->clk); return 0; } static const struct of_device_id cti_match[] = { {.compatible = "arm,coresight-cti"}, {} .id = 0x0003b966, .mask = 0x0003ffff, .data = "CTI", }, { 0, 0}, }; static struct platform_driver cti_driver = { .probe = cti_probe, .remove = cti_remove, .driver = { static struct amba_driver cti_driver = { .drv = { .name = "coresight-cti", .owner = THIS_MODULE, .of_match_table = cti_match, .suppress_bind_attrs = true, }, .probe = cti_probe, .id_table = cti_ids, }; static int __init cti_init(void) { return platform_driver_register(&cti_driver); } module_init(cti_init); static void __exit cti_exit(void) { platform_driver_unregister(&cti_driver); } module_exit(cti_exit); builtin_amba_driver(cti_driver); MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("CoreSight CTI driver"); drivers/hwtracing/coresight/coresight-replicator-qcom.c +0 −3 Original line number Diff line number Diff line Loading @@ -47,8 +47,6 @@ static int replicator_enable(struct coresight_device *csdev, int inport, { struct replicator_state *drvdata = dev_get_drvdata(csdev->dev.parent); pm_runtime_get_sync(drvdata->dev); CS_UNLOCK(drvdata->base); /* Loading Loading @@ -85,7 +83,6 @@ static void replicator_disable(struct coresight_device *csdev, int inport, CS_LOCK(drvdata->base); pm_runtime_put(drvdata->dev); dev_info(drvdata->dev, "REPLICATOR disabled\n"); } Loading drivers/hwtracing/coresight/coresight-tpda.c +25 −64 Original line number Diff line number Diff line /* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading @@ -14,10 +14,10 @@ #include <linux/module.h> #include <linux/device.h> #include <linux/platform_device.h> #include <linux/amba/bus.h> #include <linux/io.h> #include <linux/err.h> #include <linux/fs.h> #include <linux/clk.h> #include <linux/bitmap.h> #include <linux/of.h> #include <linux/coresight.h> Loading Loading @@ -53,7 +53,6 @@ struct tpda_drvdata { void __iomem *base; struct device *dev; struct coresight_device *csdev; struct clk *clk; struct mutex lock; bool enable; uint32_t atid; Loading Loading @@ -183,11 +182,6 @@ static void __tpda_enable(struct tpda_drvdata *drvdata, int port) static int tpda_enable(struct coresight_device *csdev, int inport, int outport) { struct tpda_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); int ret; ret = clk_prepare_enable(drvdata->clk); if (ret) return ret; mutex_lock(&drvdata->lock); __tpda_enable(drvdata, inport); Loading Loading @@ -221,8 +215,6 @@ static void tpda_disable(struct coresight_device *csdev, int inport, drvdata->enable = false; mutex_unlock(&drvdata->lock); clk_disable_unprepare(drvdata->clk); dev_info(drvdata->dev, "TPDA inport %d disabled\n", inport); } Loading Loading @@ -653,31 +645,27 @@ static void tpda_init_default_data(struct tpda_drvdata *drvdata) drvdata->freq_ts = true; } static int tpda_probe(struct platform_device *pdev) static int tpda_probe(struct amba_device *adev, const struct amba_id *id) { int ret; struct device *dev = &pdev->dev; struct device *dev = &adev->dev; struct coresight_platform_data *pdata; struct tpda_drvdata *drvdata; struct resource *res; struct coresight_desc *desc; pdata = of_get_coresight_platform_data(dev, pdev->dev.of_node); pdata = of_get_coresight_platform_data(dev, adev->dev.of_node); if (IS_ERR(pdata)) return PTR_ERR(pdata); pdev->dev.platform_data = pdata; adev->dev.platform_data = pdata; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) return -ENOMEM; drvdata->dev = &pdev->dev; platform_set_drvdata(pdev, drvdata); res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "tpda-base"); if (!res) return -ENODEV; drvdata->dev = &adev->dev; dev_set_drvdata(dev, drvdata); drvdata->base = devm_ioremap(dev, res->start, resource_size(res)); drvdata->base = devm_ioremap_resource(dev, &adev->res); if (!drvdata->base) return -ENOMEM; Loading @@ -687,22 +675,10 @@ static int tpda_probe(struct platform_device *pdev) if (ret) return ret; drvdata->clk = devm_clk_get(dev, "core_clk"); if (IS_ERR(drvdata->clk)) return PTR_ERR(drvdata->clk); ret = clk_set_rate(drvdata->clk, CORESIGHT_CLK_RATE_TRACE); if (ret) return ret; ret = clk_prepare_enable(drvdata->clk); if (ret) return ret; if (!coresight_authstatus_enabled(drvdata->base)) goto err; clk_disable_unprepare(drvdata->clk); pm_runtime_put(&adev->dev); tpda_init_default_data(drvdata); Loading @@ -712,8 +688,8 @@ static int tpda_probe(struct platform_device *pdev) desc->type = CORESIGHT_DEV_TYPE_LINK; desc->subtype.link_subtype = CORESIGHT_DEV_SUBTYPE_LINK_MERG; desc->ops = &tpda_cs_ops; desc->pdata = pdev->dev.platform_data; desc->dev = &pdev->dev; desc->pdata = adev->dev.platform_data; desc->dev = &adev->dev; desc->groups = tpda_attr_grps; drvdata->csdev = coresight_register(desc); if (IS_ERR(drvdata->csdev)) Loading @@ -722,44 +698,29 @@ static int tpda_probe(struct platform_device *pdev) dev_dbg(drvdata->dev, "TPDA initialized\n"); return 0; err: clk_disable_unprepare(drvdata->clk); return -EPERM; } static int tpda_remove(struct platform_device *pdev) static struct amba_id tpda_ids[] = { { struct tpda_drvdata *drvdata = platform_get_drvdata(pdev); coresight_unregister(drvdata->csdev); return 0; } static const struct of_device_id tpda_match[] = { {.compatible = "qcom,coresight-tpda"}, {} .id = 0x0003b969, .mask = 0x0003ffff, .data = "TPDA", }, { 0, 0}, }; static struct platform_driver tpda_driver = { .probe = tpda_probe, .remove = tpda_remove, .driver = { static struct amba_driver tpda_driver = { .drv = { .name = "coresight-tpda", .owner = THIS_MODULE, .of_match_table = tpda_match, .suppress_bind_attrs = true, }, .probe = tpda_probe, .id_table = tpda_ids, }; static int __init tpda_init(void) { return platform_driver_register(&tpda_driver); } module_init(tpda_init); static void __exit tpda_exit(void) { platform_driver_unregister(&tpda_driver); } module_exit(tpda_exit); builtin_amba_driver(tpda_driver); MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("Trace, Profiling & Diagnostic Aggregator driver"); drivers/hwtracing/coresight/coresight-tpdm.c +26 −66 Original line number Diff line number Diff line Loading @@ -13,11 +13,10 @@ #include <linux/kernel.h> #include <linux/module.h> #include <linux/device.h> #include <linux/platform_device.h> #include <linux/amba/bus.h> #include <linux/io.h> #include <linux/err.h> #include <linux/fs.h> #include <linux/clk.h> #include <linux/bitmap.h> #include <linux/of.h> #include <linux/coresight.h> Loading Loading @@ -246,7 +245,6 @@ struct tpdm_drvdata { void __iomem *base; struct device *dev; struct coresight_device *csdev; struct clk *clk; struct mutex lock; bool enable; bool clk_enable; Loading Loading @@ -648,11 +646,6 @@ static int tpdm_enable(struct coresight_device *csdev, struct perf_event *event, u32 mode) { struct tpdm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); int ret; ret = clk_prepare_enable(drvdata->clk); if (ret) return ret; mutex_lock(&drvdata->lock); __tpdm_enable(drvdata); Loading Loading @@ -732,8 +725,6 @@ static void tpdm_disable(struct coresight_device *csdev, drvdata->enable = false; mutex_unlock(&drvdata->lock); clk_disable_unprepare(drvdata->clk); dev_info(drvdata->dev, "TPDM tracing disabled\n"); } Loading Loading @@ -3939,57 +3930,40 @@ static void tpdm_init_default_data(struct tpdm_drvdata *drvdata) drvdata->cmb->trig_ts = true; } static int tpdm_probe(struct platform_device *pdev) static int tpdm_probe(struct amba_device *adev, const struct amba_id *id) { int ret, i; uint32_t pidr, devid; struct device *dev = &pdev->dev; struct device *dev = &adev->dev; struct coresight_platform_data *pdata; struct tpdm_drvdata *drvdata; struct resource *res; struct coresight_desc *desc; static int traceid = TPDM_TRACE_ID_START; uint32_t version; pdata = of_get_coresight_platform_data(dev, pdev->dev.of_node); pdata = of_get_coresight_platform_data(dev, adev->dev.of_node); if (IS_ERR(pdata)) return PTR_ERR(pdata); pdev->dev.platform_data = pdata; adev->dev.platform_data = pdata; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) return -ENOMEM; drvdata->dev = &pdev->dev; platform_set_drvdata(pdev, drvdata); res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "tpdm-base"); if (!res) return -ENODEV; drvdata->dev = &adev->dev; dev_set_drvdata(dev, drvdata); drvdata->base = devm_ioremap(dev, res->start, resource_size(res)); drvdata->base = devm_ioremap_resource(dev, &adev->res); if (!drvdata->base) return -ENOMEM; drvdata->clk_enable = of_property_read_bool(pdev->dev.of_node, drvdata->clk_enable = of_property_read_bool(adev->dev.of_node, "qcom,clk-enable"); drvdata->msr_fix_req = of_property_read_bool(pdev->dev.of_node, drvdata->msr_fix_req = of_property_read_bool(adev->dev.of_node, "qcom,msr-fix-req"); mutex_init(&drvdata->lock); drvdata->clk = devm_clk_get(dev, "core_clk"); if (IS_ERR(drvdata->clk)) return PTR_ERR(drvdata->clk); ret = clk_set_rate(drvdata->clk, CORESIGHT_CLK_RATE_TRACE); if (ret) return ret; ret = clk_prepare_enable(drvdata->clk); if (ret) return ret; version = tpdm_readl(drvdata, CORESIGHT_PERIPHIDR2); drvdata->version = BMVAL(version, 4, 7); Loading Loading @@ -4017,7 +3991,7 @@ static int tpdm_probe(struct platform_device *pdev) drvdata->bc_counters_avail = BMVAL(devid, 6, 10) + 1; drvdata->tc_counters_avail = BMVAL(devid, 4, 5) + 1; clk_disable_unprepare(drvdata->clk); pm_runtime_put(&adev->dev); drvdata->traceid = traceid++; Loading @@ -4027,8 +4001,8 @@ static int tpdm_probe(struct platform_device *pdev) desc->type = CORESIGHT_DEV_TYPE_SOURCE; desc->subtype.source_subtype = CORESIGHT_DEV_SUBTYPE_SOURCE_PROC; desc->ops = &tpdm_cs_ops; desc->pdata = pdev->dev.platform_data; desc->dev = &pdev->dev; desc->pdata = adev->dev.platform_data; desc->dev = &adev->dev; desc->groups = tpdm_attr_grps; drvdata->csdev = coresight_register(desc); if (IS_ERR(drvdata->csdev)) Loading @@ -4042,40 +4016,26 @@ static int tpdm_probe(struct platform_device *pdev) return 0; } static int tpdm_remove(struct platform_device *pdev) static struct amba_id tpdm_ids[] = { { struct tpdm_drvdata *drvdata = platform_get_drvdata(pdev); coresight_unregister(drvdata->csdev); return 0; } static const struct of_device_id tpdm_match[] = { {.compatible = "qcom,coresight-tpdm"}, {} .id = 0x0003b968, .mask = 0x0003ffff, .data = "TPDM", }, { 0, 0}, }; static struct platform_driver tpdm_driver = { .probe = tpdm_probe, .remove = tpdm_remove, .driver = { static struct amba_driver tpdm_driver = { .drv = { .name = "coresight-tpdm", .owner = THIS_MODULE, .of_match_table = tpdm_match, .suppress_bind_attrs = true, }, .probe = tpdm_probe, .id_table = tpdm_ids, }; static int __init tpdm_init(void) { return platform_driver_register(&tpdm_driver); } module_init(tpdm_init); static void __exit tpdm_exit(void) { platform_driver_unregister(&tpdm_driver); } module_exit(tpdm_exit); builtin_amba_driver(tpdm_driver); MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("Trace, Profiling & Diagnostic Monitor driver"); Loading
Documentation/devicetree/bindings/arm/coresight.txt +9 −15 Original line number Diff line number Diff line Loading @@ -73,9 +73,6 @@ its hardware characteristcs. AMBA markee): - "arm,coresight-replicator" - "qcom,coresight-csr" - "arm,coresight-cti" - "qcom,coresight-tpda" - "qcom,coresight-tpdm" - "qcom,coresight-remote-etm" - "qcom,coresight-hwevent" - "qcom,coresight-dummy" Loading Loading @@ -264,7 +261,7 @@ Example: }; tpda_mss: tpda@7043000 { compatible = "qcom,coresight-tpda"; compatible = "qcom,coresight-tpda", "arm,primecell"; reg = <0x7043000 0x1000>; reg-names = "tpda-base"; Loading @@ -274,9 +271,8 @@ Example: qcom,dsb-elem-size = <0 32>; qcom,cmb-elem-size = <0 32>; clocks = <&clock_gcc clk_qdss_clk>, <&clock_gcc clk_qdss_a_clk>; clock-names = "core_clk", "core_a_clk"; clocks = <&clock_aop clk_qdss_clk>; clock-names = "apb_pclk"; ports { #address-cells = <1>; Loading Loading @@ -345,15 +341,14 @@ Example: }; tpdm_mss: tpdm@7042000 { compatible = "qcom,coresight-tpdm"; compatible = "qcom,coresight-tpdm", "arm,primecell"; reg = <0x7042000 0x1000>; reg-names = "tpdm-base"; coresight-name = "coresight-tpdm-mss"; clocks = <&clock_gcc clk_qdss_clk>, <&clock_gcc clk_qdss_a_clk>; clock-names = "core_clk", "core_a_clk"; clocks = <&clock_aop qdss_clk>; clock-names = "apb_pclk"; port{ tpdm_mss_out_tpda_mss: endpoint { Loading @@ -364,15 +359,14 @@ Example: 4. CTIs cti0: cti@6010000 { compatible = "arm,coresight-cti"; compatible = "arm,coresight-cti", "arm,primecell"; reg = <0x6010000 0x1000>; reg-names = "cti-base"; coresight-name = "coresight-cti0"; clocks = <&clock_gcc clk_qdss_clk>, <&clock_gcc clk_qdss_a_clk>; clock-names = "core_clk", "core_a_clk"; clocks = <&clock_aop qdss_clk>; clock-names = "apb_pclk"; }; [1]. There is currently two version of STM: STM32 and STM500. Both Loading
drivers/hwtracing/coresight/coresight-cti.c +39 −73 Original line number Diff line number Diff line /* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading @@ -19,7 +19,7 @@ #include <linux/err.h> #include <linux/slab.h> #include <linux/mutex.h> #include <linux/clk.h> #include <linux/amba/bus.h> #include <linux/cpu_pm.h> #include <linux/topology.h> #include <linux/of.h> Loading Loading @@ -379,7 +379,7 @@ int coresight_cti_map_trigin(struct coresight_cti *cti, int trig, int ch) * within the mutex lock region in addition to within the spinlock. */ if (drvdata->refcnt == 0) { ret = clk_prepare_enable(drvdata->clk); ret = pm_runtime_get_sync(drvdata->dev); if (ret) goto err1; } Loading @@ -402,7 +402,7 @@ int coresight_cti_map_trigin(struct coresight_cti *cti, int trig, int ch) * adjusting its value. */ if (drvdata->refcnt == 0) clk_disable_unprepare(drvdata->clk); pm_runtime_put(drvdata->dev); err1: cti_trigin_gpio_disable(drvdata); err0: Loading Loading @@ -463,7 +463,7 @@ int coresight_cti_map_trigout(struct coresight_cti *cti, int trig, int ch) * within the mutex lock region in addition to within the spinlock. */ if (drvdata->refcnt == 0) { ret = clk_prepare_enable(drvdata->clk); ret = pm_runtime_get_sync(drvdata->dev); if (ret) goto err1; } Loading @@ -485,7 +485,7 @@ int coresight_cti_map_trigout(struct coresight_cti *cti, int trig, int ch) * __cti_map_trigout so it is safe to check it against 0. */ if (drvdata->refcnt == 0) clk_disable_unprepare(drvdata->clk); pm_runtime_put(drvdata->dev); err1: cti_trigout_gpio_disable(drvdata); err0: Loading Loading @@ -563,7 +563,7 @@ void coresight_cti_unmap_trigin(struct coresight_cti *cti, int trig, int ch) * within the mutex lock region in addition to within the spinlock. */ if (drvdata->refcnt == 0) clk_disable_unprepare(drvdata->clk); pm_runtime_put(drvdata->dev); if (drvdata->gpio_trigin->trig == trig) cti_trigin_gpio_disable(drvdata); Loading Loading @@ -632,7 +632,7 @@ void coresight_cti_unmap_trigout(struct coresight_cti *cti, int trig, int ch) * within the mutex lock region in addition to within the spinlock. */ if (drvdata->refcnt == 0) clk_disable_unprepare(drvdata->clk); pm_runtime_put(drvdata->dev); if (drvdata->gpio_trigout->trig == trig) cti_trigout_gpio_disable(drvdata); Loading Loading @@ -1388,34 +1388,29 @@ static struct notifier_block cti_cpu_pm_notifier = { .notifier_call = cti_cpu_pm_callback, }; static int cti_probe(struct platform_device *pdev) static int cti_probe(struct amba_device *adev, const struct amba_id *id) { int ret; int trig; struct device *dev = &pdev->dev; struct device *dev = &adev->dev; struct coresight_platform_data *pdata; struct cti_drvdata *drvdata; struct resource *res; struct coresight_desc *desc; struct device_node *cpu_node; pdata = of_get_coresight_platform_data(dev, pdev->dev.of_node); pdata = of_get_coresight_platform_data(dev, adev->dev.of_node); if (IS_ERR(pdata)) return PTR_ERR(pdata); pdev->dev.platform_data = pdata; adev->dev.platform_data = pdata; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) return -ENOMEM; /* Store the driver data pointer for use in exported functions */ drvdata->dev = &pdev->dev; platform_set_drvdata(pdev, drvdata); drvdata->dev = &adev->dev; dev_set_drvdata(dev, drvdata); res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cti-base"); if (!res) return -ENODEV; drvdata->base = devm_ioremap(dev, res->start, resource_size(res)); drvdata->base = devm_ioremap_resource(dev, &adev->res); if (!drvdata->base) return -ENOMEM; Loading @@ -1423,21 +1418,13 @@ static int cti_probe(struct platform_device *pdev) mutex_init(&drvdata->mutex); drvdata->clk = devm_clk_get(dev, "core_clk"); if (IS_ERR(drvdata->clk)) return PTR_ERR(drvdata->clk); ret = clk_set_rate(drvdata->clk, CORESIGHT_CLK_RATE_TRACE); if (ret) return ret; drvdata->gpio_trigin = devm_kzalloc(dev, sizeof(struct cti_pctrl), GFP_KERNEL); if (!drvdata->gpio_trigin) return -ENOMEM; drvdata->gpio_trigin->trig = -1; ret = of_property_read_u32(pdev->dev.of_node, ret = of_property_read_u32(adev->dev.of_node, "qcom,cti-gpio-trigin", &trig); if (!ret) drvdata->gpio_trigin->trig = trig; Loading @@ -1450,7 +1437,7 @@ static int cti_probe(struct platform_device *pdev) return -ENOMEM; drvdata->gpio_trigout->trig = -1; ret = of_property_read_u32(pdev->dev.of_node, ret = of_property_read_u32(adev->dev.of_node, "qcom,cti-gpio-trigout", &trig); if (!ret) drvdata->gpio_trigout->trig = trig; Loading @@ -1458,7 +1445,7 @@ static int cti_probe(struct platform_device *pdev) return ret; drvdata->cpu = -1; cpu_node = of_parse_phandle(pdev->dev.of_node, "cpu", 0); cpu_node = of_parse_phandle(adev->dev.of_node, "cpu", 0); if (cpu_node) { drvdata->cpu = pdata ? pdata->cpu : -1; if (drvdata->cpu == -1) { Loading @@ -1468,7 +1455,7 @@ static int cti_probe(struct platform_device *pdev) } if (!cti_save_disable) drvdata->cti_save = of_property_read_bool(pdev->dev.of_node, drvdata->cti_save = of_property_read_bool(adev->dev.of_node, "qcom,cti-save"); if (drvdata->cti_save) { drvdata->state = devm_kzalloc(dev, sizeof(struct cti_state), Loading @@ -1476,18 +1463,18 @@ static int cti_probe(struct platform_device *pdev) if (!drvdata->state) return -ENOMEM; drvdata->cti_hwclk = of_property_read_bool(pdev->dev.of_node, drvdata->cti_hwclk = of_property_read_bool(adev->dev.of_node, "qcom,cti-hwclk"); } if (drvdata->cti_save && !drvdata->cti_hwclk) { ret = clk_prepare_enable(drvdata->clk); ret = pm_runtime_get_sync(drvdata->dev); if (ret) return ret; } mutex_lock(&cti_lock); drvdata->cti.name = ((struct coresight_platform_data *) (pdev->dev.platform_data))->name; (adev->dev.platform_data))->name; list_add_tail(&drvdata->cti.link, &cti_list); mutex_unlock(&cti_lock); Loading @@ -1497,8 +1484,8 @@ static int cti_probe(struct platform_device *pdev) goto err; } desc->type = CORESIGHT_DEV_TYPE_NONE; desc->pdata = pdev->dev.platform_data; desc->dev = &pdev->dev; desc->pdata = adev->dev.platform_data; desc->dev = &adev->dev; desc->groups = cti_attr_grps; drvdata->csdev = coresight_register(desc); if (IS_ERR(drvdata->csdev)) { Loading @@ -1511,56 +1498,35 @@ static int cti_probe(struct platform_device *pdev) cpu_pm_register_notifier(&cti_cpu_pm_notifier); registered++; } pm_runtime_put(&adev->dev); dev_dbg(dev, "CTI initialized\n"); return 0; err: if (drvdata->cti_save && !drvdata->cti_hwclk) clk_disable_unprepare(drvdata->clk); pm_runtime_put(&adev->dev); return ret; } static int cti_remove(struct platform_device *pdev) static struct amba_id cti_ids[] = { { struct cti_drvdata *drvdata = platform_get_drvdata(pdev); if (drvdata->cti_save) { registered--; if (!registered) cpu_pm_unregister_notifier(&cti_cpu_pm_notifier); } coresight_unregister(drvdata->csdev); if (drvdata->cti_save && !drvdata->cti_hwclk) clk_disable_unprepare(drvdata->clk); return 0; } static const struct of_device_id cti_match[] = { {.compatible = "arm,coresight-cti"}, {} .id = 0x0003b966, .mask = 0x0003ffff, .data = "CTI", }, { 0, 0}, }; static struct platform_driver cti_driver = { .probe = cti_probe, .remove = cti_remove, .driver = { static struct amba_driver cti_driver = { .drv = { .name = "coresight-cti", .owner = THIS_MODULE, .of_match_table = cti_match, .suppress_bind_attrs = true, }, .probe = cti_probe, .id_table = cti_ids, }; static int __init cti_init(void) { return platform_driver_register(&cti_driver); } module_init(cti_init); static void __exit cti_exit(void) { platform_driver_unregister(&cti_driver); } module_exit(cti_exit); builtin_amba_driver(cti_driver); MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("CoreSight CTI driver");
drivers/hwtracing/coresight/coresight-replicator-qcom.c +0 −3 Original line number Diff line number Diff line Loading @@ -47,8 +47,6 @@ static int replicator_enable(struct coresight_device *csdev, int inport, { struct replicator_state *drvdata = dev_get_drvdata(csdev->dev.parent); pm_runtime_get_sync(drvdata->dev); CS_UNLOCK(drvdata->base); /* Loading Loading @@ -85,7 +83,6 @@ static void replicator_disable(struct coresight_device *csdev, int inport, CS_LOCK(drvdata->base); pm_runtime_put(drvdata->dev); dev_info(drvdata->dev, "REPLICATOR disabled\n"); } Loading
drivers/hwtracing/coresight/coresight-tpda.c +25 −64 Original line number Diff line number Diff line /* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading @@ -14,10 +14,10 @@ #include <linux/module.h> #include <linux/device.h> #include <linux/platform_device.h> #include <linux/amba/bus.h> #include <linux/io.h> #include <linux/err.h> #include <linux/fs.h> #include <linux/clk.h> #include <linux/bitmap.h> #include <linux/of.h> #include <linux/coresight.h> Loading Loading @@ -53,7 +53,6 @@ struct tpda_drvdata { void __iomem *base; struct device *dev; struct coresight_device *csdev; struct clk *clk; struct mutex lock; bool enable; uint32_t atid; Loading Loading @@ -183,11 +182,6 @@ static void __tpda_enable(struct tpda_drvdata *drvdata, int port) static int tpda_enable(struct coresight_device *csdev, int inport, int outport) { struct tpda_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); int ret; ret = clk_prepare_enable(drvdata->clk); if (ret) return ret; mutex_lock(&drvdata->lock); __tpda_enable(drvdata, inport); Loading Loading @@ -221,8 +215,6 @@ static void tpda_disable(struct coresight_device *csdev, int inport, drvdata->enable = false; mutex_unlock(&drvdata->lock); clk_disable_unprepare(drvdata->clk); dev_info(drvdata->dev, "TPDA inport %d disabled\n", inport); } Loading Loading @@ -653,31 +645,27 @@ static void tpda_init_default_data(struct tpda_drvdata *drvdata) drvdata->freq_ts = true; } static int tpda_probe(struct platform_device *pdev) static int tpda_probe(struct amba_device *adev, const struct amba_id *id) { int ret; struct device *dev = &pdev->dev; struct device *dev = &adev->dev; struct coresight_platform_data *pdata; struct tpda_drvdata *drvdata; struct resource *res; struct coresight_desc *desc; pdata = of_get_coresight_platform_data(dev, pdev->dev.of_node); pdata = of_get_coresight_platform_data(dev, adev->dev.of_node); if (IS_ERR(pdata)) return PTR_ERR(pdata); pdev->dev.platform_data = pdata; adev->dev.platform_data = pdata; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) return -ENOMEM; drvdata->dev = &pdev->dev; platform_set_drvdata(pdev, drvdata); res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "tpda-base"); if (!res) return -ENODEV; drvdata->dev = &adev->dev; dev_set_drvdata(dev, drvdata); drvdata->base = devm_ioremap(dev, res->start, resource_size(res)); drvdata->base = devm_ioremap_resource(dev, &adev->res); if (!drvdata->base) return -ENOMEM; Loading @@ -687,22 +675,10 @@ static int tpda_probe(struct platform_device *pdev) if (ret) return ret; drvdata->clk = devm_clk_get(dev, "core_clk"); if (IS_ERR(drvdata->clk)) return PTR_ERR(drvdata->clk); ret = clk_set_rate(drvdata->clk, CORESIGHT_CLK_RATE_TRACE); if (ret) return ret; ret = clk_prepare_enable(drvdata->clk); if (ret) return ret; if (!coresight_authstatus_enabled(drvdata->base)) goto err; clk_disable_unprepare(drvdata->clk); pm_runtime_put(&adev->dev); tpda_init_default_data(drvdata); Loading @@ -712,8 +688,8 @@ static int tpda_probe(struct platform_device *pdev) desc->type = CORESIGHT_DEV_TYPE_LINK; desc->subtype.link_subtype = CORESIGHT_DEV_SUBTYPE_LINK_MERG; desc->ops = &tpda_cs_ops; desc->pdata = pdev->dev.platform_data; desc->dev = &pdev->dev; desc->pdata = adev->dev.platform_data; desc->dev = &adev->dev; desc->groups = tpda_attr_grps; drvdata->csdev = coresight_register(desc); if (IS_ERR(drvdata->csdev)) Loading @@ -722,44 +698,29 @@ static int tpda_probe(struct platform_device *pdev) dev_dbg(drvdata->dev, "TPDA initialized\n"); return 0; err: clk_disable_unprepare(drvdata->clk); return -EPERM; } static int tpda_remove(struct platform_device *pdev) static struct amba_id tpda_ids[] = { { struct tpda_drvdata *drvdata = platform_get_drvdata(pdev); coresight_unregister(drvdata->csdev); return 0; } static const struct of_device_id tpda_match[] = { {.compatible = "qcom,coresight-tpda"}, {} .id = 0x0003b969, .mask = 0x0003ffff, .data = "TPDA", }, { 0, 0}, }; static struct platform_driver tpda_driver = { .probe = tpda_probe, .remove = tpda_remove, .driver = { static struct amba_driver tpda_driver = { .drv = { .name = "coresight-tpda", .owner = THIS_MODULE, .of_match_table = tpda_match, .suppress_bind_attrs = true, }, .probe = tpda_probe, .id_table = tpda_ids, }; static int __init tpda_init(void) { return platform_driver_register(&tpda_driver); } module_init(tpda_init); static void __exit tpda_exit(void) { platform_driver_unregister(&tpda_driver); } module_exit(tpda_exit); builtin_amba_driver(tpda_driver); MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("Trace, Profiling & Diagnostic Aggregator driver");
drivers/hwtracing/coresight/coresight-tpdm.c +26 −66 Original line number Diff line number Diff line Loading @@ -13,11 +13,10 @@ #include <linux/kernel.h> #include <linux/module.h> #include <linux/device.h> #include <linux/platform_device.h> #include <linux/amba/bus.h> #include <linux/io.h> #include <linux/err.h> #include <linux/fs.h> #include <linux/clk.h> #include <linux/bitmap.h> #include <linux/of.h> #include <linux/coresight.h> Loading Loading @@ -246,7 +245,6 @@ struct tpdm_drvdata { void __iomem *base; struct device *dev; struct coresight_device *csdev; struct clk *clk; struct mutex lock; bool enable; bool clk_enable; Loading Loading @@ -648,11 +646,6 @@ static int tpdm_enable(struct coresight_device *csdev, struct perf_event *event, u32 mode) { struct tpdm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); int ret; ret = clk_prepare_enable(drvdata->clk); if (ret) return ret; mutex_lock(&drvdata->lock); __tpdm_enable(drvdata); Loading Loading @@ -732,8 +725,6 @@ static void tpdm_disable(struct coresight_device *csdev, drvdata->enable = false; mutex_unlock(&drvdata->lock); clk_disable_unprepare(drvdata->clk); dev_info(drvdata->dev, "TPDM tracing disabled\n"); } Loading Loading @@ -3939,57 +3930,40 @@ static void tpdm_init_default_data(struct tpdm_drvdata *drvdata) drvdata->cmb->trig_ts = true; } static int tpdm_probe(struct platform_device *pdev) static int tpdm_probe(struct amba_device *adev, const struct amba_id *id) { int ret, i; uint32_t pidr, devid; struct device *dev = &pdev->dev; struct device *dev = &adev->dev; struct coresight_platform_data *pdata; struct tpdm_drvdata *drvdata; struct resource *res; struct coresight_desc *desc; static int traceid = TPDM_TRACE_ID_START; uint32_t version; pdata = of_get_coresight_platform_data(dev, pdev->dev.of_node); pdata = of_get_coresight_platform_data(dev, adev->dev.of_node); if (IS_ERR(pdata)) return PTR_ERR(pdata); pdev->dev.platform_data = pdata; adev->dev.platform_data = pdata; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) return -ENOMEM; drvdata->dev = &pdev->dev; platform_set_drvdata(pdev, drvdata); res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "tpdm-base"); if (!res) return -ENODEV; drvdata->dev = &adev->dev; dev_set_drvdata(dev, drvdata); drvdata->base = devm_ioremap(dev, res->start, resource_size(res)); drvdata->base = devm_ioremap_resource(dev, &adev->res); if (!drvdata->base) return -ENOMEM; drvdata->clk_enable = of_property_read_bool(pdev->dev.of_node, drvdata->clk_enable = of_property_read_bool(adev->dev.of_node, "qcom,clk-enable"); drvdata->msr_fix_req = of_property_read_bool(pdev->dev.of_node, drvdata->msr_fix_req = of_property_read_bool(adev->dev.of_node, "qcom,msr-fix-req"); mutex_init(&drvdata->lock); drvdata->clk = devm_clk_get(dev, "core_clk"); if (IS_ERR(drvdata->clk)) return PTR_ERR(drvdata->clk); ret = clk_set_rate(drvdata->clk, CORESIGHT_CLK_RATE_TRACE); if (ret) return ret; ret = clk_prepare_enable(drvdata->clk); if (ret) return ret; version = tpdm_readl(drvdata, CORESIGHT_PERIPHIDR2); drvdata->version = BMVAL(version, 4, 7); Loading Loading @@ -4017,7 +3991,7 @@ static int tpdm_probe(struct platform_device *pdev) drvdata->bc_counters_avail = BMVAL(devid, 6, 10) + 1; drvdata->tc_counters_avail = BMVAL(devid, 4, 5) + 1; clk_disable_unprepare(drvdata->clk); pm_runtime_put(&adev->dev); drvdata->traceid = traceid++; Loading @@ -4027,8 +4001,8 @@ static int tpdm_probe(struct platform_device *pdev) desc->type = CORESIGHT_DEV_TYPE_SOURCE; desc->subtype.source_subtype = CORESIGHT_DEV_SUBTYPE_SOURCE_PROC; desc->ops = &tpdm_cs_ops; desc->pdata = pdev->dev.platform_data; desc->dev = &pdev->dev; desc->pdata = adev->dev.platform_data; desc->dev = &adev->dev; desc->groups = tpdm_attr_grps; drvdata->csdev = coresight_register(desc); if (IS_ERR(drvdata->csdev)) Loading @@ -4042,40 +4016,26 @@ static int tpdm_probe(struct platform_device *pdev) return 0; } static int tpdm_remove(struct platform_device *pdev) static struct amba_id tpdm_ids[] = { { struct tpdm_drvdata *drvdata = platform_get_drvdata(pdev); coresight_unregister(drvdata->csdev); return 0; } static const struct of_device_id tpdm_match[] = { {.compatible = "qcom,coresight-tpdm"}, {} .id = 0x0003b968, .mask = 0x0003ffff, .data = "TPDM", }, { 0, 0}, }; static struct platform_driver tpdm_driver = { .probe = tpdm_probe, .remove = tpdm_remove, .driver = { static struct amba_driver tpdm_driver = { .drv = { .name = "coresight-tpdm", .owner = THIS_MODULE, .of_match_table = tpdm_match, .suppress_bind_attrs = true, }, .probe = tpdm_probe, .id_table = tpdm_ids, }; static int __init tpdm_init(void) { return platform_driver_register(&tpdm_driver); } module_init(tpdm_init); static void __exit tpdm_exit(void) { platform_driver_unregister(&tpdm_driver); } module_exit(tpdm_exit); builtin_amba_driver(tpdm_driver); MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("Trace, Profiling & Diagnostic Monitor driver");