All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] DaVinci: correct PDSTAT.STATE mask
@ 2011-09-16 14:54 Sergei Shtylyov
  2011-09-16 14:58 ` [U-Boot] [PATCH v2] DaVinci: correct MDSTAT.STATE mask Sergei Shtylyov
  0 siblings, 1 reply; 6+ messages in thread
From: Sergei Shtylyov @ 2011-09-16 14:54 UTC (permalink / raw)
  To: u-boot

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

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

---
Analogous Linux patch has been queued in the linux-davinci tree:

http://linux.davincidsp.com/pipermail/davinci-linux-open-source/2011-July/023075.html

 arch/arm/cpu/arm926ejs/davinci/lowlevel_init.S |    6 +++---
 arch/arm/cpu/arm926ejs/davinci/psc.c           |    4 ++--
 2 files changed, 5 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
@@ -268,7 +268,7 @@ checkStatClkStop:
 checkDDRStatClkStop:
 	ldr	r6, MDSTAT_DDR2
 	ldr	r7, [r6]
-	and	r7, r7, $0x1f
+	and	r7, r7, $0x3f
 	cmp	r7, $0x03
 	bne	checkDDRStatClkStop
 
@@ -343,7 +343,7 @@ checkStatClkStop2:
 checkDDRStatClkStop2:
 	ldr	r6, MDSTAT_DDR2
 	ldr	r7, [r6]
-	and	r7, r7, $0x1f
+	and	r7, r7, $0x3f
 	cmp	r7, $0x01
 	bne	checkDDRStatClkStop2
 
@@ -374,7 +374,7 @@ checkStatClkEn2:
 checkDDRStatClkEn2:
 	ldr	r6, MDSTAT_DDR2
 	ldr	r7, [r6]
-	and	r7, r7, $0x1f
+	and	r7, r7, $0x3f
 	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) & 0x3f) == 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) & 0x3f) != 0x03)
 		continue;
 }
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH v2] DaVinci: correct MDSTAT.STATE mask
  2011-09-16 14:54 [U-Boot] [PATCH] DaVinci: correct PDSTAT.STATE mask Sergei Shtylyov
@ 2011-09-16 14:58 ` Sergei Shtylyov
  2011-09-16 21:01   ` Wolfgang Denk
  2011-09-23 14:29   ` [U-Boot] [PATCH v3] " Sergei Shtylyov
  0 siblings, 2 replies; 6+ messages in thread
From: Sergei Shtylyov @ 2011-09-16 14:58 UTC (permalink / raw)
  To: u-boot

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

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

---
Resending with the corrected subject/description...
Analogous Linux patch has been queued in the linux-davinci tree:

http://linux.davincidsp.com/pipermail/davinci-linux-open-source/2011-July/023075.html

 arch/arm/cpu/arm926ejs/davinci/lowlevel_init.S |    6 +++---
 arch/arm/cpu/arm926ejs/davinci/psc.c           |    4 ++--
 2 files changed, 5 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
@@ -268,7 +268,7 @@ checkStatClkStop:
 checkDDRStatClkStop:
 	ldr	r6, MDSTAT_DDR2
 	ldr	r7, [r6]
-	and	r7, r7, $0x1f
+	and	r7, r7, $0x3f
 	cmp	r7, $0x03
 	bne	checkDDRStatClkStop
 
@@ -343,7 +343,7 @@ checkStatClkStop2:
 checkDDRStatClkStop2:
 	ldr	r6, MDSTAT_DDR2
 	ldr	r7, [r6]
-	and	r7, r7, $0x1f
+	and	r7, r7, $0x3f
 	cmp	r7, $0x01
 	bne	checkDDRStatClkStop2
 
@@ -374,7 +374,7 @@ checkStatClkEn2:
 checkDDRStatClkEn2:
 	ldr	r6, MDSTAT_DDR2
 	ldr	r7, [r6]
-	and	r7, r7, $0x1f
+	and	r7, r7, $0x3f
 	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) & 0x3f) == 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) & 0x3f) != 0x03)
 		continue;
 }
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH v2] DaVinci: correct MDSTAT.STATE mask
  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   ` [U-Boot] [PATCH v3] " Sergei Shtylyov
  1 sibling, 1 reply; 6+ messages in thread
From: Wolfgang Denk @ 2011-09-16 21:01 UTC (permalink / raw)
  To: u-boot

Dear Sergei Shtylyov,

In message <201109161858.08706.sshtylyov@ru.mvista.com> you wrote:
> MDSTAT.STATE occupies bits 0..5 according to all available documentation, so fix
> the masks which previously was leaving out the intermediate state indicator bit.
> 
> Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
> 
> ---
> Resending with the corrected subject/description...
> Analogous Linux patch has been queued in the linux-davinci tree:
> 
> http://linux.davincidsp.com/pipermail/davinci-linux-open-source/2011-July/023075.html
> 
>  arch/arm/cpu/arm926ejs/davinci/lowlevel_init.S |    6 +++---
>  arch/arm/cpu/arm926ejs/davinci/psc.c           |    4 ++--
>  2 files changed, 5 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
> @@ -268,7 +268,7 @@ checkStatClkStop:
>  checkDDRStatClkStop:
>  	ldr	r6, MDSTAT_DDR2
>  	ldr	r7, [r6]
> -	and	r7, r7, $0x1f
> +	and	r7, r7, $0x3f

Don't you think it's high time to replace these magic constants with
at least somewhat meaningful symbolic names (so it would be sufficient
to fix this in  a single place) ?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Let's say the docs present a simplified view of reality...    :-)
                      - Larry Wall in  <6940@jpl-devvax.JPL.NASA.GOV>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH v2] DaVinci: correct MDSTAT.STATE mask
  2011-09-16 21:01   ` Wolfgang Denk
@ 2011-09-17 22:48     ` Sergei Shtylyov
  0 siblings, 0 replies; 6+ messages in thread
From: Sergei Shtylyov @ 2011-09-17 22:48 UTC (permalink / raw)
  To: u-boot

Hello.

On 17-09-2011 1:01, Wolfgang Denk wrote:

> Dear Sergei Shtylyov,

    Thank you for the really quick response. :-)

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

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

>> ---
>> Resending with the corrected subject/description...
>> Analogous Linux patch has been queued in the linux-davinci tree:

>> http://linux.davincidsp.com/pipermail/davinci-linux-open-source/2011-July/023075.html

>>   arch/arm/cpu/arm926ejs/davinci/lowlevel_init.S |    6 +++---
>>   arch/arm/cpu/arm926ejs/davinci/psc.c           |    4 ++--
>>   2 files changed, 5 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
>> @@ -268,7 +268,7 @@ checkStatClkStop:
>>   checkDDRStatClkStop:
>>   	ldr	r6, MDSTAT_DDR2
>>   	ldr	r7, [r6]
>> -	and	r7, r7, $0x1f
>> +	and	r7, r7, $0x3f

> Don't you think it's high time to replace these magic constants with
> at least somewhat meaningful symbolic names (so it would be sufficient
> to fix this in  a single place) ?

    I agree. Do you mean I should recast this patch, or do two patches 
instead: one adding the symbolic name and another correcting its value?

> Best regards,

> Wolfgang Denk

WBR, Sergei

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH v3] DaVinci: correct MDSTAT.STATE mask
  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-23 14:29   ` Sergei Shtylyov
  2011-10-13 12:14     ` Christian Riesch
  1 sibling, 1 reply; 6+ messages in thread
From: Sergei Shtylyov @ 2011-09-23 14:29 UTC (permalink / raw)
  To: u-boot

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... */

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH v3] DaVinci: correct MDSTAT.STATE mask
  2011-09-23 14:29   ` [U-Boot] [PATCH v3] " Sergei Shtylyov
@ 2011-10-13 12:14     ` Christian Riesch
  0 siblings, 0 replies; 6+ messages in thread
From: Christian Riesch @ 2011-10-13 12:14 UTC (permalink / raw)
  To: u-boot

Hi,

On Fri, Sep 23, 2011 at 4:29 PM, Sergei Shtylyov
<sshtylyov@ru.mvista.com> wrote:
> 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(-)

What's the state of this patch? Could this be merged please? Thank you!
Regards, Christian

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-10-13 12:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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   ` [U-Boot] [PATCH v3] " Sergei Shtylyov
2011-10-13 12:14     ` Christian Riesch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.