aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwtracing
diff options
context:
space:
mode:
authorSuzuki K Poulose <suzuki.poulose@arm.com>2018-09-20 15:18:15 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-25 14:09:19 -0400
commit4e33d694376e7f57d788e734dc96fdbd3c408768 (patch)
tree076114721a07b586626948309586fb9c979d9fd7 /drivers/hwtracing
parentf92201b1ab95b3f17c3fa9df8f88dc521e0b604f (diff)
coresight: dynamic-replicator: Claim device for use
Use CLAIM protocol to make sure the device is available for use. Cc: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hwtracing')
-rw-r--r--drivers/hwtracing/coresight/coresight-dynamic-replicator.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/hwtracing/coresight/coresight-dynamic-replicator.c b/drivers/hwtracing/coresight/coresight-dynamic-replicator.c
index 97f4673452cb..299667b887fc 100644
--- a/drivers/hwtracing/coresight/coresight-dynamic-replicator.c
+++ b/drivers/hwtracing/coresight/coresight-dynamic-replicator.c
@@ -41,8 +41,11 @@ static void replicator_reset(struct replicator_state *drvdata)
41{ 41{
42 CS_UNLOCK(drvdata->base); 42 CS_UNLOCK(drvdata->base);
43 43
44 writel_relaxed(0xff, drvdata->base + REPLICATOR_IDFILTER0); 44 if (!coresight_claim_device_unlocked(drvdata->base)) {
45 writel_relaxed(0xff, drvdata->base + REPLICATOR_IDFILTER1); 45 writel_relaxed(0xff, drvdata->base + REPLICATOR_IDFILTER0);
46 writel_relaxed(0xff, drvdata->base + REPLICATOR_IDFILTER1);
47 coresight_disclaim_device_unlocked(drvdata->base);
48 }
46 49
47 CS_LOCK(drvdata->base); 50 CS_LOCK(drvdata->base);
48} 51}
@@ -50,6 +53,7 @@ static void replicator_reset(struct replicator_state *drvdata)
50static int replicator_enable(struct coresight_device *csdev, int inport, 53static int replicator_enable(struct coresight_device *csdev, int inport,
51 int outport) 54 int outport)
52{ 55{
56 int rc = 0;
53 u32 reg; 57 u32 reg;
54 struct replicator_state *drvdata = dev_get_drvdata(csdev->dev.parent); 58 struct replicator_state *drvdata = dev_get_drvdata(csdev->dev.parent);
55 59
@@ -67,13 +71,19 @@ static int replicator_enable(struct coresight_device *csdev, int inport,
67 71
68 CS_UNLOCK(drvdata->base); 72 CS_UNLOCK(drvdata->base);
69 73
74 if ((readl_relaxed(drvdata->base + REPLICATOR_IDFILTER0) == 0xff) &&
75 (readl_relaxed(drvdata->base + REPLICATOR_IDFILTER1) == 0xff))
76 rc = coresight_claim_device_unlocked(drvdata->base);
70 77
71 /* Ensure that the outport is enabled. */ 78 /* Ensure that the outport is enabled. */
72 writel_relaxed(0x00, drvdata->base + reg); 79 if (!rc) {
80 writel_relaxed(0x00, drvdata->base + reg);
81 dev_dbg(drvdata->dev, "REPLICATOR enabled\n");
82 }
83
73 CS_LOCK(drvdata->base); 84 CS_LOCK(drvdata->base);
74 85
75 dev_dbg(drvdata->dev, "REPLICATOR enabled\n"); 86 return rc;
76 return 0;
77} 87}
78 88
79static void replicator_disable(struct coresight_device *csdev, int inport, 89static void replicator_disable(struct coresight_device *csdev, int inport,
@@ -99,6 +109,9 @@ static void replicator_disable(struct coresight_device *csdev, int inport,
99 /* disable the flow of ATB data through port */ 109 /* disable the flow of ATB data through port */
100 writel_relaxed(0xff, drvdata->base + reg); 110 writel_relaxed(0xff, drvdata->base + reg);
101 111
112 if ((readl_relaxed(drvdata->base + REPLICATOR_IDFILTER0) == 0xff) &&
113 (readl_relaxed(drvdata->base + REPLICATOR_IDFILTER1) == 0xff))
114 coresight_disclaim_device_unlocked(drvdata->base);
102 CS_LOCK(drvdata->base); 115 CS_LOCK(drvdata->base);
103 116
104 dev_dbg(drvdata->dev, "REPLICATOR disabled\n"); 117 dev_dbg(drvdata->dev, "REPLICATOR disabled\n");