#include <linux/bitops.h>
#include <linux/clk.h>
#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/limits.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pm.h>
#include <linux/reset.h>
#include <linux/watchdog.h>
#define WDOG_CONTROL_REG_OFFSET …
#define WDOG_CONTROL_REG_WDT_EN_MASK …
#define WDOG_CONTROL_REG_RESP_MODE_MASK …
#define WDOG_TIMEOUT_RANGE_REG_OFFSET …
#define WDOG_TIMEOUT_RANGE_TOPINIT_SHIFT …
#define WDOG_CURRENT_COUNT_REG_OFFSET …
#define WDOG_COUNTER_RESTART_REG_OFFSET …
#define WDOG_COUNTER_RESTART_KICK_VALUE …
#define WDOG_INTERRUPT_STATUS_REG_OFFSET …
#define WDOG_INTERRUPT_CLEAR_REG_OFFSET …
#define WDOG_COMP_PARAMS_5_REG_OFFSET …
#define WDOG_COMP_PARAMS_4_REG_OFFSET …
#define WDOG_COMP_PARAMS_3_REG_OFFSET …
#define WDOG_COMP_PARAMS_2_REG_OFFSET …
#define WDOG_COMP_PARAMS_1_REG_OFFSET …
#define WDOG_COMP_PARAMS_1_USE_FIX_TOP …
#define WDOG_COMP_VERSION_REG_OFFSET …
#define WDOG_COMP_TYPE_REG_OFFSET …
#define DW_WDT_NUM_TOPS …
#define DW_WDT_FIX_TOP(_idx) …
#define DW_WDT_DEFAULT_SECONDS …
static const u32 dw_wdt_fix_tops[DW_WDT_NUM_TOPS] = …;
static bool nowayout = … WATCHDOG_NOWAYOUT;
module_param(nowayout, bool, 0);
MODULE_PARM_DESC(…) …;
enum dw_wdt_rmod { … };
struct dw_wdt_timeout { … };
struct dw_wdt { … };
#define to_dw_wdt(wdd) …
static inline int dw_wdt_is_enabled(struct dw_wdt *dw_wdt)
{ … }
static void dw_wdt_update_mode(struct dw_wdt *dw_wdt, enum dw_wdt_rmod rmod)
{ … }
static unsigned int dw_wdt_find_best_top(struct dw_wdt *dw_wdt,
unsigned int timeout, u32 *top_val)
{ … }
static unsigned int dw_wdt_get_min_timeout(struct dw_wdt *dw_wdt)
{ … }
static unsigned int dw_wdt_get_max_timeout_ms(struct dw_wdt *dw_wdt)
{ … }
static unsigned int dw_wdt_get_timeout(struct dw_wdt *dw_wdt)
{ … }
static int dw_wdt_ping(struct watchdog_device *wdd)
{ … }
static int dw_wdt_set_timeout(struct watchdog_device *wdd, unsigned int top_s)
{ … }
static int dw_wdt_set_pretimeout(struct watchdog_device *wdd, unsigned int req)
{ … }
static void dw_wdt_arm_system_reset(struct dw_wdt *dw_wdt)
{ … }
static int dw_wdt_start(struct watchdog_device *wdd)
{ … }
static int dw_wdt_stop(struct watchdog_device *wdd)
{ … }
static int dw_wdt_restart(struct watchdog_device *wdd,
unsigned long action, void *data)
{ … }
static unsigned int dw_wdt_get_timeleft(struct watchdog_device *wdd)
{ … }
static const struct watchdog_info dw_wdt_ident = …;
static const struct watchdog_info dw_wdt_pt_ident = …;
static const struct watchdog_ops dw_wdt_ops = …;
static irqreturn_t dw_wdt_irq(int irq, void *devid)
{ … }
static int dw_wdt_suspend(struct device *dev)
{ … }
static int dw_wdt_resume(struct device *dev)
{ … }
static DEFINE_SIMPLE_DEV_PM_OPS(dw_wdt_pm_ops, dw_wdt_suspend, dw_wdt_resume);
static void dw_wdt_handle_tops(struct dw_wdt *dw_wdt, const u32 *tops)
{ … }
static int dw_wdt_init_timeouts(struct dw_wdt *dw_wdt, struct device *dev)
{ … }
#ifdef CONFIG_DEBUG_FS
#define DW_WDT_DBGFS_REG(_name, _off) …
static const struct debugfs_reg32 dw_wdt_dbgfs_regs[] = …;
static void dw_wdt_dbgfs_init(struct dw_wdt *dw_wdt)
{ … }
static void dw_wdt_dbgfs_clear(struct dw_wdt *dw_wdt)
{ … }
#else
static void dw_wdt_dbgfs_init(struct dw_wdt *dw_wdt) {}
static void dw_wdt_dbgfs_clear(struct dw_wdt *dw_wdt) {}
#endif
static int dw_wdt_drv_probe(struct platform_device *pdev)
{ … }
static void dw_wdt_drv_remove(struct platform_device *pdev)
{ … }
#ifdef CONFIG_OF
static const struct of_device_id dw_wdt_of_match[] = …;
MODULE_DEVICE_TABLE(of, dw_wdt_of_match);
#endif
static struct platform_driver dw_wdt_driver = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;