Skip to contentSkip to conversation

sh: Convert generic board

PATCH New Yoshinori Sato 4 participants 17 messages May 19, 2016 – Jun 7, 2016 SuperH

lore
Share & tools
lore

Yoshinori Sato

author maintainer
#0 lore raw

cover sh: Convert generic board

Hello.
This patch series convert generic board for SH.
Tested on r2dplus target.

Yoshinori Sato (9):
board_f: Add relocate_code stub
board_f: Add SH specific timer_init
board_f: if SKIP_RELOC is ture, return from board_init_f
board_f: Add SH specific mon_len
sh: Add missing symbol for generic board
sh: Remove arch specific board.c
sh: generic board support - startup
sh: generic board support - header
sh: generic board support - Kconfig

 arch/Kconfig                 |   2 +
 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 ++++--
 arch/sh/cpu/u-boot.lds       |   1 +
 arch/sh/include/asm/u-boot.h |  11 +--
 arch/sh/lib/Makefile         |   1 -
 arch/sh/lib/board.c          | 189 -------------------------------------------
 common/board_f.c             |  12 ++-
 12 files changed, 86 insertions(+), 223 deletions(-)
 delete mode 100644 arch/sh/lib/board.c
Signature · 1 line
2.7.0
author maintainer
#1 lore raw

PATCH 1/9 board_f: Add relocate_code stub

---
 common/board_f.c | 5 +++++
 1 file changed, 5 insertions(+)
common/board_f.c +5 -0
index 109025a..bf768d1 100644
@@ -826,6 +826,11 @@ __weak int arch_cpu_init_dm(void)
 	return 0;
 }
 
+__weak void relocate_code(ulong sp, gd_t *new_gd, ulong reloc)
+{
+	for(;;);
+}
+
 static init_fnc_t init_sequence_f[] = {
 #ifdef CONFIG_SANDBOX
 	setup_ram_buf,
Signature · 1 line
2.7.0
author maintainer
#2 lore raw

PATCH 2/9 board_f: Add SH specific timer_init

In reply to Yoshinori Sato
---
 common/board_f.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/board_f.c +1 -1
index bf768d1..fcc69b8 100644
@@ -870,7 +870,7 @@ static init_fnc_t init_sequence_f[] = {
 #endif
 #if defined(CONFIG_ARM) || defined(CONFIG_MIPS) || \
 		defined(CONFIG_BLACKFIN) || defined(CONFIG_NDS32) || \
-		defined(CONFIG_SPARC)
+		defined(CONFIG_SPARC) || defined(CONFIG_SH)
 	timer_init,		/* initialize timer */
 #endif
 #ifdef CONFIG_SYS_ALLOC_DPRAM
Signature · 1 line
2.7.0
author maintainer
#3 lore raw

PATCH 3/9 board_f: if SKIP_RELOC is ture, return from board_init_f

In reply to Yoshinori Sato
---
 common/board_f.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
common/board_f.c +2 -1
index fcc69b8..e1122e3 100644
@@ -1067,7 +1067,8 @@ void board_init_f(ulong boot_flags)
 #if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX) && \
 		!defined(CONFIG_EFI_APP)
 	/* NOTREACHED - jump_to_copy() does not return */
-	hang();
+        if (!(gd->flags & GD_FLG_SKIP_RELOC))
+		hang();
 #endif
 }
 
Signature · 1 line
2.7.0
author maintainer
#4 lore raw

PATCH 4/9 board_f: Add SH specific mon_len

In reply to Yoshinori Sato
---
 common/board_f.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/board_f.c +1 -1
index e1122e3..f31f2de 100644
@@ -270,7 +270,7 @@ static int setup_mon_len(void)
 	gd->mon_len = (ulong)&__bss_end - (ulong)_start;
 #elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
 	gd->mon_len = (ulong)&_end - (ulong)_init;
-#elif defined(CONFIG_BLACKFIN) || defined(CONFIG_NIOS2)
+#elif defined(CONFIG_BLACKFIN) || defined(CONFIG_NIOS2) || defined(CONFIG_SH)
 	gd->mon_len = CONFIG_SYS_MONITOR_LEN;
 #elif defined(CONFIG_NDS32)
 	gd->mon_len = (ulong)(&__bss_end) - (ulong)(&_start);
Signature · 1 line
2.7.0
author maintainer
#5 lore raw

PATCH 5/9 sh: Add missing symbol for generic board

In reply to Yoshinori Sato
---
 arch/sh/cpu/u-boot.lds | 1 +
 1 file changed, 1 insertion(+)
arch/sh/cpu/u-boot.lds +1 -0
index 30c7a9d..4e8b718 100644
@@ -80,4 +80,5 @@ SECTIONS
 	PROVIDE (bss_end = .);
 
 	PROVIDE (__bss_end = .);
+	PROVIDE (__init_end = .);
 }
Signature · 1 line
2.7.0
author maintainer
#6 lore raw

PATCH 6/9 sh: Remove arch specific board.c

In reply to Yoshinori Sato
---
 arch/sh/lib/Makefile |   1 -
 arch/sh/lib/board.c  | 189 ---------------------------------------------------
 2 files changed, 190 deletions(-)
 delete mode 100644 arch/sh/lib/board.c
arch/sh/lib/Makefile +0 -1
index f7ae4f8..c5cf89f 100644
@@ -6,7 +6,6 @@
 #
 
 
-obj-y	+= board.o
 obj-$(CONFIG_CMD_BOOTM) += bootm.o
 ifeq ($(CONFIG_CPU_SH2),y)
 obj-y	+= time_sh2.o
arch/sh/lib/board.c deleted +0 -189

189 lines not on this page · raw message

Signature · 1 line
2.7.0
author maintainer
#7 lore raw

PATCH 7/9 sh: generic board support - startup

In reply to Yoshinori Sato
---
 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(-)
arch/sh/cpu/sh2/cpu.c +9 -0
index a2f856f..8119893 100644
@@ -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;
+}
arch/sh/cpu/sh2/start.S +16 -6
index ebf731a..0ee771c 100644
@@ -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
arch/sh/cpu/sh3/cpu.c +9 -0
index ea0006a..85cb6a3 100644
@@ -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;
+}
arch/sh/cpu/sh3/start.S +15 -6
index 7a934e2..a1633a7 100644
@@ -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
arch/sh/cpu/sh4/cpu.c +9 -0
index e8ee0a4..fea8e59 100644
@@ -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;
+}
arch/sh/cpu/sh4/start.S +15 -8
index 21644b5..52f960c 100644
@@ -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
Signature · 1 line
2.7.0
author maintainer
#8 lore raw

PATCH 8/9 sh: generic board support - header

In reply to Yoshinori Sato
---
 arch/sh/include/asm/u-boot.h | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
arch/sh/include/asm/u-boot.h +1 -10
index ea37c24..9e578a6 100644
@@ -12,16 +12,7 @@
 #ifndef __ASM_SH_U_BOOT_H_
 #define __ASM_SH_U_BOOT_H_
 
-typedef struct bd_info {
-	unsigned long   bi_memstart;    /* start of DRAM memory */
-	phys_size_t	bi_memsize;     /* size  of DRAM memory in bytes */
-	unsigned long   bi_flashstart;  /* start of FLASH memory */
-	unsigned long   bi_flashsize;   /* size  of FLASH memory */
-	unsigned long   bi_flashoffset; /* reserved area for startup monitor */
-	unsigned long   bi_sramstart;   /* start of SRAM memory */
-	unsigned long   bi_sramsize;    /* size  of SRAM memory */
-	unsigned long	bi_boot_params; /* where this board expects params */
-} bd_t;
+#include <asm-generic/u-boot.h>
 
 /* For image.h:image_check_target_arch() */
 #define IH_ARCH_DEFAULT IH_ARCH_SH
Signature · 1 line
2.7.0
author maintainer
#9 lore raw

PATCH 9/9 sh: generic board support - Kconfig

In reply to Yoshinori Sato
---
 arch/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
arch/Kconfig +2 -0
index ec12013..291e1dc 100644
@@ -96,6 +96,8 @@ config SANDBOX
 config SH
 	bool "SuperH architecture"
 	select HAVE_PRIVATE_LIBGCC
+	select HAVE_GENERIC_BOARD
+	select SYS_GENERIC_BOARD
 
 config SPARC
 	bool "SPARC architecture"
Signature · 1 line
2.7.0
#10 lore raw

cover sh: Convert generic board

In reply to Yoshinori Sato
Quoted 3 lines · Yoshinori Sato

Hello.
This patch series convert generic board for SH.
Tested on r2dplus target.

Since I believe you said before this was QEMU, how did you start it off? Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160520/8a22e141/attachment.sig>
author maintainer
#11 lore raw

cover sh: Convert generic board

Quoted 11 lines · Tom Rini

[1 <text/plain; us-ascii (quoted-printable)>]

Quoted 3 lines · Yoshinori Sato

Hello.
This patch series convert generic board for SH.
Tested on r2dplus target.

Since I believe you said before this was QEMU, how did you start it off? Thanks!

Yes.
I tested comannd bellow

$ qemu-system-sh4 -M r2d -kernel u-boot.bin -serial null -serial vc

You can see banner for serial1 console (crtl - alt - 3).

Thanks.

Quoted 4 lines
Signature · 3 lines
Tom
[2 Digital signature <application/pgp-signature (7bit)>]
No public key for 87F9F635D31D7652 created at 2016-05-21T10:28:42+0900 using RSA
Signature · 2 lines
Yoshinori Sato
<[email protected]>
#12 lore raw

cover sh: Convert generic board

Quoted 14 lines · Yoshinori Sato
Quoted 11 lines · Tom Rini

[1 <text/plain; us-ascii (quoted-printable)>]

Quoted 3 lines · Yoshinori Sato

Hello.
This patch series convert generic board for SH.
Tested on r2dplus target.

Since I believe you said before this was QEMU, how did you start it off? Thanks!

Quoted 5 lines

Yes.
I tested comannd bellow

$ qemu-system-sh4 -M r2d -kernel u-boot.bin -serial null -serial vc

You can see banner for serial1 console (crtl - alt - 3).

OK, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160522/fcf57a6e/attachment.sig>
#13 lore raw

cover sh: Convert generic board

In reply to Yoshinori Sato

Hi,

Quoted 10 lines · Yoshinori Sato
Quoted 8 lines · Tom Rini

[1 <text/plain; us-ascii (quoted-printable)>]

Quoted 3 lines · Yoshinori Sato

Hello.
This patch series convert generic board for SH.
Tested on r2dplus target.

Quoted 7 lines
Quoted 3 lines

Since I believe you said before this was QEMU, how did you start it off? Thanks!

Yes.
I tested comannd bellow

$ qemu-system-sh4 -M r2d -kernel u-boot.bin -serial null -serial vc

Please can you add a README.sh showing how to do this? It would be good to have the instructions in the source tree for future reference.

Quoted 5 lines

You can see banner for serial1 console (crtl - alt - 3).

Thanks.

Regards,
SImon

#14 lore raw

cover sh: Convert generic board

In reply to Yoshinori Sato

Hi,

Sorry, my reply was too late. And thanks for your work.

2016-05-19 21:26 GMT+09:00 Yoshinori Sato <[email protected]>:

Quoted 6 lines

Hello.
This patch series convert generic board for SH.
Tested on r2dplus target.

Yoshinori Sato (9):
board_f: Add relocate_code stub

Please add more infomation to commit log.
This patch contains the fixes that are referenced by other architectures.

Quoted 8 lines

board_f: Add SH specific timer_init
board_f: if SKIP_RELOC is ture, return from board_init_f
board_f: Add SH specific mon_len
sh: Add missing symbol for generic board
sh: Remove arch specific board.c
sh: generic board support - startup
sh: generic board support - header
sh: generic board support - Kconfig

Best regards,
Nobuhiro

Signature · 3 lines
Nobuhiro Iwamatsu
   iwamatsu at {nigauri.org / debian.org}
   GPG ID: 40AD1FA6
#15 lore raw

cover sh: Convert generic board

Hi, again.

Same fixes and you had already been taken up by Simon. I'm sorry to reply and confirmation slow.

Best regards,
Nobuhiro

2016-06-07 9:14 GMT+09:00 Nobuhiro Iwamatsu <[email protected]>:

Quoted 33 lines

Hi,

Sorry, my reply was too late. And thanks for your work.

2016-05-19 21:26 GMT+09:00 Yoshinori Sato <[email protected]>:

Quoted 6 lines

Hello.
This patch series convert generic board for SH.
Tested on r2dplus target.

Yoshinori Sato (9):
board_f: Add relocate_code stub

Please add more infomation to commit log.
This patch contains the fixes that are referenced by other architectures.

Quoted 8 lines

board_f: Add SH specific timer_init
board_f: if SKIP_RELOC is ture, return from board_init_f
board_f: Add SH specific mon_len
sh: Add missing symbol for generic board
sh: Remove arch specific board.c
sh: generic board support - startup
sh: generic board support - header
sh: generic board support - Kconfig

Best regards,
Nobuhiro

--
Nobuhiro Iwamatsu
iwamatsu at {nigauri.org / debian.org}
GPG ID: 40AD1FA6

Signature · 3 lines
Nobuhiro Iwamatsu
   iwamatsu at {nigauri.org / debian.org}
   GPG ID: 40AD1FA6
author maintainer
#16 lore raw

cover sh: Convert generic board

Quoted 8 lines · Nobuhiro Iwamatsu

Hi, again.

Same fixes and you had already been taken up by Simon. I'm sorry to reply and confirmation slow.

Best regards,
Nobuhiro

OK.
I'll sent V2.

Quoted 42 lines

2016-06-07 9:14 GMT+09:00 Nobuhiro Iwamatsu <[email protected]>:

Quoted 33 lines

Hi,

Sorry, my reply was too late. And thanks for your work.

2016-05-19 21:26 GMT+09:00 Yoshinori Sato <[email protected]>:

Quoted 6 lines

Hello.
This patch series convert generic board for SH.
Tested on r2dplus target.

Yoshinori Sato (9):
board_f: Add relocate_code stub

Please add more infomation to commit log.
This patch contains the fixes that are referenced by other architectures.

Quoted 8 lines

board_f: Add SH specific timer_init
board_f: if SKIP_RELOC is ture, return from board_init_f
board_f: Add SH specific mon_len
sh: Add missing symbol for generic board
sh: Remove arch specific board.c
sh: generic board support - startup
sh: generic board support - header
sh: generic board support - Kconfig

Best regards,
Nobuhiro

--
Nobuhiro Iwamatsu
iwamatsu at {nigauri.org / debian.org}
GPG ID: 40AD1FA6

Signature · 3 lines
Nobuhiro Iwamatsu
   iwamatsu at {nigauri.org / debian.org}
   GPG ID: 40AD1FA6
Signature · 2 lines
Yoshinori Sato
<[email protected]>