mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-04-07 20:58:00 +07:00
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>
This commit is contained in:
parent
f92201b1ab
commit
4e33d69437
@ -41,8 +41,11 @@ static void replicator_reset(struct replicator_state *drvdata)
|
|||||||
{
|
{
|
||||||
CS_UNLOCK(drvdata->base);
|
CS_UNLOCK(drvdata->base);
|
||||||
|
|
||||||
|
if (!coresight_claim_device_unlocked(drvdata->base)) {
|
||||||
writel_relaxed(0xff, drvdata->base + REPLICATOR_IDFILTER0);
|
writel_relaxed(0xff, drvdata->base + REPLICATOR_IDFILTER0);
|
||||||
writel_relaxed(0xff, drvdata->base + REPLICATOR_IDFILTER1);
|
writel_relaxed(0xff, drvdata->base + REPLICATOR_IDFILTER1);
|
||||||
|
coresight_disclaim_device_unlocked(drvdata->base);
|
||||||
|
}
|
||||||
|
|
||||||
CS_LOCK(drvdata->base);
|
CS_LOCK(drvdata->base);
|
||||||
}
|
}
|
||||||
@ -50,6 +53,7 @@ static void replicator_reset(struct replicator_state *drvdata)
|
|||||||
static int replicator_enable(struct coresight_device *csdev, int inport,
|
static int replicator_enable(struct coresight_device *csdev, int inport,
|
||||||
int outport)
|
int outport)
|
||||||
{
|
{
|
||||||
|
int rc = 0;
|
||||||
u32 reg;
|
u32 reg;
|
||||||
struct replicator_state *drvdata = dev_get_drvdata(csdev->dev.parent);
|
struct replicator_state *drvdata = dev_get_drvdata(csdev->dev.parent);
|
||||||
|
|
||||||
@ -67,13 +71,19 @@ static int replicator_enable(struct coresight_device *csdev, int inport,
|
|||||||
|
|
||||||
CS_UNLOCK(drvdata->base);
|
CS_UNLOCK(drvdata->base);
|
||||||
|
|
||||||
|
if ((readl_relaxed(drvdata->base + REPLICATOR_IDFILTER0) == 0xff) &&
|
||||||
|
(readl_relaxed(drvdata->base + REPLICATOR_IDFILTER1) == 0xff))
|
||||||
|
rc = coresight_claim_device_unlocked(drvdata->base);
|
||||||
|
|
||||||
/* Ensure that the outport is enabled. */
|
/* Ensure that the outport is enabled. */
|
||||||
|
if (!rc) {
|
||||||
writel_relaxed(0x00, drvdata->base + reg);
|
writel_relaxed(0x00, drvdata->base + reg);
|
||||||
|
dev_dbg(drvdata->dev, "REPLICATOR enabled\n");
|
||||||
|
}
|
||||||
|
|
||||||
CS_LOCK(drvdata->base);
|
CS_LOCK(drvdata->base);
|
||||||
|
|
||||||
dev_dbg(drvdata->dev, "REPLICATOR enabled\n");
|
return rc;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void replicator_disable(struct coresight_device *csdev, int inport,
|
static void replicator_disable(struct coresight_device *csdev, int inport,
|
||||||
@ -99,6 +109,9 @@ static void replicator_disable(struct coresight_device *csdev, int inport,
|
|||||||
/* disable the flow of ATB data through port */
|
/* disable the flow of ATB data through port */
|
||||||
writel_relaxed(0xff, drvdata->base + reg);
|
writel_relaxed(0xff, drvdata->base + reg);
|
||||||
|
|
||||||
|
if ((readl_relaxed(drvdata->base + REPLICATOR_IDFILTER0) == 0xff) &&
|
||||||
|
(readl_relaxed(drvdata->base + REPLICATOR_IDFILTER1) == 0xff))
|
||||||
|
coresight_disclaim_device_unlocked(drvdata->base);
|
||||||
CS_LOCK(drvdata->base);
|
CS_LOCK(drvdata->base);
|
||||||
|
|
||||||
dev_dbg(drvdata->dev, "REPLICATOR disabled\n");
|
dev_dbg(drvdata->dev, "REPLICATOR disabled\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user