Lines Matching +full:coresight +full:- +full:tpiu
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
5 * Description: CoreSight Trace Port Interface Unit driver
12 #include <linux/coresight.h>
22 #include "coresight-priv.h"
45 /* FFSR - 0x300 */
47 /* FFCR - 0x304 */
52 DEFINE_CORESIGHT_DEVLIST(tpiu_devs, "tpiu");
56 * @atclk: optional clock for the core parts of the TPIU.
70 CS_UNLOCK(csa->base); in tpiu_enable_hw()
74 CS_LOCK(csa->base); in tpiu_enable_hw()
80 struct tpiu_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); in tpiu_enable()
82 guard(spinlock)(&drvdata->spinlock); in tpiu_enable()
83 tpiu_enable_hw(&csdev->access); in tpiu_enable()
84 csdev->refcnt++; in tpiu_enable()
85 dev_dbg(&csdev->dev, "TPIU enabled\n"); in tpiu_enable()
91 CS_UNLOCK(csa->base); in tpiu_disable_hw()
102 CS_LOCK(csa->base); in tpiu_disable_hw()
107 struct tpiu_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); in tpiu_disable()
109 guard(spinlock)(&drvdata->spinlock); in tpiu_disable()
110 csdev->refcnt--; in tpiu_disable()
111 if (csdev->refcnt) in tpiu_disable()
112 return -EBUSY; in tpiu_disable()
114 tpiu_disable_hw(&csdev->access); in tpiu_disable()
116 dev_dbg(&csdev->dev, "TPIU disabled\n"); in tpiu_disable()
139 return -ENOMEM; in __tpiu_probe()
143 return -ENOMEM; in __tpiu_probe()
145 spin_lock_init(&drvdata->spinlock); in __tpiu_probe()
147 drvdata->atclk = devm_clk_get(dev, "atclk"); /* optional */ in __tpiu_probe()
148 if (!IS_ERR(drvdata->atclk)) { in __tpiu_probe()
149 ret = clk_prepare_enable(drvdata->atclk); in __tpiu_probe()
154 drvdata->pclk = coresight_get_enable_apb_pclk(dev); in __tpiu_probe()
155 if (IS_ERR(drvdata->pclk)) in __tpiu_probe()
156 return -ENODEV; in __tpiu_probe()
164 drvdata->base = base; in __tpiu_probe()
167 /* Disable tpiu to support older devices */ in __tpiu_probe()
173 dev->platform_data = pdata; in __tpiu_probe()
180 drvdata->csdev = coresight_register(&desc); in __tpiu_probe()
182 if (!IS_ERR(drvdata->csdev)) in __tpiu_probe()
185 return PTR_ERR(drvdata->csdev); in __tpiu_probe()
192 ret = __tpiu_probe(&adev->dev, &adev->res); in tpiu_probe()
194 pm_runtime_put(&adev->dev); in tpiu_probe()
202 coresight_unregister(drvdata->csdev); in __tpiu_remove()
207 __tpiu_remove(&adev->dev); in tpiu_remove()
215 if (drvdata && !IS_ERR(drvdata->atclk)) in tpiu_runtime_suspend()
216 clk_disable_unprepare(drvdata->atclk); in tpiu_runtime_suspend()
218 if (drvdata && !IS_ERR_OR_NULL(drvdata->pclk)) in tpiu_runtime_suspend()
219 clk_disable_unprepare(drvdata->pclk); in tpiu_runtime_suspend()
227 if (drvdata && !IS_ERR(drvdata->atclk)) in tpiu_runtime_resume()
228 clk_prepare_enable(drvdata->atclk); in tpiu_runtime_resume()
230 if (drvdata && !IS_ERR_OR_NULL(drvdata->pclk)) in tpiu_runtime_resume()
231 clk_prepare_enable(drvdata->pclk); in tpiu_runtime_resume()
250 /* Coresight SoC-600 */
261 .name = "coresight-tpiu",
275 pm_runtime_get_noresume(&pdev->dev); in tpiu_platform_probe()
276 pm_runtime_set_active(&pdev->dev); in tpiu_platform_probe()
277 pm_runtime_enable(&pdev->dev); in tpiu_platform_probe()
279 ret = __tpiu_probe(&pdev->dev, res); in tpiu_platform_probe()
280 pm_runtime_put(&pdev->dev); in tpiu_platform_probe()
282 pm_runtime_disable(&pdev->dev); in tpiu_platform_probe()
289 struct tpiu_drvdata *drvdata = dev_get_drvdata(&pdev->dev); in tpiu_platform_remove()
294 __tpiu_remove(&pdev->dev); in tpiu_platform_remove()
295 pm_runtime_disable(&pdev->dev); in tpiu_platform_remove()
296 if (!IS_ERR_OR_NULL(drvdata->pclk)) in tpiu_platform_remove()
297 clk_put(drvdata->pclk); in tpiu_platform_remove()
302 {"ARMHC979", 0, 0, 0}, /* ARM CoreSight TPIU */
312 .name = "coresight-tpiu-platform",
321 return coresight_init_driver("tpiu", &tpiu_driver, &tpiu_platform_driver); in tpiu_init()
333 MODULE_DESCRIPTION("Arm CoreSight TPIU (Trace Port Interface Unit) driver");