Skip to contentSkip to conversation

coresight: Move remaining AMBA ACPI devices into platform driver

RFC In review Anshuman Khandual 2 participants 10 messages Sep 21, 2023 – Sep 22, 2023

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

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 might still require some further changes but presented here just for some initial review & feedback.

This series applies on coresight/next coresight/for-next/queue and has been built tested. This series has also been boot tested on a DT based coresight device latform. Although it still requires testing on ACPI platforms.

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  | 136 ++++++++++++++++--
 drivers/hwtracing/coresight/coresight-catu.h  |   1 +
 .../hwtracing/coresight/coresight-cpu-debug.c | 130 +++++++++++++++--
 .../hwtracing/coresight/coresight-funnel.c    |  49 ++++---
 .../coresight/coresight-replicator.c          |  44 +++---
 drivers/hwtracing/coresight/coresight-stm.c   |  80 +++++++++--
 .../hwtracing/coresight/coresight-tmc-core.c  | 127 ++++++++++++++--
 drivers/hwtracing/coresight/coresight-tmc.h   |   1 +
 drivers/hwtracing/coresight/coresight-tpiu.c  |  76 +++++++++-
 10 files changed, 549 insertions(+), 103 deletions(-)
Signature · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#1 lore raw

RFC 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
index 60be8ee1dbdc..ac59ce50de07 100644
@@ -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 · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer
#2 lore raw

Re: [RFC RESEND 1/7] coresight: replicator: Move ACPI support from AMBA driver to platform driver

Quoted 79 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.

---
  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
index 60be8ee1dbdc..ac59ce50de07 100644
@@ -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 +9 -4
index b6be73034996..a18d5e8fcba1 100644
@@ -38,6 +38,7 @@ DEFINE_CORESIGHT_DEVLIST(replicator_devs, "replicator");
  struct replicator_drvdata {
  	void __iomem		*base;
  	struct clk		*atclk;
+	struct clk		*pclk;
  	struct coresight_device	*csdev;
  	spinlock_t		spinlock;
  	bool			check_idfilter_val;
@@ -243,6 +244,10 @@ static int replicator_probe(struct device *dev, struct resource *res)
  			return ret;
  	}
 
+	drvdata->pclk = coresight_get_enable_apb_pclk(dev);
+	if (IS_ERR(drvdata->pclk))
+		return -ENODEV;
+
  	/*
  	 * Map the device base for dynamic-replicator, which has been
  	 * validated by AMBA core
@@ -301,16 +306,16 @@ static int replicator_remove(struct device *dev)
  	return 0;
  }
 
-static int static_replicator_probe(struct platform_device *pdev)
+static int replicator_platform_probe(struct platform_device *pdev)
  {
+	struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  	int ret;
 
  	pm_runtime_get_noresume(&pdev->dev);
  	pm_runtime_set_active(&pdev->dev);
  	pm_runtime_enable(&pdev->dev);
 
-	/* Static replicators do not have programming base */
-	ret = replicator_probe(&pdev->dev, NULL);
+	ret = replicator_probe(&pdev->dev, res);
 
  	if (ret) {
  		pm_runtime_put_noidle(&pdev->dev);
@@ -320,7 +325,7 @@ static int static_replicator_probe(struct platform_device *pdev)
  	return ret;
  }
 
-static int static_replicator_remove(struct platform_device *pdev)
+static int replicator_platform_remove(struct platform_device *pdev)
  {
  	replicator_remove(&pdev->dev);
  	pm_runtime_disable(&pdev->dev);

drivers/hwtracing/coresight/coresight-replicator.c static int replicator_runtime_suspend(struct device *dev) · line 343

Quoted 4 lines
drivers/hwtracing/coresight/coresight-replicator.c +1 -0
@@ -335,6 +340,8 @@ static int replicator_runtime_suspend(struct device *dev)
  	if (drvdata && !IS_ERR(drvdata->atclk))
  		clk_disable_unprepare(drvdata->atclk);
 
+	if (drvdata && !IS_ERR(drvdata->pclk))

!IS_ERR_OR_NULL() ? If we don't have pclk, drvdata->pclk is always NULL

Same applies throughout the series.

Suzuki

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#3 lore raw

Re: [RFC RESEND 1/7] coresight: replicator: Move ACPI support from AMBA driver to platform driver

Quoted 71 lines · Suzuki K Poulose
Quoted 70 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.

---
  drivers/acpi/arm64/amba.c                     |  1 - .../coresight/coresight-replicator.c          | 44 ++++++++++++-------

  2 files changed, 27 insertions(+), 18 deletions(-)
drivers/acpi/arm64/amba.c +0 -0
index 60be8ee1dbdc..ac59ce50de07 100644
@@ -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 +6 -0
index b6be73034996..a18d5e8fcba1 100644
@@ -38,6 +38,7 @@ DEFINE_CORESIGHT_DEVLIST(replicator_devs, "replicator");
   struct replicator_drvdata {
       void __iomem        *base;
       struct clk        *atclk;
+    struct clk        *pclk;
       struct coresight_device    *csdev;
       spinlock_t        spinlock;
       bool            check_idfilter_val;
@@ -243,6 +244,10 @@ static int replicator_probe(struct device *dev, struct resource *res)
               return ret;
       }
   +    drvdata->pclk = coresight_get_enable_apb_pclk(dev);
+    if (IS_ERR(drvdata->pclk))
+        return -ENODEV;
+
       /*
        * Map the device base for dynamic-replicator, which has been
        * validated by AMBA core
@@ -301,16 +306,16 @@ static int replicator_remove(struct device *dev)
       return 0;
   }
   -static int static_replicator_probe(struct platform_device *pdev)
+static int replicator_platform_probe(struct platform_device *pdev)
   {
+    struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
       int ret;
         pm_runtime_get_noresume(&pdev->dev);
       pm_runtime_set_active(&pdev->dev);
       pm_runtime_enable(&pdev->dev);

  -    /* Static replicators do not have programming base */ -    ret = replicator_probe(&pdev->dev, NULL);
+    ret = replicator_probe(&pdev->dev, res);
        if (ret) { pm_runtime_put_noidle(&pdev->dev);

drivers/hwtracing/coresight/coresight-replicator.c +1 -0
@@ -320,7 +325,7 @@ static int static_replicator_probe(struct platform_device *pdev)
       return ret;
   }
   -static int static_replicator_remove(struct platform_device *pdev)
+static int replicator_platform_remove(struct platform_device *pdev)
   {
Quoted 8 lines

drivers/hwtracing/coresight/coresight-replicator.c static int replicator_runtime_suspend(struct device *dev) · line 342

Quoted 6 lines
drivers/hwtracing/coresight/coresight-replicator.c +0 -0
       replicator_remove(&pdev->dev);
       pm_runtime_disable(&pdev->dev);
@@ -335,6 +340,8 @@ static int replicator_runtime_suspend(struct device *dev)
       if (drvdata && !IS_ERR(drvdata->atclk))
           clk_disable_unprepare(drvdata->atclk);
   +    if (drvdata && !IS_ERR(drvdata->pclk))

!IS_ERR_OR_NULL() ? If we don't have pclk, drvdata->pclk is always NULL

Agreed, IS_ERR_OR_NULL() should be used instead.

Quoted 2 lines

Same applies throughout the series.

Updated suspend/resume callbacks in each driver to use IS_ERR_OR_NULL().

#4 lore raw

RFC 2/7 coresight: funnel: Move ACPI support from AMBA driver to platform driver

In reply to 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.

---
 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
index ac59ce50de07..18aa41d91729 100644
@@ -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 · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#5 lore raw

RFC 3/7 coresight: catu: Move ACPI support from AMBA driver to platform driver

In reply to 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.

---
 drivers/acpi/arm64/amba.c                    |   1 -
 drivers/hwtracing/coresight/coresight-catu.c | 136 +++++++++++++++++--
 drivers/hwtracing/coresight/coresight-catu.h |   1 +
 3 files changed, 122 insertions(+), 16 deletions(-)
drivers/acpi/arm64/amba.c +0 -1
index 18aa41d91729..56a7e020555b 100644
@@ -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 +121 -15

192 lines not on this page · raw message

drivers/hwtracing/coresight/coresight-catu.h +1 -0
index 442e034bbfba..141feac1c14b 100644
@@ -61,6 +61,7 @@
 #define CATU_IRQEN_OFF		0x0
 
 struct catu_drvdata {
+	struct clk *pclk;
 	void __iomem *base;
 	struct coresight_device *csdev;
 	int irq;
Signature · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#6 lore raw

RFC 4/7 coresight: tpiu: Move ACPI support from AMBA driver to platform driver

In reply to 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.

---
 drivers/acpi/arm64/amba.c                    |  1 -
 drivers/hwtracing/coresight/coresight-tpiu.c | 76 ++++++++++++++++++--
 2 files changed, 69 insertions(+), 8 deletions(-)
drivers/acpi/arm64/amba.c +0 -1
index 56a7e020555b..8e1783166c33 100644
@@ -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 +69 -7

145 lines not on this page · raw message

Signature · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#7 lore raw

RFC 5/7 coresight: tmc: Move ACPI support from AMBA driver to platform driver

In reply to 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.

---
 drivers/acpi/arm64/amba.c                     |   2 -
 .../hwtracing/coresight/coresight-tmc-core.c  | 127 +++++++++++++++---
 drivers/hwtracing/coresight/coresight-tmc.h   |   1 +
 3 files changed, 113 insertions(+), 17 deletions(-)
drivers/acpi/arm64/amba.c +0 -2
index 8e1783166c33..6980502b7868 100644
@@ -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 +112 -15

189 lines not on this page · raw message

drivers/hwtracing/coresight/coresight-tmc.h +1 -0
index 0ee48c5ba764..193af5959f2c 100644
@@ -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 · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#8 lore raw

RFC 6/7 coresight: stm: Move ACPI support from AMBA driver to platform driver

In reply to 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.

---
 drivers/acpi/arm64/amba.c                   |  1 -
 drivers/hwtracing/coresight/coresight-stm.c | 80 ++++++++++++++++++---
 2 files changed, 71 insertions(+), 10 deletions(-)
drivers/acpi/arm64/amba.c +0 -1
index 6980502b7868..ebc866518057 100644
@@ -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 +71 -9

159 lines not on this page · raw message

Signature · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#9 lore raw

RFC 7/7 coresight: debug: Move ACPI support from AMBA driver to platform driver

In reply to 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.

---
 drivers/acpi/arm64/amba.c                     |   1 -
 .../hwtracing/coresight/coresight-cpu-debug.c | 130 ++++++++++++++++--
 2 files changed, 117 insertions(+), 14 deletions(-)
drivers/acpi/arm64/amba.c +0 -1
index ebc866518057..b591c7a650aa 100644
@@ -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 +117 -13

177 lines not on this page · raw message

Signature · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel