From: Guenter Roeck <linux@roeck-us.net>
To: Xingyu Chen <xingyu.chen@amlogic.com>,
Wim Van Sebroeck <wim@linux-watchdog.org>,
Kevin Hilman <khilman@baylibre.com>,
Neil Armstrong <narmstrong@baylibre.com>
Cc: Jerome Brunet <jbrunet@baylibre.com>,
Qianggui Song <qianggui.song@amlogic.com>,
Jianxin Pan <jianxin.pan@amlogic.com>,
linux-watchdog@vger.kernel.org,
linux-amlogic@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] watchdog: meson: Fix the wrong value of left time
Date: Mon, 30 Sep 2019 06:12:51 -0700 [thread overview]
Message-ID: <ee3ea7d5-1adf-c718-4533-70b04bb23ecc@roeck-us.net> (raw)
In-Reply-To: <1569754429-17287-1-git-send-email-xingyu.chen@amlogic.com>
On 9/29/19 3:53 AM, Xingyu Chen wrote:
> The left time value is wrong when we get it by sysfs. The left time value
> should be equal to preset timeout value minus elapsed time value. According
> to the Meson-GXB/GXL datasheets which can be found at [0], the timeout value
> is saved to BIT[0-15] of the WATCHDOG_TCNT, and elapsed time value is saved
> to BIT[16-31] of the WATCHDOG_TCNT.
>
> [0]: http://linux-meson.com
>
> Fixes: 683fa50f0e18 ("watchdog: Add Meson GXBB Watchdog Driver")
> Signed-off-by: Xingyu Chen <xingyu.chen@amlogic.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/meson_gxbb_wdt.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/watchdog/meson_gxbb_wdt.c b/drivers/watchdog/meson_gxbb_wdt.c
> index d17c1a6..5a9ca10 100644
> --- a/drivers/watchdog/meson_gxbb_wdt.c
> +++ b/drivers/watchdog/meson_gxbb_wdt.c
> @@ -89,8 +89,8 @@ static unsigned int meson_gxbb_wdt_get_timeleft(struct watchdog_device *wdt_dev)
>
> reg = readl(data->reg_base + GXBB_WDT_TCNT_REG);
>
> - return ((reg >> GXBB_WDT_TCNT_CNT_SHIFT) -
> - (reg & GXBB_WDT_TCNT_SETUP_MASK)) / 1000;
> + return ((reg & GXBB_WDT_TCNT_SETUP_MASK) -
> + (reg >> GXBB_WDT_TCNT_CNT_SHIFT)) / 1000;
> }
>
> static const struct watchdog_ops meson_gxbb_wdt_ops = {
>
next prev parent reply other threads:[~2019-09-30 13:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-29 10:53 [PATCH] watchdog: meson: Fix the wrong value of left time Xingyu Chen
2019-09-30 8:16 ` Neil Armstrong
2019-09-30 13:12 ` Guenter Roeck [this message]
2019-10-03 17:35 ` Kevin Hilman
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=ee3ea7d5-1adf-c718-4533-70b04bb23ecc@roeck-us.net \
--to=linux@roeck-us.net \
--cc=jbrunet@baylibre.com \
--cc=jianxin.pan@amlogic.com \
--cc=khilman@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=narmstrong@baylibre.com \
--cc=qianggui.song@amlogic.com \
--cc=wim@linux-watchdog.org \
--cc=xingyu.chen@amlogic.com \
/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).