All of lore.kernel.org
 help / color / mirror / Atom feed
From: Neil Armstrong <narmstrong@baylibre.com>
To: Xingyu Chen <xingyu.chen@amlogic.com>,
	Wim Van Sebroeck <wim@linux-watchdog.org>,
	Guenter Roeck <linux@roeck-us.net>,
	Kevin Hilman <khilman@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 10:16:53 +0200	[thread overview]
Message-ID: <06f3e719-a6e1-ef70-0c5c-1a07f809905a@baylibre.com> (raw)
In-Reply-To: <1569754429-17287-1-git-send-email-xingyu.chen@amlogic.com>

On 29/09/2019 12:53, 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>
> ---
>  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 = {
> 

Acked-by: Neil Armstrong <narmstrong@baylibre.com>

WARNING: multiple messages have this Message-ID (diff)
From: Neil Armstrong <narmstrong@baylibre.com>
To: Xingyu Chen <xingyu.chen@amlogic.com>,
	Wim Van Sebroeck <wim@linux-watchdog.org>,
	Guenter Roeck <linux@roeck-us.net>,
	Kevin Hilman <khilman@baylibre.com>
Cc: Qianggui Song <qianggui.song@amlogic.com>,
	linux-watchdog@vger.kernel.org,
	Jianxin Pan <jianxin.pan@amlogic.com>,
	linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	Jerome Brunet <jbrunet@baylibre.com>
Subject: Re: [PATCH] watchdog: meson: Fix the wrong value of left time
Date: Mon, 30 Sep 2019 10:16:53 +0200	[thread overview]
Message-ID: <06f3e719-a6e1-ef70-0c5c-1a07f809905a@baylibre.com> (raw)
In-Reply-To: <1569754429-17287-1-git-send-email-xingyu.chen@amlogic.com>

On 29/09/2019 12:53, 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>
> ---
>  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 = {
> 

Acked-by: Neil Armstrong <narmstrong@baylibre.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Neil Armstrong <narmstrong@baylibre.com>
To: Xingyu Chen <xingyu.chen@amlogic.com>,
	Wim Van Sebroeck <wim@linux-watchdog.org>,
	Guenter Roeck <linux@roeck-us.net>,
	Kevin Hilman <khilman@baylibre.com>
Cc: Qianggui Song <qianggui.song@amlogic.com>,
	linux-watchdog@vger.kernel.org,
	Jianxin Pan <jianxin.pan@amlogic.com>,
	linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	Jerome Brunet <jbrunet@baylibre.com>
Subject: Re: [PATCH] watchdog: meson: Fix the wrong value of left time
Date: Mon, 30 Sep 2019 10:16:53 +0200	[thread overview]
Message-ID: <06f3e719-a6e1-ef70-0c5c-1a07f809905a@baylibre.com> (raw)
In-Reply-To: <1569754429-17287-1-git-send-email-xingyu.chen@amlogic.com>

On 29/09/2019 12:53, 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>
> ---
>  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 = {
> 

Acked-by: Neil Armstrong <narmstrong@baylibre.com>

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2019-09-30  8:17 UTC|newest]

Thread overview: 12+ 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-29 10:53 ` Xingyu Chen
2019-09-29 10:53 ` Xingyu Chen
2019-09-30  8:16 ` Neil Armstrong [this message]
2019-09-30  8:16   ` Neil Armstrong
2019-09-30  8:16   ` Neil Armstrong
2019-09-30 13:12 ` Guenter Roeck
2019-09-30 13:12   ` Guenter Roeck
2019-09-30 13:12   ` Guenter Roeck
2019-10-03 17:35 ` Kevin Hilman
2019-10-03 17:35   ` Kevin Hilman
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=06f3e719-a6e1-ef70-0c5c-1a07f809905a@baylibre.com \
    --to=narmstrong@baylibre.com \
    --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=linux@roeck-us.net \
    --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 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.