From patchwork Thu Aug 7 07:08:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sonic Zhang X-Patchwork-Id: 377763 X-Patchwork-Delegate: sonic.adi@gmail.com 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 1C7691400B9 for ; Thu, 7 Aug 2014 17:09:01 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 513B8A76B7; Thu, 7 Aug 2014 09:08: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 hxBLYinMTOpl; Thu, 7 Aug 2014 09:08:59 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 535FDA76BB; Thu, 7 Aug 2014 09:08:56 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7B4B5A76BB for ; Thu, 7 Aug 2014 09:08:52 +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 hgsYFERP16vk for ; Thu, 7 Aug 2014 09:08:50 +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 na01-bn1-obe.outbound.protection.outlook.com (mail-bn1blp0182.outbound.protection.outlook.com [207.46.163.182]) by theia.denx.de (Postfix) with ESMTPS id 9813DA76B7 for ; Thu, 7 Aug 2014 09:08:45 +0200 (CEST) Received: from BY2PR03CA055.namprd03.prod.outlook.com (10.141.249.28) by BY2PR03MB364.namprd03.prod.outlook.com (10.242.237.17) with Microsoft SMTP Server (TLS) id 15.0.995.14; Thu, 7 Aug 2014 07:08:42 +0000 Received: from BN1BFFO11FD053.protection.gbl (2a01:111:f400:7c10::1:171) by BY2PR03CA055.outlook.office365.com (2a01:111:e400:2c5d::28) with Microsoft SMTP Server (TLS) id 15.0.1005.10 via Frontend Transport; Thu, 7 Aug 2014 07:08:42 +0000 Received: from nwd2mta2.analog.com (137.71.25.57) by BN1BFFO11FD053.mail.protection.outlook.com (10.58.145.8) with Microsoft SMTP Server (TLS) id 15.0.990.10 via Frontend Transport; Thu, 7 Aug 2014 07:08:42 +0000 Received: from NWD2HUBCAS8.ad.analog.com (nwd2hubcas8.ad.analog.com [10.64.72.141]) by nwd2mta2.analog.com (8.13.8/8.13.8) with ESMTP id s779hglB020335 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Thu, 7 Aug 2014 05:43:44 -0400 Received: from zeus.spd.analog.com (10.64.82.11) by NWD2HUBCAS8.ad.analog.com (10.64.72.141) with Microsoft SMTP Server id 14.3.158.1; Thu, 7 Aug 2014 03:07:55 -0400 Received: from linux.site ([10.99.22.20]) by zeus.spd.analog.com (8.14.6/8.14.6) with ESMTP id s7777qbc018127; Thu, 7 Aug 2014 03:07:53 -0400 Received: from nine.ad.analog.com (unknown [10.99.24.98]) by linux.site (Postfix) with ESMTP id 7004E3AEB888; Wed, 6 Aug 2014 17:06:21 -0600 (MDT) From: Sonic Zhang To: Tom Rini , Wolfgang Denk Date: Thu, 7 Aug 2014 15:08:52 +0800 Message-ID: <1407395332-20363-2-git-send-email-sonic.adi@gmail.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1407395332-20363-1-git-send-email-sonic.adi@gmail.com> References: <1407395332-20363-1-git-send-email-sonic.adi@gmail.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 130518689220657561; (52f37747-95c3-483a-bd05-08d153b03fac); () X-Forefront-Antispam-Report: CIP:137.71.25.57; CTRY:US; IPV:NLI; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009003)(6009001)(199002)(189002)(50986999)(77982001)(74662001)(89996001)(76176999)(74502001)(102836001)(79102001)(33646002)(87572001)(81542001)(87936001)(107046002)(21056001)(95666004)(61266001)(46102001)(229853001)(44976005)(82202001)(86362001)(85306004)(73972005)(36756003)(93916002)(81442001)(575784001)(6806004)(64706001)(105596002)(106466001)(19580405001)(77156001)(62966002)(48376002)(92726001)(85852003)(20776003)(73392001)(83072002)(55446002)(47776003)(50466002)(88136002)(19580395003)(50226001)(104166001)(87286001)(80022001)(4396001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR03MB364; H:nwd2mta2.analog.com; FPR:; MLV:sfv; PTR:nwd2mail11.analog.com; A:1; MX:1; LANG:en; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID: X-Forefront-PRVS: 029651C7A1 Received-SPF: SoftFail (protection.outlook.com: domain of transitioning gmail.com discourages use of 137.71.25.57 as permitted sender) Authentication-Results: spf=softfail (sender IP is 137.71.25.57) smtp.mailfrom=sonic.adi@gmail.com; Cc: u-boot@lists.denx.de, Sonic Zhang , adi-u-boot-devel@lists.sourceforge.net Subject: [U-Boot] [PATCH v4 2/2] support blackfin board initialization in generic board_f X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 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 From: Sonic Zhang - init hardware watchdog if applicable - use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin - reserve u-boot memory at the top field of the RAM for Blackfin - avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin Signed-off-by: Sonic Zhang --- v2-changes: - make hardware watchdog init depend on BLACKFIN || M68K || MICROBLAZE || SH - define watchdog init and reset macros for both software and hardware watchdog v3-changes: - allocate board info struct only when it is not already allocated in arch init v4-changes: - Init hw watchdog only when generic board macro is defined, because m68k havsn't switched over to generic board yet. - avoid reserving video for Blackfin boards --- common/board_f.c | 45 ++++++++++++++++++++++++++++++++++----------- include/watchdog.h | 3 ++- 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/common/board_f.c b/common/board_f.c index 6203d85..d5e7622 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -106,9 +106,14 @@ __weak void blue_led_off(void) {} * Could the CONFIG_SPL_BUILD infection become a flag in gd? */ -#if defined(CONFIG_WATCHDOG) +#if defined(CONFIG_WATCHDOG) || defined(CONFIG_HW_WATCHDOG) static int init_func_watchdog_init(void) { +# if defined(CONFIG_HW_WATCHDOG) && (defined(CONFIG_BLACKFIN) || \ + defined(CONFIG_M68K) || defined(CONFIG_MICROBLAZE) || \ + defined(CONFIG_SH)) + hw_watchdog_init(); +# endif puts(" Watchdog enabled\n"); WATCHDOG_RESET(); @@ -146,7 +151,11 @@ static int display_text_info(void) bss_end = (ulong)&__bss_end; debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n", +#ifdef CONFIG_SYS_TEXT_BASE CONFIG_SYS_TEXT_BASE, bss_start, bss_end); +#else + CONFIG_SYS_MONITOR_BASE, bss_start, bss_end); +#endif #endif #ifdef CONFIG_MODEM_SUPPORT @@ -261,6 +270,8 @@ static int setup_mon_len(void) gd->mon_len = (ulong)&__bss_end - (ulong)_start; #elif defined(CONFIG_SANDBOX) gd->mon_len = (ulong)&_end - (ulong)_init; +#elif defined(CONFIG_BLACKFIN) + gd->mon_len = CONFIG_SYS_MONITOR_LEN; #else /* TODO: use (ulong)&__bss_end - (ulong)&__text_start; ? */ gd->mon_len = (ulong)&__bss_end - CONFIG_SYS_MONITOR_BASE; @@ -470,8 +481,9 @@ static int reserve_trace(void) return 0; } -#if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) \ - && !defined(CONFIG_ARM) && !defined(CONFIG_X86) +#if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && \ + !defined(CONFIG_ARM) && !defined(CONFIG_X86) && \ + !defined(CONFIG_BLACKFIN) static int reserve_video(void) { /* reserve memory for video display (always full pages) */ @@ -516,11 +528,13 @@ static int reserve_malloc(void) /* (permanently) allocate a Board Info struct */ static int reserve_board(void) { - gd->start_addr_sp -= sizeof(bd_t); - gd->bd = (bd_t *)map_sysmem(gd->start_addr_sp, sizeof(bd_t)); - memset(gd->bd, '\0', sizeof(bd_t)); - debug("Reserving %zu Bytes for Board Info at: %08lx\n", - sizeof(bd_t), gd->start_addr_sp); + if (!gd->bd) { + gd->start_addr_sp -= sizeof(bd_t); + gd->bd = (bd_t *)map_sysmem(gd->start_addr_sp, sizeof(bd_t)); + memset(gd->bd, '\0', sizeof(bd_t)); + debug("Reserving %zu Bytes for Board Info at: %08lx\n", + sizeof(bd_t), gd->start_addr_sp); + } return 0; } #endif @@ -721,7 +735,9 @@ static int reloc_fdt(void) static int setup_reloc(void) { +#ifdef CONFIG_SYS_TEXT_BASE gd->reloc_off = gd->relocaddr - CONFIG_SYS_TEXT_BASE; +#endif memcpy(gd->new_gd, (char *)gd, sizeof(gd_t)); debug("Relocation Offset is: %08lx\n", gd->reloc_off); @@ -828,7 +844,7 @@ static init_fnc_t init_sequence_f[] = { /* TODO: can we rename this to timer_init()? */ init_timebase, #endif -#if defined(CONFIG_ARM) || defined(CONFIG_MIPS) +#if defined(CONFIG_ARM) || defined(CONFIG_MIPS) || defined(CONFIG_BLACKFIN) timer_init, /* initialize timer */ #endif #ifdef CONFIG_SYS_ALLOC_DPRAM @@ -929,6 +945,10 @@ static init_fnc_t init_sequence_f[] = { * - board info struct */ setup_dest_addr, +#if defined(CONFIG_BLACKFIN) + /* Blackfin u-boot monitor should be on top of the ram */ + reserve_uboot, +#endif #if defined(CONFIG_LOGBUFFER) && !defined(CONFIG_ALT_LB_ADDR) reserve_logbuffer, #endif @@ -945,11 +965,14 @@ static init_fnc_t init_sequence_f[] = { #endif reserve_trace, /* TODO: Why the dependency on CONFIG_8xx? */ -#if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) \ - && !defined(CONFIG_ARM) && !defined(CONFIG_X86) +#if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && \ + !defined(CONFIG_ARM) && !defined(CONFIG_X86) && \ + !defined(CONFIG_BLACKFIN) reserve_video, #endif +#if !defined(CONFIG_BLACKFIN) reserve_uboot, +#endif #ifndef CONFIG_SPL_BUILD reserve_malloc, reserve_board, diff --git a/include/watchdog.h b/include/watchdog.h index bd0a8d6..9273fa1 100644 --- a/include/watchdog.h +++ b/include/watchdog.h @@ -21,7 +21,8 @@ int init_func_watchdog_reset(void); #endif -#ifdef CONFIG_WATCHDOG +#if defined(CONFIG_SYS_GENERIC_BOARD) && \ + (defined(CONFIG_WATCHDOG) || defined(CONFIG_HW_WATCHDOG)) #define INIT_FUNC_WATCHDOG_INIT init_func_watchdog_init, #define INIT_FUNC_WATCHDOG_RESET init_func_watchdog_reset, #else