coresight: Move remaining AMBA ACPI devices into platform driver
Subsystems (5)
v2 cover coresight: Move remaining AMBA ACPI devices into platform driver
This moves remaining AMBA ACPI devices into respective platform drivers for enabling ACPI based power management support. This series applies on latest coresight/next branch. This series has been built, and boot tested on a DT based coresight platform. Although this still requires some more testing on ACPI based coresight platforms.
https://git.gitlab.arm.com/linux-arm/linux-anshuman.git (amba_other_acpi_migration_v2)
Changes in V2:
- Dropped redundant devm_ioremap_resource() hunk from tmc_platform_probe()
- Defined coresight_[init|remove]_driver() for both AMBA/platform drivers
- Changed catu, tmc, tpiu, stm and debug coresight drivers to use the new helpers avoiding build issues arising from module_amba_driver(), and module_platform_driver() being on the same file
Changes in V1:
https://lore.kernel.org/all/[email protected]/
- Replaced all IS_ERR() instances with IS_ERR_OR_NULL() as per Suzuki
Changes in RFC:
https://lore.kernel.org/all/[email protected]/
Anshuman Khandual (7):
coresight: replicator: Move ACPI support from AMBA driver to platform driver
coresight: funnel: Move ACPI support from AMBA driver to platform driver
coresight: catu: Move ACPI support from AMBA driver to platform driver
coresight: tpiu: Move ACPI support from AMBA driver to platform driver
coresight: tmc: Move ACPI support from AMBA driver to platform driver
coresight: stm: Move ACPI support from AMBA driver to platform driver
coresight: debug: Move ACPI support from AMBA driver to platform driver
drivers/acpi/arm64/amba.c | 8 - drivers/hwtracing/coresight/coresight-catu.c | 130 +++++++++++++--- drivers/hwtracing/coresight/coresight-catu.h | 1 + drivers/hwtracing/coresight/coresight-core.c | 29 ++++ .../hwtracing/coresight/coresight-cpu-debug.c | 141 ++++++++++++++++-- .../hwtracing/coresight/coresight-funnel.c | 49 +++--- .../coresight/coresight-replicator.c | 44 +++--- drivers/hwtracing/coresight/coresight-stm.c | 91 +++++++++-- .../hwtracing/coresight/coresight-tmc-core.c | 130 ++++++++++++++-- drivers/hwtracing/coresight/coresight-tmc.h | 1 + drivers/hwtracing/coresight/coresight-tpiu.c | 87 ++++++++++- include/linux/coresight.h | 7 + 12 files changed, 608 insertions(+), 110 deletions(-)
Signature · 1 line
2.25.1
PATCH v2 1/7 coresight: replicator: Move ACPI support from AMBA driver to platform driver
Add support for the dynamic replicator device in the platform driver, which can then be used on ACPI based platforms. This change would now allow runtime power management for repliacator devices on ACPI based systems.
The driver would try to enable the APB clock if available. Also, rename the code to reflect the fact that it now handles both static and dynamic replicators.
--- drivers/acpi/arm64/amba.c | 1 - .../coresight/coresight-replicator.c | 44 ++++++++++++------- 2 files changed, 27 insertions(+), 18 deletions(-)
drivers/acpi/arm64/amba.c +0 -1
@@ -27,7 +27,6 @@ static const struct acpi_device_id amba_id_list[] = { {"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 */ {"", 0},
drivers/hwtracing/coresight/coresight-replicator.c +27 -17
126 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH V2 1/7] coresight: replicator: Move ACPI support from AMBA driver to platform driver
Quoted 10 lines · Anshuman Khandual
Add support for the dynamic replicator device in the platform driver, which can then be used on ACPI based platforms. This change would now allow runtime power management for repliacator devices on ACPI based systems.
The driver would try to enable the APB clock if available. Also, rename the code to reflect the fact that it now handles both static and dynamic replicators.
Cc Lorenzo Pieralisi <[email protected]>Cc Sudeep Holla <[email protected]>
Except the minor nit below which may apply also for few other patches in the series
[...]
drivers/hwtracing/coresight/coresight-replicator.c DEFINE_CORESIGHT_DEVLIST(replicator_devs, "replicator"); · line 41
Quoted 9 lines
drivers/hwtracing/coresight/coresight-replicator.c +1
-0@@ -38,6 +38,7 @@ DEFINE_CORESIGHT_DEVLIST(replicator_devs, "replicator");struct replicator_drvdata {void __iomem *base;struct clk *atclk; +struct clk *pclk;
[minor nit] Perhaps can be documented as well ?
Signature · 2 lines
Regards, Sudeep
Re: [PATCH V2 1/7] coresight: replicator: Move ACPI support from AMBA driver to platform driver
Quoted 20 lines · Sudeep Holla
Quoted 10 lines · Anshuman Khandual
Add support for the dynamic replicator device in the platform driver, which can then be used on ACPI based platforms. This change would now allow runtime power management for repliacator devices on ACPI based systems.
The driver would try to enable the APB clock if available. Also, rename the code to reflect the fact that it now handles both static and dynamic replicators.
Cc Lorenzo Pieralisi <[email protected]>Cc Sudeep Holla <[email protected]>Except the minor nit below which may apply also for few other patches in the series
[...]
Quoted 11 lines
drivers/hwtracing/coresight/coresight-replicator.c DEFINE_CORESIGHT_DEVLIST(replicator_devs, "replicator"); · line 41
Quoted 9 lines
drivers/hwtracing/coresight/coresight-replicator.c +1
-0@@ -38,6 +38,7 @@ DEFINE_CORESIGHT_DEVLIST(replicator_devs, "replicator");struct replicator_drvdata {void __iomem *base;struct clk *atclk; +struct clk *pclk;[minor nit] Perhaps can be documented as well ?
Sure, will add the following comment above the structure.
@pclk: optional clock for the core parts of the replicator.
Re: [PATCH V2 1/7] coresight: replicator: Move ACPI support from AMBA driver to platform driver
Quoted 35 lines · Anshuman Khandual
Quoted 20 lines · Sudeep Holla
Quoted 10 lines · Anshuman Khandual
Add support for the dynamic replicator device in the platform driver, which can then be used on ACPI based platforms. This change would now allow runtime power management for repliacator devices on ACPI based systems.
The driver would try to enable the APB clock if available. Also, rename the code to reflect the fact that it now handles both static and dynamic replicators.
Cc Lorenzo Pieralisi <[email protected]>Cc Sudeep Holla <[email protected]>Except the minor nit below which may apply also for few other patches in the series
[...]
Quoted 11 lines
drivers/hwtracing/coresight/coresight-replicator.c DEFINE_CORESIGHT_DEVLIST(replicator_devs, "replicator"); · line 41
Quoted 9 lines
drivers/hwtracing/coresight/coresight-replicator.c +1
-0@@ -38,6 +38,7 @@ DEFINE_CORESIGHT_DEVLIST(replicator_devs, "replicator");struct replicator_drvdata {void __iomem *base;struct clk *atclk; +struct clk *pclk;[minor nit] Perhaps can be documented as well ?
Quoted 3 lines
Sure, will add the following comment above the structure.
@pclk: optional clock for the core parts of the replicator.
My bad, this will be the following instead.
drivers/hwtracing/coresight/coresight-replicator.c +1 -0
@@ -31,6 +31,7 @@ DEFINE_CORESIGHT_DEVLIST(replicator_devs, "replicator");* @base: memory mapped base address for this component. Also indicates * whether this one is programmable or not. * @atclk: optional clock for the core parts of the replicator. +* @pclk: APB clock if present, otherwise NULL * @csdev: component vitals needed by the framework * @spinlock: serialize enable/disable operations. * @check_idfilter_val: check if the context is lost upon clock removal.
I will update replicator, tpiu, tmc, and stm devices.
struct catu_drvdata and debug_drvdata do not have the comment section itself.
Re: [PATCH V2 1/7] coresight: replicator: Move ACPI support from AMBA driver to platform driver
Quoted 57 lines · Anshuman Khandual
Quoted 35 lines · Anshuman Khandual
Quoted 20 lines · Sudeep Holla
Quoted 10 lines · Anshuman Khandual
Add support for the dynamic replicator device in the platform driver, which can then be used on ACPI based platforms. This change would now allow runtime power management for repliacator devices on ACPI based systems.
The driver would try to enable the APB clock if available. Also, rename the code to reflect the fact that it now handles both static and dynamic replicators.
Cc Lorenzo Pieralisi <[email protected]>Cc Sudeep Holla <[email protected]>Except the minor nit below which may apply also for few other patches in the series
[...]
Quoted 11 lines
drivers/hwtracing/coresight/coresight-replicator.c DEFINE_CORESIGHT_DEVLIST(replicator_devs, "replicator"); · line 41
Quoted 9 lines
drivers/hwtracing/coresight/coresight-replicator.c +1
-0@@ -38,6 +38,7 @@ DEFINE_CORESIGHT_DEVLIST(replicator_devs, "replicator");struct replicator_drvdata {void __iomem *base;struct clk *atclk; +struct clk *pclk;[minor nit] Perhaps can be documented as well ?
Quoted 3 lines
Sure, will add the following comment above the structure.
@pclk: optional clock for the core parts of the replicator.
My bad, this will be the following instead.
drivers/hwtracing/coresight/coresight-replicator.c +1
-0@@ -31,6 +31,7 @@ DEFINE_CORESIGHT_DEVLIST(replicator_devs, "replicator");* @base: memory mapped base address for this component. Also indicates * whether this one is programmable or not. * @atclk: optional clock for the core parts of the replicator. +* @pclk: APB clock if present, otherwise NULL * @csdev: component vitals needed by the framework * @spinlock: serialize enable/disable operations. * @check_idfilter_val: check if the context is lost upon clock removal.
Quoted 2 lines
I will update replicator, tpiu, tmc, and stm devices.
funnel is missing it as well. If you build with W=1 it shows up.
Quoted 4 lines
struct
catu_drvdataanddebug_drvdatado not have the comment section itself.
_______________________________________________
CoreSight mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Re: [PATCH V2 1/7] coresight: replicator: Move ACPI support from AMBA driver to platform driver
Quoted 53 lines · James Clark
Quoted 51 lines · Anshuman Khandual
Quoted 31 lines · Anshuman Khandual
Quoted 19 lines · Sudeep Holla
Quoted 10 lines · Anshuman Khandual
Add support for the dynamic replicator device in the platform driver, which can then be used on ACPI based platforms. This change would now allow runtime power management for repliacator devices on ACPI based systems.
The driver would try to enable the APB clock if available. Also, rename the code to reflect the fact that it now handles both static and dynamic replicators.
Cc Lorenzo Pieralisi <[email protected]>Cc Sudeep Holla <[email protected]>Except the minor nit below which may apply also for few other patches in the series
[...]
Quoted 10 lines
drivers/hwtracing/coresight/coresight-replicator.c DEFINE_CORESIGHT_DEVLIST(replicator_devs, "replicator"); · line 41
Quoted 9 lines
drivers/hwtracing/coresight/coresight-replicator.c +1
-0@@ -38,6 +38,7 @@ DEFINE_CORESIGHT_DEVLIST(replicator_devs, "replicator");struct replicator_drvdata {void __iomem *base;struct clk *atclk; +struct clk *pclk;[minor nit] Perhaps can be documented as well ?
Quoted 3 lines
Sure, will add the following comment above the structure.
@pclk: optional clock for the core parts of the replicator.
My bad, this will be the following instead.
drivers/hwtracing/coresight/coresight-replicator.c +1
-0@@ -31,6 +31,7 @@ DEFINE_CORESIGHT_DEVLIST(replicator_devs, "replicator");* @base: memory mapped base address for this component. Also indicates * whether this one is programmable or not. * @atclk: optional clock for the core parts of the replicator. +* @pclk: APB clock if present, otherwise NULL * @csdev: component vitals needed by the framework * @spinlock: serialize enable/disable operations. * @check_idfilter_val: check if the context is lost upon clock removal.
Quoted 3 lines
Quoted 2 lines
I will update replicator, tpiu, tmc, and stm devices.
funnel is missing it as well. If you build with W=1 it shows up.
Updated, done.
PATCH v2 2/7 coresight: funnel: Move ACPI support from AMBA driver to platform driver
In reply to Anshuman KhandualAdd support for the dynamic funnel device in the platform driver, which can then be used on ACPI based platforms. This change would allow runtime power management for ACPI based systems.
The driver would try to enable the APB clock if available. Also, rename the code to reflect the fact that it now handles both static and dynamic funnels.
--- drivers/acpi/arm64/amba.c | 1 - .../hwtracing/coresight/coresight-funnel.c | 49 ++++++++++++------- 2 files changed, 30 insertions(+), 20 deletions(-)
drivers/acpi/arm64/amba.c +0 -1
@@ -28,7 +28,6 @@ static const struct acpi_device_id amba_id_list[] = { {"ARMHC979", 0}, /* ARM CoreSight TPIU */ {"ARMHC97C", 0}, /* ARM CoreSight SoC-400 TMC, SoC-600 ETF/ETB */ {"ARMHC9CA", 0}, /* ARM CoreSight CATU */ - {"ARMHC9FF", 0}, /* ARM CoreSight Dynamic Funnel */ {"", 0}, };
drivers/hwtracing/coresight/coresight-funnel.c +30 -19
128 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH V2 2/7] coresight: funnel: Move ACPI support from AMBA driver to platform driver
Quoted 10 lines · Anshuman Khandual
Add support for the dynamic funnel device in the platform driver, which can then be used on ACPI based platforms. This change would allow runtime power management for ACPI based systems.
The driver would try to enable the APB clock if available. Also, rename the code to reflect the fact that it now handles both static and dynamic funnels.
Cc Lorenzo Pieralisi <[email protected]>Cc Sudeep Holla <[email protected]>
Signature · 2 lines
Regards, Sudeep
PATCH v2 3/7 coresight: catu: Move ACPI support from AMBA driver to platform driver
In reply to Anshuman KhandualAdd support for the catu devices in a new platform driver, which can then be used on ACPI based platforms. This change would now allow runtime power management for ACPI based systems. The driver would try to enable the APB clock if available.
--- drivers/acpi/arm64/amba.c | 1 - drivers/hwtracing/coresight/coresight-catu.c | 130 ++++++++++++++++--- drivers/hwtracing/coresight/coresight-catu.h | 1 + drivers/hwtracing/coresight/coresight-core.c | 29 +++++ include/linux/coresight.h | 7 + 5 files changed, 149 insertions(+), 19 deletions(-)
drivers/acpi/arm64/amba.c +0 -1
@@ -27,7 +27,6 @@ static const struct acpi_device_id amba_id_list[] = { {"ARMHC503", 0}, /* ARM CoreSight Debug */ {"ARMHC979", 0}, /* ARM CoreSight TPIU */ {"ARMHC97C", 0}, /* ARM CoreSight SoC-400 TMC, SoC-600 ETF/ETB */ - {"ARMHC9CA", 0}, /* ARM CoreSight CATU */ {"", 0}, };
drivers/hwtracing/coresight/coresight-catu.c +112 -18
184 lines not on this page · raw message
drivers/hwtracing/coresight/coresight-catu.h +1 -0
@@ -61,6 +61,7 @@#define CATU_IRQEN_OFF 0x0struct catu_drvdata { +struct clk *pclk;void __iomem *base;struct coresight_device *csdev;int irq;
drivers/hwtracing/coresight/coresight-core.c +29 -0
@@ -1833,6 +1833,35 @@ static void __exit coresight_exit(void)module_init (coresight_init);module_exit (coresight_exit); +int coresight_init_driver (const char *drv,struct amba_driver *amba_drv, +struct platform_driver *pdev_drv) +{ +int ret; + + ret =amba_driver_register (amba_drv); +if (ret) { +pr_err ("%s: error registering AMBA driver\n" , drv); +return ret; + } + + ret =platform_driver_register (pdev_drv); +if (!ret) +return 0 ; + +pr_err ("%s: error registering platform driver\n" , drv); +amba_driver_unregister (amba_drv); +return ret; +} +EXPORT_SYMBOL_GPL (coresight_init_driver); + +void coresight_remove_driver (struct amba_driver *amba_drv, +struct platform_driver *pdev_drv) +{ +amba_driver_unregister (amba_drv); +platform_driver_unregister (pdev_drv); +} +EXPORT_SYMBOL_GPL (coresight_remove_driver); +MODULE_LICENSE ("GPL v2" );MODULE_AUTHOR ("Pratik Patel <[email protected]>" );MODULE_AUTHOR ("Mathieu Poirier <[email protected]>" );
include/linux/coresight.h +7 -0
@@ -12,6 +12,8 @@#include <linux/io.h> #include <linux/perf_event.h> #include <linux/sched.h> +#include <linux/amba/bus.h> +#include <linux/platform_device.h> /* Peripheral id registers (0xFD0-0xFEC) */ #define CORESIGHT_PERIPHIDR4 0xfd0
@@ -597,6 +599,11 @@ void coresight_relaxed_write64(struct coresight_device *csdev, u64 val, u32 offset);void coresight_write64 (struct coresight_device *csdev,u64 val,u32 offset); +int coresight_init_driver (const char *drv,struct amba_driver *amba_drv, +struct platform_driver *pdev_drv); + +void coresight_remove_driver (struct amba_driver *amba_drv, +struct platform_driver *pdev_drv);#else static inline struct coresight_device *coresight_register (struct coresight_desc *desc) {return NULL ; }
Signature · 1 line
2.25.1
Re: [PATCH V2 3/7] coresight: catu: Move ACPI support from AMBA driver to platform driver
Quoted 7 lines · Anshuman Khandual
Add support for the catu devices in a new platform driver, which can then be used on ACPI based platforms. This change would now allow runtime power management for ACPI based systems. The driver would try to enable the APB clock if available.
Cc Lorenzo Pieralisi <[email protected]>Cc Sudeep Holla <[email protected]>
Signature · 2 lines
Regards, Sudeep
Suzuki K Poulose
maintainerRe: [PATCH V2 3/7] coresight: catu: Move ACPI support from AMBA driver to platform driver
In reply to Anshuman KhandualHi Anshuman,
Quoted 4 lines · Anshuman Khandual
Add support for the catu devices in a new platform driver, which can then be used on ACPI based platforms. This change would now allow runtime power management for ACPI based systems. The driver would try to enable the APB clock if available.
This doesn't talk about the new helper. As such I would prefer that to be a separate preparatory patch. See below.
Quoted 156 lines
Cc Lorenzo Pieralisi <[email protected]>Cc Sudeep Holla <[email protected]>Cc Suzuki K Poulose <[email protected]>Cc Mike Leach <[email protected]>Cc James Clark <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>--- drivers/acpi/arm64/amba.c | 1 - drivers/hwtracing/coresight/coresight-catu.c | 130 ++++++++++++++++--- drivers/hwtracing/coresight/coresight-catu.h | 1 + drivers/hwtracing/coresight/coresight-core.c | 29 +++++ include/linux/coresight.h | 7 + 5 files changed, 149 insertions(+), 19 deletions(-)drivers/acpi/arm64/amba.c +0
-1@@ -27,7 +27,6 @@ static const struct acpi_device_id amba_id_list[] = { {"ARMHC503", 0}, /* ARM CoreSight Debug */ {"ARMHC979", 0}, /* ARM CoreSight TPIU */ {"ARMHC97C", 0}, /* ARM CoreSight SoC-400 TMC, SoC-600 ETF/ETB */ - {"ARMHC9CA", 0}, /* ARM CoreSight CATU */ {"", 0}, };drivers/hwtracing/coresight/coresight-catu.c +62
-14@@ -7,6 +7,8 @@* Author: Suzuki K Poulose <[email protected]> */ +#include <linux/platform_device.h> +#include <linux/acpi.h> #include <linux/amba/bus.h> #include <linux/device.h> #include <linux/dma-mapping.h> @@ -502,28 +504,20 @@ static const struct coresight_ops catu_ops = { .helper_ops = &catu_helper_ops, }; -static int catu_probe (struct amba_device *adev,const struct amba_id *id) +static int __catu_probe (struct device *dev,struct resource *res) {int ret =0 ;u32 dma_mask; -struct catu_drvdata *drvdata; +struct catu_drvdata *drvdata =dev_get_drvdata (dev);struct coresight_desc catu_desc;struct coresight_platform_data *pdata =NULL ; -struct device *dev = &adev->dev;void __iomem *base; catu_desc.name =coresight_alloc_device_name (&catu_devs, dev);if (!catu_desc.name)return -ENOMEM ; - drvdata =devm_kzalloc (dev,sizeof (*drvdata),GFP_KERNEL ); -if (!drvdata) { - ret = -ENOMEM ; - goto out; - } - -dev_set_drvdata (dev, drvdata); - base =devm_ioremap_resource (dev, &adev->res); + base =devm_ioremap_resource (dev, res);if (IS_ERR (base)) { ret =PTR_ERR (base); goto out;@@ -568,18 +562,35 @@ static int catu_probe(struct amba_device *adev, const struct amba_id *id)if (IS_ERR (drvdata->csdev)) ret =PTR_ERR (drvdata->csdev);else -pm_runtime_put (&adev->dev); +pm_runtime_put (dev); out:return ret; } -static void catu_remove (struct amba_device *adev) +static int catu_probe (struct amba_device *adev,const struct amba_id *id) +{ +struct catu_drvdata *drvdata; + + drvdata =devm_kzalloc (&adev->dev,sizeof (*drvdata),GFP_KERNEL ); +if (!drvdata) +return -ENOMEM ; + +amba_set_drvdata (adev, drvdata); +return __catu_probe (&adev->dev, &adev->res); +} + +static void __catu_remove (struct device *dev) { -struct catu_drvdata *drvdata =dev_get_drvdata (&adev->dev); +struct catu_drvdata *drvdata =dev_get_drvdata (dev);coresight_unregister (drvdata->csdev); } +static void catu_remove (struct amba_device *adev) +{ +__catu_remove (&adev->dev); +} +static struct amba_id catu_ids[] = {CS_AMBA_ID (0x000bb9ee ), {},@@ -598,13 +609,96 @@ static struct amba_driver catu_driver = { .id_table = catu_ids, }; +static int catu_platform_probe (struct platform_device *pdev) +{ +struct resource *res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +struct catu_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 ; + +if (res) { + drvdata->base =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (drvdata->base)) { +clk_put (drvdata->pclk); +return PTR_ERR (drvdata->base); + } + } + +pm_runtime_get_noresume (&pdev->dev); +pm_runtime_set_active (&pdev->dev); +pm_runtime_enable (&pdev->dev); + +dev_set_drvdata (&pdev->dev, drvdata); + ret =__catu_probe (&pdev->dev, res); +if (ret) { +pm_runtime_put_noidle (&pdev->dev); +pm_runtime_disable (&pdev->dev); + } +return ret; +} + +static int catu_platform_remove (struct platform_device *pdev) +{
drivers/hwtracing/coresight/coresight-catu.c static struct amba_driver catu_driver = { · line 658
Quoted 10 lines
drivers/hwtracing/coresight/coresight-catu.c +10
-0+__catu_remove (&pdev->dev); +return 0 ; +} + +#ifdef CONFIG_PM +static int catu_runtime_suspend (struct device *dev) +{ +struct catu_drvdata *drvdata =dev_get_drvdata (dev); + +if (drvdata->pclk && !IS_ERR_OR_NULL (drvdata->pclk))
Only the second part is needed. IS_ERR_OR_NULL() already checks for NULL.
drivers/hwtracing/coresight/coresight-catu.c static struct amba_driver catu_driver = { · line 667
Quoted 9 lines
drivers/hwtracing/coresight/coresight-catu.c +9
-0+clk_disable_unprepare (drvdata->pclk); +return 0 ; +} + +static int catu_runtime_resume (struct device *dev) +{ +struct catu_drvdata *drvdata =dev_get_drvdata (dev); + +if (drvdata->pclk && !IS_ERR_OR_NULL (drvdata->pclk))
Same here.
Quoted 66 lines
drivers/hwtracing/coresight/coresight-catu.c +31
-4+clk_prepare_enable (drvdata->pclk); +return 0 ; +} +#endif + +static const struct dev_pm_ops catu_dev_pm_ops = { +SET_RUNTIME_PM_OPS (catu_runtime_suspend, catu_runtime_resume,NULL ) +}; + +#ifdef CONFIG_ACPI +static const struct acpi_device_id catu_acpi_ids[] = { + {"ARMHC9CA" ,0 },/* ARM CoreSight CATU */ + {}, +}; + +MODULE_DEVICE_TABLE (acpi, catu_acpi_ids); +#endif + +static struct platform_driver catu_platform_driver = { + .probe = catu_platform_probe, + .remove = catu_platform_remove, + .driver = { + .name ="coresight-catu-platform" , + .acpi_match_table =ACPI_PTR (catu_acpi_ids), + .suppress_bind_attrs = true, + .pm = &catu_dev_pm_ops, + }, +}; +static int __init catu_init (void ) {int ret; - ret =amba_driver_register (&catu_driver); -if (ret) -pr_info ("Error registering catu driver\n" ); + ret =coresight_init_driver ("catu" , &catu_driver, &catu_platform_driver);tmc_etr_set_catu_ops (&etr_catu_buf_ops);return ret; }@@ -612,7 +706,7 @@ static int __init catu_init(void) static void __exit catu_exit(void) {tmc_etr_remove_catu_ops (); -amba_driver_unregister (&catu_driver); +coresight_remove_driver (&catu_driver, &catu_platform_driver); }module_init (catu_init);drivers/hwtracing/coresight/coresight-catu.h +1
-0@@ -61,6 +61,7 @@#define CATU_IRQEN_OFF 0x0struct catu_drvdata { +struct clk *pclk;void __iomem *base;struct coresight_device *csdev;int irq;drivers/hwtracing/coresight/coresight-core.c +0
-0
drivers/hwtracing/coresight/coresight-core.c static void __exit coresight_exit(void) · line 1835
Quoted 3 lines
drivers/hwtracing/coresight/coresight-core.c +0
-0@@ -1833,6 +1833,35 @@ static void __exit coresight_exit(void)module_init (coresight_init);module_exit (coresight_exit);
---8>---
Quoted 18 lines
drivers/hwtracing/coresight/coresight-core.c +18
-0+int coresight_init_driver (const char *drv,struct amba_driver *amba_drv, +struct platform_driver *pdev_drv) +{ +int ret; + + ret =amba_driver_register (amba_drv); +if (ret) { +pr_err ("%s: error registering AMBA driver\n" , drv); +return ret; + } + + ret =platform_driver_register (pdev_drv); +if (!ret) +return 0 ; + +pr_err ("%s: error registering platform driver\n" , drv); +amba_driver_unregister (amba_drv); +return ret;
drivers/hwtracing/coresight/coresight-core.c static void __exit coresight_exit(void) · line 1863
Quoted 10 lines
drivers/hwtracing/coresight/coresight-core.c +10
-0+} +EXPORT_SYMBOL_GPL (coresight_init_driver); + +void coresight_remove_driver (struct amba_driver *amba_drv, +struct platform_driver *pdev_drv) +{ +amba_driver_unregister (amba_drv); +platform_driver_unregister (pdev_drv); +} +EXPORT_SYMBOL_GPL (coresight_remove_driver);
Please could we split this into a separate patch itself ? Also, can we not use them for the other components ? funnel, replicator ?
Quoted 19 lines
drivers/hwtracing/coresight/coresight-core.c +1
-0+MODULE_LICENSE ("GPL v2" );MODULE_AUTHOR ("Pratik Patel <[email protected]>" );MODULE_AUTHOR ("Mathieu Poirier <[email protected]>" );include/linux/coresight.h +2
-0@@ -12,6 +12,8 @@#include <linux/io.h> #include <linux/perf_event.h> #include <linux/sched.h> +#include <linux/amba/bus.h> +#include <linux/platform_device.h> /* Peripheral id registers (0xFD0-0xFEC) */ #define CORESIGHT_PERIPHIDR4 0xfd0@@ -597,6 +599,11 @@ void coresight_relaxed_write64(struct coresight_device *csdev, u64 val, u32 offset);
include/linux/coresight.h void coresight_relaxed_write64(struct coresight_device *csdev, · line 609
Quoted 10 lines
include/linux/coresight.h +5
-0void coresight_write64 (struct coresight_device *csdev,u64 val,u32 offset); +int coresight_init_driver (const char *drv,struct amba_driver *amba_drv, +struct platform_driver *pdev_drv); + +void coresight_remove_driver (struct amba_driver *amba_drv, +struct platform_driver *pdev_drv);#else static inline struct coresight_device *coresight_register (struct coresight_desc *desc) {return NULL ; }
Suzuki
Re: [PATCH V2 3/7] coresight: catu: Move ACPI support from AMBA driver to platform driver
Quoted 9 lines · Suzuki K Poulose
Hi Anshuman,
Quoted 4 lines · Anshuman Khandual
Add support for the catu devices in a new platform driver, which can then be used on ACPI based platforms. This change would now allow runtime power management for ACPI based systems. The driver would try to enable the APB clock if available.
This doesn't talk about the new helper. As such I would prefer that to be a separate preparatory patch. See below.
Makes sense.
Quoted 152 lines
Quoted 152 lines
Cc Lorenzo Pieralisi <[email protected]>Cc Sudeep Holla <[email protected]>Cc Suzuki K Poulose <[email protected]>Cc Mike Leach <[email protected]>Cc James Clark <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>---
drivers/acpi/arm64/amba.c | 1 -drivers/hwtracing/coresight/coresight-catu.c | 130 ++++++++++++++++--- drivers/hwtracing/coresight/coresight-catu.h | 1 + drivers/hwtracing/coresight/coresight-core.c | 29 +++++ include/linux/coresight.h | 7 + 5 files changed, 149 insertions(+), 19 deletions(-)drivers/acpi/arm64/amba.c +0
-0@@ -27,7 +27,6 @@ static const struct acpi_device_id amba_id_list[] = {{"ARMHC503", 0}, /* ARM CoreSight Debug */
{"ARMHC979", 0}, /* ARM CoreSight TPIU */
{"ARMHC97C", 0}, /* ARM CoreSight SoC-400 TMC, SoC-600 ETF/ETB */
- {"ARMHC9CA", 0}, /* ARM CoreSight CATU */
{"", 0},
};
diff --gita/drivers/hwtracing/coresight/coresight-catu.cb/drivers/hwtracing/coresight/coresight-catu.cindex3949ded0d4fa..ba5ee7d158dd100644drivers/hwtracing/coresight/coresight-catu.c +0
-0@@ -7,6 +7,8 @@* Author: Suzuki K Poulose <[email protected]> */ +#include <
linux/platform_device.h>
+#include <linux/acpi.h>
#include <linux/amba/bus.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>drivers/hwtracing/coresight/coresight-catu.c +3
-9@@ -502,28 +504,20 @@ static const struct coresight_ops catu_ops = { .helper_ops = &catu_helper_ops, }; -static int catu_probe(struct amba_device *adev, const struct amba_id *id) +static int __catu_probe(struct device *dev, struct resource *res) { int ret = 0; u32 dma_mask; - struct catu_drvdata *drvdata; + struct catu_drvdata *drvdata = dev_get_drvdata(dev); struct coresight_desc catu_desc; struct coresight_platform_data *pdata = NULL; - struct device *dev = &adev->dev; void __iomem *base; catu_desc.name = coresight_alloc_device_name(&catu_devs, dev); if (!catu_desc.name) return -ENOMEM; - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); - if (!drvdata) { - ret = -ENOMEM; - goto out; - } - - dev_set_drvdata(dev, drvdata); - base = devm_ioremap_resource(dev, &adev->res); + base = devm_ioremap_resource(dev, res); if (IS_ERR(base)) { ret = PTR_ERR(base); goto out;@@ -568,18 +562,35 @@ static int catu_probe(struct amba_device *adev, const struct amba_id *id) if (IS_ERR(drvdata->csdev)) ret = PTR_ERR(drvdata->csdev);else
-pm_runtime_put(&adev->dev);
+pm_runtime_put(dev);
out:
return ret;
}
-static voidcatu_remove(struct amba_device *adev)drivers/hwtracing/coresight/coresight-catu.c +13
-0+static int catu_probe (struct amba_device *adev,const struct amba_id *id) +{ + struct catu_drvdata *drvdata; + + drvdata = devm_kzalloc(&adev->dev, sizeof(*drvdata), GFP_KERNEL); + if (!drvdata) + return -ENOMEM; + + amba_set_drvdata(adev, drvdata); + return __catu_probe(&adev->dev, &adev->res); +} + +static void __catu_remove (struct device *dev){
- structcatu_drvdata*drvdata =dev_get_drvdata(&adev->dev); + structcatu_drvdata*drvdata =dev_get_drvdata(dev);coresight_unregister(drvdata->csdev);
}
+static voidcatu_remove(struct amba_device *adev)drivers/hwtracing/coresight/coresight-catu.c +4
-0+{ + __catu_remove(&adev->dev); +} +static struct
amba_idcatu_ids[] = {
CS_AMBA_ID(0x000bb9ee),
{},drivers/hwtracing/coresight/coresight-catu.c +40
-0@@ -598,13 +609,96 @@ static struct amba_driver catu_driver = { .id_table = catu_ids, }; +static int catu_platform_probe(struct platform_device *pdev) +{ + struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + struct catu_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; + + if (res) { + drvdata->base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(drvdata->base)) { + clk_put(drvdata->pclk); + return PTR_ERR(drvdata->base); + } + } + + pm_runtime_get_noresume(&pdev->dev); + pm_runtime_set_active(&pdev->dev); + pm_runtime_enable(&pdev->dev); + + dev_set_drvdata(&pdev->dev, drvdata); + ret = __catu_probe(&pdev->dev, res); + if (ret) { + pm_runtime_put_noidle(&pdev->dev); + pm_runtime_disable(&pdev->dev); + } + return ret; +} + +static int catu_platform_remove (struct platform_device *pdev) +{ + __catu_remove(&pdev->dev); + return 0; +} +
Quoted 8 lines
drivers/hwtracing/coresight/coresight-catu.c static struct amba_driver catu_driver = { · line 658
Quoted 6 lines
drivers/hwtracing/coresight/coresight-catu.c +6
-0+#ifdef CONFIG_PM +static int catu_runtime_suspend (struct device *dev) +{ + struct catu_drvdata *drvdata = dev_get_drvdata(dev); + + if (drvdata->pclk && !IS_ERR_OR_NULL(drvdata->pclk))Only the second part is needed.
IS_ERR_OR_NULL()already checks for NULL.
Actually, the first check here should be for valid drvdata instead, ensuring that subsequent de-referencing for drvdata->pclk does not crash. Will do this replacement for all affected patches.
Quoted 104 lines
drivers/hwtracing/coresight/coresight-catu.c static struct amba_driver catu_driver = { · line 667
Quoted 10 lines
drivers/hwtracing/coresight/coresight-catu.c +9
-0+ clk_disable_unprepare(drvdata->pclk); + return 0; +} + +static int catu_runtime_resume (struct device *dev) +{ + struct catu_drvdata *drvdata = dev_get_drvdata(dev); + + if (drvdata->pclk && !IS_ERR_OR_NULL(drvdata->pclk))Same here.
Quoted 65 lines
drivers/hwtracing/coresight/coresight-catu.c +31
-3+ clk_prepare_enable(drvdata->pclk); + return 0; +} +#endif + +static const struct dev_pm_ops catu_dev_pm_ops = { + SET_RUNTIME_PM_OPS(catu_runtime_suspend, catu_runtime_resume, NULL) +}; + +#ifdef CONFIG_ACPI +static const struct acpi_device_id catu_acpi_ids[] = { + {"ARMHC9CA", 0}, /* ARM CoreSight CATU */ + {}, +}; + +MODULE_DEVICE_TABLE (acpi, catu_acpi_ids); +#endif + +static struct platform_driver catu_platform_driver = { + .probe = catu_platform_probe, + .remove = catu_platform_remove, + .driver = { + .name = "coresight-catu-platform", + .acpi_match_table = ACPI_PTR(catu_acpi_ids), + .suppress_bind_attrs = true, + .pm = &catu_dev_pm_ops, + }, +}; + static int __init catu_init(void) { int ret; - ret = amba_driver_register(&catu_driver); - if (ret) - pr_info("Error registering catu driver\n"); + ret = coresight_init_driver("catu", &catu_driver, &catu_platform_driver); tmc_etr_set_catu_ops(&etr_catu_buf_ops); return ret; }@@ -612,7 +706,7 @@ static int __init catu_init(void) static void __exit catu_exit(void) { tmc_etr_remove_catu_ops(); - amba_driver_unregister(&catu_driver); + coresight_remove_driver(&catu_driver, &catu_platform_driver); } module_init(catu_init);drivers/hwtracing/coresight/coresight-catu.h +1
-0@@ -61,6 +61,7 @@ #define CATU_IRQEN_OFF 0x0 struct catu_drvdata { + struct clk *pclk; void __iomem *base; struct coresight_device *csdev; int irq;drivers/hwtracing/coresight/coresight-core.c +0
-0@@ -1833,6 +1833,35 @@ static void __exit coresight_exit(void) module_init(coresight_init); module_exit(coresight_exit);Quoted 1 line
---8>---
Quoted 22 lines
drivers/hwtracing/coresight/coresight-core.c +22
-0+int coresight_init_driver (const char *drv,struct amba_driver *amba_drv, + struct platform_driver *pdev_drv) +{ + int ret; + + ret = amba_driver_register(amba_drv); + if (ret) { + pr_err("%s: error registering AMBA driver\n", drv); + return ret; + } + + ret = platform_driver_register(pdev_drv); + if (!ret) + return 0; + + pr_err("%s: error registering platform driver\n", drv); + amba_driver_unregister(amba_drv); + return ret; +} +EXPORT_SYMBOL_GPL (coresight_init_driver); + +void coresight_remove_driver(struct amba_driver *amba_drv,
Quoted 8 lines
drivers/hwtracing/coresight/coresight-core.c static void __exit coresight_exit(void) · line 1863
Quoted 6 lines
+ struct
platform_driver*pdev_drv)drivers/hwtracing/coresight/coresight-core.c +5
-0+{ + amba_driver_unregister(amba_drv); + platform_driver_unregister(pdev_drv); +} +EXPORT_SYMBOL_GPL (coresight_remove_driver);Please could we split this into a separate patch itself ? Also, can we not use them for the other components ? funnel, replicator ?
Sure, will split the helpers addition along with their header changes into a separate patch at the beginning of this series, and then use them for funnel and replicator devices in subsequent patches.
Quoted 32 lines
Quoted 27 lines
+
MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Pratik Patel <[email protected]>");MODULE_AUTHOR("Mathieu Poirier <[email protected]>");include/linux/coresight.h +6
-0@@ -12,6 +12,8 @@ #include <linux/io.h> #include <linux/perf_event.h> #include <linux/sched.h> +#include <linux/amba/bus.h> +#include <linux/platform_device.h> /* Peripheral id registers (0xFD0-0xFEC) */ #define CORESIGHT_PERIPHIDR4 0xfd0@@ -597,6 +599,11 @@ void coresight_relaxed_write64(struct coresight_device *csdev, u64 val, u32 offset); void coresight_write64(struct coresight_device *csdev, u64 val, u32 offset); +int coresight_init_driver(const char *drv, struct amba_driver *amba_drv, + struct platform_driver *pdev_drv); + +void coresight_remove_driver (struct amba_driver *amba_drv, + struct platform_driver *pdev_drv); #elseQuoted 2 lines
static inline struct
coresight_device*coresight_register(struct coresight_desc *desc){ return NULL; }Suzuki
PATCH v2 4/7 coresight: tpiu: Move ACPI support from AMBA driver to platform driver
In reply to Anshuman KhandualAdd support for the tpiu device in the platform driver, which can then be used on ACPI based platforms. This change would now allow runtime power management for ACPI based systems. The driver would try to enable the APB clock if available.
--- drivers/acpi/arm64/amba.c | 1 - drivers/hwtracing/coresight/coresight-tpiu.c | 87 ++++++++++++++++++-- 2 files changed, 79 insertions(+), 9 deletions(-)
drivers/acpi/arm64/amba.c +0 -1
@@ -25,7 +25,6 @@ static const struct acpi_device_id amba_id_list[] = { {"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 */ {"", 0}, };
drivers/hwtracing/coresight/coresight-tpiu.c +79 -8
156 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH V2 4/7] coresight: tpiu: Move ACPI support from AMBA driver to platform driver
Quoted 7 lines · Anshuman Khandual
Add support for the tpiu device in the platform driver, which can then be used on ACPI based platforms. This change would now allow runtime power management for ACPI based systems. The driver would try to enable the APB clock if available.
Cc Lorenzo Pieralisi <[email protected]>Cc Sudeep Holla <[email protected]>
Signature · 2 lines
Regards, Sudeep
PATCH v2 5/7 coresight: tmc: Move ACPI support from AMBA driver to platform driver
In reply to Anshuman KhandualAdd support for the tmc devices in the platform driver, which can then be used on ACPI based platforms. This change would now allow runtime power management for ACPI based systems. The driver would try to enable the APB clock if available.
--- drivers/acpi/arm64/amba.c | 2 - .../hwtracing/coresight/coresight-tmc-core.c | 130 +++++++++++++++--- drivers/hwtracing/coresight/coresight-tmc.h | 1 + 3 files changed, 115 insertions(+), 18 deletions(-)
drivers/acpi/arm64/amba.c +0 -2
@@ -22,10 +22,8 @@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 */ - {"ARMHC97C" ,0 },/* ARM CoreSight SoC-400 TMC, SoC-600 ETF/ETB */ {"" ,0 }, };
drivers/hwtracing/coresight/coresight-tmc-core.c +114 -16
192 lines not on this page · raw message
drivers/hwtracing/coresight/coresight-tmc.h +1 -0
@@ -189,6 +189,7 @@ 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;
Signature · 1 line
2.25.1
Re: [PATCH V2 5/7] coresight: tmc: Move ACPI support from AMBA driver to platform driver
Quoted 7 lines · Anshuman Khandual
Add support for the tmc devices in the platform driver, which can then be used on ACPI based platforms. This change would now allow runtime power management for ACPI based systems. The driver would try to enable the APB clock if available.
Cc Lorenzo Pieralisi <[email protected]>Cc Sudeep Holla <[email protected]>
Signature · 2 lines
Regards, Sudeep
Re: [PATCH V2 5/7] coresight: tmc: Move ACPI support from AMBA driver to platform driver
In reply to Anshuman KhandualQuoted 21 lines · Anshuman Khandual
Add support for the tmc devices in the platform driver, which can then be used on ACPI based platforms. This change would now allow runtime power management for ACPI based systems. The driver would try to enable the APB clock if available.
Cc Lorenzo Pieralisi <[email protected]>Cc Sudeep Holla <[email protected]>Cc Suzuki K Poulose <[email protected]>Cc Mike Leach <[email protected]>Cc James Clark <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>--- drivers/acpi/arm64/amba.c | 2 - .../hwtracing/coresight/coresight-tmc-core.c | 130 +++++++++++++++--- drivers/hwtracing/coresight/coresight-tmc.h | 1 + 3 files changed, 115 insertions(+), 18 deletions(-)
[...]
Quoted 32 lines
drivers/hwtracing/coresight/coresight-tmc-core.c +3
-11-static int tmc_probe (struct amba_device *adev,const struct amba_id *id) +static int __tmc_probe (struct device *dev,struct resource *res,void *dev_caps) {int ret =0 ;u32 devid;void __iomem *base; -struct device *dev = &adev->dev;struct coresight_platform_data *pdata =NULL ; -struct tmc_drvdata *drvdata; -struct resource *res = &adev->res; +struct tmc_drvdata *drvdata =dev_get_drvdata (dev);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);@@ -487,8 +482,7 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) desc.type =CORESIGHT_DEV_TYPE_SINK ; desc.subtype.sink_subtype =CORESIGHT_DEV_SUBTYPE_SINK_SYSMEM ; desc.ops = &tmc_etr_cs_ops; - ret =tmc_etr_setup_caps (dev, devid, -coresight_get_uci_data (id)); + ret =tmc_etr_setup_caps (dev, devid, dev_caps);if (ret) goto out;
[...]
Quoted 11 lines
drivers/hwtracing/coresight/coresight-tmc-core.c +10
-1-module_amba_driver (tmc_driver); +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 ; +
drivers/hwtracing/coresight/coresight-tmc-core.c static struct amba_driver tmc_driver = { · line 633
Quoted 10 lines
drivers/hwtracing/coresight/coresight-tmc-core.c +10
-0+ 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,NULL );
What effect does passing NULL here have? It seems like the dev_caps did something useful when it's set to CORESIGHT_SOC_600_ETR_CAPS. Maybe Suzuki knows as he added it?
Suzuki K Poulose
maintainerRe: [PATCH V2 5/7] coresight: tmc: Move ACPI support from AMBA driver to platform driver
Quoted 75 lines · James Clark
Quoted 21 lines · Anshuman Khandual
Add support for the tmc devices in the platform driver, which can then be used on ACPI based platforms. This change would now allow runtime power management for ACPI based systems. The driver would try to enable the APB clock if available.
Cc Lorenzo Pieralisi <[email protected]>Cc Sudeep Holla <[email protected]>Cc Suzuki K Poulose <[email protected]>Cc Mike Leach <[email protected]>Cc James Clark <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>--- drivers/acpi/arm64/amba.c | 2 - .../hwtracing/coresight/coresight-tmc-core.c | 130 +++++++++++++++--- drivers/hwtracing/coresight/coresight-tmc.h | 1 + 3 files changed, 115 insertions(+), 18 deletions(-)[...]
Quoted 32 lines
drivers/hwtracing/coresight/coresight-tmc-core.c +3
-11-static int tmc_probe (struct amba_device *adev,const struct amba_id *id) +static int __tmc_probe (struct device *dev,struct resource *res,void *dev_caps) {int ret =0 ;u32 devid;void __iomem *base; -struct device *dev = &adev->dev;struct coresight_platform_data *pdata =NULL ; -struct tmc_drvdata *drvdata; -struct resource *res = &adev->res; +struct tmc_drvdata *drvdata =dev_get_drvdata (dev);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);@@ -487,8 +482,7 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) desc.type =CORESIGHT_DEV_TYPE_SINK ; desc.subtype.sink_subtype =CORESIGHT_DEV_SUBTYPE_SINK_SYSMEM ; desc.ops = &tmc_etr_cs_ops; - ret =tmc_etr_setup_caps (dev, devid, -coresight_get_uci_data (id)); + ret =tmc_etr_setup_caps (dev, devid, dev_caps);if (ret) goto out;[...]
Quoted 17 lines
drivers/hwtracing/coresight/coresight-tmc-core.c +16
-1-module_amba_driver (tmc_driver); +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);
Quoted 8 lines
drivers/hwtracing/coresight/coresight-tmc-core.c static struct amba_driver tmc_driver = { · line 633
Quoted 4 lines
drivers/hwtracing/coresight/coresight-tmc-core.c +4
-0+pm_runtime_set_active (&pdev->dev); +pm_runtime_enable (&pdev->dev); + + ret =__tmc_probe (&pdev->dev, res,NULL );What effect does passing NULL here have? It seems like the
dev_capsdid something useful when it's set toCORESIGHT_SOC_600_ETR_CAPS. Maybe Suzuki knows as he added it?
That was supposed to initialise the capabilities of the TMC-ETR, which are not discoverable by ID registers. (e.g., SAVE restore of RRP/RWP). I guess, we could get rid of that cap and use the "PID" register match to figure out the capabilities.
Suzuki
Re: [PATCH V2 5/7] coresight: tmc: Move ACPI support from AMBA driver to platform driver
In reply to Anshuman KhandualQuoted 5 lines · Anshuman Khandual
Add support for the tmc devices in the platform driver, which can then be used on ACPI based platforms. This change would now allow runtime power management for ACPI based systems. The driver would try to enable the APB clock if available.
[...]
Quoted 15 lines
drivers/hwtracing/coresight/coresight-tmc-core.c +14
-1-module_amba_driver (tmc_driver); +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 ; +
drivers/hwtracing/coresight/coresight-tmc-core.c static struct amba_driver tmc_driver = { · line 637
Quoted 10 lines
drivers/hwtracing/coresight/coresight-tmc-core.c +10
-0+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,NULL ); +if (ret) { +pm_runtime_put_noidle (&pdev->dev); +pm_runtime_disable (&pdev->dev); + }
I'm not sure if these pm_runtime()s are right because there is already a put inside of __tmc_probe() if it fails. If you unload and then reload all the coresight modules with these patches you get these errors which are new:
coresight-tpiu-platform ARMHC979:00: Unbalanced pm_runtime_enable! CSCFG registered etm0
coresight etm0: CPU0: etm v4.2 initialized
CSCFG registered etm1
coresight etm1: CPU1: etm v4.2 initialized
CSCFG registered etm2
coresight etm2: CPU2: etm v4.2 initialized
CSCFG registered etm3
coresight etm3: CPU3: etm v4.2 initialized coresight-tmc-platform ARMHC97C:00: Unbalanced pm_runtime_enable! coresight-tmc-platform ARMHC97C:01: Unbalanced pm_runtime_enable! coresight-tmc-platform ARMHC97C:02: Unbalanced pm_runtime_enable! coresight-tmc-platform ARMHC97C:03: Unbalanced pm_runtime_enable!
It might be worth testing all of these pm_runtime()s, including the error case ones, because loading and unloading the modules doesn't even include the error scenarios, so there are probably more bad ones in there too.
Re: [PATCH V2 5/7] coresight: tmc: Move ACPI support from AMBA driver to platform driver
Quoted 31 lines · James Clark
Quoted 5 lines · Anshuman Khandual
Add support for the tmc devices in the platform driver, which can then be used on ACPI based platforms. This change would now allow runtime power management for ACPI based systems. The driver would try to enable the APB clock if available.
[...]
Quoted 22 lines
drivers/hwtracing/coresight/coresight-tmc-core.c +21
-1-module_amba_driver (tmc_driver); +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,NULL ); +if (ret) {
Quoted 9 lines
drivers/hwtracing/coresight/coresight-tmc-core.c static struct amba_driver tmc_driver = { · line 637
Quoted 3 lines
drivers/hwtracing/coresight/coresight-tmc-core.c +3
-0+pm_runtime_put_noidle (&pdev->dev); +pm_runtime_disable (&pdev->dev); + }I'm not sure if these pm_runtime()s are right because there is already a put inside of
__tmc_probe()if it fails. If you unload and then reload all the coresight modules with these patches you get these errors which are new:
Ah good find. I have just tested with ACPI and these modules as built-in to be more specific.
--
Regards,
Sudeep
Re: [PATCH V2 5/7] coresight: tmc: Move ACPI support from AMBA driver to platform driver
In reply to James ClarkQuoted 29 lines · James Clark
Quoted 5 lines · Anshuman Khandual
Add support for the tmc devices in the platform driver, which can then be used on ACPI based platforms. This change would now allow runtime power management for ACPI based systems. The driver would try to enable the APB clock if available.
[...]
Quoted 20 lines
drivers/hwtracing/coresight/coresight-tmc-core.c +19
-1-module_amba_driver (tmc_driver); +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); +
Quoted 8 lines
drivers/hwtracing/coresight/coresight-tmc-core.c static struct amba_driver tmc_driver = { · line 637
Quoted 5 lines
drivers/hwtracing/coresight/coresight-tmc-core.c +5
-0+ ret =__tmc_probe (&pdev->dev, res,NULL ); +if (ret) { +pm_runtime_put_noidle (&pdev->dev); +pm_runtime_disable (&pdev->dev); + }I'm not sure if these pm_runtime()s are right because there is already a put inside of
__tmc_probe()if it fails. If you unload and then reload
Actually there is a pm_runtime_put() on the success path, not when it fails. So pm_runtime_put() gets called when __tmc_probe() returns 0.
__tmc_probe()
{
....
ret = misc_register(&drvdata->miscdev);
if (ret)
coresight_unregister(drvdata->csdev);
else
pm_runtime_put(dev);
out:
return ret;
}tmc_platform_probe()
{
....
pm_runtime_get_noresume(&pdev->dev);
pm_runtime_set_active(&pdev->dev);
pm_runtime_enable(&pdev->dev);
ret = __tmc_probe(&pdev->dev, res, NULL);
if (ret) {
pm_runtime_put_noidle(&pdev->dev);
pm_runtime_disable(&pdev->dev);
}
return ret;
}tmc_probe()
{
....
return __tmc_probe(&adev->dev, &adev->res, coresight_get_uci_data(id));
}Currently pm_runtime_put() gets called
- In success path both for AMBA and platform drivers
- In error path only for platform driver
Although the problem might be with pm_runtime_disable() instead
- pm_runtime_disable() is not required in the platform driver probe() path
- But might be required in tmc_platform_remove() along with a clk_put()
Quoted 4 lines
all the coresight modules with these patches you get these errors which are new:
coresight-tpiu-platform ARMHC979:00: Unbalanced
pm_runtime_enable!
The code is similar in TPIU platform driver as well.
Quoted 13 lines
CSCFG registered etm0
coresight etm0: CPU0: etm v4.2 initialized
CSCFG registered etm1
coresight etm1: CPU1: etm v4.2 initialized
CSCFG registered etm2
coresight etm2: CPU2: etm v4.2 initialized
CSCFG registered etm3
coresight etm3: CPU3: etm v4.2 initialized coresight-tmc-platform ARMHC97C:00: Unbalancedpm_runtime_enable! coresight-tmc-platform ARMHC97C:01: Unbalancedpm_runtime_enable! coresight-tmc-platform ARMHC97C:02: Unbalancedpm_runtime_enable! coresight-tmc-platform ARMHC97C:03: Unbalancedpm_runtime_enable!
Quoted 4 lines
It might be worth testing all of these pm_runtime()s, including the error case ones, because loading and unloading the modules doesn't even include the error scenarios, so there are probably more bad ones in there too.
The code is very similar in CATU, STM as well but debug_platform_remove() seems to be doing this right.
I am not very familiar with all the power management aspects in coresight, please do let me know if I missing something here.
PATCH v2 6/7 coresight: stm: Move ACPI support from AMBA driver to platform driver
In reply to Anshuman KhandualAdd support for the stm devices in the platform driver, which can then be used on ACPI based platforms. This change would now allow runtime power management for ACPI based systems. The driver would try to enable the APB clock if available.
--- drivers/acpi/arm64/amba.c | 1 - drivers/hwtracing/coresight/coresight-stm.c | 91 ++++++++++++++++++--- 2 files changed, 81 insertions(+), 11 deletions(-)
drivers/acpi/arm64/amba.c +0 -1
@@ -22,7 +22,6 @@static const struct acpi_device_id amba_id_list[] = { {"ARMH0061" ,0 },/* PL061 GPIO Device */ {"ARMH0330" ,0 },/* ARM DMA Controller DMA-330 */ - {"ARMHC502" ,0 },/* ARM CoreSight STM */ {"ARMHC503" ,0 },/* ARM CoreSight Debug */ {"" ,0 }, };
drivers/hwtracing/coresight/coresight-stm.c +81 -10
170 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH V2 6/7] coresight: stm: Move ACPI support from AMBA driver to platform driver
Quoted 7 lines · Anshuman Khandual
Add support for the stm devices in the platform driver, which can then be used on ACPI based platforms. This change would now allow runtime power management for ACPI based systems. The driver would try to enable the APB clock if available.
Cc Lorenzo Pieralisi <[email protected]>Cc Sudeep Holla <[email protected]>
Signature · 2 lines
Regards, Sudeep
Re: [PATCH V2 6/7] coresight: stm: Move ACPI support from AMBA driver to platform driver
In reply to Anshuman KhandualQuoted 19 lines · Anshuman Khandual
Add support for the stm devices in the platform driver, which can then be used on ACPI based platforms. This change would now allow runtime power management for ACPI based systems. The driver would try to enable the APB clock if available.
Cc Lorenzo Pieralisi <[email protected]>Cc Sudeep Holla <[email protected]>Cc Suzuki K Poulose <[email protected]>Cc Mike Leach <[email protected]>Cc James Clark <[email protected]>Cc Maxime Coquelin <[email protected]>Cc Alexandre Torgue <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>---
[...]
drivers/hwtracing/coresight/coresight-stm.c static struct amba_driver stm_driver = { · line 998
Quoted 12 lines
drivers/hwtracing/coresight/coresight-stm.c +10
-1-module_amba_driver (stm_driver); +static int stm_platform_probe (struct platform_device *pdev) +{ +struct resource *res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +int ret =0 ; + +pm_runtime_get_noresume (&pdev->dev); +pm_runtime_set_active (&pdev->dev); +pm_runtime_enable (&pdev->dev); + + ret =__stm_probe (&pdev->dev, res,NULL );
Very minor nit, but this used to print this:
coresight stm0: STM500 initialized
And now it prints this:
coresight stm0: (null) initialized
(null) kind of makes it look a little bit like something has gone wrong. Maybe we could just put "initialised" if you don't have a string from ACPI?
Re: [PATCH V2 6/7] coresight: stm: Move ACPI support from AMBA driver to platform driver
Quoted 38 lines · James Clark
Quoted 19 lines · Anshuman Khandual
Add support for the stm devices in the platform driver, which can then be used on ACPI based platforms. This change would now allow runtime power management for ACPI based systems. The driver would try to enable the APB clock if available.
Cc Lorenzo Pieralisi <[email protected]>Cc Sudeep Holla <[email protected]>Cc Suzuki K Poulose <[email protected]>Cc Mike Leach <[email protected]>Cc James Clark <[email protected]>Cc Maxime Coquelin <[email protected]>Cc Alexandre Torgue <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>---
[...]
drivers/hwtracing/coresight/coresight-stm.c static struct amba_driver stm_driver = { · line 998
Quoted 12 lines
drivers/hwtracing/coresight/coresight-stm.c +10
-1-module_amba_driver (stm_driver); +static int stm_platform_probe (struct platform_device *pdev) +{ +struct resource *res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +int ret =0 ; + +pm_runtime_get_noresume (&pdev->dev); +pm_runtime_set_active (&pdev->dev); +pm_runtime_enable (&pdev->dev); + + ret =__stm_probe (&pdev->dev, res,NULL );Very minor nit, but this used to print this:
Quoted 8 lines
coresight stm0: STM500 initialized
And now it prints this:
coresight stm0: (null) initialized
(null) kind of makes it look a little bit like something has gone wrong. Maybe we could just put "initialised" if you don't have a string from ACPI?
__stm_probe() gets called from both AMBA and platform driver paths. Even though a NULL check inside dev_info(..."%s initialized\n",...) could be added, but how to differentiate it from a scenario when coresight_get_uci_data() returns NULL ?
Re: [PATCH V2 6/7] coresight: stm: Move ACPI support from AMBA driver to platform driver
Quoted 45 lines · Anshuman Khandual
Quoted 42 lines · James Clark
Quoted 19 lines · Anshuman Khandual
Add support for the stm devices in the platform driver, which can then be used on ACPI based platforms. This change would now allow runtime power management for ACPI based systems. The driver would try to enable the APB clock if available.
Cc Lorenzo Pieralisi <[email protected]>Cc Sudeep Holla <[email protected]>Cc Suzuki K Poulose <[email protected]>Cc Mike Leach <[email protected]>Cc James Clark <[email protected]>Cc Maxime Coquelin <[email protected]>Cc Alexandre Torgue <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>---
[...]
drivers/hwtracing/coresight/coresight-stm.c static struct amba_driver stm_driver = { · line 998
Quoted 12 lines
drivers/hwtracing/coresight/coresight-stm.c +10
-1-module_amba_driver (stm_driver); +static int stm_platform_probe (struct platform_device *pdev) +{ +struct resource *res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +int ret =0 ; + +pm_runtime_get_noresume (&pdev->dev); +pm_runtime_set_active (&pdev->dev); +pm_runtime_enable (&pdev->dev); + + ret =__stm_probe (&pdev->dev, res,NULL );Very minor nit, but this used to print this:
coresight stm0: STM500 initialized
And now it prints this:
Quoted 8 lines
Quoted 4 lines
coresight stm0: (null) initialized
(null) kind of makes it look a little bit like something has gone wrong. Maybe we could just put "initialised" if you don't have a string from ACPI?
__stm_probe()gets called from both AMBA and platform driver paths. Even though a NULL check insidedev_info(..."%s initialized\n",...)could be added, but how to differentiate it from a scenario whencoresight_get_uci_data()returns NULL ?
Sudeep's suggestion seems ok, just add a hard coded string instead of the NULL. And keep the coresight_get_uci_data() the same.
Re: [PATCH V2 6/7] coresight: stm: Move ACPI support from AMBA driver to platform driver
Quoted 53 lines · James Clark
Quoted 50 lines · Anshuman Khandual
Quoted 46 lines · James Clark
Quoted 19 lines · Anshuman Khandual
Add support for the stm devices in the platform driver, which can then be used on ACPI based platforms. This change would now allow runtime power management for ACPI based systems. The driver would try to enable the APB clock if available.
Cc Lorenzo Pieralisi <[email protected]>Cc Sudeep Holla <[email protected]>Cc Suzuki K Poulose <[email protected]>Cc Mike Leach <[email protected]>Cc James Clark <[email protected]>Cc Maxime Coquelin <[email protected]>Cc Alexandre Torgue <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>---
[...]
Review
Quoted 12 lines
(quoted diff) +10
-1-module_amba_driver(stm_driver); +static int stm_platform_probe(struct platform_device *pdev) +{ + struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + int ret = 0; + + pm_runtime_get_noresume(&pdev->dev); + pm_runtime_set_active(&pdev->dev); + pm_runtime_enable(&pdev->dev); + + ret = __stm_probe(&pdev->dev, res, NULL);Very minor nit, but this used to print this:
coresight stm0: STM500 initialized
And now it prints this:
coresight stm0: (null) initialized
(null) kind of makes it look a little bit like something has gone wrong. Maybe we could just put "initialised" if you don't have a string from ACPI?
Quoted 6 lines
Quoted 3 lines
__stm_probe()gets called from both AMBA and platform driver paths. Even though a NULL check insidedev_info(..."%s initialized\n",...)could be added, but how to differentiate it from a scenario whencoresight_get_uci_data()returns NULL ?Sudeep's suggestion seems ok, just add a hard coded string instead of the NULL. And keep the
coresight_get_uci_data()the same.
Something like this works ?
drivers/hwtracing/coresight/coresight-stm.c +1 -1
@@ -906,7 +906,7 @@ static int __stm_probe(struct device *dev, struct resource *res, void *dev_caps)pm_runtime_put (dev);dev_info (&drvdata->csdev->dev,"%s initialized\n" , - (char *)dev_caps); + dev_caps ? (char *)dev_caps:"STM" );return 0 ; cs_unregister:
Re: [PATCH V2 6/7] coresight: stm: Move ACPI support from AMBA driver to platform driver
Quoted 7 lines · Anshuman Khandual
Something like this works ?
drivers/hwtracing/coresight/coresight-stm.c +0
-0
drivers/hwtracing/coresight/coresight-stm.c static int __stm_probe(struct device *dev, struct resource *res, void *dev_caps) · line 912
Quoted 8 lines
drivers/hwtracing/coresight/coresight-stm.c +1
-1@@ -906,7 +906,7 @@ static int __stm_probe(struct device *dev, struct resource *res, void *dev_caps)pm_runtime_put (dev);dev_info (&drvdata->csdev->dev,"%s initialized\n" , - (char *)dev_caps); + dev_caps ? (char *)dev_caps:"STM" );return 0 ; cs_unregister:
Yes, looks good to me.
Signature · 2 lines
Regards, Sudeep
Suzuki K Poulose
maintainerRe: [PATCH V2 6/7] coresight: stm: Move ACPI support from AMBA driver to platform driver
In reply to Anshuman KhandualQuoted 70 lines · Anshuman Khandual
Quoted 53 lines · James Clark
Quoted 50 lines · Anshuman Khandual
Quoted 46 lines · James Clark
Quoted 19 lines · Anshuman Khandual
Add support for the stm devices in the platform driver, which can then be used on ACPI based platforms. This change would now allow runtime power management for ACPI based systems. The driver would try to enable the APB clock if available.
Cc Lorenzo Pieralisi <[email protected]>Cc Sudeep Holla <[email protected]>Cc Suzuki K Poulose <[email protected]>Cc Mike Leach <[email protected]>Cc James Clark <[email protected]>Cc Maxime Coquelin <[email protected]>Cc Alexandre Torgue <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>---
[...]
Review
Quoted 12 lines
(quoted diff) +10
-1-module_amba_driver(stm_driver); +static int stm_platform_probe(struct platform_device *pdev) +{ + struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + int ret = 0; + + pm_runtime_get_noresume(&pdev->dev); + pm_runtime_set_active(&pdev->dev); + pm_runtime_enable(&pdev->dev); + + ret = __stm_probe(&pdev->dev, res, NULL);Very minor nit, but this used to print this:
coresight stm0: STM500 initialized
And now it prints this:
coresight stm0: (null) initialized
(null) kind of makes it look a little bit like something has gone wrong. Maybe we could just put "initialised" if you don't have a string from ACPI?
Quoted 6 lines
Quoted 3 lines
__stm_probe()gets called from both AMBA and platform driver paths. Even though a NULL check insidedev_info(..."%s initialized\n",...)could be added, but how to differentiate it from a scenario whencoresight_get_uci_data()returns NULL ?Sudeep's suggestion seems ok, just add a hard coded string instead of the NULL. And keep the
coresight_get_uci_data()the same.Something like this works ?
drivers/hwtracing/coresight/coresight-stm.c +0
-0
drivers/hwtracing/coresight/coresight-stm.c static int __stm_probe(struct device *dev, struct resource *res, void *dev_caps) · line 911
Quoted 7 lines
drivers/hwtracing/coresight/coresight-stm.c +1
-1@@ -906,7 +906,7 @@ static int __stm_probe(struct device *dev, struct resource *res, void *dev_caps)pm_runtime_put (dev);dev_info (&drvdata->csdev->dev,"%s initialized\n" , - (char *)dev_caps); + dev_caps ? (char *)dev_caps:"STM" );return 0 ;
Please could stop abusing the private data for storing the name ? Instead, we could read the PID of the device and use a table to map it to the name and use that instead ?
Suzuki
Quoted 2 lines
drivers/hwtracing/coresight/coresight-stm.c +0
-0cs_unregister:
Re: [PATCH V2 6/7] coresight: stm: Move ACPI support from AMBA driver to platform driver
In reply to James ClarkQuoted 37 lines · James Clark
Quoted 19 lines · Anshuman Khandual
Add support for the stm devices in the platform driver, which can then be used on ACPI based platforms. This change would now allow runtime power management for ACPI based systems. The driver would try to enable the APB clock if available.
Cc Lorenzo Pieralisi <[email protected]>Cc Sudeep Holla <[email protected]>Cc Suzuki K Poulose <[email protected]>Cc Mike Leach <[email protected]>Cc James Clark <[email protected]>Cc Maxime Coquelin <[email protected]>Cc Alexandre Torgue <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>---
[...]
drivers/hwtracing/coresight/coresight-stm.c static struct amba_driver stm_driver = { · line 998
Quoted 12 lines
drivers/hwtracing/coresight/coresight-stm.c +10
-1-module_amba_driver (stm_driver); +static int stm_platform_probe (struct platform_device *pdev) +{ +struct resource *res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +int ret =0 ; + +pm_runtime_get_noresume (&pdev->dev); +pm_runtime_set_active (&pdev->dev); +pm_runtime_enable (&pdev->dev); + + ret =__stm_probe (&pdev->dev, res,NULL );Very minor nit, but this used to print this:
Quoted 8 lines
coresight stm0: STM500 initialized
And now it prints this:
coresight stm0: (null) initialized
(null) kind of makes it look a little bit like something has gone wrong. Maybe we could just put "initialised" if you don't have a string from ACPI?
Ah right, I too noticed this and forgot to mention. Just add a generic "STM" string for ACPI if we don't have a way to identify exact IP ?
--
Regards,
Sudeep
PATCH v2 7/7 coresight: debug: Move ACPI support from AMBA driver to platform driver
In reply to Anshuman KhandualAdd support for the cpu debug devices in a new platform driver, which can then be used on ACPI based platforms. This change would now allow runtime power management for ACPI based systems. The driver would try to enable the APB clock if available.
--- drivers/acpi/arm64/amba.c | 1 - .../hwtracing/coresight/coresight-cpu-debug.c | 141 ++++++++++++++++-- 2 files changed, 127 insertions(+), 15 deletions(-)
drivers/acpi/arm64/amba.c +0 -1
@@ -22,7 +22,6 @@static const struct acpi_device_id amba_id_list[] = { {"ARMH0061" ,0 },/* PL061 GPIO Device */ {"ARMH0330" ,0 },/* ARM DMA Controller DMA-330 */ - {"ARMHC503" ,0 },/* ARM CoreSight Debug */ {"" ,0 }, };
drivers/hwtracing/coresight/coresight-cpu-debug.c +127 -14
188 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH V2 7/7] coresight: debug: Move ACPI support from AMBA driver to platform driver
Quoted 7 lines · Anshuman Khandual
Add support for the cpu debug devices in a new platform driver, which can then be used on ACPI based platforms. This change would now allow runtime power management for ACPI based systems. The driver would try to enable the APB clock if available.
Cc Lorenzo Pieralisi <[email protected]>Cc Sudeep Holla <[email protected]>
Signature · 2 lines
Regards, Sudeep