Patchwork [U-Boot,alternate,version] at91rm9200: fix lowlevel_init() SMRDATA size

login
register
mail settings
Submitter Jens Scharsig
Date Dec. 4, 2010, 10:53 a.m.
Message ID <4CFA1DB1.3010100@scharsoft.de>
Download mbox | patch
Permalink /patch/74259/
State Rejected
Delegated to: Reinhard Meyer
Headers show

Comments

Jens Scharsig - Dec. 4, 2010, 10:53 a.m.
Signed-off-by: Jens Scharsig <js_at_ng@scharsoft.de>
---

Am 03.12.2010 08:26, schrieb Andreas Bießmann:
> SMRDATA in a/a/c/arm920t/at91/lowlevel_init.c has wrong size. This patch
> reduces it to correct size of 40 byte.
> 
> Signed-off-by: Andreas Bießmann <biessmann@corscience.de>
> ---
> Dear all,
> 
> I thougt about a problem in lowlevel_init() cause of errornous booting from
> NOR flash on at91rm9200ek last night . This morning I detected this, but the
> patch is untested!
> I can not test it til sunday, if one can test it before please send a mail
> (Jens?).
> 
> regards
> 
> Andreas Bießmann
> 
> arch/arm/cpu/arm920t/at91/lowlevel_init.S |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/cpu/arm920t/at91/lowlevel_init.S b/arch/arm/cpu/arm920t/at91/lowlevel_init.S
> index eaea9d2..6e397c2 100644
> --- a/arch/arm/cpu/arm920t/at91/lowlevel_init.S
> +++ b/arch/arm/cpu/arm920t/at91/lowlevel_init.S
> @@ -65,7 +65,7 @@ LoopOsc:
>  	ldr	r0, =SMRDATA
>  	ldr	r1, _MTEXT_BASE
>  	sub	r0, r0, r1
> -	add	r2, r0, #80
> +	add	r2, r0, #40
>  pllloop:
>  	/* the address */
>  	ldr	r1, [r0], #4

The patch has no positive or negative effects. But you are right, this is an error with
unknown side effects. 

So we should resolve this in a future-proof way (see below)

 arch/arm/cpu/arm920t/at91/lowlevel_init.S |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

-- 1.7.1
Andreas Bießmann - Dec. 4, 2010, 1:12 p.m.
Dear Jens Scharsig,

Am 04.12.2010 um 11:53 schrieb Jens Scharsig:

[snip]

> So we should resolve this in a future-proof way (see below)
> 
> arch/arm/cpu/arm920t/at91/lowlevel_init.S |    9 ++++++---
> 1 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/cpu/arm920t/at91/lowlevel_init.S b/arch/arm/cpu/arm920t/at91/lowlevel_init.S
> index eaea9d2..1143c7e 100644
> --- a/arch/arm/cpu/arm920t/at91/lowlevel_init.S
> +++ b/arch/arm/cpu/arm920t/at91/lowlevel_init.S
> @@ -65,7 +65,8 @@ LoopOsc:
> 	ldr	r0, =SMRDATA
> 	ldr	r1, _MTEXT_BASE
> 	sub	r0, r0, r1
> -	add	r2, r0, #80
> +	ldr	r2, =SMRDATAE
> +	add	r2, r2, r1

Your approach seems better, therefore

Acked-by: Andreas Bießmann <andreas.devel@googlemail.com>

regards

Andreas Bießmann
Andreas Bießmann - Dec. 4, 2010, 1:19 p.m.
Dear Jens Scharsig,

Am 04.12.2010 um 11:53 schrieb Jens Scharsig:

> diff --git a/arch/arm/cpu/arm920t/at91/lowlevel_init.S b/arch/arm/cpu/arm920t/at91/lowlevel_init.S
> index eaea9d2..1143c7e 100644
> --- a/arch/arm/cpu/arm920t/at91/lowlevel_init.S
> +++ b/arch/arm/cpu/arm920t/at91/lowlevel_init.S
> @@ -65,7 +65,8 @@ LoopOsc:
> 	ldr	r0, =SMRDATA
> 	ldr	r1, _MTEXT_BASE
> 	sub	r0, r0, r1
> -	add	r2, r0, #80
> +	ldr	r2, =SMRDATAE
> +	add	r2, r2, r1
> pllloop:
> 	/* the address */
> 	ldr	r1, [r0], #4
> @@ -82,8 +83,8 @@ lock:
> 	bhi	lock
> 	ldr	r0, =SMRDATA1
> 	ldr	r1, _MTEXT_BASE
> -	sub	r0, r0, r1
> -	add	r2, r0, #176
> +	ldr	r2, =SMRDATA1E
> +	add	r2, r2, r1

OUCH, one line to much deleted ...

regards 

Andreas Bießmann

Patch

diff --git a/arch/arm/cpu/arm920t/at91/lowlevel_init.S b/arch/arm/cpu/arm920t/at91/lowlevel_init.S
index eaea9d2..1143c7e 100644
--- a/arch/arm/cpu/arm920t/at91/lowlevel_init.S
+++ b/arch/arm/cpu/arm920t/at91/lowlevel_init.S
@@ -65,7 +65,8 @@  LoopOsc:
 	ldr	r0, =SMRDATA
 	ldr	r1, _MTEXT_BASE
 	sub	r0, r0, r1
-	add	r2, r0, #80
+	ldr	r2, =SMRDATAE
+	add	r2, r2, r1
 pllloop:
 	/* the address */
 	ldr	r1, [r0], #4
@@ -82,8 +83,8 @@  lock:
 	bhi	lock
 	ldr	r0, =SMRDATA1
 	ldr	r1, _MTEXT_BASE
-	sub	r0, r0, r1
-	add	r2, r0, #176
+	ldr	r2, =SMRDATA1E
+	add	r2, r2, r1
 sdinit:
 	/* the address */
 	ldr	r1, [r0], #4
@@ -114,6 +115,7 @@  SMRDATA:
 	.word CONFIG_SYS_PLLBR_VAL
 	.word AT91_ASM_PMC_MCKR
 	.word CONFIG_SYS_MCKR_VAL
+SMRDATAE:	
 	/* here there's a delay */
 SMRDATA1:
 	.word AT91_ASM_PIOC_ASR
@@ -160,5 +162,6 @@  SMRDATA1:
 	.word CONFIG_SYS_SDRC_MR_VAL3
 	.word CONFIG_SYS_SDRAM
 	.word CONFIG_SYS_SDRAM_VAL
+SMRDATA1E:		
 	/* SMRDATA1 is 176 bytes long */
 #endif /* CONFIG_SKIP_LOWLEVEL_INIT */