public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Yoshinori Sato <ysato@users.sourceforge.jp>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 7/9] sh: generic board support - startup
Date: Thu, 19 May 2016 21:26:53 +0900	[thread overview]
Message-ID: <1463660815-26050-8-git-send-email-ysato@users.sourceforge.jp> (raw)
In-Reply-To: <1463660815-26050-1-git-send-email-ysato@users.sourceforge.jp>

Signed-off-by: Yoshinori Sato <ysato@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

  parent reply	other threads:[~2016-05-19 12:26 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-19 12:26 [U-Boot] [PATCH 0/9] sh: Convert generic board Yoshinori Sato
2016-05-19 12:26 ` [U-Boot] [PATCH 1/9] board_f: Add relocate_code stub Yoshinori Sato
2016-05-19 12:26 ` [U-Boot] [PATCH 2/9] board_f: Add SH specific timer_init Yoshinori Sato
2016-05-19 12:26 ` [U-Boot] [PATCH 3/9] board_f: if SKIP_RELOC is ture, return from board_init_f Yoshinori Sato
2016-05-19 12:26 ` [U-Boot] [PATCH 4/9] board_f: Add SH specific mon_len Yoshinori Sato
2016-05-19 12:26 ` [U-Boot] [PATCH 5/9] sh: Add missing symbol for generic board Yoshinori Sato
2016-05-19 12:26 ` [U-Boot] [PATCH 6/9] sh: Remove arch specific board.c Yoshinori Sato
2016-05-19 12:26 ` Yoshinori Sato [this message]
2016-05-19 12:26 ` [U-Boot] [PATCH 8/9] sh: generic board support - header Yoshinori Sato
2016-05-19 12:26 ` [U-Boot] [PATCH 9/9] sh: generic board support - Kconfig Yoshinori Sato
2016-05-21  1:28 ` [U-Boot] [PATCH 0/9] sh: Convert generic board Tom Rini
2016-05-22  5:26   ` Yoshinori Sato
2016-05-22 13:10     ` Tom Rini
2016-06-07  6:46     ` Simon Glass
2016-06-07  0:14 ` Nobuhiro Iwamatsu
2016-06-07  0:21   ` Nobuhiro Iwamatsu
2016-06-07  6:44     ` Yoshinori Sato

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1463660815-26050-8-git-send-email-ysato@users.sourceforge.jp \
    --to=ysato@users.sourceforge.jp \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox