From patchwork Wed Mar 2 07:40:06 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshinori Sato X-Patchwork-Id: 85039 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 29E13B7088 for ; Wed, 2 Mar 2011 18:59:13 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0427228102; Wed, 2 Mar 2011 08:59:08 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZV2Qo+MgEBvC; Wed, 2 Mar 2011 08:59:07 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5862B280FB; Wed, 2 Mar 2011 08:59:06 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D0796280F4 for ; Wed, 2 Mar 2011 08:59:03 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RH46Pxln6gRp for ; Wed, 2 Mar 2011 08:59:02 +0100 (CET) X-Greylist: delayed 1072 seconds by postgrey-1.27 at theia; Wed, 02 Mar 2011 08:59:00 CET X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail2.asahi-net.or.jp (mail2.asahi-net.or.jp [202.224.39.198]) by theia.denx.de (Postfix) with ESMTP id 0C58128084 for ; Wed, 2 Mar 2011 08:59:00 +0100 (CET) Received: from sk22g2 (y081184.ppp.asahi-net.or.jp [118.243.81.184]) by mail2.asahi-net.or.jp (Postfix) with ESMTP id 4A5D8D9E3B for ; Wed, 2 Mar 2011 16:41:05 +0900 (JST) Received: from 10A9073.labs.sios.com.ath.cx (unknown [192.168.16.128]) by sk22g2 (Postfix) with ESMTP id 6DF6F492F for ; Wed, 2 Mar 2011 16:41:05 +0900 (JST) Date: Wed, 02 Mar 2011 16:40:06 +0900 Message-ID: <87vd029dih.wl%ysato@users.sourceforge.jp> From: Yoshinori Sato User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?ISO-2022-JP-2?B?R29qGyQoRCtXGyhC?=) APEL/10.8 Emacs/23.2 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) To: u-boot@lists.denx.de MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Subject: [U-Boot] [PATCH 3/5] Add h8300 architecture part3 - misc X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This part h8300 cpu support (3/3) Signed-off-by: Yoshinori Sato --- common/cmd_bdinfo.c | 20 ++++++++++++++++++++ common/cmd_bootm.c | 2 ++ examples/standalone/Makefile | 3 +-- examples/standalone/stubs.c | 20 ++++++++++++++++++-- include/image.h | 5 +++++ 5 files changed, 46 insertions(+), 4 deletions(-) diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c index bba7374..4c8494d 100644 --- a/common/cmd_bdinfo.c +++ b/common/cmd_bdinfo.c @@ -410,6 +410,26 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return 0; } +#elif defined(CONFIG_H8300) + +int do_bdinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ + bd_t *bd = gd->bd; + print_num ("mem start ", (ulong)bd->bi_memstart); + print_lnum ("mem size ", (u64)bd->bi_memsize); +#if !defined(CONFIG_SYS_NO_FLASH) + print_num ("flash start ", (ulong)bd->bi_flashstart); + print_num ("flash size ", (ulong)bd->bi_flashsize); + print_num ("flash offset ", (ulong)bd->bi_flashoffset); +#endif + +#if defined(CONFIG_CMD_NET) + print_eth(0); + printf ("ip_addr = %pI4\n", &bd->bi_ip_addr); +#endif + printf ("baudrate = %ld bps\n", (ulong)bd->bi_baudrate); + return 0; +} #else #error "a case for this architecture does not exist!" diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 18019d6..08321e7 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -187,6 +187,8 @@ void arch_preboot_os(void) __attribute__((weak, alias("__arch_preboot_os"))); #define IH_INITRD_ARCH IH_ARCH_SH #elif defined(__sparc__) #define IH_INITRD_ARCH IH_ARCH_SPARC +#elif defined(__H8300H__) || defined(__H8300S__) + #define IH_INITRD_ARCH IH_ARCH_H8300 #else # error Unknown CPU type #endif diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile index c1dfdce..e5eaf5b 100644 --- a/examples/standalone/Makefile +++ b/examples/standalone/Makefile @@ -68,8 +68,6 @@ ELF := $(addprefix $(obj),$(ELF)) BIN := $(addprefix $(obj),$(BIN)) SREC := $(addprefix $(obj),$(SREC)) -gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`) - CPPFLAGS += -I.. # For PowerPC there's no need to compile standalone applications as a @@ -86,6 +84,7 @@ endif # application's entry point will be the first function in the application's # source file. CFLAGS += $(call cc-option,-fno-toplevel-reorder) +gcclibdir := $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) all: $(obj).depend $(OBJS) $(LIB) $(SREC) $(BIN) $(ELF) diff --git a/examples/standalone/stubs.c b/examples/standalone/stubs.c index 2d2e709..957326f 100644 --- a/examples/standalone/stubs.c +++ b/examples/standalone/stubs.c @@ -167,7 +167,20 @@ gd_t *global_data; " jmp %%g1\n" \ " nop\n" \ : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "g1" ); - +#elif defined(CONFIG_H8300) +/* + * er5 holds the pointer to the global_data. er0 is call clobbered. + */ +#define EXPORT_FUNC(x) \ + asm volatile( \ + " .globl\t_" #x "\n" \ + "_" #x ":\n" \ + " mov.l er5,er0\n" \ + " add.l %0,er0\n" \ + " add.l %1,er0\n" \ + " mov.l @er0,er0\n" \ + " jmp @er0\n" \ + : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "er0" ); #else #error stubs definition missing for this architecture #endif @@ -186,7 +199,10 @@ void __attribute__((unused)) dummy(void) { #include <_exports.h> } - +#if defined(CONFIG_H8300) +#define __bss_start _bss_start +#define _end end +#endif extern unsigned long __bss_start, _end; void app_startup(char * const *argv) diff --git a/include/image.h b/include/image.h index 005e0d2..8cee0fc 100644 --- a/include/image.h +++ b/include/image.h @@ -106,6 +106,7 @@ #define IH_ARCH_BLACKFIN 16 /* Blackfin */ #define IH_ARCH_AVR32 17 /* AVR32 */ #define IH_ARCH_ST200 18 /* STMicroelectronics ST200 */ +#define IH_ARCH_H8300 19 /* H8/300 */ /* * Image Types @@ -504,6 +505,8 @@ static inline int image_check_target_arch (const image_header_t *hdr) if (!image_check_arch (hdr, IH_ARCH_SH)) #elif defined(__sparc__) if (!image_check_arch (hdr, IH_ARCH_SPARC)) +#elif defined(__H8300H__) || defined(__H8300S__) + if (!image_check_arch (hdr, IH_ARCH_H8300)) #else # error Unknown CPU type #endif @@ -656,6 +659,8 @@ static inline int fit_image_check_target_arch (const void *fdt, int node) if (!fit_image_check_arch (fdt, node, IH_ARCH_SH)) #elif defined(__sparc__) if (!fit_image_check_arch (fdt, node, IH_ARCH_SPARC)) +#elif defined(__H8300H__) || defined(__H8300S__) + if (!image_check_arch (hdr, IH_ARCH_H8300)) #else # error Unknown CPU type #endif