public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3] DaVinci: correct MDSTAT.STATE mask
Date: Fri, 23 Sep 2011 18:29:15 +0400	[thread overview]
Message-ID: <201109231829.15371.sshtylyov@ru.mvista.com> (raw)
In-Reply-To: <201109161858.08706.sshtylyov@ru.mvista.com>

MDSTAT.STATE occupies bits 0..5 according to all available documentation, so fix
the mask which previously was leaving out the intermediate state indicator bit.

While at it, introduce two #define's for that mask -- unfortunately, we can't
use a single #define as the assembly code can't include <asm/arch/hardware.h>
due to C-specfic constructs in it.

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

---
 arch/arm/cpu/arm926ejs/davinci/lowlevel_init.S |    8 +++++---
 arch/arm/cpu/arm926ejs/davinci/psc.c           |    4 ++--
 arch/arm/include/asm/arch-davinci/hardware.h   |    2 ++
 3 files changed, 9 insertions(+), 5 deletions(-)

Index: u-boot/arch/arm/cpu/arm926ejs/davinci/lowlevel_init.S
===================================================================
--- u-boot.orig/arch/arm/cpu/arm926ejs/davinci/lowlevel_init.S
+++ u-boot/arch/arm/cpu/arm926ejs/davinci/lowlevel_init.S
@@ -45,6 +45,8 @@
 
 #include <config.h>
 
+#define MDSTAT_STATE	0x3f
+
 .globl	lowlevel_init
 lowlevel_init:
 
@@ -268,7 +270,7 @@ checkStatClkStop:
 checkDDRStatClkStop:
 	ldr	r6, MDSTAT_DDR2
 	ldr	r7, [r6]
-	and	r7, r7, $0x1f
+	and	r7, r7, $MDSTAT_STATE
 	cmp	r7, $0x03
 	bne	checkDDRStatClkStop
 
@@ -343,7 +345,7 @@ checkStatClkStop2:
 checkDDRStatClkStop2:
 	ldr	r6, MDSTAT_DDR2
 	ldr	r7, [r6]
-	and	r7, r7, $0x1f
+	and	r7, r7, $MDSTAT_STATE
 	cmp	r7, $0x01
 	bne	checkDDRStatClkStop2
 
@@ -374,7 +376,7 @@ checkStatClkEn2:
 checkDDRStatClkEn2:
 	ldr	r6, MDSTAT_DDR2
 	ldr	r7, [r6]
-	and	r7, r7, $0x1f
+	and	r7, r7, $MDSTAT_STATE
 	cmp	r7, $0x03
 	bne	checkDDRStatClkEn2
 
Index: u-boot/arch/arm/cpu/arm926ejs/davinci/psc.c
===================================================================
--- u-boot.orig/arch/arm/cpu/arm926ejs/davinci/psc.c
+++ u-boot/arch/arm/cpu/arm926ejs/davinci/psc.c
@@ -83,7 +83,7 @@ void lpsc_on(unsigned int id)
 	while (readl(ptstat) & 0x01)
 		continue;
 
-	if ((readl(mdstat) & 0x1f) == 0x03)
+	if ((readl(mdstat) & PSC_MDSTAT_STATE) == 0x03)
 		return; /* Already on and enabled */
 
 	writel(readl(mdctl) | 0x03, mdctl);
@@ -114,7 +114,7 @@ void lpsc_on(unsigned int id)
 
 	while (readl(ptstat) & 0x01)
 		continue;
-	while ((readl(mdstat) & 0x1f) != 0x03)
+	while ((readl(mdstat) & PSC_MDSTAT_STATE) != 0x03)
 		continue;
 }
 
Index: u-boot/arch/arm/include/asm/arch-davinci/hardware.h
===================================================================
--- u-boot.orig/arch/arm/include/asm/arch-davinci/hardware.h
+++ u-boot/arch/arm/include/asm/arch-davinci/hardware.h
@@ -347,6 +347,8 @@ struct davinci_psc_regs {
 
 #endif /* CONFIG_SOC_DA8XX */
 
+#define PSC_MDSTAT_STATE		0x3f
+
 #ifndef CONFIG_SOC_DA8XX
 
 /* Miscellania... */

  parent reply	other threads:[~2011-09-23 14:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-16 14:54 [U-Boot] [PATCH] DaVinci: correct PDSTAT.STATE mask Sergei Shtylyov
2011-09-16 14:58 ` [U-Boot] [PATCH v2] DaVinci: correct MDSTAT.STATE mask Sergei Shtylyov
2011-09-16 21:01   ` Wolfgang Denk
2011-09-17 22:48     ` Sergei Shtylyov
2011-09-23 14:29   ` Sergei Shtylyov [this message]
2011-10-13 12:14     ` [U-Boot] [PATCH v3] " Christian Riesch

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=201109231829.15371.sshtylyov@ru.mvista.com \
    --to=sshtylyov@ru.mvista.com \
    --cc=u-boot@lists.denx.de \
    /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