From patchwork Fri Jul 18 11:38:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Niebel X-Patchwork-Id: 4582621 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 72F65C0514 for ; Fri, 18 Jul 2014 11:29:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9474B20166 for ; Fri, 18 Jul 2014 11:29:07 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B5F1D2011E for ; Fri, 18 Jul 2014 11:29:06 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X86JX-0003sS-52; Fri, 18 Jul 2014 11:26:59 +0000 Received: from smtprelay01.ispgateway.de ([80.67.31.24]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X86JT-0003oA-W6 for linux-arm-kernel@lists.infradead.org; Fri, 18 Jul 2014 11:26:56 +0000 Received: from [89.246.71.91] (helo=mail6.tqsc.de) by smtprelay01.ispgateway.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1X86J7-0006ew-Vw; Fri, 18 Jul 2014 13:26:34 +0200 Received: from sc1006092vm.tqsc.de ([192.168.169.50] helo=ubuntu.tqsc.de) by mail6.tqsc.de with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1X86J7-0007Z6-IJ; Fri, 18 Jul 2014 13:26:33 +0200 From: Markus Niebel To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2] watchdog: imx2_wdt: add support for WDOG_B signal generation Date: Fri, 18 Jul 2014 13:38:30 +0200 Message-Id: <1405683510-1303-1-git-send-email-list-09_linux_arm@tqsc.de> X-Mailer: git-send-email 1.7.9.5 X-Df-Sender: MTQ1NzgzNQ== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140718_042656_394325_2975E35D X-CRM114-Status: GOOD ( 12.30 ) X-Spam-Score: -0.0 (/) Cc: shawn.guo@linaro.org, Markus Niebel , kernel@pengutronix.de, wsa@the-dreams.de X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Niebel Watchdog unit of i.MX supports output of a signal at watchdog shutdown. This feature can be useful to signal an external supevisor that a watchdog reset occured. Support this feature as an option via devicetree. Signed-off-by: Markus Niebel --- History v2: Fix incorrect sent patch - add include of.h - fix missing if in probe .../devicetree/bindings/watchdog/fsl-imx-wdt.txt | 3 +++ drivers/watchdog/imx2_wdt.c | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.txt b/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.txt index 2144af1..cb759cd 100644 --- a/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.txt +++ b/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.txt @@ -5,6 +5,9 @@ Required properties: - reg : Should contain WDT registers location and length - interrupts : Should contain WDT interrupt +Optional properties: +- fsl,use-wre: set if watchdog reset out (WDOG_B) signal shall be asserted + Examples: wdt@73f98000 { diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c index 9d4874f..bde96db 100644 --- a/drivers/watchdog/imx2_wdt.c +++ b/drivers/watchdog/imx2_wdt.c @@ -58,6 +58,7 @@ struct imx2_wdt_device { struct regmap *regmap; struct timer_list timer; /* Pings the watchdog when closed */ struct watchdog_device wdog; + unsigned int use_wre:1; /* enable WRE feature */ }; static bool nowayout = WATCHDOG_NOWAYOUT; @@ -88,7 +89,10 @@ static inline void imx2_wdt_setup(struct watchdog_device *wdog) /* Strip the old watchdog Time-Out value */ val &= ~IMX2_WDT_WCR_WT; /* Generate reset if WDOG times out */ - val &= ~IMX2_WDT_WCR_WRE; + if (wdev->use_wre) + val |= IMX2_WDT_WCR_WRE; + else + val &= ~IMX2_WDT_WCR_WRE; /* Keep Watchdog Disabled */ val &= ~IMX2_WDT_WCR_WDE; /* Set the watchdog's Time-Out value */ @@ -219,6 +223,9 @@ static int __init imx2_wdt_probe(struct platform_device *pdev) return PTR_ERR(wdev->clk); } + if (of_property_read_bool(pdev->dev.of_node, "fsl,use-wre")) + wdev->use_wre = 1; + wdog = &wdev->wdog; wdog->info = &imx2_wdt_info; wdog->ops = &imx2_wdt_ops; @@ -226,7 +233,7 @@ static int __init imx2_wdt_probe(struct platform_device *pdev) wdog->max_timeout = IMX2_WDT_MAX_TIME; clk_prepare_enable(wdev->clk); - + regmap_read(wdev->regmap, IMX2_WDT_WRSR, &val); wdog->bootstatus = val & IMX2_WDT_WRSR_TOUT ? WDIOF_CARDRESET : 0;