From: Pramod Gurav <pramod.gurav@smartplayin.com>
To: Josh Cartwright <joshc@codeaurora.org>
Cc: Wim Van Sebroeck <wim@iguana.be>,
linux-arm-msm@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Kumar Gala <galak@codeaurora.org>,
linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] watchdog: qcom: register a restart notifier
Date: Fri, 19 Sep 2014 18:17:33 +0530 [thread overview]
Message-ID: <541C25E5.6080601@smartplayin.com> (raw)
In-Reply-To: <d0f4cd93ad3f6690d637413b1171ac3c71aba861.1411078426.git.joshc@codeaurora.org>
Hi Josh,
Tested this patch on IFC6410 by disabling pinctrl ps_hold reset
implementation and on top of Guenter's patchset for restart_notifier.
Tested-by: pramod.gurav@smartplayin.com
I picked up DT changes from bindings as they are from this patchset.
Thanks
Pramod
On Friday 19 September 2014 03:57 AM, Josh Cartwright wrote:
> The WDT's BITE_TIME warm-reset behavior can be leveraged as a last
> resort mechanism for triggering chip reset. Usually, other restart
> methods (such as PS_HOLD) are preferrable for issuing a more complete
> reset of the chip. As such, keep the priority of the watchdog notifier
> low.
>
> Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
> ---
> drivers/watchdog/qcom-wdt.c | 31 +++++++++++++++++++++++++++++++
> 1 file changed, 31 insertions(+)
>
> diff --git a/drivers/watchdog/qcom-wdt.c b/drivers/watchdog/qcom-wdt.c
> index e9409f5..710ab43 100644
> --- a/drivers/watchdog/qcom-wdt.c
> +++ b/drivers/watchdog/qcom-wdt.c
> @@ -15,6 +15,7 @@
> #include <linux/module.h>
> #include <linux/of.h>
> #include <linux/platform_device.h>
> +#include <linux/reboot.h>
> #include <linux/watchdog.h>
>
> #define WDT_RST 0x0
> @@ -24,6 +25,7 @@
> struct qcom_wdt {
> struct watchdog_device wdd;
> unsigned long freq;
> + struct notifier_block restart_nb;
> void __iomem *base;
> };
>
> @@ -82,6 +84,24 @@ static const struct watchdog_info qcom_wdt_info = {
> .identity = KBUILD_MODNAME,
> };
>
> +static int qcom_wdt_restart(struct notifier_block *nb, unsigned long action,
> + void *data)
> +{
> + struct qcom_wdt *wdt = container_of(nb, struct qcom_wdt, restart_nb);
> +
> + /*
> + * Trigger watchdog bite:
> + * Setup BITE_TIME to be very low, and enable WDT.
> + */
> + mutex_lock(&wdt->wdd.lock);
> + writel_relaxed(0, wdt->base + WDT_EN);
> + writel_relaxed(1, wdt->base + WDT_RST);
> + writel_relaxed(0x31F3, wdt->base + WDT_BITE_TIME);
> + writel_relaxed(1, wdt->base + WDT_EN);
> + mutex_unlock(&wdt->wdd.lock);
> + return NOTIFY_DONE;
> +}
> +
> static int qcom_watchdog_probe(struct platform_device *pdev)
> {
> struct qcom_wdt *wdt;
> @@ -121,6 +141,17 @@ static int qcom_watchdog_probe(struct platform_device *pdev)
> return ret;
> }
>
> + /*
> + * WDT restart notifier has priority 0 (use as a last resort)
> + */
> + wdt->restart_nb.notifier_call = qcom_wdt_restart;
> + ret = register_restart_handler(&wdt->restart_nb);
> + if (ret) {
> + dev_err(&pdev->dev, "failed to setup restart handler\n");
> + watchdog_unregister_device(&wdt->wdd);
> + return ret;
> + }
> +
> return 0;
> }
>
>
prev parent reply other threads:[~2014-09-19 12:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-18 22:26 [PATCH 0/3] watchdog: add support for QCOM WDT Josh Cartwright
2014-09-18 22:26 ` [PATCH 1/3] watchdog: qcom: add support for KPSS WDT Josh Cartwright
2014-09-19 2:41 ` Guenter Roeck
2014-09-19 3:24 ` Josh Cartwright
2014-09-19 3:41 ` Guenter Roeck
2014-09-19 16:25 ` Josh Cartwright
2014-09-19 16:56 ` Guenter Roeck
2014-09-18 22:27 ` [PATCH 2/3] watchdog: qcom: document device tree bindings Josh Cartwright
2014-09-18 22:27 ` [PATCH 3/3] watchdog: qcom: register a restart notifier Josh Cartwright
2014-09-19 2:47 ` Guenter Roeck
2014-09-19 3:32 ` Josh Cartwright
2014-09-19 4:03 ` Guenter Roeck
2014-09-19 16:29 ` Josh Cartwright
2014-09-19 12:47 ` Pramod Gurav [this message]
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=541C25E5.6080601@smartplayin.com \
--to=pramod.gurav@smartplayin.com \
--cc=galak@codeaurora.org \
--cc=joshc@codeaurora.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=wim@iguana.be \
/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