mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "xt.hu[胡先韬]" <xt.hu@cqplus1.com>
To: Guenter Roeck <linux@roeck-us.net>,
	"wim@linux-watchdog.org" <wim@linux-watchdog.org>,
	"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-watchdog@vger.kernel.org" <linux-watchdog@vger.kernel.org>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Cc: "Wells Lu 呂芳騰" <wells.lu@sunplus.com>,
	"qinjian[覃健]" <qinjian@cqplus1.com>
Subject: RE: [PATCH v6 2/2] watchdog: Add watchdog driver for Sunplus SP7021
Date: Mon, 28 Feb 2022 10:04:34 +0000	[thread overview]
Message-ID: <f61d99bff64e4a49b2a2943d01d9b6d2@cqplus1.com> (raw)
In-Reply-To: <6620b35b-5475-fe6d-5149-d8cb4fb834d5@roeck-us.net>

...
> > +
> > +/* TIMEOUT_MAX = ffff0/90kHz =11.65,so longer than 11 seconds will time out */
> > +static int sp_wdt_ping(struct watchdog_device *wdev)
> > +{
> > +	struct sp_wdt_priv *priv = watchdog_get_drvdata(wdev);
> > +	void __iomem *base = priv->base;
> > +	u32 count;
> > +	u32 actual;
> > +
> > +	actual = min(wdev->timeout, SP_WDT_MAX_TIMEOUT);
> > +
> > +	if (actual > SP_WDT_MAX_TIMEOUT) {
> 
> This is never true. because actual is set to the minimum of wdev->timeout
> and SP_WDT_MAX_TIMEOUT. It is also not clear to me what this code path
> is supposed to be doing, compared to the code below. Please fix and add
> a comment explaining the code (ie what does writing WDT_CONMAX into
> the control register do ?)
> 

I will fix "if (actual > SP_WDT_MAX_TIMEOUT)" to "if (wdev->timeout > 
SP_WDT_MAX_TIMEOUT)". I will add comment "WDT_CONMAX sets the 
count to the maximum (down-counting)."
When timeout > SP_WDT_MAX_TIMEOUT, I try to set a smaller value or 
do nothing. Watchdog driver don't work properly.

> > +		writel(WDT_CONMAX, base + WDT_CTRL);
> > +	} else {
> > +		writel(WDT_UNLOCK, base + WDT_CTRL);
> > +		/* tiemrw_cnt[3:0]can't be write,only [19:4] can be write. */
> 
> timerw_cnd ?, space before can't, and s/write/written/g.
> 
> > +		count = (actual * STC_CLK) >> 4;
> 
> so this is (actual * 90000) >> 4 and does set bit 0..3. Is that intentional
> or is it supposed to be << 4 ? The comment above does not really explain
> the calculation; if anything, it just creates confusion.
> 

I will add comment "Watchdog timer is a 20-bit down-counting based 
on STC_CLK. This register bits[16]~[0] is from bit[19]~bit[4] of the 
watchdog timer counter. "

Thanks,
Best Regards

      reply	other threads:[~2022-02-28 10:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-24  7:42 [PATCH v5 0/2] Add watchdog driver for Sunplus SP7021 SoC Xiantao Hu
2022-02-24  7:42 ` [PATCH v6 1/2] watchdog: Add Sunplus SP7021 WDT devicetree bindings documentation Xiantao Hu
2022-02-24  7:42 ` [PATCH v6 2/2] watchdog: Add watchdog driver for Sunplus SP7021 Xiantao Hu
2022-02-25 16:57   ` Guenter Roeck
2022-02-28 10:04     ` xt.hu[胡先韬] [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=f61d99bff64e4a49b2a2943d01d9b6d2@cqplus1.com \
    --to=xt.hu@cqplus1.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=p.zabel@pengutronix.de \
    --cc=qinjian@cqplus1.com \
    --cc=robh+dt@kernel.org \
    --cc=wells.lu@sunplus.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®