From: Sam Protsenko <semen.protsenko@linaro.org>
To: Wim Van Sebroeck <wim@linux-watchdog.org>,
Guenter Roeck <linux@roeck-us.net>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Cc: linux-watchdog@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org
Subject: [PATCH 7/7] watchdog: s3c2410: Let kernel kick watchdog
Date: Thu, 28 Oct 2021 21:35:27 +0300 [thread overview]
Message-ID: <20211028183527.3050-8-semen.protsenko@linaro.org> (raw)
In-Reply-To: <20211028183527.3050-1-semen.protsenko@linaro.org>
When "tmr_atboot" module param is set, the watchdog is started in
driver's probe. In that case, also set WDOG_HW_RUNNING bit to let
watchdog core driver know it's running. This way wathcdog core can kick
the watchdog for us (if CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED option is
enabled), until user space takes control.
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
---
drivers/watchdog/s3c2410_wdt.c | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index ca082b1226e3..9af014ff1468 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -732,6 +732,21 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
wdt->wdt_device.bootstatus = s3c2410wdt_get_bootstatus(wdt);
wdt->wdt_device.parent = dev;
+ /*
+ * If "tmr_atboot" param is non-zero, start the watchdog right now. Also
+ * set WDOG_HW_RUNNING bit, so that watchdog core can kick the watchdog.
+ *
+ * If we're not enabling the watchdog, then ensure it is disabled if it
+ * has been left running from the bootloader or other source.
+ */
+ if (tmr_atboot && started == 0) {
+ dev_info(dev, "starting watchdog timer\n");
+ s3c2410wdt_start(&wdt->wdt_device);
+ set_bit(WDOG_HW_RUNNING, &wdt->wdt_device.status);
+ } else if (!tmr_atboot) {
+ s3c2410wdt_stop(&wdt->wdt_device);
+ }
+
ret = watchdog_register_device(&wdt->wdt_device);
if (ret)
goto err_cpufreq;
@@ -740,17 +755,6 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
if (ret < 0)
goto err_unregister;
- if (tmr_atboot && started == 0) {
- dev_info(dev, "starting watchdog timer\n");
- s3c2410wdt_start(&wdt->wdt_device);
- } else if (!tmr_atboot) {
- /* if we're not enabling the watchdog, then ensure it is
- * disabled if it has been left running from the bootloader
- * or other source */
-
- s3c2410wdt_stop(&wdt->wdt_device);
- }
-
platform_set_drvdata(pdev, wdt);
/* print out a statement of readiness */
--
2.30.2
next prev parent reply other threads:[~2021-10-28 18:36 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-28 18:35 [PATCH 0/7] watchdog: s3c2410: Add Exynos850 support Sam Protsenko
2021-10-28 18:35 ` [PATCH 1/7] dt-bindings: watchdog: Require samsung,syscon-phandle for Exynos7 Sam Protsenko
2021-10-29 7:55 ` Krzysztof Kozlowski
2021-10-28 18:35 ` [PATCH 2/7] dt-bindings: watchdog: Document Exynos850 watchdog bindings Sam Protsenko
2021-10-29 8:02 ` Krzysztof Kozlowski
2021-10-29 17:48 ` Sam Protsenko
2021-10-28 18:35 ` [PATCH 3/7] watchdog: s3c2410: Make reset disable optional Sam Protsenko
2021-10-29 0:16 ` Guenter Roeck
2021-10-29 8:04 ` Krzysztof Kozlowski
2021-10-29 19:25 ` Sam Protsenko
2021-10-29 19:23 ` Sam Protsenko
2021-10-28 18:35 ` [PATCH 4/7] watchdog: s3c2410: Add support for WDT counter enable Sam Protsenko
2021-10-29 0:16 ` Guenter Roeck
2021-10-29 20:44 ` Sam Protsenko
2021-10-28 18:35 ` [PATCH 5/7] watchdog: s3c2410: Introduce separate source clock Sam Protsenko
2021-10-29 0:21 ` Guenter Roeck
2021-10-30 12:39 ` Sam Protsenko
2021-10-29 8:18 ` Krzysztof Kozlowski
2021-10-30 14:12 ` Sam Protsenko
2021-10-28 18:35 ` [PATCH 6/7] watchdog: s3c2410: Add Exynos850 support Sam Protsenko
2021-10-28 18:35 ` Sam Protsenko [this message]
2021-10-29 0:30 ` [PATCH 7/7] watchdog: s3c2410: Let kernel kick watchdog Guenter Roeck
2021-10-30 14:29 ` Sam Protsenko
2021-10-30 15:14 ` Guenter Roeck
2021-10-30 16:59 ` Sam Protsenko
2021-10-30 17:47 ` Guenter Roeck
2021-10-30 19:25 ` Sam Protsenko
2021-10-29 8:20 ` Krzysztof Kozlowski
2021-10-30 14:59 ` Sam Protsenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211028183527.3050-8-semen.protsenko@linaro.org \
--to=semen.protsenko@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski@canonical.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=robh+dt@kernel.org \
--cc=wim@linux-watchdog.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).