Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 980110c5 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog:
  [WATCHDOG] add Nano 7240 driver
  [WATCHDOG] ipmi: add the standard watchdog timeout ioctls
  [WATCHDOG] IT8212F watchdog driver
  [WATCHDOG] Sbus: cpwatchdog, remove SPIN_LOCK_UNLOCKED
  [WATCHDOG] bfin_wdt, remove SPIN_LOCK_UNLOCKED
  [WATCHDOG] Stop looking for device as soon as one is found
  [WATCHDOG] at32ap700x_wdt: add support for boot status and add fix for silicon errata
parents 5cdddecc c4c28335
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -669,6 +669,7 @@ static int ipmi_ioctl(struct inode *inode, struct file *file,
		return 0;

	case WDIOC_SET_PRETIMEOUT:
	case WDIOC_SETPRETIMEOUT:
		i = copy_from_user(&val, argp, sizeof(int));
		if (i)
			return -EFAULT;
@@ -676,6 +677,7 @@ static int ipmi_ioctl(struct inode *inode, struct file *file,
		return ipmi_set_timeout(IPMI_SET_TIMEOUT_HB_IF_NECESSARY);

	case WDIOC_GET_PRETIMEOUT:
	case WDIOC_GETPRETIMEOUT:
		i = copy_to_user(argp, &pretimeout, sizeof(pretimeout));
		if (i)
			return -EFAULT;
+1 −1
Original line number Diff line number Diff line
@@ -154,7 +154,7 @@ struct wd_device {
};

static struct wd_device wd_dev = { 
		0, SPIN_LOCK_UNLOCKED, 0, 0, 0, 0,
		0, __SPIN_LOCK_UNLOCKED(wd_dev.lock), 0, 0, 0, 0,
};

static struct timer_list wd_timer;
+23 −0
Original line number Diff line number Diff line
@@ -392,6 +392,16 @@ config ITCO_VENDOR_SUPPORT
	  devices. At this moment we only have additional support for some
	  SuperMicro Inc. motherboards.

config IT8712F_WDT
	tristate "IT8712F (Smart Guardian) Watchdog Timer"
	depends on X86
	---help---
	  This is the driver for the built-in watchdog timer on the IT8712F
	  Super I/0 chipset used on many motherboards.

	  To compile this driver as a module, choose M here: the
	  module will be called it8712f_wdt.

config SC1200_WDT
	tristate "National Semiconductor PC87307/PC97307 (ala SC1200) Watchdog"
	depends on X86
@@ -456,6 +466,19 @@ config SBC8360_WDT

	  Most people will say N.

config SBC7240_WDT
	tristate "SBC Nano 7240 Watchdog Timer"
	depends on X86_32
	---help---
	  This is the driver for the hardware watchdog found on the IEI
	  single board computers EPIC Nano 7240 (and likely others). This
	  watchdog simply watches your kernel to make sure it doesn't freeze,
	  and if it does, it reboots your computer after a certain amount of
	  time.

	  To compile this driver as a module, choose M here: the
	  module will be called sbc7240_wdt.

config CPU5_WDT
	tristate "SMA CPU5 Watchdog"
	depends on X86
+2 −0
Original line number Diff line number Diff line
@@ -66,11 +66,13 @@ obj-$(CONFIG_IBMASR) += ibmasr.o
obj-$(CONFIG_WAFER_WDT) += wafer5823wdt.o
obj-$(CONFIG_I6300ESB_WDT) += i6300esb.o
obj-$(CONFIG_ITCO_WDT) += iTCO_wdt.o iTCO_vendor_support.o
obj-$(CONFIG_IT8712F_WDT) += it8712f_wdt.o
obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o
obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o
obj-$(CONFIG_PC87413_WDT) += pc87413_wdt.o
obj-$(CONFIG_60XX_WDT) += sbc60xxwdt.o
obj-$(CONFIG_SBC8360_WDT) += sbc8360.o
obj-$(CONFIG_SBC7240_WDT) += sbc7240_wdt.o
obj-$(CONFIG_CPU5_WDT) += cpu5wdt.o
obj-$(CONFIG_SMSC37B787_WDT) += smsc37b787_wdt.o
obj-$(CONFIG_W83627HF_WDT) += w83627hf_wdt.o
+65 −4
Original line number Diff line number Diff line
@@ -6,6 +6,19 @@
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 *
 * Errata: WDT Clear is blocked after WDT Reset
 *
 * A watchdog timer event will, after reset, block writes to the WDT_CLEAR
 * register, preventing the program to clear the next Watchdog Timer Reset.
 *
 * If you still want to use the WDT after a WDT reset a small code can be
 * insterted at the startup checking the AVR32_PM.rcause register for WDT reset
 * and use a GPIO pin to reset the system. This method requires that one of the
 * GPIO pins are available and connected externally to the RESET_N pin. After
 * the GPIO pin has pulled down the reset line the GPIO will be reset and leave
 * the pin tristated with pullup.
 */

#include <linux/init.h>
@@ -44,6 +57,13 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="

#define WDT_CLR			0x04

#define WDT_RCAUSE		0x10
#define WDT_RCAUSE_POR		   0
#define WDT_RCAUSE_EXT		   2
#define WDT_RCAUSE_WDT		   3
#define WDT_RCAUSE_JTAG		   4
#define WDT_RCAUSE_SERP		   5

#define WDT_BIT(name)		(1 << WDT_##name)
#define WDT_BF(name, value)	((value) << WDT_##name)

@@ -56,6 +76,7 @@ struct wdt_at32ap700x {
	void __iomem		*regs;
	spinlock_t		io_lock;
	int			timeout;
	int			boot_status;
	unsigned long		users;
	struct miscdevice	miscdev;
};
@@ -126,7 +147,7 @@ static int at32_wdt_close(struct inode *inode, struct file *file)
		at32_wdt_stop();
	} else {
		dev_dbg(wdt->miscdev.parent,
			"Unexpected close, not stopping watchdog!\n");
			"unexpected close, not stopping watchdog!\n");
		at32_wdt_pat();
	}
	clear_bit(1, &wdt->users);
@@ -154,6 +175,33 @@ static int at32_wdt_settimeout(int time)
	return 0;
}

/*
 * Get the watchdog status.
 */
static int at32_wdt_get_status(void)
{
	int rcause;
	int status = 0;

	rcause = wdt_readl(wdt, RCAUSE);

	switch (rcause) {
	case WDT_BIT(RCAUSE_EXT):
		status = WDIOF_EXTERN1;
		break;
	case WDT_BIT(RCAUSE_WDT):
		status = WDIOF_CARDRESET;
		break;
	case WDT_BIT(RCAUSE_POR):  /* fall through */
	case WDT_BIT(RCAUSE_JTAG): /* fall through */
	case WDT_BIT(RCAUSE_SERP): /* fall through */
	default:
		break;
	}

	return status;
}

static struct watchdog_info at32_wdt_info = {
	.identity	= "at32ap700x watchdog",
	.options	= WDIOF_SETTIMEOUT |
@@ -194,10 +242,12 @@ static int at32_wdt_ioctl(struct inode *inode, struct file *file,
	case WDIOC_GETTIMEOUT:
		ret = put_user(wdt->timeout, p);
		break;
	case WDIOC_GETSTATUS: /* fall through */
	case WDIOC_GETBOOTSTATUS:
	case WDIOC_GETSTATUS:
		ret = put_user(0, p);
		break;
	case WDIOC_GETBOOTSTATUS:
		ret = put_user(wdt->boot_status, p);
		break;
	case WDIOC_SETOPTIONS:
		ret = get_user(time, p);
		if (ret)
@@ -282,8 +332,19 @@ static int __init at32_wdt_probe(struct platform_device *pdev)
		dev_dbg(&pdev->dev, "could not map I/O memory\n");
		goto err_free;
	}

	spin_lock_init(&wdt->io_lock);
	wdt->boot_status = at32_wdt_get_status();

	/* Work-around for watchdog silicon errata. */
	if (wdt->boot_status & WDIOF_CARDRESET) {
		dev_info(&pdev->dev, "CPU must be reset with external "
				"reset or POR due to silicon errata.\n");
		ret = -EIO;
		goto err_iounmap;
	} else {
		wdt->users = 0;
	}
	wdt->miscdev.minor = WATCHDOG_MINOR;
	wdt->miscdev.name = "watchdog";
	wdt->miscdev.fops = &at32_wdt_fops;
Loading