diff mbox

[U-Boot,1/2] nios2: call board_init_f_mem

Message ID 1441785805-15203-1-git-send-email-thomas@wytron.com.tw
State Accepted, archived
Delegated to: Thomas Chou
Headers show

Commit Message

Thomas Chou Sept. 9, 2015, 8:03 a.m. UTC
We will need CONFIG_SYS_MALLOC_F_LEN to use serial uclass.
So we shall undefine CONFIG_SYS_GENERIC_GLOBAL_DATA, and
call board_init_f_mem() to allocates early malloc() memory
with size of CONFIG_SYS_MALLOC_F_LEN in board_f.c.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
 arch/nios2/cpu/start.S          | 10 ++++++++++
 arch/nios2/include/asm/config.h |  2 --
 2 files changed, 10 insertions(+), 2 deletions(-)

Comments

Marek Vasut Sept. 9, 2015, 12:04 p.m. UTC | #1
On Wednesday, September 09, 2015 at 10:03:24 AM, Thomas Chou wrote:
> We will need CONFIG_SYS_MALLOC_F_LEN to use serial uclass.
> So we shall undefine CONFIG_SYS_GENERIC_GLOBAL_DATA, and
> call board_init_f_mem() to allocates early malloc() memory
> with size of CONFIG_SYS_MALLOC_F_LEN in board_f.c.
> 
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

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

Best regards,
Marek Vasut
Thomas Chou Sept. 15, 2015, 8:56 a.m. UTC | #2
On 09/09/2015 04:03 PM, Thomas Chou wrote:
> We will need CONFIG_SYS_MALLOC_F_LEN to use serial uclass.
> So we shall undefine CONFIG_SYS_GENERIC_GLOBAL_DATA, and
> call board_init_f_mem() to allocates early malloc() memory
> with size of CONFIG_SYS_MALLOC_F_LEN in board_f.c.
>
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
> ---
>   arch/nios2/cpu/start.S          | 10 ++++++++++
>   arch/nios2/include/asm/config.h |  2 --
>   2 files changed, 10 insertions(+), 2 deletions(-)

Applied to u-boot-nios.
diff mbox

Patch

diff --git a/arch/nios2/cpu/start.S b/arch/nios2/cpu/start.S
index 5c7074e..6c7c777 100644
--- a/arch/nios2/cpu/start.S
+++ b/arch/nios2/cpu/start.S
@@ -120,6 +120,16 @@  _reloc:
 	stw	r0, 4(sp)
 	mov	fp, sp
 
+	/* Allocate and zero GD, update SP */
+	mov	r4, sp
+	movhi	r2, %hi(board_init_f_mem@h)
+	ori	r2, r2, %lo(board_init_f_mem@h)
+	callr	r2
+
+	/* Update stack- and frame-pointers */
+	mov	sp, r2
+	mov	fp, sp
+
 	/*
 	 * Call board_init_f -- never returns
 	 */
diff --git a/arch/nios2/include/asm/config.h b/arch/nios2/include/asm/config.h
index 9c13848..cd29734 100644
--- a/arch/nios2/include/asm/config.h
+++ b/arch/nios2/include/asm/config.h
@@ -7,6 +7,4 @@ 
 #ifndef _ASM_CONFIG_H_
 #define _ASM_CONFIG_H_
 
-#define CONFIG_SYS_GENERIC_GLOBAL_DATA
-
 #endif