From: Guenter Roeck <linux@roeck-us.net>
To: Jisheng Zhang <jszhang@marvell.com>
Cc: wim@iguana.be, linux-watchdog@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 1/2] watchdog: dw_wdt: initialise TOP_INIT in dw_wdt_set_top()
Date: Tue, 23 Sep 2014 11:27:51 -0700 [thread overview]
Message-ID: <20140923182751.GA24930@roeck-us.net> (raw)
In-Reply-To: <1411458132-5410-2-git-send-email-jszhang@marvell.com>
On Tue, Sep 23, 2014 at 03:42:11PM +0800, Jisheng Zhang wrote:
> The TOP_INIT, ie bit 4-7 of the WDOG_TIMEOUT_RANGE_REG_OFFSET register
> may be zero, so the timeout period may be very short after initialization
> is done, thus the system may be reset soon after enabling. We fix this
> problem by also initialising the TOP_INIT when setting TOP in function
> dw_wdt_set_top().
>
> Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
That should do it.
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/dw_wdt.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
> index 9f21029..449c885 100644
> --- a/drivers/watchdog/dw_wdt.c
> +++ b/drivers/watchdog/dw_wdt.c
> @@ -40,6 +40,7 @@
> #define WDOG_CONTROL_REG_OFFSET 0x00
> #define WDOG_CONTROL_REG_WDT_EN_MASK 0x01
> #define WDOG_TIMEOUT_RANGE_REG_OFFSET 0x04
> +#define WDOG_TIMEOUT_RANGE_TOPINIT_SHIFT 4
> #define WDOG_CURRENT_COUNT_REG_OFFSET 0x08
> #define WDOG_COUNTER_RESTART_REG_OFFSET 0x0c
> #define WDOG_COUNTER_RESTART_KICK_VALUE 0x76
> @@ -106,7 +107,8 @@ static int dw_wdt_set_top(unsigned top_s)
> }
>
> /* Set the new value in the watchdog. */
> - writel(top_val, dw_wdt.regs + WDOG_TIMEOUT_RANGE_REG_OFFSET);
> + writel(top_val | top_val << WDOG_TIMEOUT_RANGE_TOPINIT_SHIFT,
> + dw_wdt.regs + WDOG_TIMEOUT_RANGE_REG_OFFSET);
>
> dw_wdt_set_next_heartbeat();
>
> --
> 2.1.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: linux@roeck-us.net (Guenter Roeck)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/2] watchdog: dw_wdt: initialise TOP_INIT in dw_wdt_set_top()
Date: Tue, 23 Sep 2014 11:27:51 -0700 [thread overview]
Message-ID: <20140923182751.GA24930@roeck-us.net> (raw)
In-Reply-To: <1411458132-5410-2-git-send-email-jszhang@marvell.com>
On Tue, Sep 23, 2014 at 03:42:11PM +0800, Jisheng Zhang wrote:
> The TOP_INIT, ie bit 4-7 of the WDOG_TIMEOUT_RANGE_REG_OFFSET register
> may be zero, so the timeout period may be very short after initialization
> is done, thus the system may be reset soon after enabling. We fix this
> problem by also initialising the TOP_INIT when setting TOP in function
> dw_wdt_set_top().
>
> Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
That should do it.
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/dw_wdt.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
> index 9f21029..449c885 100644
> --- a/drivers/watchdog/dw_wdt.c
> +++ b/drivers/watchdog/dw_wdt.c
> @@ -40,6 +40,7 @@
> #define WDOG_CONTROL_REG_OFFSET 0x00
> #define WDOG_CONTROL_REG_WDT_EN_MASK 0x01
> #define WDOG_TIMEOUT_RANGE_REG_OFFSET 0x04
> +#define WDOG_TIMEOUT_RANGE_TOPINIT_SHIFT 4
> #define WDOG_CURRENT_COUNT_REG_OFFSET 0x08
> #define WDOG_COUNTER_RESTART_REG_OFFSET 0x0c
> #define WDOG_COUNTER_RESTART_KICK_VALUE 0x76
> @@ -106,7 +107,8 @@ static int dw_wdt_set_top(unsigned top_s)
> }
>
> /* Set the new value in the watchdog. */
> - writel(top_val, dw_wdt.regs + WDOG_TIMEOUT_RANGE_REG_OFFSET);
> + writel(top_val | top_val << WDOG_TIMEOUT_RANGE_TOPINIT_SHIFT,
> + dw_wdt.regs + WDOG_TIMEOUT_RANGE_REG_OFFSET);
>
> dw_wdt_set_next_heartbeat();
>
> --
> 2.1.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-09-23 18:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-23 7:42 [PATCH v2 0/2] watchdog: dw_wdt: one bug fix and restart handler support Jisheng Zhang
2014-09-23 7:42 ` Jisheng Zhang
2014-09-23 7:42 ` [PATCH v2 1/2] watchdog: dw_wdt: initialise TOP_INIT in dw_wdt_set_top() Jisheng Zhang
2014-09-23 7:42 ` Jisheng Zhang
2014-09-23 18:27 ` Guenter Roeck [this message]
2014-09-23 18:27 ` Guenter Roeck
2014-09-23 7:42 ` [PATCH v2 2/2] watchdog: dw_wdt: add restart handler support Jisheng Zhang
2014-09-23 7:42 ` Jisheng Zhang
2014-09-23 18:31 ` Guenter Roeck
2014-09-23 18:31 ` Guenter Roeck
2014-09-24 1:11 ` Jisheng Zhang
2014-09-24 1:11 ` Jisheng Zhang
2014-09-24 1:40 ` Guenter Roeck
2014-09-24 1:40 ` Guenter Roeck
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=20140923182751.GA24930@roeck-us.net \
--to=linux@roeck-us.net \
--cc=jszhang@marvell.com \
--cc=linux-arm-kernel@lists.infradead.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 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.