linux/drivers/watchdog/starfive-wdt.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Starfive Watchdog driver
 *
 * Copyright (C) 2022 StarFive Technology Co., Ltd.
 */

#include <linux/clk.h>
#include <linux/iopoll.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/reset.h>
#include <linux/watchdog.h>

/* JH7100 Watchdog register define */
#define STARFIVE_WDT_JH7100_INTSTAUS
#define STARFIVE_WDT_JH7100_CONTROL
#define STARFIVE_WDT_JH7100_LOAD
#define STARFIVE_WDT_JH7100_EN
#define STARFIVE_WDT_JH7100_RELOAD
#define STARFIVE_WDT_JH7100_VALUE
#define STARFIVE_WDT_JH7100_INTCLR
#define STARFIVE_WDT_JH7100_LOCK

/* JH7110 Watchdog register define */
#define STARFIVE_WDT_JH7110_LOAD
#define STARFIVE_WDT_JH7110_VALUE
#define STARFIVE_WDT_JH7110_CONTROL
#define STARFIVE_WDT_JH7110_INTCLR
#define STARFIVE_WDT_JH7110_IMS
#define STARFIVE_WDT_JH7110_LOCK

/* WDOGCONTROL */
#define STARFIVE_WDT_ENABLE
#define STARFIVE_WDT_EN_SHIFT
#define STARFIVE_WDT_RESET_EN
#define STARFIVE_WDT_JH7100_RST_EN_SHIFT
#define STARFIVE_WDT_JH7110_RST_EN_SHIFT

/* WDOGLOCK */
#define STARFIVE_WDT_JH7100_UNLOCK_KEY
#define STARFIVE_WDT_JH7110_UNLOCK_KEY

/* WDOGINTCLR */
#define STARFIVE_WDT_INTCLR
#define STARFIVE_WDT_JH7100_INTCLR_AVA_SHIFT

#define STARFIVE_WDT_MAXCNT
#define STARFIVE_WDT_DEFAULT_TIME
#define STARFIVE_WDT_DELAY_US
#define STARFIVE_WDT_TIMEOUT_US

/* module parameter */
#define STARFIVE_WDT_EARLY_ENA

static bool nowayout = WATCHDOG_NOWAYOUT;
static int heartbeat;
static bool early_enable =;

module_param(heartbeat, int, 0);
module_param(early_enable, bool, 0);
module_param(nowayout, bool, 0);

MODULE_PARM_DESC();
MODULE_PARM_DESC();
MODULE_PARM_DESC();

struct starfive_wdt_variant {};

struct starfive_wdt {};

/* Register layout and configuration for the JH7100 */
static const struct starfive_wdt_variant starfive_wdt_jh7100_variant =;

/* Register layout and configuration for the JH7110 */
static const struct starfive_wdt_variant starfive_wdt_jh7110_variant =;

static int starfive_wdt_enable_clock(struct starfive_wdt *wdt)
{}

static void starfive_wdt_disable_clock(struct starfive_wdt *wdt)
{}

static inline int starfive_wdt_get_clock(struct starfive_wdt *wdt)
{}

static inline int starfive_wdt_reset_init(struct device *dev)
{}

static u32 starfive_wdt_ticks_to_sec(struct starfive_wdt *wdt, u32 ticks)
{}

/* Write unlock-key to unlock. Write other value to lock. */
static void starfive_wdt_unlock(struct starfive_wdt *wdt)
	__acquires(&wdt->lock)
{}

static void starfive_wdt_lock(struct starfive_wdt *wdt)
	__releases(&wdt->lock)
{}

/* enable watchdog interrupt to reset/reboot */
static void starfive_wdt_enable_reset(struct starfive_wdt *wdt)
{}

/* interrupt status whether has been raised from the counter */
static bool starfive_wdt_raise_irq_status(struct starfive_wdt *wdt)
{}

/* waiting interrupt can be free to clear */
static int starfive_wdt_wait_int_free(struct starfive_wdt *wdt)
{}

/* clear interrupt signal before initialization or reload */
static int starfive_wdt_int_clr(struct starfive_wdt *wdt)
{}

static inline void starfive_wdt_set_count(struct starfive_wdt *wdt, u32 val)
{}

static inline u32 starfive_wdt_get_count(struct starfive_wdt *wdt)
{}

/* enable watchdog */
static inline void starfive_wdt_enable(struct starfive_wdt *wdt)
{}

/* disable watchdog */
static inline void starfive_wdt_disable(struct starfive_wdt *wdt)
{}

static inline void starfive_wdt_set_reload_count(struct starfive_wdt *wdt, u32 count)
{}

static unsigned int starfive_wdt_max_timeout(struct starfive_wdt *wdt)
{}

static unsigned int starfive_wdt_get_timeleft(struct watchdog_device *wdd)
{}

static int starfive_wdt_keepalive(struct watchdog_device *wdd)
{}

static int starfive_wdt_start(struct starfive_wdt *wdt)
{}

static void starfive_wdt_stop(struct starfive_wdt *wdt)
{}

static int starfive_wdt_pm_start(struct watchdog_device *wdd)
{}

static int starfive_wdt_pm_stop(struct watchdog_device *wdd)
{}

static int starfive_wdt_set_timeout(struct watchdog_device *wdd,
				    unsigned int timeout)
{}

#define STARFIVE_WDT_OPTIONS

static const struct watchdog_info starfive_wdt_info =;

static const struct watchdog_ops starfive_wdt_ops =;

static int starfive_wdt_probe(struct platform_device *pdev)
{}

static void starfive_wdt_remove(struct platform_device *pdev)
{}

static void starfive_wdt_shutdown(struct platform_device *pdev)
{}

static int starfive_wdt_suspend(struct device *dev)
{}

static int starfive_wdt_resume(struct device *dev)
{}

static int starfive_wdt_runtime_suspend(struct device *dev)
{}

static int starfive_wdt_runtime_resume(struct device *dev)
{}

static const struct dev_pm_ops starfive_wdt_pm_ops =;

static const struct of_device_id starfive_wdt_match[] =;
MODULE_DEVICE_TABLE(of, starfive_wdt_match);

static struct platform_driver starfive_wdt_driver =;
module_platform_driver();

MODULE_AUTHOR();
MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();