From patchwork Sun Apr 7 10:12:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sonic Zhang X-Patchwork-Id: 234472 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 2AA752C00BA for ; Sun, 7 Apr 2013 20:27:07 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6A0474A019; Sun, 7 Apr 2013 12:27:05 +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 YYyZzvcNn8c5; Sun, 7 Apr 2013 12:27:05 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C04454A025; Sun, 7 Apr 2013 12:27:00 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C19424A025 for ; Sun, 7 Apr 2013 12:26:58 +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 ZRnYMewuTz0f for ; Sun, 7 Apr 2013 12:26:58 +0200 (CEST) X-Greylist: delayed 907 seconds by postgrey-1.27 at theia; Sun, 07 Apr 2013 12:26:55 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 db8outboundpool.messaging.microsoft.com (mail-db8lp0189.outbound.messaging.microsoft.com [213.199.154.189]) by theia.denx.de (Postfix) with ESMTPS id D6C484A019 for ; Sun, 7 Apr 2013 12:26:55 +0200 (CEST) Received: from mail1-db8-R.bigfish.com (10.174.8.225) by DB8EHSOBE036.bigfish.com (10.174.4.99) with Microsoft SMTP Server id 14.1.225.23; Sun, 7 Apr 2013 10:11:46 +0000 Received: from mail1-db8 (localhost [127.0.0.1]) by mail1-db8-R.bigfish.com (Postfix) with ESMTP id 2A9521B003CF; Sun, 7 Apr 2013 10:11:46 +0000 (UTC) X-Forefront-Antispam-Report: CIP:137.71.25.57; KIP:(null); UIP:(null); IPV:NLI; H:nwd2mta2.analog.com; RD:nwd2mail11.analog.com; EFVD:NLI X-SpamScore: 12 X-BigFish: VS12(zzzz1f42h1fc6h1ee6h1ce5h1fdah1202h1fd0h1e76h1d1ah1cabh1d2ahzz8275bhz2ei87h2a8h668h839hd24he5bh1288h12a5h12a9h12bdh12e5h1354h137ah139eh13b6h13eah1441h1504h1537h15a8h162dh1631h1758h17eeh1898h18e1h1946h19b5h1b0ahff4m1355m129fi1155h) Received-SPF: neutral (mail1-db8: 137.71.25.57 is neither permitted nor denied by domain of gmail.com) client-ip=137.71.25.57; envelope-from=sonic.adi@gmail.com; helo=nwd2mta2.analog.com ; 2.analog.com ; X-FB-DOMAIN-IP-MATCH: fail Received: from mail1-db8 (localhost.localdomain [127.0.0.1]) by mail1-db8 (MessageSwitch) id 136532950494390_18296; Sun, 7 Apr 2013 10:11:44 +0000 (UTC) Received: from DB8EHSMHS015.bigfish.com (unknown [10.174.8.247]) by mail1-db8.bigfish.com (Postfix) with ESMTP id 0A9C114C0046; Sun, 7 Apr 2013 10:11:44 +0000 (UTC) Received: from nwd2mta2.analog.com (137.71.25.57) by DB8EHSMHS015.bigfish.com (10.174.4.25) with Microsoft SMTP Server (TLS) id 14.1.225.23; Sun, 7 Apr 2013 10:11:43 +0000 Received: from NWD2HUBCAS6.ad.analog.com (nwd2hubcas6.ad.analog.com [10.64.72.159]) by nwd2mta2.analog.com (8.13.8/8.13.8) with ESMTP id r37BZfEV017699 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Sun, 7 Apr 2013 07:35:41 -0400 Received: from zeus.spd.analog.com (10.64.82.11) by NWD2HUBCAS6.ad.analog.com (10.64.72.159) with Microsoft SMTP Server id 14.3.123.3; Sun, 7 Apr 2013 06:11:42 -0400 Received: from linux.site ([10.99.22.20]) by zeus.spd.analog.com (8.14.6/8.14.6) with ESMTP id r37ABe6X014422; Sun, 7 Apr 2013 06:11:41 -0400 Received: from localhost.localdomain (unknown [10.99.22.72]) by linux.site (Postfix) with ESMTP id 67E4C42CC5A7; Sat, 6 Apr 2013 19:44:28 -0700 (MST) From: Sonic Zhang To: , Wolfgang Denk Date: Sun, 7 Apr 2013 18:12:55 +0800 Message-ID: <1365329575-25538-1-git-send-email-sonic.adi@gmail.com> X-Mailer: git-send-email 1.7.0.4 MIME-Version: 1.0 Cc: u-boot-devel@blackfin.uclinux.org, Sonic Zhang Subject: [U-Boot] [PATCH v1] blackfin: Move blackfin watchdog driver out of the blackfin arch folder. 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 - Enable hw_watchdog_init() in watchdog.h if CONFIG_HW_WATCHDOG is defined. - Move blackfin hw watchdog driver to the generic driver folder. - Call hw_watchdog_init() from blackfin board init code. - Reuse macro CONFIG_WATCHDOG_TIMEOUT_MSECS - Update README.watchdog accordingly Signed-off-by: Sonic Zhang --- arch/blackfin/cpu/Makefile | 1 - arch/blackfin/cpu/start.S | 13 ++++++------- arch/blackfin/lib/board.c | 4 ++-- doc/README.watchdog | 3 +++ drivers/watchdog/Makefile | 1 + .../cpu/watchdog.c => drivers/watchdog/bfin_wdt.c | 2 +- include/configs/bfin_adi_common.h | 6 ++++++ include/watchdog.h | 3 +-- 8 files changed, 20 insertions(+), 13 deletions(-) rename arch/blackfin/cpu/watchdog.c => drivers/watchdog/bfin_wdt.c (83%) diff --git a/arch/blackfin/cpu/Makefile b/arch/blackfin/cpu/Makefile index 0a72ec5..145f63e 100644 --- a/arch/blackfin/cpu/Makefile +++ b/arch/blackfin/cpu/Makefile @@ -25,7 +25,6 @@ COBJS-y += os_log.o COBJS-y += reset.o COBJS-y += serial.o COBJS-y += traps.o -COBJS-$(CONFIG_HW_WATCHDOG) += watchdog.o SRCS := $(SEXTRA:.o=.S) $(SOBJS:.o=.S) $(COBJS-y:.o=.c) OBJS := $(addprefix $(obj),$(COBJS-y) $(SOBJS)) diff --git a/arch/blackfin/cpu/start.S b/arch/blackfin/cpu/start.S index 7155fc8..32b3ec7 100644 --- a/arch/blackfin/cpu/start.S +++ b/arch/blackfin/cpu/start.S @@ -65,20 +65,19 @@ ENTRY(_start) p5.h = HI(COREMMR_BASE); #ifdef CONFIG_HW_WATCHDOG -#ifndef __ADSPBF60x__ -# ifndef CONFIG_HW_WATCHDOG_TIMEOUT_START -# define CONFIG_HW_WATCHDOG_TIMEOUT_START 5000 -# endif - /* Program the watchdog with an initial timeout of ~5 seconds. + /* Program the watchdog with default timeout of ~5 seconds. * That should be long enough to bootstrap ourselves up and * then the common u-boot code can take over. */ r0 = 0; - r0.h = HI(MSEC_TO_SCLK(CONFIG_HW_WATCHDOG_TIMEOUT_START)); + r0.h = HI(MSEC_TO_SCLK(CONFIG_WATCHDOG_TIMEOUT_MSECS)); [p4 + (WDOG_CNT - SYSMMR_BASE)] = r0; /* fire up the watchdog - R0.L above needs to be 0x0000 */ +# ifdef __ADSPBF60x__ + [p4 + (WDOG_CTL - SYSMMR_BASE)] = r0; +# else W[p4 + (WDOG_CTL - SYSMMR_BASE)] = r0; -#endif +# endif #endif /* Turn on the serial for debugging the init process */ diff --git a/arch/blackfin/lib/board.c b/arch/blackfin/lib/board.c index c1e14e2..99970e1 100644 --- a/arch/blackfin/lib/board.c +++ b/arch/blackfin/lib/board.c @@ -279,9 +279,9 @@ void board_init_f(ulong bootflag) dcache_enable(); #endif -#ifdef CONFIG_WATCHDOG +#ifdef CONFIG_HW_WATCHDOG serial_early_puts("Setting up external watchdog\n"); - watchdog_init(); + hw_watchdog_init(); #endif #ifdef DEBUG diff --git a/doc/README.watchdog b/doc/README.watchdog index ee65008..f2a9d26 100644 --- a/doc/README.watchdog +++ b/doc/README.watchdog @@ -27,3 +27,6 @@ CONFIG_IMX_WATCHDOG Available for i.mx31/35/5x/6x to service the watchdog. This is not automatically set because some boards (vision2) still need to define their own hw_watchdog_reset routine. + +CONFIG_BFIN_WATCHDOG + Available for bf5xx and bf6xx to service the watchdog. diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index b1f4e0f..1da3d75 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile @@ -32,6 +32,7 @@ COBJS-y += imx_watchdog.o endif COBJS-$(CONFIG_TNETV107X_WATCHDOG) += tnetv107x_wdt.o COBJS-$(CONFIG_S5P) += s5p_wdt.o +COBJS-$(CONFIG_BFIN_WATCHDOG) += bfin_wdt.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) diff --git a/arch/blackfin/cpu/watchdog.c b/drivers/watchdog/bfin_wdt.c similarity index 83% rename from arch/blackfin/cpu/watchdog.c rename to drivers/watchdog/bfin_wdt.c index 1886bda..2101f6e 100644 --- a/arch/blackfin/cpu/watchdog.c +++ b/drivers/watchdog/bfin_wdt.c @@ -17,7 +17,7 @@ void hw_watchdog_reset(void) void hw_watchdog_init(void) { - bfin_write_WDOG_CNT(5 * get_sclk()); /* 5 second timeout */ + bfin_write_WDOG_CNT(CONFIG_WATCHDOG_TIMEOUT_MSECS / 1000 * get_sclk()); hw_watchdog_reset(); bfin_write_WDOG_CTL(0x0); } diff --git a/include/configs/bfin_adi_common.h b/include/configs/bfin_adi_common.h index c986ba3..0bcccf8 100644 --- a/include/configs/bfin_adi_common.h +++ b/include/configs/bfin_adi_common.h @@ -314,5 +314,11 @@ #define CONFIG_BFIN_SPI_GPIO_CS /* Only matters if BFIN_SPI is enabled */ #define CONFIG_LZMA #define CONFIG_MONITOR_IS_IN_RAM +#ifdef CONFIG_HW_WATCHDOG +# define CONFIG_BFIN_WATCHDOG +# ifndef CONFIG_WATCHDOG_TIMEOUT_MSECS +# define CONFIG_WATCHDOG_TIMEOUT_MSECS 5000 +# endif +#endif #endif diff --git a/include/watchdog.h b/include/watchdog.h index 8c92a0b..f821edc 100644 --- a/include/watchdog.h +++ b/include/watchdog.h @@ -90,8 +90,7 @@ void reset_4xx_watchdog(void); #endif -/* Freescale i.MX */ -#if defined(CONFIG_IMX_WATCHDOG) && !defined(__ASSEMBLY__) +#if defined(CONFIG_HW_WATCHDOG) && !defined(__ASSEMBLY__) void hw_watchdog_init(void); #endif #endif /* _WATCHDOG_H_ */