[U-Boot] [PATCH 7/9] sh: generic board support - startup
Yoshinori Sato
ysato at users.sourceforge.jp
Thu May 19 14:26:53 CEST 2016
Signed-off-by: Yoshinori Sato <ysato at users.sourceforge.jp>
---
arch/sh/cpu/sh2/cpu.c | 9 +++++++++
arch/sh/cpu/sh2/start.S | 22 ++++++++++++++++------
arch/sh/cpu/sh3/cpu.c | 9 +++++++++
arch/sh/cpu/sh3/start.S | 21 +++++++++++++++------
arch/sh/cpu/sh4/cpu.c | 9 +++++++++
arch/sh/cpu/sh4/start.S | 23 +++++++++++++++--------
6 files changed, 73 insertions(+), 20 deletions(-)
diff --git a/arch/sh/cpu/sh2/cpu.c b/arch/sh/cpu/sh2/cpu.c
index a2f856f..8119893 100644
--- a/arch/sh/cpu/sh2/cpu.c
+++ b/arch/sh/cpu/sh2/cpu.c
@@ -10,6 +10,8 @@
#include <asm/processor.h>
#include <asm/io.h>
+DECLARE_GLOBAL_DATA_PTR;
+
#define STBCR4 0xFFFE040C
#define cmt_clock_enable() do {\
writeb(readb(STBCR4) & ~0x04, STBCR4);\
@@ -83,3 +85,10 @@ int dcache_status(void)
{
return 0;
}
+
+int arch_cpu_init(void)
+{
+ gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
+
+ return 0;
+}
diff --git a/arch/sh/cpu/sh2/start.S b/arch/sh/cpu/sh2/start.S
index ebf731a..0ee771c 100644
--- a/arch/sh/cpu/sh2/start.S
+++ b/arch/sh/cpu/sh2/start.S
@@ -7,6 +7,7 @@
#include <asm-offsets.h>
#include <config.h>
+#include <asm-generic/global_data.h>
.text
.align 2
@@ -43,12 +44,18 @@ _init:
cmp/hs r5, r4
bf 3b
- mov.l ._gd_init, r13 /* global data */
- mov.l ._stack_init, r15 /* stack */
+ mov.l ._stack_init, r15
+ mov.l ._board_init_f_init_reserve, r0
+ jsr @r0
+ mov r15, r4
- mov.l ._sh_generic_init, r0
+ mov.l ._board_init_f, r0
jsr @r0
- nop
+ mov ._bootflag ,r4
+
+ mov.l ._board_init_r, r0
+ jsr @r0
+ mov r13,r4
loop:
bra loop
@@ -61,5 +68,8 @@ loop:
._bss_start: .long bss_start
._bss_end: .long bss_end
._gd_init: .long (_sh_start - GENERATED_GBL_DATA_SIZE)
-._stack_init: .long (_sh_start - GENERATED_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - 16)
-._sh_generic_init: .long sh_generic_init
+._stack_init: .long (_sh_start - GENERATED_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - CONFIG_ENV_SIZE- 16)
+._board_init_f: .long board_init_f
+._board_init_r: .long board_init_r
+._board_init_f_init_reserve: .long board_init_f_init_reserve
+._bootflag: .long GD_FLG_SKIP_RELOC
diff --git a/arch/sh/cpu/sh3/cpu.c b/arch/sh/cpu/sh3/cpu.c
index ea0006a..85cb6a3 100644
--- a/arch/sh/cpu/sh3/cpu.c
+++ b/arch/sh/cpu/sh3/cpu.c
@@ -12,6 +12,8 @@
#include <command.h>
#include <asm/processor.h>
+DECLARE_GLOBAL_DATA_PTR;
+
int checkcpu(void)
{
puts("CPU: SH3\n");
@@ -66,3 +68,10 @@ int dcache_status(void)
{
return 0;
}
+
+int arch_cpu_init(void)
+{
+ gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
+
+ return 0;
+}
diff --git a/arch/sh/cpu/sh3/start.S b/arch/sh/cpu/sh3/start.S
index 7a934e2..a1633a7 100644
--- a/arch/sh/cpu/sh3/start.S
+++ b/arch/sh/cpu/sh3/start.S
@@ -10,6 +10,7 @@
#include <asm-offsets.h>
#include <config.h>
+#include <asm-generic/global_data.h>
.text
.align 2
@@ -42,13 +43,18 @@ _sh_start:
cmp/hs r5, r4
bf 3b
- mov.l ._gd_init, r13 /* global data */
- mov.l ._stack_init, r15 /* stack */
+ mov.l ._stack_init, r15
+ mov.l ._board_init_f_init_reserve, r0
+ jsr @r0
+ mov r15, r4
- mov.l ._sh_generic_init, r0
+ mov.l ._board_init_f, r0
jsr @r0
- nop
+ mov #._bootflag, r4
+ mov.l ._board_init_r, r0
+ jsr @r0
+ mov r13,r4
loop:
bra loop
@@ -60,5 +66,8 @@ loop:
._bss_start: .long bss_start
._bss_end: .long bss_end
._gd_init: .long (_sh_start - GENERATED_GBL_DATA_SIZE)
-._stack_init: .long (_sh_start - GENERATED_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - 16)
-._sh_generic_init: .long sh_generic_init
+._stack_init: .long (_sh_start - GENERATED_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - CONFIG_ENV_SIZE - 16)
+._board_init_f: .long board_init_f
+._board_init_r: .long board_init_r
+._board_init_f_init_reserve: .long board_init_f_init_reserve
+._bootflag: .long GD_FLG_SKIP_RELOC
diff --git a/arch/sh/cpu/sh4/cpu.c b/arch/sh/cpu/sh4/cpu.c
index e8ee0a4..fea8e59 100644
--- a/arch/sh/cpu/sh4/cpu.c
+++ b/arch/sh/cpu/sh4/cpu.c
@@ -11,6 +11,8 @@
#include <asm/processor.h>
#include <asm/cache.h>
+DECLARE_GLOBAL_DATA_PTR;
+
int checkcpu(void)
{
puts("CPU: SH4\n");
@@ -75,3 +77,10 @@ int cpu_eth_init(bd_t *bis)
#endif
return 0;
}
+
+int arch_cpu_init(void)
+{
+ gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
+
+ return 0;
+}
diff --git a/arch/sh/cpu/sh4/start.S b/arch/sh/cpu/sh4/start.S
index 21644b5..52f960c 100644
--- a/arch/sh/cpu/sh4/start.S
+++ b/arch/sh/cpu/sh4/start.S
@@ -7,6 +7,7 @@
#include <asm-offsets.h>
#include <config.h>
+#include <asm-generic/global_data.h>
.text
.align 2
@@ -39,16 +40,20 @@ _sh_start:
cmp/hs r5, r4
bf 3b
- mov.l ._gd_init, r13 /* global data */
- mov.l ._stack_init, r15 /* stack */
+ mov.l ._stack_init, r15
+ mov.l ._board_init_f_init_reserve, r0
+ jsr @r0
+ mov r15, r4
- mov.l ._sh_generic_init, r0
+ mov.l ._board_init_f, r0
jsr @r0
- nop
+ mov.l ._bootflag, r4
+ mov.l ._board_init_r, r0
+ jsr @r0
+ mov r13,r4
loop:
bra loop
-
.align 2
._lowlevel_init: .long (lowlevel_init - (100b + 4))
@@ -56,6 +61,8 @@ loop:
._reloc_dst_end: .long reloc_dst_end
._bss_start: .long bss_start
._bss_end: .long bss_end
-._gd_init: .long (_sh_start - GENERATED_GBL_DATA_SIZE)
-._stack_init: .long (_sh_start - GENERATED_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - 16)
-._sh_generic_init: .long sh_generic_init
+._stack_init: .long (_sh_start - GENERATED_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - CONFIG_ENV_SIZE - 16)
+._board_init_f: .long board_init_f
+._board_init_r: .long board_init_r
+._board_init_f_init_reserve: .long board_init_f_init_reserve
+._bootflag: .long GD_FLG_SKIP_RELOC
--
2.7.0
More information about the U-Boot
mailing list