From patchwork Wed Mar 6 00:39:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 225207 X-Patchwork-Delegate: trini@ti.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 467B42C02A8 for ; Wed, 6 Mar 2013 11:41:52 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A2D4F4A1F1; Wed, 6 Mar 2013 01:41:48 +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 5jawyKyZ2rUl; Wed, 6 Mar 2013 01:41:48 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0FEAC4A1D3; Wed, 6 Mar 2013 01:41:15 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CBA2F4A1EC for ; Wed, 6 Mar 2013 01:41:07 +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 tos7MoU2zDIH for ; Wed, 6 Mar 2013 01:41:06 +0100 (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 mail-ve0-f202.google.com (mail-ve0-f202.google.com [209.85.128.202]) by theia.denx.de (Postfix) with ESMTPS id 086364A1CD for ; Wed, 6 Mar 2013 01:41:01 +0100 (CET) Received: by mail-ve0-f202.google.com with SMTP id m1so807328ves.3 for ; Tue, 05 Mar 2013 16:41:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=35rhGd4W/EeqeucjitoHJX3BiLvZS1I7LxTIs2MwN6A=; b=ViwvLahma1K12wsiHnx4JWZcaw13KlTiH71KLAsEO30aTUmIrTHKfqr7++jkL7C4S5 x2SgmG5H2/6UnKLgb35vdJ82HQpf0QaeFUQ+Q3aywg2xMY0Bz6/zmckVeLI5zMFTLI35 u8fR+7zwBFLJi/91N38sT5+7BWIrWHI3IrW6Us4huV2WezLLPEk6dS1h5ki+Qlb12Pzg 3deZmHiAh3vDpSwH/wikOLTMlL8aIEdplF5x5CiCauxiMiX5qm1iIuSiPvS/WoyLlQGd hsOrlwHk4pSFKR67wCywyiPoJNZe2Vv/mDglh+E4WjZ21JG5j6BckmPHQ0lLySWd9kcB 45XQ== X-Received: by 10.236.197.226 with SMTP id t62mr15990912yhn.48.1362530460014; Tue, 05 Mar 2013 16:41:00 -0800 (PST) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id f64si444572yhj.7.2013.03.05.16.40.59 (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Tue, 05 Mar 2013 16:41:00 -0800 (PST) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.73.79]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id BD8C25A4213; Tue, 5 Mar 2013 16:40:59 -0800 (PST) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id 8030C160BCE; Tue, 5 Mar 2013 16:40:59 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Date: Tue, 5 Mar 2013 16:39:42 -0800 Message-Id: <1362530405-10824-9-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.8.1.3 In-Reply-To: <1362530405-10824-1-git-send-email-sjg@chromium.org> References: <1362530405-10824-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQlwg26zJNcC/+Pt+ZaOpWoAu5uhNxBp/c7cEttUdA3OvW5t0CgcgJ9FuP5GjOgKcwPu3RXGPbIdbEJC6Xa1Hh58oVpkCbcoy3Wc4KKQqME71s7a9ETS5QgAvJKsRYfeqDmVymsjdGIo1N/AQyIPfd834j3XOMOIfJK5R843aNZHGll7wBMuy4ts7Mol1+tiUw7IRsPr Cc: Graeme Russ , Tom Rini , Vadim Bendebury Subject: [U-Boot] [PATCH v6 08/31] Declare watchdog functions in watchdog.h 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: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de These functions are only available for powerpc and are not declared in a header file. We want to use the rest function in two places (board_f and board_r), so declare the functions in watchdog.h. Signed-off-by: Simon Glass --- Changes in v6: - Fix up watchdog support for m68k and sh Changes in v5: - Avoid using static declaration for init_func_watchdog_reset() Changes in v4: None Changes in v3: None Changes in v2: None arch/m68k/lib/board.c | 1 + arch/powerpc/lib/board.c | 11 ++--------- arch/sh/lib/board.c | 1 + include/watchdog.h | 18 ++++++++++++++++++ 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/arch/m68k/lib/board.c b/arch/m68k/lib/board.c index b676255..adaccfe 100644 --- a/arch/m68k/lib/board.c +++ b/arch/m68k/lib/board.c @@ -80,6 +80,7 @@ extern ulong __init_end; extern ulong __bss_end; #if defined(CONFIG_WATCHDOG) +# undef INIT_FUNC_WATCHDOG_INIT # define INIT_FUNC_WATCHDOG_INIT watchdog_init, # define WATCHDOG_DISABLE watchdog_disable diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c index 0b23d30..acb6fdb 100644 --- a/arch/powerpc/lib/board.c +++ b/arch/powerpc/lib/board.c @@ -237,25 +237,18 @@ static int init_func_spi(void) /***********************************************************************/ #if defined(CONFIG_WATCHDOG) -static int init_func_watchdog_init(void) +int init_func_watchdog_init(void) { puts(" Watchdog enabled\n"); WATCHDOG_RESET(); return 0; } -#define INIT_FUNC_WATCHDOG_INIT init_func_watchdog_init, - -static int init_func_watchdog_reset(void) +int init_func_watchdog_reset(void) { WATCHDOG_RESET(); return 0; } - -#define INIT_FUNC_WATCHDOG_RESET init_func_watchdog_reset, -#else -#define INIT_FUNC_WATCHDOG_INIT /* undef */ -#define INIT_FUNC_WATCHDOG_RESET /* undef */ #endif /* CONFIG_WATCHDOG */ /* diff --git a/arch/sh/lib/board.c b/arch/sh/lib/board.c index 34d7881..6e43acf 100644 --- a/arch/sh/lib/board.c +++ b/arch/sh/lib/board.c @@ -65,6 +65,7 @@ static int sh_flash_init(void) #if defined(CONFIG_WATCHDOG) extern int watchdog_init(void); extern int watchdog_disable(void); +# undef INIT_FUNC_WATCHDOG_INIT # define INIT_FUNC_WATCHDOG_INIT watchdog_init, # define WATCHDOG_DISABLE watchdog_disable #else diff --git a/include/watchdog.h b/include/watchdog.h index 8c92a0b..97ec186 100644 --- a/include/watchdog.h +++ b/include/watchdog.h @@ -27,6 +27,24 @@ #ifndef _WATCHDOG_H_ #define _WATCHDOG_H_ +#if !defined(__ASSEMBLY__) +/* + * Reset the watchdog timer, always returns 0 + * + * This function is here since it is shared between board_f() and board_r(), + * and the legacy arch//board.c code. + */ +int init_func_watchdog_reset(void); +#endif + +#ifdef CONFIG_WATCHDOG +#define INIT_FUNC_WATCHDOG_INIT init_func_watchdog_init, +#define INIT_FUNC_WATCHDOG_RESET init_func_watchdog_reset, +#else +#define INIT_FUNC_WATCHDOG_INIT +#define INIT_FUNC_WATCHDOG_RESET +#endif + #if defined(CONFIG_HW_WATCHDOG) && defined(CONFIG_WATCHDOG) # error "Configuration error: CONFIG_HW_WATCHDOG and CONFIG_WATCHDOG can't be used together." #endif