^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Eurotech CPU-1220/1410/1420 on board WDT driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * (c) Copyright 2001 Ascensit <support@ascensit.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * (c) Copyright 2001 Rodolfo Giometti <giometti@ascensit.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * (c) Copyright 2002 Rob Radez <rob@osinvestor.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * Based on wdt.c.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * Original copyright messages:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * (c) Copyright 1996-1997 Alan Cox <alan@lxorguk.ukuu.org.uk>,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * All Rights Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * Neither Alan Cox nor CymruNet Ltd. admit liability nor provide
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * warranty for any of this software. This material is provided
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) * "AS-IS" and at no charge.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk>*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) /* Changelog:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * 2001 - Rodolfo Giometti
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * Initial release
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * 2002/04/25 - Rob Radez
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) * clean up #includes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * clean up locking
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) * make __setup param unique
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) * proper options in watchdog_info
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) * add WDIOC_GETSTATUS and WDIOC_SETOPTIONS ioctls
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) * add expect_close support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) * 2002.05.30 - Joel Becker <joel.becker@oracle.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) * Added Matt Domsch's nowayout module option.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) * The eurotech CPU-1220/1410/1420's watchdog is a part
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) * of the on-board SUPER I/O device SMSC FDC 37B782.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) #include <linux/moduleparam.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #include <linux/miscdevice.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) #include <linux/watchdog.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #include <linux/fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #include <linux/ioport.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) #include <linux/notifier.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) #include <linux/reboot.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) #include <linux/uaccess.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) static unsigned long eurwdt_is_open;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) static int eurwdt_timeout;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) static char eur_expect_close;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) static DEFINE_SPINLOCK(eurwdt_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) * You must set these - there is no sane way to probe for this board.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) static int io = 0x3f0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) static int irq = 10;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) static char *ev = "int";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) #define WDT_TIMEOUT 60 /* 1 minute */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) static bool nowayout = WATCHDOG_NOWAYOUT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) module_param(nowayout, bool, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) MODULE_PARM_DESC(nowayout,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) "Watchdog cannot be stopped once started (default="
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) * Some symbolic names
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) #define WDT_CTRL_REG 0x30
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) #define WDT_OUTPIN_CFG 0xe2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) #define WDT_EVENT_INT 0x00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) #define WDT_EVENT_REBOOT 0x08
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) #define WDT_UNIT_SEL 0xf1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) #define WDT_UNIT_SECS 0x80
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) #define WDT_TIMEOUT_VAL 0xf2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) #define WDT_TIMER_CFG 0xf3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) module_param_hw(io, int, ioport, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) MODULE_PARM_DESC(io, "Eurotech WDT io port (default=0x3f0)");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) module_param_hw(irq, int, irq, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) MODULE_PARM_DESC(irq, "Eurotech WDT irq (default=10)");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) module_param(ev, charp, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) MODULE_PARM_DESC(ev, "Eurotech WDT event type (default is `int')");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) * Programming support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) static inline void eurwdt_write_reg(u8 index, u8 data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) outb(index, io);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) outb(data, io+1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) static inline void eurwdt_lock_chip(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) outb(0xaa, io);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) static inline void eurwdt_unlock_chip(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) outb(0x55, io);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) eurwdt_write_reg(0x07, 0x08); /* set the logical device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) static inline void eurwdt_set_timeout(int timeout)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) eurwdt_write_reg(WDT_TIMEOUT_VAL, (u8) timeout);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) static inline void eurwdt_disable_timer(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) eurwdt_set_timeout(0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) static void eurwdt_activate_timer(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) eurwdt_disable_timer();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) eurwdt_write_reg(WDT_CTRL_REG, 0x01); /* activate the WDT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) eurwdt_write_reg(WDT_OUTPIN_CFG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) !strcmp("int", ev) ? WDT_EVENT_INT : WDT_EVENT_REBOOT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) /* Setting interrupt line */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) if (irq == 2 || irq > 15 || irq < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) pr_err("invalid irq number\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) irq = 0; /* if invalid we disable interrupt */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) if (irq == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) pr_info("interrupt disabled\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) eurwdt_write_reg(WDT_TIMER_CFG, irq << 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) eurwdt_write_reg(WDT_UNIT_SEL, WDT_UNIT_SECS); /* we use seconds */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) eurwdt_set_timeout(0); /* the default timeout */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) * Kernel methods.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) static irqreturn_t eurwdt_interrupt(int irq, void *dev_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) pr_crit("timeout WDT timeout\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) #ifdef ONLY_TESTING
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) pr_crit("Would Reboot\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) pr_crit("Initiating system reboot\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) emergency_restart();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) return IRQ_HANDLED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) * eurwdt_ping:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) * Reload counter one with the watchdog timeout.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) static void eurwdt_ping(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) /* Write the watchdog default value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) eurwdt_set_timeout(eurwdt_timeout);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) * eurwdt_write:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) * @file: file handle to the watchdog
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) * @buf: buffer to write (unused as data does not matter here
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) * @count: count of bytes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) * @ppos: pointer to the position to write. No seeks allowed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) * A write to a watchdog device is defined as a keepalive signal. Any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) * write of data will do, as we we don't define content meaning.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) static ssize_t eurwdt_write(struct file *file, const char __user *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) size_t count, loff_t *ppos)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) if (count) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) if (!nowayout) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) size_t i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) eur_expect_close = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) for (i = 0; i != count; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) char c;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) if (get_user(c, buf + i))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) return -EFAULT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) if (c == 'V')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) eur_expect_close = 42;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) spin_lock(&eurwdt_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) eurwdt_ping(); /* the default timeout */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) spin_unlock(&eurwdt_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) return count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) * eurwdt_ioctl:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) * @file: file handle to the device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) * @cmd: watchdog command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) * @arg: argument pointer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) * The watchdog API defines a common set of functions for all watchdogs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) * according to their available features.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) static long eurwdt_ioctl(struct file *file,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) unsigned int cmd, unsigned long arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) void __user *argp = (void __user *)arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) int __user *p = argp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) static const struct watchdog_info ident = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) | WDIOF_MAGICCLOSE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) .firmware_version = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) .identity = "WDT Eurotech CPU-1220/1410",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) int time;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) int options, retval = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) switch (cmd) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) case WDIOC_GETSUPPORT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) case WDIOC_GETSTATUS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) case WDIOC_GETBOOTSTATUS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) return put_user(0, p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) case WDIOC_SETOPTIONS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) if (get_user(options, p))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) return -EFAULT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) spin_lock(&eurwdt_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) if (options & WDIOS_DISABLECARD) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) eurwdt_disable_timer();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) retval = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) if (options & WDIOS_ENABLECARD) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) eurwdt_activate_timer();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) eurwdt_ping();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) retval = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) spin_unlock(&eurwdt_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) return retval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) case WDIOC_KEEPALIVE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) spin_lock(&eurwdt_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) eurwdt_ping();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) spin_unlock(&eurwdt_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) case WDIOC_SETTIMEOUT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) if (copy_from_user(&time, p, sizeof(int)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) return -EFAULT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) /* Sanity check */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) if (time < 0 || time > 255)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) spin_lock(&eurwdt_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) eurwdt_timeout = time;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) eurwdt_set_timeout(time);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) spin_unlock(&eurwdt_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) fallthrough;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) case WDIOC_GETTIMEOUT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) return put_user(eurwdt_timeout, p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) return -ENOTTY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) * eurwdt_open:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) * @inode: inode of device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) * @file: file handle to device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) * The misc device has been opened. The watchdog device is single
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) * open and on opening we load the counter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) static int eurwdt_open(struct inode *inode, struct file *file)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) if (test_and_set_bit(0, &eurwdt_is_open))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) return -EBUSY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) eurwdt_timeout = WDT_TIMEOUT; /* initial timeout */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) /* Activate the WDT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) eurwdt_activate_timer();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) return stream_open(inode, file);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) * eurwdt_release:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) * @inode: inode to board
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) * @file: file handle to board
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) * The watchdog has a configurable API. There is a religious dispute
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) * between people who want their watchdog to be able to shut down and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) * those who want to be sure if the watchdog manager dies the machine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) * reboots. In the former case we disable the counters, in the latter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) * case you have to open it again very soon.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) static int eurwdt_release(struct inode *inode, struct file *file)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) if (eur_expect_close == 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) eurwdt_disable_timer();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) pr_crit("Unexpected close, not stopping watchdog!\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) eurwdt_ping();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) clear_bit(0, &eurwdt_is_open);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) eur_expect_close = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) * eurwdt_notify_sys:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) * @this: our notifier block
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) * @code: the event being reported
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) * @unused: unused
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) * Our notifier is called on system shutdowns. We want to turn the card
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) * off at reboot otherwise the machine will reboot again during memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) * test or worse yet during the following fsck. This would suck, in fact
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) * trust me - if it happens it does suck.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) static int eurwdt_notify_sys(struct notifier_block *this, unsigned long code,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) void *unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) if (code == SYS_DOWN || code == SYS_HALT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) eurwdt_disable_timer(); /* Turn the card off */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) return NOTIFY_DONE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) * Kernel Interfaces
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) static const struct file_operations eurwdt_fops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) .owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) .llseek = no_llseek,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) .write = eurwdt_write,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) .unlocked_ioctl = eurwdt_ioctl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) .compat_ioctl = compat_ptr_ioctl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) .open = eurwdt_open,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) .release = eurwdt_release,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) static struct miscdevice eurwdt_miscdev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) .minor = WATCHDOG_MINOR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) .name = "watchdog",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) .fops = &eurwdt_fops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) * The WDT card needs to learn about soft shutdowns in order to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) * turn the timebomb registers off.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) static struct notifier_block eurwdt_notifier = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) .notifier_call = eurwdt_notify_sys,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) * cleanup_module:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) * Unload the watchdog. You cannot do this with any file handles open.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) * If your watchdog is set to continue ticking on close and you unload
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) * it, well it keeps ticking. We won't get the interrupt but the board
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) * will not touch PC memory so all is fine. You just have to load a new
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) * module in 60 seconds or reboot.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) static void __exit eurwdt_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) eurwdt_lock_chip();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) misc_deregister(&eurwdt_miscdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) unregister_reboot_notifier(&eurwdt_notifier);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) release_region(io, 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) free_irq(irq, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) * eurwdt_init:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) * Set up the WDT watchdog board. After grabbing the resources
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) * we require we need also to unlock the device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) * The open() function will actually kick the board off.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) static int __init eurwdt_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) ret = request_irq(irq, eurwdt_interrupt, 0, "eurwdt", NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) pr_err("IRQ %d is not free\n", irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) if (!request_region(io, 2, "eurwdt")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) pr_err("IO %X is not free\n", io);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) ret = -EBUSY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) goto outirq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) ret = register_reboot_notifier(&eurwdt_notifier);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) pr_err("can't register reboot notifier (err=%d)\n", ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) goto outreg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) ret = misc_register(&eurwdt_miscdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) pr_err("can't misc_register on minor=%d\n", WATCHDOG_MINOR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) goto outreboot;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) eurwdt_unlock_chip();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) pr_info("Eurotech WDT driver 0.01 at %X (Interrupt %d) - timeout event: %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) io, irq, (!strcmp("int", ev) ? "int" : "reboot"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) outreboot:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) unregister_reboot_notifier(&eurwdt_notifier);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) outreg:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) release_region(io, 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) outirq:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) free_irq(irq, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) module_init(eurwdt_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) module_exit(eurwdt_exit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) MODULE_AUTHOR("Rodolfo Giometti");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) MODULE_DESCRIPTION("Driver for Eurotech CPU-1220/1410 on board watchdog");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) MODULE_LICENSE("GPL");