All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Twiss <stwiss.opensource@diasemi.com>
To: Guenter Roeck <linux@roeck-us.net>,
	Marco Felsch <mfe@pengutronix.de>,
	Marco Felsch <m.felsch@pengutronix.de>
Cc: "wim@linux-watchdog.org" <wim@linux-watchdog.org>,
	Support Opensource <Support.Opensource@diasemi.com>,
	"fzuuzf@googlemail.com" <fzuuzf@googlemail.com>,
	Guenter Roeck <groeck7@gmail.com>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"linux-watchdog@vger.kernel.org" <linux-watchdog@vger.kernel.org>
Subject: RE: [PATCH v2] watchdog: da9063: Fix setting/changing timeout
Date: Wed, 16 May 2018 07:35:13 +0000	[thread overview]
Message-ID: <6ED8E3B22081A4459DAC7699F3695FB7019418108B@SW-EX-MBX02.diasemi.com> (raw)
In-Reply-To: <20180515184412.GC16006@roeck-us.net>

On 15 May 2018 19:44, Guenter Roeck wrote,

> Subject: Re: [PATCH v2] watchdog: da9063: Fix setting/changing timeout
> 
> On Wed, May 09, 2018 at 04:10:15PM +0200, Marco Felsch wrote:
> > Hi Steve,
> >
> > On 05/09/2018 03:50 PM, Steve Twiss wrote:
> > >On 09 May 2018 13:33, Marco Felsch wrote:
> > >
> > >>
> > >>The DA9063 watchdog always resets the system when it changes the timeout
> > >>value after the bootloader (e.g. Barebox) has it already set.
> > >>
> > >>To update the timeout value we have to disable the watchdog, clear the
> > >>watchdog counter value and write the new timeout value to the watchdog.
> > >>Clearing the counter value is a feature to be on the safe side, because the
> > >>data sheet doesn't describe the behaviour of the watchdog counter value
> > >>after a watchdog disabling-enable-sequence.
> > >>
> > >>The patch is based on Philipp Zabel's <p.zabel@pengutronix.de>previous
> > >>patch but doesn't wait 150us because the DA9063 doesn't need this delay.
> > >>https://www.dialog-semiconductor.com/products/DA9063
> > >
> > >Yes, according to the Dialog datasheet DA9063_2v1, there is no 150us minimum
> > >assert time limit. But ... that doesn't seem correct to me, because the DA9062
> > >driver and DA9062 datasheet both show a minimum assertion time, like you
> > >said.
> > >
> > >https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/tree/drivers/watchdog/da9062_wdt.c?h=v4.17-rc3#n67
> > >
> > >So let me check with the hardware engineers.
> >
> > That would be great looking forward to hear from you. I will prepare a v3 if it is.
> >
> Any updates ?
> 
> Guenter

Hi Guenter and Marco,

Thank you for your patience.
The best advice I can give at the moment is:

Please follow what has been done in the DA9062 and DA9053 device drivers.
https://elixir.bootlin.com/linux/latest/source/drivers/watchdog/da9062_wdt.c#L90
https://elixir.bootlin.com/linux/latest/source/drivers/watchdog/da9052_wdt.c#L76

In these cases:
"setting TWDSCALE to zero for at least 150 us before writing the new value"

There will be a longer answer, but that must wait until the formal datasheets have
been clarified by the hardware engineers.

Regards,
Steve

> 
> > >>+
> > >>  static int _da9063_wdt_set_timeout(struct da9063 *da9063, unsigned int regval)
> > >>  {
> > >>+    int ret;
> > >>+
> > >>+    /*
> > >>+     * The watchdog trigger a reboot if a timeout value is already
> > >>+     * programmed. Because the timeout value combines two functions in
> > >>+     * one: indicating the counter limit and starting the watchdog. To be
> > >>+     * able to set the watchdog a second time (first time was done by the
> > >>+     * bootloader) disable the watchdog clear the counter value manually and
> > >>+     * set the new timeout value.
> > >>+     */
> > >>+    ret = regmap_update_bits(da9063->regmap, DA9063_REG_CONTROL_D,
> > >>+                 DA9063_TWDSCALE_MASK, DA9063_TWDSCALE_DISABLE);
> > >>+    if (ret)
> > >>+        dev_warn(da9063->dev,
> > >>+             "Failed to disable watchdog before setting new timeout\n");
> > >>+
> > >>+    ret = _da9063_wdt_reset_timer(da9063);
> > >>+    if (ret)
> > >>+        dev_warn(da9063->dev, "Failed to reset watchdog counter\n");
> >
> > BTW. can you ask them if it is necessary to reset the counter value register
> > manually or if this is done by disabling the watchdog.
> >
> > Regards,
> > Marco

  reply	other threads:[~2018-05-16  7:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-09 12:32 [PATCH v2] watchdog: da9063: Fix setting/changing timeout Marco Felsch
2018-05-09 13:50 ` Steve Twiss
2018-05-09 14:10   ` Marco Felsch
2018-05-15 18:44     ` Guenter Roeck
2018-05-16  7:35       ` Steve Twiss [this message]
2018-05-16  9:01         ` Marco Felsch
2018-05-16 12:56           ` 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=6ED8E3B22081A4459DAC7699F3695FB7019418108B@SW-EX-MBX02.diasemi.com \
    --to=stwiss.opensource@diasemi.com \
    --cc=Support.Opensource@diasemi.com \
    --cc=fzuuzf@googlemail.com \
    --cc=groeck7@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=m.felsch@pengutronix.de \
    --cc=mfe@pengutronix.de \
    --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 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.