Skip to contentSkip to conversation

ARM: etm: wait for Progbit to go to 1 before programing ETM

PATCH New Akinobu Mita 1 participant 1 message Apr 17, 2011 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: etm: wait for Progbit to go to 1 before programing ETM

According to "Embedded Trace Macrocell Architecture Specification", 3.4.3. Use of the Programming bit, you must wait for Progbit of the ETM Status Register to go to 1 before you start to program the ETM registers. The current code somehow reads programing bit in ETM Control Register instead.

Likewise, you must wait for Progbit to go to 0 after programing ETM.

Cc Alexander Shishkin <[email protected]>
Cc Russell King <[email protected]>
---
 arch/arm/kernel/etm.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/kernel/etm.c +3 -3
index 1bec8b5..7229840 100644
@@ -106,7 +106,7 @@ static int trace_start(struct tracectx *t)
 
 	etm_writel(t, v, ETMR_CTRL);
 
-	while (!(etm_readl(t, ETMR_CTRL) & ETMCTRL_PROGRAM) && --timeout)
+	while (!etm_progbit(t) && --timeout)
 		;
 	if (!timeout) {
 		dev_dbg(t->dev, "Waiting for progbit to assert timed out\n");
@@ -126,7 +126,7 @@ static int trace_start(struct tracectx *t)
 	etm_writel(t, v, ETMR_CTRL);
 
 	timeout = TRACER_TIMEOUT;
-	while (etm_readl(t, ETMR_CTRL) & ETMCTRL_PROGRAM && --timeout)
+	while (etm_progbit(t) && --timeout)
 		;
 	if (!timeout) {
 		dev_dbg(t->dev, "Waiting for progbit to deassert timed out\n");
@@ -148,7 +148,7 @@ static int trace_stop(struct tracectx *t)
 	etm_unlock(t);
 
 	etm_writel(t, 0x440, ETMR_CTRL);
-	while (!(etm_readl(t, ETMR_CTRL) & ETMCTRL_PROGRAM) && --timeout)
+	while (!etm_progbit(t) && --timeout)
 		;
 	if (!timeout) {
 		dev_dbg(t->dev, "Waiting for progbit to assert timed out\n");
Signature · 1 line
1.7.4.2