Re: [PATCH v5] watchdog: introduce retu_wdt driver

2013-02-07 Thread Wim Van Sebroeck
Hi Aaro,

> Introduce Retu watchdog driver.
> 
> Cc: linux-watch...@vger.kernel.org
> Acked-by: Felipe Balbi 
> Acked-by: Tony Lindgren 
> Signed-off-by: Aaro Koskinen 
> Cc: Wim Van Sebroeck 

Added tolinux-watchdog-next.

Kind regards,
Wim.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5] watchdog: introduce retu_wdt driver

2013-02-06 Thread Paul Walmsley
Hi Wim,

On Mon, 28 Jan 2013, Aaro Koskinen wrote:

> On Thu, Dec 27, 2012 at 10:58:29PM +0200, Aaro Koskinen wrote:
> > Introduce Retu watchdog driver.
> 
> Wim, any comments about this driver? Do you think it could be queued
> for 3.9?

It'd be really great if this could go in for v3.9.  Without it, Nokia N800 
boards crash shortly after boot because the Retu watchdog isn't being 
tickled :-(


- Paul
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5] watchdog: introduce retu_wdt driver

2013-01-28 Thread Aaro Koskinen
Hi,

On Thu, Dec 27, 2012 at 10:58:29PM +0200, Aaro Koskinen wrote:
> Introduce Retu watchdog driver.

Wim, any comments about this driver? Do you think it could be queued
for 3.9?

Thanks,

A.

> Cc: linux-watch...@vger.kernel.org
> Acked-by: Felipe Balbi 
> Acked-by: Tony Lindgren 
> Signed-off-by: Aaro Koskinen 
> Cc: Wim Van Sebroeck 
> ---
> 
>   v5: Deleted __dev* annotations.
>   Fixed a typo in Kconfig help text (Nokia 700 -> 770).
> 
>   For earlier history, see:
>   http://marc.info/?l=linux-kernel&m=135325660302114&w=2
> 
>  drivers/watchdog/Kconfig|   12 +++
>  drivers/watchdog/Makefile   |1 +
>  drivers/watchdog/retu_wdt.c |  178 
> +++
>  3 files changed, 191 insertions(+)
>  create mode 100644 drivers/watchdog/retu_wdt.c
> 
> diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> index 7f809fd..75afc76 100644
> --- a/drivers/watchdog/Kconfig
> +++ b/drivers/watchdog/Kconfig
> @@ -364,6 +364,18 @@ config IMX2_WDT
> To compile this driver as a module, choose M here: the
> module will be called imx2_wdt.
>  
> +config RETU_WATCHDOG
> + tristate "Retu watchdog"
> + depends on MFD_RETU
> + select WATCHDOG_CORE
> + help
> +   Retu watchdog driver for Nokia Internet Tablets (770, N800,
> +   N810). At least on N800 the watchdog cannot be disabled, so
> +   this driver is essential and you should enable it.
> +
> +   To compile this driver as a module, choose M here: the
> +   module will be called retu_wdt.
> +
>  # AVR32 Architecture
>  
>  config AT32AP700X_WDT
> diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
> index 97bbdb3a..157bc61 100644
> --- a/drivers/watchdog/Makefile
> +++ b/drivers/watchdog/Makefile
> @@ -52,6 +52,7 @@ obj-$(CONFIG_STMP3XXX_WATCHDOG) += stmp3xxx_wdt.o
>  obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o
>  obj-$(CONFIG_TS72XX_WATCHDOG) += ts72xx_wdt.o
>  obj-$(CONFIG_IMX2_WDT) += imx2_wdt.o
> +obj-$(CONFIG_RETU_WATCHDOG) += retu_wdt.o
>  
>  # AVR32 Architecture
>  obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o
> diff --git a/drivers/watchdog/retu_wdt.c b/drivers/watchdog/retu_wdt.c
> new file mode 100644
> index 000..f53615d
> --- /dev/null
> +++ b/drivers/watchdog/retu_wdt.c
> @@ -0,0 +1,178 @@
> +/*
> + * Retu watchdog driver
> + *
> + * Copyright (C) 2004, 2005 Nokia Corporation
> + *
> + * Based on code written by Amit Kucheria and Michael Buesch.
> + * Rewritten by Aaro Koskinen.
> + *
> + * This file is subject to the terms and conditions of the GNU General
> + * Public License. See the file "COPYING" in the main directory of this
> + * archive for more details.
> + *
> + * 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 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +/* Watchdog timer values in seconds */
> +#define RETU_WDT_MAX_TIMER   63
> +
> +struct retu_wdt_dev {
> + struct retu_dev *rdev;
> + struct device   *dev;
> + struct delayed_work ping_work;
> +};
> +
> +/*
> + * Since Retu watchdog cannot be disabled in hardware, we must kick it
> + * with a timer until userspace watchdog software takes over. If
> + * CONFIG_WATCHDOG_NOWAYOUT is set, we never start the feeding.
> + */
> +static void retu_wdt_ping_enable(struct retu_wdt_dev *wdev)
> +{
> + retu_write(wdev->rdev, RETU_REG_WATCHDOG, RETU_WDT_MAX_TIMER);
> + schedule_delayed_work(&wdev->ping_work,
> + round_jiffies_relative(RETU_WDT_MAX_TIMER * HZ / 2));
> +}
> +
> +static void retu_wdt_ping_disable(struct retu_wdt_dev *wdev)
> +{
> + retu_write(wdev->rdev, RETU_REG_WATCHDOG, RETU_WDT_MAX_TIMER);
> + cancel_delayed_work_sync(&wdev->ping_work);
> +}
> +
> +static void retu_wdt_ping_work(struct work_struct *work)
> +{
> + struct retu_wdt_dev *wdev = container_of(to_delayed_work(work),
> + struct retu_wdt_dev, ping_work);
> + retu_wdt_ping_enable(wdev);
> +}
> +
> +static int retu_wdt_start(struct watchdog_device *wdog)
> +{
> + struct retu_wdt_dev *wdev = watchdog_get_drvdata(wdog);
> +
> + retu_wdt_ping_disable(wdev);
> +
> + return retu_write(wdev->rdev, RETU_REG_WATCHDOG, wdog->timeout);
> +}
> +
> +static int retu_wdt_stop(struct watchdog_device *wdog)
> +{
> + struct retu_wdt_dev *wdev = watchdog_get_drvdata(wdog);
> +
> + retu_wdt_ping_enable(wdev);
> +
> + return 0;
> +}
> +
> +static int retu_wdt_ping(struct watchdog_device *wdog)
> +{
> + struct retu_wdt_dev *wdev = watchdog_get_drvdata(wdog);
> +
> + return retu_write(wdev->rdev, RETU_REG_WATCHDOG, wdog->timeout);
> +}
> +
> +static int retu_wdt_set_timeout(str