From patchwork Mon May 2 13:25:11 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Macpaul Lin X-Patchwork-Id: 93661 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 BB1A9B6F59 for ; Mon, 2 May 2011 23:27:16 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DC02128237; Mon, 2 May 2011 15:26:25 +0200 (CEST) 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 iJqht-n4NUIf; Mon, 2 May 2011 15:26:25 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6285328207; Mon, 2 May 2011 15:26:02 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3197928171 for ; Mon, 2 May 2011 15:25:59 +0200 (CEST) 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 55w5ZmYiEUlj for ; Mon, 2 May 2011 15:25:58 +0200 (CEST) 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 ATCPCS06.andestech.com (59-124-160-117.HINET-IP.hinet.net [59.124.160.117]) by theia.denx.de (Postfix) with ESMTP id 00A9828187 for ; Mon, 2 May 2011 15:25:39 +0200 (CEST) Received: from app01.andestech.com ([10.0.4.31]) by ATCPCS06.andestech.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 2 May 2011 21:25:17 +0800 From: Macpaul Lin To: Macpaul Lin , u-boot@lists.denx.de, ratbert@faraday-tech.com, Chih-Min Chao , Wolfgang Denk Date: Mon, 2 May 2011 21:25:11 +0800 Message-Id: <1304342712-17120-9-git-send-email-macpaul@andestech.com> X-Mailer: git-send-email 1.7.3.5 In-Reply-To: <1302180333-25372-1-git-send-email-macpaul@andestech.com> References: <1302180333-25372-1-git-send-email-macpaul@andestech.com> X-OriginalArrivalTime: 02 May 2011 13:25:17.0107 (UTC) FILETIME=[606DF030:01CC08CC] Subject: [U-Boot] [PATCH v9 09/10] nds32: common bdinfo, bootm, image support 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: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Add support of NDS32 to common commands bdinfo, bootm, and image format. Signed-off-by: Macpaul Lin Changes for v1-v6: - Code clean up Changes for v7-v9: - No Change. --- common/cmd_bdinfo.c | 28 +++++++++++++++++++++++++++- common/cmd_bootm.c | 2 ++ common/image.c | 1 + include/image.h | 5 +++++ 4 files changed, 35 insertions(+), 1 deletions(-) diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c index 1d76ffa..cfa7de6 100644 --- a/common/cmd_bdinfo.c +++ b/common/cmd_bdinfo.c @@ -411,13 +411,39 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return 0; } +#elif defined(CONFIG_NDS32) + +int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ + int i; + bd_t *bd = gd->bd; + + print_num("arch_number", bd->bi_arch_number); + print_num("env_t", (ulong)bd->bi_env); + print_num("boot_params", (ulong)bd->bi_boot_params); + + for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) { + print_num("DRAM bank", i); + print_num("-> start", bd->bi_dram[i].start); + print_num("-> size", bd->bi_dram[i].size); + } + +#if defined(CONFIG_CMD_NET) + print_eth(0); + printf("ip_addr = %pI4\n", &bd->bi_ip_addr); +#endif + printf("baudrate = %d bps\n", bd->bi_baudrate); + + return 0; +} + #else #error "a case for this architecture does not exist!" #endif static void print_num(const char *name, ulong value) { - printf ("%-12s= 0x%08lX\n", name, value); + printf("%-12s= 0x%08lX\n", name, value); } #if !(defined(CONFIG_ARM) || defined(CONFIG_M68K)) || defined(CONFIG_CMD_NET) diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 1966da4..79b9031 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(__nds32__) + #define IH_INITRD_ARCH IH_ARCH_NDS32 #else # error Unknown CPU type #endif diff --git a/common/image.c b/common/image.c index e542a57..dac17c0 100644 --- a/common/image.c +++ b/common/image.c @@ -93,6 +93,7 @@ static const table_entry_t uimage_arch[] = { { IH_ARCH_SPARC64, "sparc64", "SPARC 64 Bit", }, { IH_ARCH_BLACKFIN, "blackfin", "Blackfin", }, { IH_ARCH_AVR32, "avr32", "AVR32", }, + { IH_ARCH_NDS32, "nds32", "NDS32", }, { -1, "", "", }, }; diff --git a/include/image.h b/include/image.h index c31e862..5a619bc 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_NDS32 19 /* ANDES Technology - NDS32 */ /* * 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(__nds32__) + if (!image_check_arch(hdr, IH_ARCH_NDS32)) #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(__nds32__) + if (!fit_image_check_arch(fdt, node, IH_ARCH_NDS32)) #else # error Unknown CPU type #endif