From: Johannes Thumshirn <johannes.thumshirn@men.de>
To: Guenter Roeck <linux@roeck-us.net>
Cc: <wim@iguana.be>, <guenter@roeck-us.net>,
<linux-watchdog@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<johannes.thumshirn@men.de>
Subject: Re: [PATCH v6] watchdog: New watchdog driver for MEN A21 watchdogs
Date: Fri, 31 May 2013 14:55:19 +0200 [thread overview]
Message-ID: <20130531125519.GB8983@jtlinux> (raw)
In-Reply-To: <20130531114037.GA13533@roeck-us.net>
Hi Guenther,
On Fri, May 31, 2013 at 04:40:37AM -0700, Guenter Roeck wrote:
> > +#define GPIO_WD_ENAB 169
> > +#define GPIO_WD_FAST 170
> > +#define GPIO_WD_TRIG 171
> > +
> > +#define GPIO_RST_CAUSE_BASE 166
> > +
>
> I think I asked that before ... as you are supporting devicetree, gpio pins
> should really be provided through devicetree properties and not be hardcoded.
>
Yes you did and I didn't come up with a solution to this problem yet. I understand
and agree to your concerns but I'm lacking example code/documentation for it, maybe
you can point me to an example on that and then I'll update my code accordingly.
> > +struct a21_wdt_drv {
> > + struct watchdog_device wdt;
> > + struct mutex lock;
> > + }
> > +
> > + if (timeout == 30 && wdt->timeout == 1) {
> > + dev_err(wdt->dev,
> > + "Transition from fast to slow mode not allowed\n");
> > + return -EINVAL;
> > + }
> > +
> I dislike that [2 .. 29] timeout values are not supported, and would rather have
> you accept that range and set the timeout to 30. Also, it is somewhat undesirable
> that the timeout can not be changed back to 30 after being set to 1.
The not changing back issue was a hardware design criterion and I have no
influence on that one. I've already checked with the IC developer and he said,
this is intended. I don't quite understand why I should accept the timeout and
set it to 30? In my opinion this only introduces some magic the user won't
understand. Instead failing and giving an error message is something a user can
take as a hint for investigating.
> As Wim recommended, a softdog on top of the hardware watchdog would be the best
> solution. I'll leave it up to him to decide if he wants to accept the code
> as-is.
Yes let's see what he's saying.
>
> > + mutex_lock(&drv->lock);
> > +
> > + ret = watchdog_register_device(&a21_wdt);
> > + if (ret) {
> > + dev_err(&pdev->dev, "Cannot register watchdog device\n");
> > + goto err_register_wd;
> > + }
> > +
> > + ret = a21_wdt_get_bootstatus(&reset);
> > + if (ret)
> > + dev_warn(&pdev->dev, "Reset Cause contains invalid data\n");
> > + else {
> > + if (reset == 2)
> > + a21_wdt.bootstatus |= WDIOF_EXTERN1;
> > + else if (reset == 4)
> > + a21_wdt.bootstatus |= WDIOF_CARDRESET;
> > + else if (reset == 5)
> > + a21_wdt.bootstatus |= WDIOF_POWERUNDER;
> > + else if (reset == 7)
> > + a21_wdt.bootstatus |= WDIOF_EXTERN2;
>
> What about other causes ? No useful match ?
>
None I could find. Actually WDIOF_EXTERN[12] already are a pretty creative
mapping in my opinion. EXTERN1 is a "Push Button" event, EXTERN2 is a reset
caused by a JTAG/BDM adapter...
> I think bootstatus should be set prior to registering the watchdog device
> to avoid race conditions where an application reads it prior to being set.
>
Agreed, didn't see that one *doh*, must be fixed before inclusion.
> > + }
next prev parent reply other threads:[~2013-05-31 12:53 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-31 8:58 [PATCH v5 1/2] watchdog: New watchdog driver for MEN A21 watchdogs Johannes Thumshirn
2013-05-31 9:01 ` [PATCH v2 2/2] This patch adds a sysfs interface for the watchdog device found on MEN A21 Boards Johannes Thumshirn
2013-05-31 9:04 ` [PATCH v5 1/2] watchdog: New watchdog driver for MEN A21 watchdogs Johannes Thumshirn
2013-05-31 10:36 ` Guenter Roeck
2013-05-31 10:53 ` Johannes Thumshirn
2013-05-31 11:08 ` [PATCH v6] " Johannes Thumshirn
2013-05-31 11:40 ` Guenter Roeck
2013-05-31 12:55 ` Johannes Thumshirn [this message]
2013-06-01 4:15 ` Guenter Roeck
2013-06-03 9:50 ` Johannes Thumshirn
2013-06-06 10:51 ` Some problems with sysfs patch (was Re: [PATCH v6] watchdog: New watchdog driver for MEN A21 watchdogs) Johannes Thumshirn
2013-06-06 11:31 ` Guenter Roeck
2013-06-06 13:00 ` Johannes Thumshirn
2013-06-06 17:08 ` Guenter Roeck
2013-06-07 7:45 ` Johannes Thumshirn
2013-06-07 9:14 ` Guenter Roeck
2013-06-07 9:49 ` Johannes Thumshirn
2013-05-31 13:32 ` [PATCH v7] watchdog: New watchdog driver for MEN A21 watchdogs Johannes Thumshirn
2013-06-01 15:28 ` Guenter Roeck
2013-06-03 14:34 ` [PATCH v8] " Johannes Thumshirn
2013-06-07 9:55 ` [PATCH v8 2/2] watchdog: Sysfs interface for MEN A21 watchdog Johannes Thumshirn
2013-06-14 3:55 ` [PATCH v8] watchdog: New watchdog driver for MEN A21 watchdogs Guenter Roeck
2013-06-14 7:39 ` Johannes Thumshirn
2013-06-14 10:58 ` [PATCH v9] " Johannes Thumshirn
2013-06-14 11:19 ` [PATCH v9 2/2] watchdog: Sysfs interface for MEN A21 watchdog Johannes Thumshirn
2013-06-16 22:07 ` [PATCH v9] watchdog: New watchdog driver for MEN A21 watchdogs Guenter Roeck
2013-06-17 6:40 ` Johannes Thumshirn
2013-06-17 10:22 ` [PATCH v10 1/2] " Johannes Thumshirn
2013-06-17 10:24 ` [PATCH v10 2/2] watchdog: Sysfs interface for MEN A21 watchdog Johannes Thumshirn
2013-06-17 14:00 ` [PATCH v10 1/2] watchdog: New watchdog driver for MEN A21 watchdogs Guenter Roeck
2013-06-18 15:19 ` [PATCH RESEND " Johannes Thumshirn
2013-06-18 15:21 ` [PATCH RESEND v10 2/2] watchdog: Sysfs interface for MEN A21 watchdog Johannes Thumshirn
2013-07-01 7:32 ` Johannes Thumshirn
2013-07-05 21:03 ` Wim Van Sebroeck
2013-07-08 7:06 ` Johannes Thumshirn
2013-07-05 21:01 ` [PATCH RESEND v10 1/2] watchdog: New watchdog driver for MEN A21 watchdogs Wim Van Sebroeck
2013-07-08 6:59 ` Johannes Thumshirn
2013-06-01 8:56 ` [PATCH v5 " Arnd Bergmann
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=20130531125519.GB8983@jtlinux \
--to=johannes.thumshirn@men.de \
--cc=guenter@roeck-us.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--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 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).