linux/drivers/watchdog/ziirave_wdt.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Copyright (C) 2015 Zodiac Inflight Innovations
 *
 * Author: Martyn Welch <[email protected]>
 *
 * Based on twl4030_wdt.c by Timo Kokkonen <timo.t.kokkonen at nokia.com>:
 *
 * Copyright (C) Nokia Corporation
 */

#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

/* Received and ready for next Download packet. */
#define ZIIRAVE_FIRM_DOWNLOAD_ACK

/* Firmware commands */
#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)
{}

/*
 * ziirave_firm_write_pkt() - Build and write a firmware packet
 *
 * A packet to send to the firmware is composed by following bytes:
 *     Length | Addr0 | Addr1 | Data0 .. Data15 | Checksum |
 * Where,
 *     Length: A data byte containing the length of the data.
 *     Addr0: Low byte of the address.
 *     Addr1: High byte of the address.
 *     Data0 .. Data15: Array of 16 bytes of data.
 *     Checksum: Checksum byte to verify data integrity.
 */
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();