From patchwork Fri Aug 1 10:20:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sonic Zhang X-Patchwork-Id: 375686 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 C3A441400D7 for ; Fri, 1 Aug 2014 20:20:21 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B5D474A039; Fri, 1 Aug 2014 12:20:18 +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 YNgcm+us1kM9; Fri, 1 Aug 2014 12:20:18 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5D7574A03B; Fri, 1 Aug 2014 12:20:15 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D6A334A03B for ; Fri, 1 Aug 2014 12:20:10 +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 06xN+ScQGLEy for ; Fri, 1 Aug 2014 12:20:08 +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-bn1blp0189.outbound.protection.outlook.com [207.46.163.189]) by theia.denx.de (Postfix) with ESMTPS id 8F77C4A039 for ; Fri, 1 Aug 2014 12:20:03 +0200 (CEST) Received: from BN3PR0301CA0040.namprd03.prod.outlook.com (25.160.180.178) by BY2PR03MB362.namprd03.prod.outlook.com (10.242.237.15) with Microsoft SMTP Server (TLS) id 15.0.995.14; Fri, 1 Aug 2014 10:20:01 +0000 Received: from BN1AFFO11FD029.protection.gbl (2a01:111:f400:7c10::198) by BN3PR0301CA0040.outlook.office365.com (2a01:111:e400:4000::50) with Microsoft SMTP Server (TLS) id 15.0.995.14 via Frontend Transport; Fri, 1 Aug 2014 10:20:00 +0000 Received: from nwd2mta2.analog.com (137.71.25.57) by BN1AFFO11FD029.mail.protection.outlook.com (10.58.52.184) with Microsoft SMTP Server (TLS) id 15.0.990.10 via Frontend Transport; Fri, 1 Aug 2014 10:20:00 +0000 Received: from NWD2HUBCAS7.ad.analog.com (nwd2hubcas7.ad.analog.com [10.64.72.140]) by nwd2mta2.analog.com (8.13.8/8.13.8) with ESMTP id s71CsRrB001777 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Fri, 1 Aug 2014 08:54:28 -0400 Received: from zeus.spd.analog.com (10.64.82.11) by NWD2HUBCAS7.ad.analog.com (10.64.72.140) with Microsoft SMTP Server id 14.3.158.1; Fri, 1 Aug 2014 06:19:04 -0400 Received: from linux.site ([10.99.22.20]) by zeus.spd.analog.com (8.14.6/8.14.6) with ESMTP id s71AJ1bL004225; Fri, 1 Aug 2014 06:19:02 -0400 Received: from nine.ad.analog.com (unknown [10.99.24.98]) by linux.site (Postfix) with ESMTP id 6B3D23AEB759; Thu, 31 Jul 2014 20:17:21 -0600 (MDT) From: Sonic Zhang To: Tom Rini , Wolfgang Denk Date: Fri, 1 Aug 2014 18:20:02 +0800 Message-ID: <1406888402-21575-2-git-send-email-sonic.adi@gmail.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1406888402-21575-1-git-send-email-sonic.adi@gmail.com> References: <1406888402-21575-1-git-send-email-sonic.adi@gmail.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 130513620004624871; (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:(6009001)(189002)(199002)(102836001)(73972005)(36756003)(92566001)(81542001)(95666004)(4396001)(82202001)(87936001)(77982001)(79102001)(50986999)(87572001)(33646002)(99396002)(229853001)(85306004)(80022001)(81442001)(88136002)(74662001)(55446002)(50466002)(107046002)(19580395003)(61266001)(89996001)(31966008)(47776003)(74502001)(21056001)(93916002)(85852003)(87286001)(81342001)(86362001)(46102001)(19580405001)(20776003)(83072002)(62966002)(77156001)(64706001)(6806004)(76176999)(104166001)(48376002)(44976005)(92726001)(105596002)(41533002); DIR:OUT; SFP:; SCL:1; SRVR:BY2PR03MB362; H:nwd2mta2.analog.com; FPR:; MLV:sfv; PTR:nwd2mail11.analog.com; MX:1; A:1; LANG:en; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID: X-Forefront-PRVS: 029097202E 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 v3 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 --- common/board_f.c | 35 ++++++++++++++++++++++++++++------- include/watchdog.h | 2 +- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/common/board_f.c b/common/board_f.c index bdab38e..c934365 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -104,9 +104,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(); @@ -144,7 +149,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 @@ -259,6 +268,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; @@ -514,11 +525,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 @@ -719,7 +732,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); @@ -802,7 +817,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 @@ -901,6 +916,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 @@ -921,7 +940,9 @@ static init_fnc_t init_sequence_f[] = { && !defined(CONFIG_ARM) && !defined(CONFIG_X86) 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 aacacb9..437df4b 100644 --- a/include/watchdog.h +++ b/include/watchdog.h @@ -21,7 +21,7 @@ int init_func_watchdog_reset(void); #endif -#ifdef CONFIG_WATCHDOG +#if 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