#include <linux/bitops.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/mod_devicetable.h>
#include <linux/platform_device.h>
#include <linux/watchdog.h>
#define DEFAULT_TIMEOUT 30
static bool nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, bool, 0);
MODULE_PARM_DESC(nowayout,
"Watchdog cannot be stopped once started (default="
__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
static unsigned int timeout;
module_param(timeout, int, 0);
MODULE_PARM_DESC(timeout, "Watchdog timeout");
#define WD_CONFIG_XTAL_IN BIT(0)
#define WD_CONFIG_DISABLE BIT(31)
struct tangox_wdt_device {
struct watchdog_device wdt;
static int tangox_wdt_set_timeout(struct watchdog_device *wdt,
unsigned int new_timeout)
wdt->timeout = new_timeout;
static int tangox_wdt_start(struct watchdog_device *wdt)
struct tangox_wdt_device *dev = watchdog_get_drvdata(wdt);
ticks = 1 + wdt->timeout * dev->clk_rate;
writel(ticks, dev->base + WD_COUNTER);