From: Suzuki K Poulose <suzuki.poul...@arm.com>

TRCPROCSELR is not implemented if the TRCIDR3.NUMPROC == 0. Skip
accessing the register in such cases.

Cc: sta...@vger.kernel.org
Cc: Mathieu Poirier <mathieu.poir...@linaro.org>
Cc: Mike Leach <mike.le...@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poul...@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poir...@linaro.org>
---
 drivers/hwtracing/coresight/coresight-etm4x-core.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c 
b/drivers/hwtracing/coresight/coresight-etm4x-core.c
index cbbe755d1d16..28dd278f6d47 100644
--- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
+++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
@@ -124,8 +124,8 @@ static int etm4_enable_hw(struct etmv4_drvdata *drvdata)
        if (coresight_timeout(drvdata->base, TRCSTATR, TRCSTATR_IDLE_BIT, 1))
                dev_err(etm_dev,
                        "timeout while waiting for Idle Trace Status\n");
-
-       writel_relaxed(config->pe_sel, drvdata->base + TRCPROCSELR);
+       if (drvdata->nr_pe)
+               writel_relaxed(config->pe_sel, drvdata->base + TRCPROCSELR);
        writel_relaxed(config->cfg, drvdata->base + TRCCONFIGR);
        /* nothing specific implemented */
        writel_relaxed(0x0, drvdata->base + TRCAUXCTLR);
@@ -1185,7 +1185,8 @@ static int etm4_cpu_save(struct etmv4_drvdata *drvdata)
        state = drvdata->save_state;
 
        state->trcprgctlr = readl(drvdata->base + TRCPRGCTLR);
-       state->trcprocselr = readl(drvdata->base + TRCPROCSELR);
+       if (drvdata->nr_pe)
+               state->trcprocselr = readl(drvdata->base + TRCPROCSELR);
        state->trcconfigr = readl(drvdata->base + TRCCONFIGR);
        state->trcauxctlr = readl(drvdata->base + TRCAUXCTLR);
        state->trceventctl0r = readl(drvdata->base + TRCEVENTCTL0R);
@@ -1292,7 +1293,8 @@ static void etm4_cpu_restore(struct etmv4_drvdata 
*drvdata)
        writel_relaxed(state->trcclaimset, drvdata->base + TRCCLAIMSET);
 
        writel_relaxed(state->trcprgctlr, drvdata->base + TRCPRGCTLR);
-       writel_relaxed(state->trcprocselr, drvdata->base + TRCPROCSELR);
+       if (drvdata->nr_pe)
+               writel_relaxed(state->trcprocselr, drvdata->base + TRCPROCSELR);
        writel_relaxed(state->trcconfigr, drvdata->base + TRCCONFIGR);
        writel_relaxed(state->trcauxctlr, drvdata->base + TRCAUXCTLR);
        writel_relaxed(state->trceventctl0r, drvdata->base + TRCEVENTCTL0R);
-- 
2.25.1

Reply via email to