From: Kathiravan T <kathirav@codeaurora.org>
To: Guenter Roeck <linux@roeck-us.net>,
Robert Marko <robert.marko@sartura.hr>,
agross@kernel.org, bjorn.andersson@linaro.org,
wim@linux-watchdog.org, linux-arm-msm@vger.kernel.org,
linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Luka Perkov <luka.perkov@sartura.hr>
Subject: Re: [PATCH v4] watchdog: qcom_wdt: set WDOG_HW_RUNNING bit when appropriate
Date: Mon, 2 Nov 2020 09:28:41 +0530 [thread overview]
Message-ID: <23aea80f-265b-8a23-e8ea-f46639dd4129@codeaurora.org> (raw)
In-Reply-To: <a71307f5-22b4-0d38-2880-96084bb07275@roeck-us.net>
On 10/31/2020 7:38 PM, Guenter Roeck wrote:
> On 10/31/20 5:11 AM, Robert Marko wrote:
>> If the watchdog hardware is enabled/running during boot, e.g.
>> due to a boot loader configuring it, we must tell the
>> watchdog framework about this fact so that it can ping the
>> watchdog until userspace opens the device and takes over
>> control.
>>
>> Do so using the WDOG_HW_RUNNING flag that exists for exactly
>> that use-case.
>>
>> Signed-off-by: Robert Marko <robert.marko@sartura.hr>
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Thanks for addressing the comments and now the patch looks good to me.
One more suggestion, can we make the initcall level of the driver to
subsys_initcall_sync so that the driver gets registered immediately
after the watchdog_core is registered and watchdog_core starts pinging
the WDT?
>> Cc: Luka Perkov <luka.perkov@sartura.hr>
>> ---
>> Changes in v4:
>> * Use QCOM_WDT_ENABLE macro
>>
>> Changes in v3:
>> * Drop call to stop as start already does it
>> * Update commit message
>>
>> Changes in v2:
>> * Correct authorship
>>
>> drivers/watchdog/qcom-wdt.c | 18 ++++++++++++++++++
>> 1 file changed, 18 insertions(+)
>>
>> diff --git a/drivers/watchdog/qcom-wdt.c b/drivers/watchdog/qcom-wdt.c
>> index ab7465d186fd..07d399c4edc4 100644
>> --- a/drivers/watchdog/qcom-wdt.c
>> +++ b/drivers/watchdog/qcom-wdt.c
>> @@ -152,6 +152,13 @@ static int qcom_wdt_restart(struct watchdog_device *wdd, unsigned long action,
>> return 0;
>> }
>>
>> +static int qcom_wdt_is_running(struct watchdog_device *wdd)
>> +{
>> + struct qcom_wdt *wdt = to_qcom_wdt(wdd);
>> +
>> + return (readl(wdt_addr(wdt, WDT_EN)) & QCOM_WDT_ENABLE);
>> +}
>> +
>> static const struct watchdog_ops qcom_wdt_ops = {
>> .start = qcom_wdt_start,
>> .stop = qcom_wdt_stop,
>> @@ -294,6 +301,17 @@ static int qcom_wdt_probe(struct platform_device *pdev)
>> wdt->wdd.timeout = min(wdt->wdd.max_timeout, 30U);
>> watchdog_init_timeout(&wdt->wdd, 0, dev);
>>
>> + /*
>> + * If WDT is already running, call WDT start which
>> + * will stop the WDT, set timeouts as bootloader
>> + * might use different ones and set running bit
>> + * to inform the WDT subsystem to ping the WDT
>> + */
>> + if (qcom_wdt_is_running(&wdt->wdd)) {
>> + qcom_wdt_start(&wdt->wdd);
>> + set_bit(WDOG_HW_RUNNING, &wdt->wdd.status);
>> + }
>> +
>> ret = devm_watchdog_register_device(dev, &wdt->wdd);
>> if (ret)
>> return ret;
>>
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
next prev parent reply other threads:[~2020-11-02 3:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-31 12:11 [PATCH v4] watchdog: qcom_wdt: set WDOG_HW_RUNNING bit when appropriate Robert Marko
2020-10-31 14:08 ` Guenter Roeck
2020-11-02 3:58 ` Kathiravan T [this message]
2020-11-02 5:03 ` Guenter Roeck
2020-11-02 5:19 ` Kathiravan T
2020-11-30 18:27 ` Robert Marko
2020-11-30 23:56 ` Guenter Roeck
2020-11-30 23:23 ` Bjorn Andersson
2020-12-29 20:15 ` patchwork-bot+linux-arm-msm
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=23aea80f-265b-8a23-e8ea-f46639dd4129@codeaurora.org \
--to=kathirav@codeaurora.org \
--cc=agross@kernel.org \
--cc=bjorn.andersson@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=luka.perkov@sartura.hr \
--cc=robert.marko@sartura.hr \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.