All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: gregkh@linuxfoundation.org
Cc: saiprakash.ranjan@codeaurora.org, suzuki.poulose@arm.com,
	vulab@iscas.ac.cn, tingwei@codeaurora.org,
	andriy.shevchenko@linux.intel.com,
	linux-arm-kernel@lists.infradead.org, mike.leach@linaro.org
Subject: [PATCH 03/17] coresight: etm4x: Add support to skip trace unit power up
Date: Thu, 16 Jul 2020 11:57:32 -0600	[thread overview]
Message-ID: <20200716175746.3338735-4-mathieu.poirier@linaro.org> (raw)
In-Reply-To: <20200716175746.3338735-1-mathieu.poirier@linaro.org>

From: Tingwei Zhang <tingwei@codeaurora.org>

On some Qualcomm Technologies Inc. SoCs like SC7180, there
exists a hardware errata where the APSS (Application Processor
SubSystem)/CPU watchdog counter is stopped when the trace unit
power up ETM register is set (TRCPDCR.PU = 1). Since the ETMs
share the same power domain as that of respective CPU cores,
they are powered on when the CPU core is powered on. So we can
skip powering up of trace unit after checking for this errata
via new property called "qcom,skip-power-up".

Signed-off-by: Tingwei Zhang <tingwei@codeaurora.org>
Co-developed-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
Signed-off-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
 drivers/hwtracing/coresight/coresight-etm4x.c | 27 ++++++++++++-------
 drivers/hwtracing/coresight/coresight-etm4x.h |  3 +++
 2 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c
index 0c35cd5e0d1d..2290f41f0074 100644
--- a/drivers/hwtracing/coresight/coresight-etm4x.c
+++ b/drivers/hwtracing/coresight/coresight-etm4x.c
@@ -196,12 +196,14 @@ static int etm4_enable_hw(struct etmv4_drvdata *drvdata)
 	writel_relaxed(config->vmid_mask0, drvdata->base + TRCVMIDCCTLR0);
 	writel_relaxed(config->vmid_mask1, drvdata->base + TRCVMIDCCTLR1);
 
-	/*
-	 * Request to keep the trace unit powered and also
-	 * emulation of powerdown
-	 */
-	writel_relaxed(readl_relaxed(drvdata->base + TRCPDCR) | TRCPDCR_PU,
-		       drvdata->base + TRCPDCR);
+	if (!drvdata->skip_power_up) {
+		/*
+		 * Request to keep the trace unit powered and also
+		 * emulation of powerdown
+		 */
+		writel_relaxed(readl_relaxed(drvdata->base + TRCPDCR) |
+			       TRCPDCR_PU, drvdata->base + TRCPDCR);
+	}
 
 	/* Enable the trace unit */
 	writel_relaxed(1, drvdata->base + TRCPRGCTLR);
@@ -476,10 +478,12 @@ static void etm4_disable_hw(void *info)
 
 	CS_UNLOCK(drvdata->base);
 
-	/* power can be removed from the trace unit now */
-	control = readl_relaxed(drvdata->base + TRCPDCR);
-	control &= ~TRCPDCR_PU;
-	writel_relaxed(control, drvdata->base + TRCPDCR);
+	if (!drvdata->skip_power_up) {
+		/* power can be removed from the trace unit now */
+		control = readl_relaxed(drvdata->base + TRCPDCR);
+		control &= ~TRCPDCR_PU;
+		writel_relaxed(control, drvdata->base + TRCPDCR);
+	}
 
 	control = readl_relaxed(drvdata->base + TRCPRGCTLR);
 
@@ -1468,6 +1472,9 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id)
 			return -ENOMEM;
 	}
 
+	if (fwnode_property_present(dev_fwnode(dev), "qcom,skip-power-up"))
+		drvdata->skip_power_up = true;
+
 	/* Validity for the resource is already checked by the AMBA core */
 	base = devm_ioremap_resource(dev, res);
 	if (IS_ERR(base))
diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h
index 4a695bf90582..72c9a55e67df 100644
--- a/drivers/hwtracing/coresight/coresight-etm4x.h
+++ b/drivers/hwtracing/coresight/coresight-etm4x.h
@@ -407,6 +407,8 @@ struct etmv4_save_state {
  * @config:	structure holding configuration parameters.
  * @save_state:	State to be preserved across power loss
  * @state_needs_restore: True when there is context to restore after PM exit
+ * @skip_power_up: Indicates if an implementation can skip powering up
+ *		   the trace unit.
  */
 struct etmv4_drvdata {
 	void __iomem			*base;
@@ -454,6 +456,7 @@ struct etmv4_drvdata {
 	struct etmv4_config		config;
 	struct etmv4_save_state		*save_state;
 	bool				state_needs_restore;
+	bool				skip_power_up;
 };
 
 /* Address comparator access types */
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-07-16 17:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-16 17:57 [PATCH 00/17] coresight: next v5.8-rc5 Mathieu Poirier
2020-07-16 17:57 ` [PATCH 01/17] coresight: replicator: Use CS_AMBA_ID macro for id table Mathieu Poirier
2020-07-16 17:57 ` [PATCH 02/17] coresight: catu: " Mathieu Poirier
2020-07-16 17:57 ` Mathieu Poirier [this message]
2020-07-16 17:57 ` [PATCH 04/17] dt-bindings: arm: coresight: Add support to skip trace unit power up Mathieu Poirier
2020-07-16 17:57 ` [PATCH 05/17] coresight: replicator: Reset replicator if context is lost Mathieu Poirier
2020-07-16 17:57 ` [PATCH 06/17] dt-bindings: arm: coresight: Add optional property to replicators Mathieu Poirier
2020-07-16 17:57 ` [PATCH 07/17] coresight: Use devm_kcalloc() in coresight_alloc_conns() Mathieu Poirier
2020-07-16 17:57 ` [PATCH 08/17] coresight: Drop double check for ACPI companion device Mathieu Poirier
2020-07-16 17:57 ` [PATCH 09/17] coresight: etmv4: Fix resource selector constant Mathieu Poirier
2020-07-16 17:57 ` [PATCH 10/17] coresight: etmv4: Counter values not saved on disable Mathieu Poirier
2020-07-16 17:57 ` [PATCH 11/17] coresight: Fix comment in main header file Mathieu Poirier
2020-07-16 17:57 ` [PATCH 12/17] coresight: tmc: Add shutdown callback for TMC ETR Mathieu Poirier
2020-07-16 17:57 ` [PATCH 13/17] coresight: tmc: Fix TMC mode read in tmc_read_unprepare_etb() Mathieu Poirier
2020-07-16 17:57 ` [PATCH 14/17] coresight: Add default sink selection to CoreSight base Mathieu Poirier
2020-07-16 17:57 ` [PATCH 15/17] coresight: tmc: Update sink types for default selection Mathieu Poirier
2020-07-16 17:57 ` [PATCH 16/17] coresight: etm: perf: Add default sink selection to etm perf Mathieu Poirier
2020-07-16 17:57 ` [PATCH 17/17] coresight: etm4x: Fix save/restore during cpu idle Mathieu Poirier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200716175746.3338735-4-mathieu.poirier@linaro.org \
    --to=mathieu.poirier@linaro.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mike.leach@linaro.org \
    --cc=saiprakash.ranjan@codeaurora.org \
    --cc=suzuki.poulose@arm.com \
    --cc=tingwei@codeaurora.org \
    --cc=vulab@iscas.ac.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.