From patchwork Fri Jul 18 11:23:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Niebel X-Patchwork-Id: 4582591 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 047EFC0514 for ; Fri, 18 Jul 2014 11:15:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 299C72010E for ; Fri, 18 Jul 2014 11:15:13 +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 8F01D2010C for ; Fri, 18 Jul 2014 11:15:11 +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 1X865Q-0004Xc-L0; Fri, 18 Jul 2014 11:12:24 +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 1X865K-0004Hb-0W for linux-arm-kernel@lists.infradead.org; Fri, 18 Jul 2014 11:12:22 +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 1X864O-00076y-IR; Fri, 18 Jul 2014 13:11:20 +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 1X864O-0007Ww-5v; Fri, 18 Jul 2014 13:11:20 +0200 From: Markus Niebel To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] watchdog: imx2_wdt: add support for WDOG_B signal generation Date: Fri, 18 Jul 2014 13:23:17 +0200 Message-Id: <1405682597-22936-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_041218_416008_6AF3E3A9 X-CRM114-Status: GOOD ( 11.76 ) 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 --- .../devicetree/bindings/watchdog/fsl-imx-wdt.txt | 3 +++ drivers/watchdog/imx2_wdt.c | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) 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..6497711 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); } + (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;