linux/drivers/watchdog/dw_wdt.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Copyright 2010-2011 Picochip Ltd., Jamie Iles
 * https://www.picochip.com
 *
 * This file implements a driver for the Synopsys DesignWare watchdog device
 * in the many subsystems. The watchdog has 16 different timeout periods
 * and these are a function of the input clock frequency.
 *
 * The DesignWare watchdog cannot be stopped once it has been started so we
 * do not implement a stop function. The watchdog core will continue to send
 * heartbeat requests after the watchdog device has been closed.
 */

#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

/* There are sixteen TOPs (timeout periods) that can be set in the watchdog. */
#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);

/*
 * In case if DW WDT IP core is synthesized with fixed TOP feature disabled the
 * TOPs array can be arbitrary ordered with nearly any sixteen uint numbers
 * depending on the system engineer imagination. The next method handles the
 * passed TOPs array to pre-calculate the effective timeouts and to sort the
 * TOP items out in the ascending order with respect to the timeouts.
 */

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 /* !CONFIG_DEBUG_FS */

static void dw_wdt_dbgfs_init(struct dw_wdt *dw_wdt) {}
static void dw_wdt_dbgfs_clear(struct dw_wdt *dw_wdt) {}

#endif /* !CONFIG_DEBUG_FS */

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();