Skip to content

Commit 66c6e11

Browse files
coresight: tmc: waiting for TMCReady bit before programming
According to the TRM before programming the TMC in circular buffer mode (and that for any configuration, ETB, ETR, ETF), the TMCReady bit in the status register has to be set. This patch adds a check to make sure the state machine is in a state where it can be configured, and complains otherwise. Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit 358f42184e97f9a216b927a5a744597b98e0eee1)
1 parent 43dc4e8 commit 66c6e11

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

drivers/hwtracing/coresight/coresight-tmc.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ static void tmc_etb_enable_hw(struct tmc_drvdata *drvdata)
180180

181181
CS_UNLOCK(drvdata->base);
182182

183+
/* Wait for TMCSReady bit to be set */
184+
tmc_wait_for_tmcready(drvdata);
185+
183186
writel_relaxed(TMC_MODE_CIRCULAR_BUFFER, drvdata->base + TMC_MODE);
184187
writel_relaxed(TMC_FFCR_EN_FMT | TMC_FFCR_EN_TI |
185188
TMC_FFCR_FON_FLIN | TMC_FFCR_FON_TRIG_EVT |
@@ -201,6 +204,9 @@ static void tmc_etr_enable_hw(struct tmc_drvdata *drvdata)
201204

202205
CS_UNLOCK(drvdata->base);
203206

207+
/* Wait for TMCSReady bit to be set */
208+
tmc_wait_for_tmcready(drvdata);
209+
204210
writel_relaxed(drvdata->size / 4, drvdata->base + TMC_RSZ);
205211
writel_relaxed(TMC_MODE_CIRCULAR_BUFFER, drvdata->base + TMC_MODE);
206212

@@ -230,6 +236,9 @@ static void tmc_etf_enable_hw(struct tmc_drvdata *drvdata)
230236
{
231237
CS_UNLOCK(drvdata->base);
232238

239+
/* Wait for TMCSReady bit to be set */
240+
tmc_wait_for_tmcready(drvdata);
241+
233242
writel_relaxed(TMC_MODE_HARDWARE_FIFO, drvdata->base + TMC_MODE);
234243
writel_relaxed(TMC_FFCR_EN_FMT | TMC_FFCR_EN_TI,
235244
drvdata->base + TMC_FFCR);

0 commit comments

Comments
 (0)