linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv3 0/2] Add support for replicators which loses context on clock removal
@ 2020-05-22 18:36 Sai Prakash Ranjan
  2020-05-22 18:36 ` [PATCHv3 1/2] coresight: replicator: Reset replicator if context is lost Sai Prakash Ranjan
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Sai Prakash Ranjan @ 2020-05-22 18:36 UTC (permalink / raw)
  To: Mathieu Poirier, Suzuki K Poulose, Mike Leach, devicetree, Rob Herring
  Cc: linux-arm-kernel, linux-kernel, linux-arm-msm, Stephen Boyd,
	Sai Prakash Ranjan

This series is mainly to add support for replicators
which lose context on removing AMBA clock like on SC7180
SoC where replicator in AOSS domain loses context.

v2 - https://lore.kernel.org/patchwork/cover/1244340/
More discussion is found here - https://lore.kernel.org/patchwork/patch/1231182/

Changes since v2:
 * Added DT maintainers which I missed in v2
 * Added proper kernel-doc and header as per Mathieu

Sai Prakash Ranjan (2):
  coresight: replicator: Reset replicator if context is lost
  dt-bindings: arm: coresight: Add optional property to replicators

 .../devicetree/bindings/arm/coresight.txt     |  6 ++
 .../coresight/coresight-replicator.c          | 55 +++++++++++++------
 2 files changed, 44 insertions(+), 17 deletions(-)

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCHv3 1/2] coresight: replicator: Reset replicator if context is lost
  2020-05-22 18:36 [PATCHv3 0/2] Add support for replicators which loses context on clock removal Sai Prakash Ranjan
@ 2020-05-22 18:36 ` Sai Prakash Ranjan
  2020-05-22 18:36 ` [PATCHv3 2/2] dt-bindings: arm: coresight: Add optional property to replicators Sai Prakash Ranjan
  2020-05-25 16:15 ` [PATCHv3 0/2] Add support for replicators which loses context on clock removal Mathieu Poirier
  2 siblings, 0 replies; 8+ messages in thread
From: Sai Prakash Ranjan @ 2020-05-22 18:36 UTC (permalink / raw)
  To: Mathieu Poirier, Suzuki K Poulose, Mike Leach, devicetree, Rob Herring
  Cc: linux-arm-kernel, linux-kernel, linux-arm-msm, Stephen Boyd,
	Sai Prakash Ranjan

On some QCOM SoCs, replicators in Always-On domain loses its
context as soon as the clock is disabled. Currently as a part
of pm_runtime workqueue, clock is disabled after the replicator
is initialized by amba_pm_runtime_suspend assuming that context
is not lost which is not true for replicators with such
limitations. So add a new property "qcom,replicator-loses-context"
to identify such replicators and reset them.

Suggested-by: Mike Leach <mike.leach@linaro.org>
Reviewed-by: Mike Leach <mike.leach@linaro.org>
Signed-off-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
---
 .../coresight/coresight-replicator.c          | 55 +++++++++++++------
 1 file changed, 38 insertions(+), 17 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c
index e7dc1c31d20d..9d3a8f915784 100644
--- a/drivers/hwtracing/coresight/coresight-replicator.c
+++ b/drivers/hwtracing/coresight/coresight-replicator.c
@@ -14,6 +14,7 @@
 #include <linux/err.h>
 #include <linux/slab.h>
 #include <linux/pm_runtime.h>
+#include <linux/property.h>
 #include <linux/clk.h>
 #include <linux/of.h>
 #include <linux/coresight.h>
@@ -32,12 +33,14 @@ DEFINE_CORESIGHT_DEVLIST(replicator_devs, "replicator");
  * @atclk:	optional clock for the core parts of the replicator.
  * @csdev:	component vitals needed by the framework
  * @spinlock:	serialize enable/disable operations.
+ * @check_idfilter_val: check if the context is lost upon clock removal.
  */
 struct replicator_drvdata {
 	void __iomem		*base;
 	struct clk		*atclk;
 	struct coresight_device	*csdev;
 	spinlock_t		spinlock;
+	bool			check_idfilter_val;
 };
 
 static void dynamic_replicator_reset(struct replicator_drvdata *drvdata)
@@ -66,29 +69,43 @@ static int dynamic_replicator_enable(struct replicator_drvdata *drvdata,
 				     int inport, int outport)
 {
 	int rc = 0;
-	u32 reg;
-
-	switch (outport) {
-	case 0:
-		reg = REPLICATOR_IDFILTER0;
-		break;
-	case 1:
-		reg = REPLICATOR_IDFILTER1;
-		break;
-	default:
-		WARN_ON(1);
-		return -EINVAL;
-	}
+	u32 id0val, id1val;
 
 	CS_UNLOCK(drvdata->base);
 
-	if ((readl_relaxed(drvdata->base + REPLICATOR_IDFILTER0) == 0xff) &&
-	    (readl_relaxed(drvdata->base + REPLICATOR_IDFILTER1) == 0xff))
+	id0val = readl_relaxed(drvdata->base + REPLICATOR_IDFILTER0);
+	id1val = readl_relaxed(drvdata->base + REPLICATOR_IDFILTER1);
+
+	/*
+	 * Some replicator designs lose context when AMBA clocks are removed,
+	 * so have a check for this.
+	 */
+	if (drvdata->check_idfilter_val && id0val == 0x0 && id1val == 0x0)
+		id0val = id1val = 0xff;
+
+	if (id0val == 0xff && id1val == 0xff)
 		rc = coresight_claim_device_unlocked(drvdata->base);
 
+	if (!rc) {
+		switch (outport) {
+		case 0:
+			id0val = 0x0;
+			break;
+		case 1:
+			id1val = 0x0;
+			break;
+		default:
+			WARN_ON(1);
+			rc = -EINVAL;
+		}
+	}
+
 	/* Ensure that the outport is enabled. */
-	if (!rc)
-		writel_relaxed(0x00, drvdata->base + reg);
+	if (!rc) {
+		writel_relaxed(id0val, drvdata->base + REPLICATOR_IDFILTER0);
+		writel_relaxed(id1val, drvdata->base + REPLICATOR_IDFILTER1);
+	}
+
 	CS_LOCK(drvdata->base);
 
 	return rc;
@@ -239,6 +256,10 @@ static int replicator_probe(struct device *dev, struct resource *res)
 		desc.groups = replicator_groups;
 	}
 
+	if (fwnode_property_present(dev_fwnode(dev),
+				    "qcom,replicator-loses-context"))
+		drvdata->check_idfilter_val = true;
+
 	dev_set_drvdata(dev, drvdata);
 
 	pdata = coresight_get_platform_data(dev);
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCHv3 2/2] dt-bindings: arm: coresight: Add optional property to replicators
  2020-05-22 18:36 [PATCHv3 0/2] Add support for replicators which loses context on clock removal Sai Prakash Ranjan
  2020-05-22 18:36 ` [PATCHv3 1/2] coresight: replicator: Reset replicator if context is lost Sai Prakash Ranjan
@ 2020-05-22 18:36 ` Sai Prakash Ranjan
  2020-05-25 16:01   ` Mathieu Poirier
  2020-05-25 16:15 ` [PATCHv3 0/2] Add support for replicators which loses context on clock removal Mathieu Poirier
  2 siblings, 1 reply; 8+ messages in thread
From: Sai Prakash Ranjan @ 2020-05-22 18:36 UTC (permalink / raw)
  To: Mathieu Poirier, Suzuki K Poulose, Mike Leach, devicetree, Rob Herring
  Cc: linux-arm-kernel, linux-kernel, linux-arm-msm, Stephen Boyd,
	Sai Prakash Ranjan

Add an optional boolean property "qcom,replicator-loses-context" to
identify replicators which loses context when AMBA clocks are removed
in certain configurable replicator designs.

Reviewed-by: Mike Leach <mike.leach@linaro.org>
Signed-off-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
---
 Documentation/devicetree/bindings/arm/coresight.txt | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/coresight.txt b/Documentation/devicetree/bindings/arm/coresight.txt
index 846f6daae71b..b598a5f0037d 100644
--- a/Documentation/devicetree/bindings/arm/coresight.txt
+++ b/Documentation/devicetree/bindings/arm/coresight.txt
@@ -121,6 +121,12 @@ its hardware characteristcs.
 	* interrupts : Exactly one SPI may be listed for reporting the address
 	  error
 
+* Optional property for configurable replicators:
+
+	* qcom,replicator-loses-context: boolean. Indicates that the replicator
+	  will lose register context when AMBA clock is removed which is observed
+	  in some replicator designs.
+
 Graph bindings for Coresight
 -------------------------------
 
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCHv3 2/2] dt-bindings: arm: coresight: Add optional property to replicators
  2020-05-22 18:36 ` [PATCHv3 2/2] dt-bindings: arm: coresight: Add optional property to replicators Sai Prakash Ranjan
@ 2020-05-25 16:01   ` Mathieu Poirier
  0 siblings, 0 replies; 8+ messages in thread
From: Mathieu Poirier @ 2020-05-25 16:01 UTC (permalink / raw)
  To: Sai Prakash Ranjan
  Cc: Suzuki K Poulose, Mike Leach, devicetree, Rob Herring,
	linux-arm-kernel, Linux Kernel Mailing List, linux-arm-msm,
	Stephen Boyd

On Fri, 22 May 2020 at 12:37, Sai Prakash Ranjan
<saiprakash.ranjan@codeaurora.org> wrote:
>
> Add an optional boolean property "qcom,replicator-loses-context" to
> identify replicators which loses context when AMBA clocks are removed
> in certain configurable replicator designs.
>
> Reviewed-by: Mike Leach <mike.leach@linaro.org>
> Signed-off-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
> ---
>  Documentation/devicetree/bindings/arm/coresight.txt | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/arm/coresight.txt b/Documentation/devicetree/bindings/arm/coresight.txt
> index 846f6daae71b..b598a5f0037d 100644
> --- a/Documentation/devicetree/bindings/arm/coresight.txt
> +++ b/Documentation/devicetree/bindings/arm/coresight.txt
> @@ -121,6 +121,12 @@ its hardware characteristcs.
>         * interrupts : Exactly one SPI may be listed for reporting the address
>           error
>
> +* Optional property for configurable replicators:
> +
> +       * qcom,replicator-loses-context: boolean. Indicates that the replicator
> +         will lose register context when AMBA clock is removed which is observed
> +         in some replicator designs.

Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>

> +
>  Graph bindings for Coresight
>  -------------------------------
>
> --
> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
> of Code Aurora Forum, hosted by The Linux Foundation
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCHv3 0/2] Add support for replicators which loses context on clock removal
  2020-05-22 18:36 [PATCHv3 0/2] Add support for replicators which loses context on clock removal Sai Prakash Ranjan
  2020-05-22 18:36 ` [PATCHv3 1/2] coresight: replicator: Reset replicator if context is lost Sai Prakash Ranjan
  2020-05-22 18:36 ` [PATCHv3 2/2] dt-bindings: arm: coresight: Add optional property to replicators Sai Prakash Ranjan
@ 2020-05-25 16:15 ` Mathieu Poirier
  2020-05-26  7:01   ` Sai Prakash Ranjan
  2020-05-28 14:48   ` Rob Herring
  2 siblings, 2 replies; 8+ messages in thread
From: Mathieu Poirier @ 2020-05-25 16:15 UTC (permalink / raw)
  To: Sai Prakash Ranjan
  Cc: Suzuki K Poulose, Mike Leach, devicetree, Rob Herring,
	linux-arm-kernel, linux-kernel, linux-arm-msm, Stephen Boyd

Hi Sai,

On Sat, May 23, 2020 at 12:06:50AM +0530, Sai Prakash Ranjan wrote:
> This series is mainly to add support for replicators
> which lose context on removing AMBA clock like on SC7180
> SoC where replicator in AOSS domain loses context.
> 

I am good with this set but need a reviewed-by on the DT binding before I can
add it to my tree.  The same goes for your other set[1].

Thanks,
Mathieu

[1]. "coresight: etm4x: Add support to skip trace unit power up"

> v2 - https://lore.kernel.org/patchwork/cover/1244340/
> More discussion is found here - https://lore.kernel.org/patchwork/patch/1231182/
> 
> Changes since v2:
>  * Added DT maintainers which I missed in v2
>  * Added proper kernel-doc and header as per Mathieu
> 
> Sai Prakash Ranjan (2):
>   coresight: replicator: Reset replicator if context is lost
>   dt-bindings: arm: coresight: Add optional property to replicators
> 
>  .../devicetree/bindings/arm/coresight.txt     |  6 ++
>  .../coresight/coresight-replicator.c          | 55 +++++++++++++------
>  2 files changed, 44 insertions(+), 17 deletions(-)
> 
> -- 
> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
> of Code Aurora Forum, hosted by The Linux Foundation
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCHv3 0/2] Add support for replicators which loses context on clock removal
  2020-05-25 16:15 ` [PATCHv3 0/2] Add support for replicators which loses context on clock removal Mathieu Poirier
@ 2020-05-26  7:01   ` Sai Prakash Ranjan
  2020-05-28 14:48   ` Rob Herring
  1 sibling, 0 replies; 8+ messages in thread
From: Sai Prakash Ranjan @ 2020-05-26  7:01 UTC (permalink / raw)
  To: Mathieu Poirier, devicetree, Rob Herring
  Cc: Suzuki K Poulose, Mike Leach, linux-arm-kernel, linux-kernel,
	linux-arm-msm, Stephen Boyd, devicetree-owner

Hi Mathieu,

On 2020-05-25 21:45, Mathieu Poirier wrote:
> Hi Sai,
> 
> On Sat, May 23, 2020 at 12:06:50AM +0530, Sai Prakash Ranjan wrote:
>> This series is mainly to add support for replicators
>> which lose context on removing AMBA clock like on SC7180
>> SoC where replicator in AOSS domain loses context.
>> 
> 
> I am good with this set but need a reviewed-by on the DT binding before 
> I can
> add it to my tree.  The same goes for your other set[1].
> 

Sure, let's wait for an ack from Rob and thanks for the reviews.

Thanks,
Sai

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a 
member
of Code Aurora Forum, hosted by The Linux Foundation

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCHv3 0/2] Add support for replicators which loses context on clock removal
  2020-05-25 16:15 ` [PATCHv3 0/2] Add support for replicators which loses context on clock removal Mathieu Poirier
  2020-05-26  7:01   ` Sai Prakash Ranjan
@ 2020-05-28 14:48   ` Rob Herring
  2020-05-28 17:40     ` Mathieu Poirier
  1 sibling, 1 reply; 8+ messages in thread
From: Rob Herring @ 2020-05-28 14:48 UTC (permalink / raw)
  To: Mathieu Poirier
  Cc: Sai Prakash Ranjan, Suzuki K Poulose, Mike Leach, devicetree,
	linux-arm-kernel, linux-kernel, linux-arm-msm, Stephen Boyd

On Mon, May 25, 2020 at 10:15:53AM -0600, Mathieu Poirier wrote:
> Hi Sai,
> 
> On Sat, May 23, 2020 at 12:06:50AM +0530, Sai Prakash Ranjan wrote:
> > This series is mainly to add support for replicators
> > which lose context on removing AMBA clock like on SC7180
> > SoC where replicator in AOSS domain loses context.
> > 
> 
> I am good with this set but need a reviewed-by on the DT binding before I can
> add it to my tree.  The same goes for your other set[1].

Then why is it already in linux-next?

In any case,

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCHv3 0/2] Add support for replicators which loses context on clock removal
  2020-05-28 14:48   ` Rob Herring
@ 2020-05-28 17:40     ` Mathieu Poirier
  0 siblings, 0 replies; 8+ messages in thread
From: Mathieu Poirier @ 2020-05-28 17:40 UTC (permalink / raw)
  To: Rob Herring
  Cc: Sai Prakash Ranjan, Suzuki K Poulose, Mike Leach, devicetree,
	linux-arm-kernel, linux-kernel, linux-arm-msm, Stephen Boyd

On Thu, May 28, 2020 at 08:48:03AM -0600, Rob Herring wrote:
> On Mon, May 25, 2020 at 10:15:53AM -0600, Mathieu Poirier wrote:
> > Hi Sai,
> > 
> > On Sat, May 23, 2020 at 12:06:50AM +0530, Sai Prakash Ranjan wrote:
> > > This series is mainly to add support for replicators
> > > which lose context on removing AMBA clock like on SC7180
> > > SoC where replicator in AOSS domain loses context.
> > > 
> > 
> > I am good with this set but need a reviewed-by on the DT binding before I can
> > add it to my tree.  The same goes for your other set[1].
> 
> Then why is it already in linux-next?

I wanted the patches to get exposure to linux-next before sending them on to
Greg for inclusion in the next merge window.  Rest assured that I would not have
moved forward without your consent.

> 
> In any case,
> 
> Acked-by: Rob Herring <robh@kernel.org>

Thank you for that.

Mathieu

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-05-28 17:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-22 18:36 [PATCHv3 0/2] Add support for replicators which loses context on clock removal Sai Prakash Ranjan
2020-05-22 18:36 ` [PATCHv3 1/2] coresight: replicator: Reset replicator if context is lost Sai Prakash Ranjan
2020-05-22 18:36 ` [PATCHv3 2/2] dt-bindings: arm: coresight: Add optional property to replicators Sai Prakash Ranjan
2020-05-25 16:01   ` Mathieu Poirier
2020-05-25 16:15 ` [PATCHv3 0/2] Add support for replicators which loses context on clock removal Mathieu Poirier
2020-05-26  7:01   ` Sai Prakash Ranjan
2020-05-28 14:48   ` Rob Herring
2020-05-28 17:40     ` Mathieu Poirier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).