Patchwork [U-Boot,3/3] pxa: Save lr register in relocate_code function

login
register
mail settings
Submitter Łukasz Dałek
Date Jan. 12, 2013, 9:39 p.m.
Message ID <1358026767-28130-3-git-send-email-luk0104@gmail.com>
Download mbox | patch
Permalink /patch/211568/
State Accepted
Delegated to: Tom Rini
Headers show

Comments

Łukasz Dałek - Jan. 12, 2013, 9:39 p.m.
When u-boot is compiled for PXA25x processor, pxa/start.S is calling
cpu_init_crit by BL instruction. BL is overwriting lr register so
relocate_code is going into infinite loop. This patch preservs lr
register in r12 before calling cpu_init_crit and after function returns
restores it.

Signed-off-by: Lukasz Dalek <luk0104@gmail.com>
---
 arch/arm/cpu/pxa/start.S |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
Marek Vasut - Jan. 12, 2013, 11:53 p.m.
Dear Lukasz Dalek,

> When u-boot is compiled for PXA25x processor, pxa/start.S is calling
> cpu_init_crit by BL instruction. BL is overwriting lr register so
> relocate_code is going into infinite loop. This patch preservs lr
> register in r12 before calling cpu_init_crit and after function returns
> restores it.
> 
> Signed-off-by: Lukasz Dalek <luk0104@gmail.com>

Acked-by: Marek Vasut <marex@denx.de>

Tom/Albert, can you please apply this for .01, seems critical to me ?

> ---
>  arch/arm/cpu/pxa/start.S |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/cpu/pxa/start.S b/arch/arm/cpu/pxa/start.S
> index 72af869..e71803e 100644
> --- a/arch/arm/cpu/pxa/start.S
> +++ b/arch/arm/cpu/pxa/start.S
> @@ -183,7 +183,9 @@ relocate_code:
> 
>  /* Disable the Dcache RAM lock for stack now */
>  #ifdef	CONFIG_CPU_PXA25X
> +	mov	r12, lr
>  	bl	cpu_init_crit
> +	mov	lr, r12
>  #endif
> 
>  	adr	r0, _start

Best regards,
Marek Vasut
Tom Rini - Jan. 14, 2013, 11:23 p.m.
On Sat, Jan 12, 2013 at 11:39:27AM -0000, Lukasz Dalek wrote:

> When u-boot is compiled for PXA25x processor, pxa/start.S is calling
> cpu_init_crit by BL instruction. BL is overwriting lr register so
> relocate_code is going into infinite loop. This patch preservs lr
> register in r12 before calling cpu_init_crit and after function returns
> restores it.
> 
> Signed-off-by: Lukasz Dalek <luk0104@gmail.com>
> Acked-by: Marek Vasut <marex@denx.de>

This portion of the series is now applied to u-boot/master, thanks!

Patch

diff --git a/arch/arm/cpu/pxa/start.S b/arch/arm/cpu/pxa/start.S
index 72af869..e71803e 100644
--- a/arch/arm/cpu/pxa/start.S
+++ b/arch/arm/cpu/pxa/start.S
@@ -183,7 +183,9 @@  relocate_code:
 
 /* Disable the Dcache RAM lock for stack now */
 #ifdef	CONFIG_CPU_PXA25X
+	mov	r12, lr
 	bl	cpu_init_crit
+	mov	lr, r12
 #endif
 
 	adr	r0, _start