#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/ihex.h>
#include <linux/firmware.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
#include <linux/types.h>
#include <linux/watchdog.h>
#include <asm/unaligned.h>
#define ZIIRAVE_TIMEOUT_MIN …
#define ZIIRAVE_TIMEOUT_MAX …
#define ZIIRAVE_TIMEOUT_DEFAULT …
#define ZIIRAVE_PING_VALUE …
#define ZIIRAVE_STATE_INITIAL …
#define ZIIRAVE_STATE_OFF …
#define ZIIRAVE_STATE_ON …
#define ZIIRAVE_FW_NAME …
static char *ziirave_reasons[] = …;
#define ZIIRAVE_WDT_FIRM_VER_MAJOR …
#define ZIIRAVE_WDT_BOOT_VER_MAJOR …
#define ZIIRAVE_WDT_RESET_REASON …
#define ZIIRAVE_WDT_STATE …
#define ZIIRAVE_WDT_TIMEOUT …
#define ZIIRAVE_WDT_TIME_LEFT …
#define ZIIRAVE_WDT_PING …
#define ZIIRAVE_WDT_RESET_DURATION …
#define ZIIRAVE_FIRM_PKT_TOTAL_SIZE …
#define ZIIRAVE_FIRM_PKT_DATA_SIZE …
#define ZIIRAVE_FIRM_FLASH_MEMORY_START …
#define ZIIRAVE_FIRM_FLASH_MEMORY_END …
#define ZIIRAVE_FIRM_PAGE_SIZE …
#define ZIIRAVE_FIRM_DOWNLOAD_ACK …
#define ZIIRAVE_CMD_DOWNLOAD_START …
#define ZIIRAVE_CMD_DOWNLOAD_END …
#define ZIIRAVE_CMD_DOWNLOAD_SET_READ_ADDR …
#define ZIIRAVE_CMD_DOWNLOAD_READ_BYTE …
#define ZIIRAVE_CMD_RESET_PROCESSOR …
#define ZIIRAVE_CMD_JUMP_TO_BOOTLOADER …
#define ZIIRAVE_CMD_DOWNLOAD_PACKET …
#define ZIIRAVE_CMD_JUMP_TO_BOOTLOADER_MAGIC …
#define ZIIRAVE_CMD_RESET_PROCESSOR_MAGIC …
struct ziirave_wdt_rev { … };
struct ziirave_wdt_data { … };
static int wdt_timeout;
module_param(wdt_timeout, int, 0);
MODULE_PARM_DESC(…) …;
static int reset_duration;
module_param(reset_duration, int, 0);
MODULE_PARM_DESC(…) …;
static bool nowayout = … WATCHDOG_NOWAYOUT;
module_param(nowayout, bool, 0);
MODULE_PARM_DESC(…) …;
static int ziirave_wdt_revision(struct i2c_client *client,
struct ziirave_wdt_rev *rev, u8 command)
{ … }
static int ziirave_wdt_set_state(struct watchdog_device *wdd, int state)
{ … }
static int ziirave_wdt_start(struct watchdog_device *wdd)
{ … }
static int ziirave_wdt_stop(struct watchdog_device *wdd)
{ … }
static int ziirave_wdt_ping(struct watchdog_device *wdd)
{ … }
static int ziirave_wdt_set_timeout(struct watchdog_device *wdd,
unsigned int timeout)
{ … }
static unsigned int ziirave_wdt_get_timeleft(struct watchdog_device *wdd)
{ … }
static int ziirave_firm_read_ack(struct watchdog_device *wdd)
{ … }
static int ziirave_firm_set_read_addr(struct watchdog_device *wdd, u32 addr)
{ … }
static bool ziirave_firm_addr_readonly(u32 addr)
{ … }
static int __ziirave_firm_write_pkt(struct watchdog_device *wdd,
u32 addr, const u8 *data, u8 len)
{ … }
static int ziirave_firm_write_pkt(struct watchdog_device *wdd,
u32 addr, const u8 *data, u8 len)
{ … }
static int ziirave_firm_verify(struct watchdog_device *wdd,
const struct firmware *fw)
{ … }
static int ziirave_firm_upload(struct watchdog_device *wdd,
const struct firmware *fw)
{ … }
static const struct watchdog_info ziirave_wdt_info = …;
static const struct watchdog_ops ziirave_wdt_ops = …;
static ssize_t ziirave_wdt_sysfs_show_firm(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static DEVICE_ATTR(firmware_version, S_IRUGO, ziirave_wdt_sysfs_show_firm,
NULL);
static ssize_t ziirave_wdt_sysfs_show_boot(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static DEVICE_ATTR(bootloader_version, S_IRUGO, ziirave_wdt_sysfs_show_boot,
NULL);
static ssize_t ziirave_wdt_sysfs_show_reason(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static DEVICE_ATTR(reset_reason, S_IRUGO, ziirave_wdt_sysfs_show_reason,
NULL);
static ssize_t ziirave_wdt_sysfs_store_firm(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static DEVICE_ATTR(update_firmware, S_IWUSR, NULL,
ziirave_wdt_sysfs_store_firm);
static struct attribute *ziirave_wdt_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static int ziirave_wdt_init_duration(struct i2c_client *client)
{ … }
static int ziirave_wdt_probe(struct i2c_client *client)
{ … }
static void ziirave_wdt_remove(struct i2c_client *client)
{ … }
static const struct i2c_device_id ziirave_wdt_id[] = …;
MODULE_DEVICE_TABLE(i2c, ziirave_wdt_id);
static const struct of_device_id zrv_wdt_of_match[] = …;
MODULE_DEVICE_TABLE(of, zrv_wdt_of_match);
static struct i2c_driver ziirave_wdt_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;