Source
/*
* Watchdog driver for Cirrus Logic EP93xx family of devices.
*
* Copyright (c) 2004 Ray Lehtiniemi
* Copyright (c) 2006 Tower Technologies
* Based on ep93xx driver, bits from alim7101_wdt.c
*
* Authors: Ray Lehtiniemi <rayl@mail.com>,
* Alessandro Zummo <a.zummo@towertech.it>
*
* Copyright (c) 2012 H Hartley Sweeten <hsweeten@visionengravers.com>
* Convert to a platform device and use the watchdog framework API
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*
* This watchdog fires after 250msec, which is a too short interval
* for us to rely on the user space daemon alone. So we ping the
* wdt each ~200msec and eventually stop doing it if the user space
* daemon dies.
*/
/* default timeout (secs) */
static bool nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, bool, 0);
MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started");
static unsigned int timeout;
module_param(timeout, uint, 0);
MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds.");
struct ep93xx_wdt_priv {
void __iomem *mmio;
struct watchdog_device wdd;
};
static int ep93xx_wdt_start(struct watchdog_device *wdd)
{
struct ep93xx_wdt_priv *priv = watchdog_get_drvdata(wdd);
writel(0xaaaa, priv->mmio + EP93XX_WATCHDOG);
return 0;
}
static int ep93xx_wdt_stop(struct watchdog_device *wdd)
{
struct ep93xx_wdt_priv *priv = watchdog_get_drvdata(wdd);
writel(0xaa55, priv->mmio + EP93XX_WATCHDOG);
return 0;