From patchwork Sat Aug 19 08:47:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Othacehe X-Patchwork-Id: 13358529 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 63EEEEE49AA for ; Sat, 19 Aug 2023 08:48:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :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=f388htj7vIs5/qV/cWewh18mxPrkhbFaRzj69CFRc5M=; b=G3DCiROfNKLbKG sjznREf5clhiTB0GTrsapWDx0ZTaaeCyRg+koaTA+rgi/Idddv+9VsTg7Fo4hqhdYkkQTpp008ecu uI3nt7g40uJ/531UOPas7Y4VtsP4fgr55nhp3zZB2OhULVNbS66LRTm/oyZDN1ybpz8itFvA6zUyi wYqbKmlcR/SpHmhdd0r3Mf6pKKfNUBpqzCBe5Ky49SA2OllKngK3j5BdzEVALnUBVFqK5A4JSPvRl TxrYTWBFl/+XG+JJY+y0+hM17+jhMMbKpLu1RVVCrLCLwyy1nrnF/B/kafT33r9bTKVrYomfg5Evb BwmCkR7Fhzn9HHG4apAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qXHdD-00Aaxh-34; Sat, 19 Aug 2023 08:48:27 +0000 Received: from eggs.gnu.org ([2001:470:142:3::10]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qXHdB-00Aax7-05 for linux-arm-kernel@lists.infradead.org; Sat, 19 Aug 2023 08:48:26 +0000 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qXHd2-0001kJ-8j; Sat, 19 Aug 2023 04:48:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=C+Jcu5bdm+iP02HYx68cgDC8fIORgJcECFprqrGAkIs=; b=PFRUC1cL0PO/hF M+H0QR58LezzbxnW346SGQY2DIwQ19k6nQAkzOjKrAPqEF52mY7Lz6yHcMoDQMsmy48QdGDGXxww9 arRXJKc5csOOJ3JlVMF3wNY/Xz6G3NULXMUp+mxeIHzcSf4tSZ/+j7JH44lfDmvwblxIvrs8IYD3y LKzbAAz2glvza134oJrX0wKaJESoN6tR7kSKtZtpPTkZcB4keAL+QPhJ6YvgB6tCiCf19gmCHcm/l ctaf7HH9SuiOV5aU73n7/taRvQZ9bbalbkBmUZaU/s1ylTHtMjMkjJzS4yUcPZWng+qmjJn+cwjgE jmrGecyuP4CU/ANhD8AQ==; From: Mathieu Othacehe To: nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, claudiu.beznea@tuxon.dev, wim@linux-watchdog.org, linux@roeck-us.net Cc: linux-arm-kernel@lists.infradead.org, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, Mathieu Othacehe Subject: [PATCH] watchdog: sama5d4: readout initial state Date: Sat, 19 Aug 2023 10:47:26 +0200 Message-ID: <20230819084726.11037-1-othacehe@gnu.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230819_014825_193716_DE54F49D X-CRM114-Status: UNSURE ( 9.64 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Readout the AT91_WDT_MR bit at probe so that it becomes possible to get the pre-userspace handler working. Signed-off-by: Mathieu Othacehe Reviewed-by: Guenter Roeck --- drivers/watchdog/sama5d4_wdt.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/watchdog/sama5d4_wdt.c b/drivers/watchdog/sama5d4_wdt.c index aeee934ca51b..7d31bb6f6204 100644 --- a/drivers/watchdog/sama5d4_wdt.c +++ b/drivers/watchdog/sama5d4_wdt.c @@ -255,6 +255,7 @@ static int sama5d4_wdt_probe(struct platform_device *pdev) struct sama5d4_wdt *wdt; void __iomem *regs; u32 irq = 0; + u32 reg; int ret; wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); @@ -305,6 +306,12 @@ static int sama5d4_wdt_probe(struct platform_device *pdev) watchdog_init_timeout(wdd, wdt_timeout, dev); + reg = wdt_read(wdt, AT91_WDT_MR); + if (!(reg & AT91_WDT_WDDIS)) { + wdt->mr &= ~AT91_WDT_WDDIS; + set_bit(WDOG_HW_RUNNING, &wdd->status); + } + ret = sama5d4_wdt_init(wdt); if (ret) return ret;