From: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
To: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
Cc: Christian Gmeiner
<christian.gmeiner-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-watchdog-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
Subject: Re: [PATCH 3/3] watchdog: Add Congatec CGEB watchdog driver
Date: Wed, 3 Apr 2013 17:09:52 +0200 [thread overview]
Message-ID: <20130403150952.GX1906@pengutronix.de> (raw)
In-Reply-To: <20130326143331.GA5529-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
On Tue, Mar 26, 2013 at 07:33:31AM -0700, Guenter Roeck wrote:
> On Tue, Mar 26, 2013 at 11:16:35AM +0100, Christian Gmeiner wrote:
> > 2013/2/12 Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>:
> > > This driver provides support for the CGEB watchdog found on some
> > > Congatec x86 modules.
> > >
> > > Signed-off-by: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> > > ---
> > > drivers/watchdog/Kconfig | 10 ++
> > > drivers/watchdog/Makefile | 1 +
> > > drivers/watchdog/congatec_cgeb_watchdog.c | 161 +++++++++++++++++++++++++++++
> > > 3 files changed, 172 insertions(+)
> > > create mode 100644 drivers/watchdog/congatec_cgeb_watchdog.c
> > >
> > > diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> > > index 7f809fd..47138fb 100644
> > > --- a/drivers/watchdog/Kconfig
> > > +++ b/drivers/watchdog/Kconfig
> > > @@ -934,6 +934,16 @@ config SBC_EPX_C3_WATCHDOG
> > > To compile this driver as a module, choose M here: the
> > > module will be called sbc_epx_c3.
> > >
> > > +config CONGATEC_CGEB_WATCHDOG
> > > + depends on CONGATEC_CGEB
> > > + tristate "Congatec CGEB watchdog"
> > > + ---help---
> > > + This driver provides support for the watchdogs found on Congatec
> > > + modules with the CGEB BIOS interface.
> > > +
> > > + To compile this driver as a module, choose M here: the
> > > + module will be called congatec_cgeb_wdt.
> > > +
> > > # M32R Architecture
> > >
> > > # M68K Architecture
> > > diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
> > > index 97bbdb3a..e67eee5 100644
> > > --- a/drivers/watchdog/Makefile
> > > +++ b/drivers/watchdog/Makefile
> > > @@ -108,6 +108,7 @@ obj-$(CONFIG_W83977F_WDT) += w83977f_wdt.o
> > > obj-$(CONFIG_MACHZ_WDT) += machzwd.o
> > > obj-$(CONFIG_SBC_EPX_C3_WATCHDOG) += sbc_epx_c3.o
> > > obj-$(CONFIG_INTEL_SCU_WATCHDOG) += intel_scu_watchdog.o
> > > +obj-$(CONFIG_CONGATEC_CGEB_WATCHDOG) += congatec_cgeb_watchdog.o
> > >
> > > # M32R Architecture
> > >
> > > diff --git a/drivers/watchdog/congatec_cgeb_watchdog.c b/drivers/watchdog/congatec_cgeb_watchdog.c
> > > new file mode 100644
> > > index 0000000..b7b6cf5
> > > --- /dev/null
> > > +++ b/drivers/watchdog/congatec_cgeb_watchdog.c
> > > @@ -0,0 +1,161 @@
> > > +/*
> > > + * CGEB watchdog driver
> > > + *
> > > + * (c) 2011 Sascha Hauer, Pengutronix
> > > + *
> > > + * This program is free software; you can redistribute it and/or modify
> > > + * it under the terms of the GNU General Public License as published by
> > > + * the Free Software Foundation; version 2 of the License.
> > > + *
> > > + * This program is distributed in the hope that it will be useful,
> > > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> > > + * GNU General Public License for more details.
> > > + */
> > > +#include <linux/module.h>
> > > +#include <linux/platform_device.h>
> > > +#include <linux/watchdog.h>
> > > +#include <asm/congatec-cgeb.h>
> > > +
> > > +#define CGOS_WDOG_MODE_REBOOT_PC 0
> > > +#define CGOS_WDOG_MODE_RESTART_OS 1
> > > +#define CGOS_WDOG_MODE_STAGED 0x80
> > > +
> > > +#define CGOS_WDOG_OPMODE_DISABLED 0
> > > +#define CGOS_WDOG_OPMODE_ONETIME_TRIG 1
> > > +#define CGOS_WDOG_OPMODE_SINGLE_EVENT 2
> > > +#define CGOS_WDOG_OPMODE_EVENT_REPEAT 3
> > > +
> > > +#define CGOS_WDOG_EVENT_INT 0 /* NMI/IRQ */
> > > +#define CGOS_WDOG_EVENT_SCI 1 /* SMI/SCI */
> > > +#define CGOS_WDOG_EVENT_RST 2 /* system reset */
> > > +#define CGOS_WDOG_EVENT_BTN 3 /* power button */
> > > +
> > > +#define CGOS_WDOG_EVENT_MAX_STAGES 3
> > > +
> > > +struct cgeb_watchdog_stage {
> > > + unsigned long timeout;
> > > + unsigned long event;
> > > +};
> > > +
> > > +struct cgeb_watchdog_config {
> > > + unsigned long size;
> > > + unsigned long timeout; /* not used in staged mode */
> > > + unsigned long delay;
> > > + unsigned long mode;
> > > + /* optional parameters for staged watchdog */
> > > + unsigned long op_mode;
> > > + unsigned long stage_count;
> > > + struct cgeb_watchdog_stage stages[CGOS_WDOG_EVENT_MAX_STAGES];
> > > +};
>
> Presumably that is a data structure sent to the board. Just wondering - can the
> driver ever be build as 64 bit driver ? If so, you might want to use u32 instead
> of unsigned long.
I don't think that this is used on any 64bit capable hardware. Anyway,
explicitly using u32 here sounds very good. I'll change it.
> > > +static int cgeb_watchdog_start(struct watchdog_device *wdd)
> > > +{
> > > + struct cgeb_watchdog_priv *priv = watchdog_get_drvdata(wdd);
> > > +
> > > + return watchdog_set_config(priv, wdd->timeout);
> > > +}
> > > +
> > > +static int cgeb_watchdog_stop(struct watchdog_device *wdd)
> > > +{
> > > + struct cgeb_watchdog_priv *priv = watchdog_get_drvdata(wdd);
> > > +
> > > + return watchdog_set_config(priv, 0);
> > > +}
> > > +
> > > +static int cgeb_watchdog_set_timeout(struct watchdog_device *wdd,
> > > + unsigned int timeout_s)
> > > +{
> > > + return 0;
> > > +}
>
> That doesn't make any sense - it means wdd->timeout is never set. That also
> means it is never started.
Yeah, I just realized that since v3.4 the watchdog core no longer sets
wdd->timeout, the drivers have to do it themselves. Will fix.
> > > + priv->wdd.ops = &cgeb_watchdog_ops;
> > > + priv->wdd.info = &cgeb_wdd_info;
> > > + priv->wdd.min_timeout = 1;
> > > + priv->wdd.max_timeout = 3600;
>
> Might make sense to also set wdd.timeout to a default value, especially since
> watchdog_init_timeout is not called.
Ok, will do.
>
> On a side note, if the driver supports devicetree, it might make sense to call
> watchdog_init_timeout, since it initializes the timeout from devicetree data.
The driver does not support devicetree.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2013-04-03 15:09 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-12 10:02 [PATCH] Congatec CGEB base, i2c and watchdog driver support Sascha Hauer
2013-02-12 10:02 ` [PATCH 3/3] watchdog: Add Congatec CGEB watchdog driver Sascha Hauer
[not found] ` <1360663374-30951-4-git-send-email-s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-03-26 10:16 ` Christian Gmeiner
2013-03-26 14:33 ` Guenter Roeck
[not found] ` <20130326143331.GA5529-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2013-04-03 15:09 ` Sascha Hauer [this message]
2013-04-03 15:30 ` Guenter Roeck
[not found] ` <20130403153000.GA30641-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2013-04-03 17:06 ` Sascha Hauer
2013-04-03 15:16 ` Sascha Hauer
[not found] ` <1360663374-30951-1-git-send-email-s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-02-12 10:02 ` [PATCH 1/3] x86: Add basic support for the Congatec CGEB BIOS interface Sascha Hauer
[not found] ` <1360663374-30951-2-git-send-email-s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-03-25 8:31 ` Christian Gmeiner
2013-03-26 8:54 ` Sascha Hauer
[not found] ` <20130326085454.GK1906-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-03-26 9:24 ` Wolfram Sang
[not found] ` <20130326092435.GB8553-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2013-03-26 9:31 ` Sascha Hauer
[not found] ` <20130326093139.GL1906-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-03-26 9:38 ` Christian Gmeiner
[not found] ` <CAH9NwWdUqH8gF8Vz7K_2UW1X==LWbYEd5dhSTPqqYwEnDuRVuQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-04-11 7:14 ` Christian Gmeiner
[not found] ` <CAH9NwWd-UAYG0y2R379hPvntnfPhNEwvXm-f2uO3o1AZZ+OSMw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-04-11 11:20 ` Wolfram Sang
2013-02-12 10:02 ` [PATCH 2/3] i2c: Add Congatec CGEB I2C driver Sascha Hauer
[not found] ` <1360663374-30951-3-git-send-email-s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-02-14 10:11 ` Wolfram Sang
[not found] ` <20130214101130.GB12290-8EAEigeeuNG034pCzgS/Qg7AFbiQbgqx@public.gmane.org>
2013-03-26 9:55 ` Christian Gmeiner
2013-02-13 14:57 ` [PATCH] Congatec CGEB base, i2c and watchdog driver support Christian Gmeiner
[not found] ` <CAH9NwWfSQKW2c1LvLQkojPiKA_r7+_6OmgoVHrBNRHUEFNYvJg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-14 8:35 ` Sascha Hauer
-- strict thread matches above, loose matches on Subject: below --
2012-02-01 13:26 [RESEND] " Sascha Hauer
[not found] ` <1328102793-4313-1-git-send-email-s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-02-01 13:26 ` [PATCH 3/3] watchdog: Add Congatec CGEB watchdog driver Sascha Hauer
[not found] ` <1328102793-4313-4-git-send-email-s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-02-07 15:08 ` Wolfram Sang
[not found] ` <20120207150856.GI2539-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-02-15 13:41 ` Sascha Hauer
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=20130403150952.GX1906@pengutronix.de \
--to=s.hauer-bicnvbalz9megne8c9+irq@public.gmane.org \
--cc=christian.gmeiner-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-watchdog-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
--cc=x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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;
as well as URLs for NNTP newsgroup(s).