linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: akinobu.mita@gmail.com (Akinobu Mita)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: etm: wait for Progbit to go to 1 before programing ETM
Date: Sun, 17 Apr 2011 23:01:16 +0900	[thread overview]
Message-ID: <1303048876-28540-1-git-send-email-akinobu.mita@gmail.com> (raw)

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.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Alexander Shishkin <virtuoso@slind.org>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/kernel/etm.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/kernel/etm.c b/arch/arm/kernel/etm.c
index 1bec8b5..7229840 100644
--- a/arch/arm/kernel/etm.c
+++ b/arch/arm/kernel/etm.c
@@ -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");
-- 
1.7.4.2

                 reply	other threads:[~2011-04-17 14:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1303048876-28540-1-git-send-email-akinobu.mita@gmail.com \
    --to=akinobu.mita@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).