From patchwork Thu Apr 11 15:36:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 10896301 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3B5FF14DB for ; Thu, 11 Apr 2019 15:37:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 229E128E30 for ; Thu, 11 Apr 2019 15:37:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1736B28E58; Thu, 11 Apr 2019 15:37:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C9A4D28EB7 for ; Thu, 11 Apr 2019 15:37:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=CrJaX54mrEz4Fru+1Sow9bI7FSO+YWhZgEGIP2GAi60=; b=N9keYxG2D7wOqK ynl/F12lL3XjKPwxXTY56h4Zbi/5vFl924F7y4EUpBB+DcYONb0kA3cakh/SG55Mw7zOh8MU808uJ vK07q9or/ugDX6X/uGs8qpdYrMYMixjPoSZQymRI20SLn6r8oh0cfxJ1sS9qaJzVRGwIDKJtgyuNT 3FcF48JIg3Dy+4he/RP5/7KWDJjHqsNiPtAQn84FLBxpKRO1sb5f2l8hLIFu68IC/MXMsdzfOeXHN Yr2cxlOoZCeFM76AXC5FyrCfT940sj6v6tVPy8h+MkRhxIYqEii381hdKYHxyRNXMUND6Q1i37Fo+ K/yx6FLTJ50AyPnb3QOQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEbl5-0007ZM-DQ; Thu, 11 Apr 2019 15:36:59 +0000 Received: from relay7-d.mail.gandi.net ([217.70.183.200]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEbl2-0007Yg-7N for linux-arm-kernel@lists.infradead.org; Thu, 11 Apr 2019 15:36:57 +0000 X-Originating-IP: 109.213.33.177 Received: from localhost (alyon-652-1-42-177.w109-213.abo.wanadoo.fr [109.213.33.177]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 635EA2000B; Thu, 11 Apr 2019 15:36:48 +0000 (UTC) From: Alexandre Belloni To: Guenter Roeck , Vladimir Zapolskiy Subject: [PATCH] watchdog: pnx4008: readout watchddog state Date: Thu, 11 Apr 2019 17:36:46 +0200 Message-Id: <20190411153646.32228-1-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190411_083656_427829_5D59B15E X-CRM114-Status: GOOD ( 11.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , linux-watchdog@vger.kernel.org, Gregory Clement , linux-kernel@vger.kernel.org, Sylvain Lemieux , Wim Van Sebroeck , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Readout the enabled state so it is possible to get the pre-userspace handler working. Also, avoid disabling the watchdog when nowayout is set to ensure the watchdog continues working and triggers if there is an issue later in the boot or if userspace fails to start. Signed-off-by: Alexandre Belloni --- drivers/watchdog/pnx4008_wdt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c index 8e261799c84e..9e3714e3814c 100644 --- a/drivers/watchdog/pnx4008_wdt.c +++ b/drivers/watchdog/pnx4008_wdt.c @@ -209,7 +209,11 @@ static int pnx4008_wdt_probe(struct platform_device *pdev) watchdog_set_nowayout(&pnx4008_wdd, nowayout); watchdog_set_restart_priority(&pnx4008_wdd, 128); - pnx4008_wdt_stop(&pnx4008_wdd); /* disable for now */ + if (readl(WDTIM_CTRL(wdt_base)) & COUNT_ENAB) + set_bit(WDOG_HW_RUNNING, &pnx4008_wdd.status); + + if (!nowayout) + pnx4008_wdt_stop(&pnx4008_wdd); /* disable for now */ ret = watchdog_register_device(&pnx4008_wdd); if (ret < 0) {