[SRU][N][PATCH v2 4/6] UBUNTU: SAUCE: Revert "coresight: tmc: Move ACPI support from AMBA driver to platform driver"
Noah Wager
noah.wager at canonical.com
Wed Feb 25 16:54:00 UTC 2026
BugLink: https://bugs.launchpad.net/bugs/2142337
This reverts commit aaf260b9572eb2f8d9d63dba53ad09c211b82565.
This commit depends on the upstream commits:
3ab210297c31 ("coresight: tmc: Extract device properties from AMBA pid based table lookup")
075b7cd7ad7d ("coresight: Add helpers registering/removing both AMBA and platform drivers")
which are not ported to this kernel. This breaks coresight builds, so
revert the change.
This patch is a dependency of
b29444d683eb ("coresight: tmc: Support atclk")
which we also need to revert.
This revert is acceptable because the generic kernel has not
demonstrated any need for this atclk fix.
Signed-off-by: Noah Wager <noah.wager at canonical.com>
---
drivers/acpi/arm64/amba.c | 2 +
.../hwtracing/coresight/coresight-tmc-core.c | 140 ++----------------
drivers/hwtracing/coresight/coresight-tmc.h | 2 -
3 files changed, 17 insertions(+), 127 deletions(-)
diff --git a/drivers/acpi/arm64/amba.c b/drivers/acpi/arm64/amba.c
index d9811b1934e0..171b5c2c7edd 100644
--- a/drivers/acpi/arm64/amba.c
+++ b/drivers/acpi/arm64/amba.c
@@ -22,9 +22,11 @@
static const struct acpi_device_id amba_id_list[] = {
{"ARMH0061", 0}, /* PL061 GPIO Device */
{"ARMH0330", 0}, /* ARM DMA Controller DMA-330 */
+ {"ARMHC501", 0}, /* ARM CoreSight ETR */
{"ARMHC502", 0}, /* ARM CoreSight STM */
{"ARMHC503", 0}, /* ARM CoreSight Debug */
{"ARMHC979", 0}, /* ARM CoreSight TPIU */
+ {"ARMHC97C", 0}, /* ARM CoreSight SoC-400 TMC, SoC-600 ETF/ETB */
{"ARMHC98D", 0}, /* ARM CoreSight Dynamic Replicator */
{"ARMHC9CA", 0}, /* ARM CoreSight CATU */
{"ARMHC9FF", 0}, /* ARM CoreSight Dynamic Funnel */
diff --git a/drivers/hwtracing/coresight/coresight-tmc-core.c b/drivers/hwtracing/coresight/coresight-tmc-core.c
index fae5e842f65c..7ec5365e2b64 100644
--- a/drivers/hwtracing/coresight/coresight-tmc-core.c
+++ b/drivers/hwtracing/coresight/coresight-tmc-core.c
@@ -24,8 +24,6 @@
#include <linux/of.h>
#include <linux/coresight.h>
#include <linux/amba/bus.h>
-#include <linux/platform_device.h>
-#include <linux/acpi.h>
#include "coresight-priv.h"
#include "coresight-tmc.h"
@@ -439,17 +437,24 @@ static u32 tmc_etr_get_max_burst_size(struct device *dev)
return burst_size;
}
-static int __tmc_probe(struct device *dev, struct resource *res)
+static int tmc_probe(struct amba_device *adev, const struct amba_id *id)
{
int ret = 0;
u32 devid;
void __iomem *base;
+ struct device *dev = &adev->dev;
struct coresight_platform_data *pdata = NULL;
- struct tmc_drvdata *drvdata = dev_get_drvdata(dev);
+ struct tmc_drvdata *drvdata;
+ struct resource *res = &adev->res;
struct coresight_desc desc = { 0 };
struct coresight_dev_list *dev_list = NULL;
ret = -ENOMEM;
+ drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
+ if (!drvdata)
+ goto out;
+
+ dev_set_drvdata(dev, drvdata);
/* Validity for the resource is already checked by the AMBA core */
base = devm_ioremap_resource(dev, res);
@@ -525,7 +530,7 @@ static int __tmc_probe(struct device *dev, struct resource *res)
ret = PTR_ERR(pdata);
goto out;
}
- dev->platform_data = pdata;
+ adev->dev.platform_data = pdata;
desc.pdata = pdata;
drvdata->csdev = coresight_register(&desc);
@@ -540,24 +545,9 @@ static int __tmc_probe(struct device *dev, struct resource *res)
ret = misc_register(&drvdata->miscdev);
if (ret)
coresight_unregister(drvdata->csdev);
-out:
- return ret;
-}
-
-static int tmc_probe(struct amba_device *adev, const struct amba_id *id)
-{
- struct tmc_drvdata *drvdata;
- int ret;
-
- drvdata = devm_kzalloc(&adev->dev, sizeof(*drvdata), GFP_KERNEL);
- if (!drvdata)
- return -ENOMEM;
-
- amba_set_drvdata(adev, drvdata);
- ret = __tmc_probe(&adev->dev, &adev->res);
- if (!ret)
+ else
pm_runtime_put(&adev->dev);
-
+out:
return ret;
}
@@ -583,9 +573,9 @@ static void tmc_shutdown(struct amba_device *adev)
spin_unlock_irqrestore(&drvdata->spinlock, flags);
}
-static void __tmc_remove(struct device *dev)
+static void tmc_remove(struct amba_device *adev)
{
- struct tmc_drvdata *drvdata = dev_get_drvdata(dev);
+ struct tmc_drvdata *drvdata = dev_get_drvdata(&adev->dev);
/*
* Since misc_open() holds a refcount on the f_ops, which is
@@ -596,11 +586,6 @@ static void __tmc_remove(struct device *dev)
coresight_unregister(drvdata->csdev);
}
-static void tmc_remove(struct amba_device *adev)
-{
- __tmc_remove(&adev->dev);
-}
-
static const struct amba_id tmc_ids[] = {
CS_AMBA_ID(0x000bb961),
/* Coresight SoC 600 TMC-ETR/ETS */
@@ -626,102 +611,7 @@ static struct amba_driver tmc_driver = {
.id_table = tmc_ids,
};
-static int tmc_platform_probe(struct platform_device *pdev)
-{
- struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- struct tmc_drvdata *drvdata;
- int ret = 0;
-
- drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL);
- if (!drvdata)
- return -ENOMEM;
-
- drvdata->pclk = coresight_get_enable_apb_pclk(&pdev->dev);
- if (IS_ERR(drvdata->pclk))
- return -ENODEV;
-
- dev_set_drvdata(&pdev->dev, drvdata);
- pm_runtime_get_noresume(&pdev->dev);
- pm_runtime_set_active(&pdev->dev);
- pm_runtime_enable(&pdev->dev);
-
- ret = __tmc_probe(&pdev->dev, res);
- pm_runtime_put(&pdev->dev);
- if (ret)
- pm_runtime_disable(&pdev->dev);
-
- return ret;
-}
-
-static int tmc_platform_remove(struct platform_device *pdev)
-{
- struct tmc_drvdata *drvdata = dev_get_drvdata(&pdev->dev);
-
- if (WARN_ON(!drvdata))
- return -ENODEV;
-
- __tmc_remove(&pdev->dev);
- pm_runtime_disable(&pdev->dev);
- if (!IS_ERR_OR_NULL(drvdata->pclk))
- clk_put(drvdata->pclk);
- return 0;
-}
-
-#ifdef CONFIG_PM
-static int tmc_runtime_suspend(struct device *dev)
-{
- struct tmc_drvdata *drvdata = dev_get_drvdata(dev);
-
- if (drvdata && !IS_ERR_OR_NULL(drvdata->pclk))
- clk_disable_unprepare(drvdata->pclk);
- return 0;
-}
-
-static int tmc_runtime_resume(struct device *dev)
-{
- struct tmc_drvdata *drvdata = dev_get_drvdata(dev);
-
- if (drvdata && !IS_ERR_OR_NULL(drvdata->pclk))
- clk_prepare_enable(drvdata->pclk);
- return 0;
-}
-#endif
-
-static const struct dev_pm_ops tmc_dev_pm_ops = {
- SET_RUNTIME_PM_OPS(tmc_runtime_suspend, tmc_runtime_resume, NULL)
-};
-
-#ifdef CONFIG_ACPI
-static const struct acpi_device_id tmc_acpi_ids[] = {
- {"ARMHC501", 0, 0, 0}, /* ARM CoreSight ETR */
- {"ARMHC97C", 0, 0, 0}, /* ARM CoreSight SoC-400 TMC, SoC-600 ETF/ETB */
- {},
-};
-MODULE_DEVICE_TABLE(acpi, tmc_acpi_ids);
-#endif
-
-static struct platform_driver tmc_platform_driver = {
- .probe = tmc_platform_probe,
- .remove = tmc_platform_remove,
- .driver = {
- .name = "coresight-tmc-platform",
- .acpi_match_table = ACPI_PTR(tmc_acpi_ids),
- .suppress_bind_attrs = true,
- .pm = &tmc_dev_pm_ops,
- },
-};
-
-static int __init tmc_init(void)
-{
- return coresight_init_driver("tmc", &tmc_driver, &tmc_platform_driver);
-}
-
-static void __exit tmc_exit(void)
-{
- coresight_remove_driver(&tmc_driver, &tmc_platform_driver);
-}
-module_init(tmc_init);
-module_exit(tmc_exit);
+module_amba_driver(tmc_driver);
MODULE_AUTHOR("Pratik Patel <pratikp at codeaurora.org>");
MODULE_DESCRIPTION("Arm CoreSight Trace Memory Controller driver");
diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracing/coresight/coresight-tmc.h
index cb5a0920c203..8dcb426ac3e7 100644
--- a/drivers/hwtracing/coresight/coresight-tmc.h
+++ b/drivers/hwtracing/coresight/coresight-tmc.h
@@ -166,7 +166,6 @@ struct etr_buf {
/**
* struct tmc_drvdata - specifics associated to an TMC component
- * @pclk: APB clock if present, otherwise NULL
* @base: memory mapped base address for this component.
* @csdev: component vitals needed by the framework.
* @miscdev: specifics to handle "/dev/xyz.tmc" entry.
@@ -191,7 +190,6 @@ struct etr_buf {
* @perf_buf: PERF buffer for ETR.
*/
struct tmc_drvdata {
- struct clk *pclk;
void __iomem *base;
struct coresight_device *csdev;
struct miscdevice miscdev;
--
2.43.0
More information about the kernel-team
mailing list