Skip to content
Snippets Groups Projects
Commit 8690d8a9 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] i6300esb.c: start locking
  [WATCHDOG] i6300esb.c: convert to platform device driver
  [WATCHDOG] wdt.c: remove #ifdef CONFIG_WDT_501
  [WATCHDOG] Fix io.h & uaccess.h includes.
  [WATCHDOG] More coding-style and trivial clean-up
  [WATCHDOG] struct file_operations should be const
  [WATCHDOG] cpwd.c: Coding style - Clean-up
  [WATCHDOG] hpwdt.c: Add new HP BMC controller. 
  [PATCH 13/13] drivers/watchdog: use USB API functions rather than constants
  [WATCHDOG] orion5x_wdt: fix compile issue by providing tclk as platform data
  [WATCHDOG] rc32434_wdt: make sure watchdog is not running at startup
  [WATCHDOG] rc32434_wdt: add spin_locking
  [WATCHDOG] rc32434_wdt: add shutdown method
  [WATCHDOG] rc32434_wdt: add timeout module parameter
  [WATCHDOG] rc32434_wdt: clean-up driver
  [WATCHDOG] davinci: convert to ioremap() + io[read|write]
  [WATCHDOG] w83697ug: add error checking
  [WATCHDOG] cpwd.c & riowd.c - unlocked_ioctl
parents d3f12d36 3b9d49ee
No related branches found
No related tags found
No related merge requests found
Showing
with 264 additions and 182 deletions
......@@ -31,6 +31,7 @@
#include <plat/ehci-orion.h>
#include <plat/mv_xor.h>
#include <plat/orion_nand.h>
#include <plat/orion5x_wdt.h>
#include <plat/time.h>
#include "common.h"
......@@ -532,6 +533,29 @@ void __init orion5x_xor_init(void)
}
/*****************************************************************************
* Watchdog
****************************************************************************/
static struct orion5x_wdt_platform_data orion5x_wdt_data = {
.tclk = 0,
};
static struct platform_device orion5x_wdt_device = {
.name = "orion5x_wdt",
.id = -1,
.dev = {
.platform_data = &orion5x_wdt_data,
},
.num_resources = 0,
};
void __init orion5x_wdt_init(void)
{
orion5x_wdt_data.tclk = orion5x_tclk;
platform_device_register(&orion5x_wdt_device);
}
/*****************************************************************************
* Time handling
****************************************************************************/
......@@ -631,6 +655,11 @@ void __init orion5x_init(void)
printk(KERN_INFO "Orion: Applying 5281 D0 WFI workaround.\n");
disable_hlt();
}
/*
* Register watchdog driver
*/
orion5x_wdt_init();
}
/*
......
/*
* arch/arm/plat-orion/include/plat/orion5x_wdt.h
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*/
#ifndef __PLAT_ORION5X_WDT_H
#define __PLAT_ORION5X_WDT_H
struct orion5x_wdt_platform_data {
u32 tclk; /* no <linux/clk.h> support yet */
};
#endif
......@@ -940,21 +940,6 @@ config WDT
To compile this driver as a module, choose M here: the
module will be called wdt.
config WDT_501
bool "WDT501 features"
depends on WDT
help
Saying Y here and creating a character special file /dev/temperature
with major number 10 and minor number 131 ("man mknod") will give
you a thermometer inside your computer: reading from
/dev/temperature yields one byte, the temperature in degrees
Fahrenheit. This works only if you have a WDT501P watchdog board
installed.
If you want to enable the Fan Tachometer on the WDT501P, then you
can do this via the tachometer parameter. Only do this if you have a
fan tachometer actually set up.
#
# PCI-based Watchdog Cards
#
......
/*
* Acquire Single Board Computer Watchdog Timer driver
*
* Based on wdt.c. Original copyright messages:
* Based on wdt.c. Original copyright messages:
*
* (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>,
* All Rights Reserved.
......@@ -17,9 +17,9 @@
*
* (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk>
*
* 14-Dec-2001 Matt Domsch <Matt_Domsch@dell.com>
* Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT
* Can't add timeout - driver doesn't allow changing value
* 14-Dec-2001 Matt Domsch <Matt_Domsch@dell.com>
* Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT
* Can't add timeout - driver doesn't allow changing value
*/
/*
......
......@@ -138,7 +138,9 @@ static long advwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
.options = WDIOF_KEEPALIVEPING |
WDIOF_SETTIMEOUT |
WDIOF_MAGICCLOSE,
.firmware_version = 1,
.identity = WATCHDOG_NAME,
};
......@@ -259,7 +261,8 @@ static int __devinit advwdt_probe(struct platform_device *dev)
goto unreg_stop;
}
/* Check that the heartbeat value is within it's range ; if not reset to the default */
/* Check that the heartbeat value is within it's range ;
* if not reset to the default */
if (advwdt_set_heartbeat(timeout)) {
advwdt_set_heartbeat(WATCHDOG_TIMEOUT);
printk(KERN_INFO PFX
......
......@@ -60,7 +60,7 @@ static void ali_start(void)
pci_read_config_dword(ali_pci, 0xCC, &val);
val &= ~0x3F; /* Mask count */
val |= (1<<25) | ali_timeout_bits;
val |= (1 << 25) | ali_timeout_bits;
pci_write_config_dword(ali_pci, 0xCC, val);
spin_unlock(&ali_lock);
......@@ -79,8 +79,8 @@ static void ali_stop(void)
spin_lock(&ali_lock);
pci_read_config_dword(ali_pci, 0xCC, &val);
val &= ~0x3F; /* Mask count to zero (disabled) */
val &= ~(1<<25);/* and for safety mask the reset enable */
val &= ~0x3F; /* Mask count to zero (disabled) */
val &= ~(1 << 25); /* and for safety mask the reset enable */
pci_write_config_dword(ali_pci, 0xCC, val);
spin_unlock(&ali_lock);
......@@ -89,7 +89,7 @@ static void ali_stop(void)
/*
* ali_keepalive - send a keepalive to the watchdog
*
* Send a keepalive to the timer (actually we restart the timer).
* Send a keepalive to the timer (actually we restart the timer).
*/
static void ali_keepalive(void)
......@@ -109,11 +109,11 @@ static int ali_settimer(int t)
if (t < 0)
return -EINVAL;
else if (t < 60)
ali_timeout_bits = t|(1<<6);
ali_timeout_bits = t|(1 << 6);
else if (t < 3600)
ali_timeout_bits = (t/60)|(1<<7);
ali_timeout_bits = (t / 60)|(1 << 7);
else if (t < 18000)
ali_timeout_bits = (t/300)|(1<<6)|(1<<7);
ali_timeout_bits = (t / 300)|(1 << 6)|(1 << 7);
else
return -EINVAL;
......@@ -138,7 +138,7 @@ static int ali_settimer(int t)
*/
static ssize_t ali_write(struct file *file, const char __user *data,
size_t len, loff_t *ppos)
size_t len, loff_t *ppos)
{
/* See if we got the magic character 'V' and reload the timer */
if (len) {
......@@ -348,9 +348,9 @@ static int __init ali_find_watchdog(void)
/* Timer bits */
wdog &= ~0x3F;
/* Issued events */
wdog &= ~((1<<27)|(1<<26)|(1<<25)|(1<<24));
wdog &= ~((1 << 27)|(1 << 26)|(1 << 25)|(1 << 24));
/* No monitor bits */
wdog &= ~((1<<16)|(1<<13)|(1<<12)|(1<<11)|(1<<10)|(1<<9));
wdog &= ~((1 << 16)|(1 << 13)|(1 << 12)|(1 << 11)|(1 << 10)|(1 << 9));
pci_write_config_dword(pdev, 0xCC, wdog);
......
......@@ -355,7 +355,8 @@ static int __init alim7101_wdt_init(void)
alim7101_pmu = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101,
NULL);
if (!alim7101_pmu) {
printk(KERN_INFO PFX "ALi M7101 PMU not present - WDT not set\n");
printk(KERN_INFO PFX
"ALi M7101 PMU not present - WDT not set\n");
return -EBUSY;
}
......@@ -399,7 +400,8 @@ static int __init alim7101_wdt_init(void)
rc = misc_register(&wdt_miscdev);
if (rc) {
printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
printk(KERN_ERR PFX
"cannot register miscdev on minor=%d (err=%d)\n",
wdt_miscdev.minor, rc);
goto err_out_reboot;
}
......
......@@ -201,7 +201,7 @@ static long at91_wdt_ioctl(struct file *file,
* Pat the watchdog whenever device is written to.
*/
static ssize_t at91_wdt_write(struct file *file, const char *data, size_t len,
loff_t *ppos)
loff_t *ppos)
{
if (!len)
return 0;
......
/* cpwd.c - driver implementation for hardware watchdog
* timers found on Sun Microsystems CP1400 and CP1500 boards.
*
* This device supports both the generic Linux watchdog
* This device supports both the generic Linux watchdog
* interface and Solaris-compatible ioctls as best it is
* able.
*
* NOTE: CP1400 systems appear to have a defective intr_mask
* register on the PLD, preventing the disabling of
* timer interrupts. We use a timer to periodically
* timer interrupts. We use a timer to periodically
* reset 'stopped' watchdogs on affected platforms.
*
* Copyright (c) 2000 Eric Brower (ebrower@usa.net)
......@@ -28,10 +28,9 @@
#include <linux/io.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/uaccess.h>
#include <asm/irq.h>
#include <asm/uaccess.h>
#include <asm/watchdog.h>
#define DRIVER_NAME "cpwd"
......@@ -43,8 +42,8 @@
#define WD_BLIMIT 0xFFFF
#define WD0_MINOR 212
#define WD1_MINOR 213
#define WD2_MINOR 214
#define WD1_MINOR 213
#define WD2_MINOR 214
/* Internal driver definitions. */
#define WD0_ID 0
......@@ -91,16 +90,16 @@ struct cpwd {
static struct cpwd *cpwd_device;
/* Sun uses Altera PLD EPF8820ATC144-4
/* Sun uses Altera PLD EPF8820ATC144-4
* providing three hardware watchdogs:
*
* 1) RIC - sends an interrupt when triggered
* 2) XIR - asserts XIR_B_RESET when triggered, resets CPU
* 3) POR - asserts POR_B_RESET when triggered, resets CPU, backplane, board
* 1) RIC - sends an interrupt when triggered
* 2) XIR - asserts XIR_B_RESET when triggered, resets CPU
* 3) POR - asserts POR_B_RESET when triggered, resets CPU, backplane, board
*
*** Timer register block definition (struct wd_timer_regblk)
*
* dcntr and limit registers (halfword access):
* dcntr and limit registers (halfword access):
* -------------------
* | 15 | ...| 1 | 0 |
* -------------------
......@@ -108,7 +107,8 @@ static struct cpwd *cpwd_device;
* -------------------
* dcntr - Current 16-bit downcounter value.
* When downcounter reaches '0' watchdog expires.
* Reading this register resets downcounter with 'limit' value.
* Reading this register resets downcounter with
* 'limit' value.
* limit - 16-bit countdown value in 1/10th second increments.
* Writing this register begins countdown with input value.
* Reading from this register does not affect counter.
......@@ -158,11 +158,11 @@ static int wd0_timeout = 0;
static int wd1_timeout = 0;
static int wd2_timeout = 0;
module_param (wd0_timeout, int, 0);
module_param(wd0_timeout, int, 0);
MODULE_PARM_DESC(wd0_timeout, "Default watchdog0 timeout in 1/10secs");
module_param (wd1_timeout, int, 0);
module_param(wd1_timeout, int, 0);
MODULE_PARM_DESC(wd1_timeout, "Default watchdog1 timeout in 1/10secs");
module_param (wd2_timeout, int, 0);
module_param(wd2_timeout, int, 0);
MODULE_PARM_DESC(wd2_timeout, "Default watchdog2 timeout in 1/10secs");
MODULE_AUTHOR("Eric Brower <ebrower@usa.net>");
......@@ -201,9 +201,9 @@ static u8 cpwd_readb(void __iomem *addr)
static void cpwd_toggleintr(struct cpwd *p, int index, int enable)
{
unsigned char curregs = cpwd_readb(p->regs + PLD_IMASK);
unsigned char setregs =
(index == -1) ?
(WD0_INTR_MASK | WD1_INTR_MASK | WD2_INTR_MASK) :
unsigned char setregs =
(index == -1) ?
(WD0_INTR_MASK | WD1_INTR_MASK | WD2_INTR_MASK) :
(p->devs[index].intr_mask);
if (enable == WD_INTR_ON)
......@@ -303,24 +303,24 @@ static int cpwd_getstatus(struct cpwd *p, int index)
unsigned char ret = WD_STOPPED;
/* determine STOPPED */
if (!stat)
if (!stat)
return ret;
/* determine EXPIRED vs FREERUN vs RUNNING */
else if (WD_S_EXPIRED & stat) {
ret = WD_EXPIRED;
} else if(WD_S_RUNNING & stat) {
} else if (WD_S_RUNNING & stat) {
if (intr & p->devs[index].intr_mask) {
ret = WD_FREERUN;
} else {
/* Fudge WD_EXPIRED status for defective CP1400--
* IF timer is running
* AND brokenstop is set
* IF timer is running
* AND brokenstop is set
* AND an interrupt has been serviced
* we are WD_EXPIRED.
*
* IF timer is running
* AND brokenstop is set
* IF timer is running
* AND brokenstop is set
* AND no interrupt has been serviced
* we are WD_FREERUN.
*/
......@@ -329,7 +329,8 @@ static int cpwd_getstatus(struct cpwd *p, int index)
if (p->devs[index].runstatus & WD_STAT_SVCD) {
ret = WD_EXPIRED;
} else {
/* we could as well pretend we are expired */
/* we could as well pretend
* we are expired */
ret = WD_FREERUN;
}
} else {
......@@ -342,7 +343,7 @@ static int cpwd_getstatus(struct cpwd *p, int index)
if (p->devs[index].runstatus & WD_STAT_SVCD)
ret |= WD_SERVICED;
return(ret);
return ret;
}
static irqreturn_t cpwd_interrupt(int irq, void *dev_id)
......@@ -367,22 +368,22 @@ static int cpwd_open(struct inode *inode, struct file *f)
struct cpwd *p = cpwd_device;
lock_kernel();
switch(iminor(inode)) {
case WD0_MINOR:
case WD1_MINOR:
case WD2_MINOR:
break;
switch (iminor(inode)) {
case WD0_MINOR:
case WD1_MINOR:
case WD2_MINOR:
break;
default:
unlock_kernel();
return -ENODEV;
default:
unlock_kernel();
return -ENODEV;
}
/* Register IRQ on first open of device */
if (!p->initialized) {
if (request_irq(p->irq, &cpwd_interrupt,
if (request_irq(p->irq, &cpwd_interrupt,
IRQF_SHARED, DRIVER_NAME, p)) {
printk(KERN_ERR PFX "Cannot register IRQ %d\n",
printk(KERN_ERR PFX "Cannot register IRQ %d\n",
p->irq);
unlock_kernel();
return -EBUSY;
......@@ -400,8 +401,7 @@ static int cpwd_release(struct inode *inode, struct file *file)
return 0;
}
static int cpwd_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
static long cpwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
static struct watchdog_info info = {
.options = WDIOF_SETTIMEOUT,
......@@ -409,6 +409,7 @@ static int cpwd_ioctl(struct inode *inode, struct file *file,
.identity = DRIVER_NAME,
};
void __user *argp = (void __user *)arg;
struct inode *inode = file->f_path.dentry->d_inode;
int index = iminor(inode) - WD0_MINOR;
struct cpwd *p = cpwd_device;
int setopt = 0;
......@@ -442,7 +443,7 @@ static int cpwd_ioctl(struct inode *inode, struct file *file,
cpwd_starttimer(p, index);
} else {
return -EINVAL;
}
}
break;
/* Solaris-compatible IOCTLs */
......@@ -458,7 +459,7 @@ static int cpwd_ioctl(struct inode *inode, struct file *file,
case WIOCSTOP:
if (p->enabled)
return(-EINVAL);
return -EINVAL;
cpwd_stoptimer(p, index);
break;
......@@ -481,7 +482,7 @@ static long cpwd_compat_ioctl(struct file *file, unsigned int cmd,
case WIOCSTOP:
case WIOCGSTAT:
lock_kernel();
rval = cpwd_ioctl(file->f_path.dentry->d_inode, file, cmd, arg);
rval = cpwd_ioctl(file, cmd, arg);
unlock_kernel();
break;
......@@ -493,7 +494,7 @@ static long cpwd_compat_ioctl(struct file *file, unsigned int cmd,
return rval;
}
static ssize_t cpwd_write(struct file *file, const char __user *buf,
static ssize_t cpwd_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
struct inode *inode = file->f_path.dentry->d_inode;
......@@ -508,20 +509,20 @@ static ssize_t cpwd_write(struct file *file, const char __user *buf,
return 0;
}
static ssize_t cpwd_read(struct file * file, char __user *buffer,
static ssize_t cpwd_read(struct file *file, char __user *buffer,
size_t count, loff_t *ppos)
{
return -EINVAL;
}
static const struct file_operations cpwd_fops = {
.owner = THIS_MODULE,
.ioctl = cpwd_ioctl,
.compat_ioctl = cpwd_compat_ioctl,
.open = cpwd_open,
.write = cpwd_write,
.read = cpwd_read,
.release = cpwd_release,
.owner = THIS_MODULE,
.unlocked_ioctl = cpwd_ioctl,
.compat_ioctl = cpwd_compat_ioctl,
.open = cpwd_open,
.write = cpwd_write,
.read = cpwd_read,
.release = cpwd_release,
};
static int __devinit cpwd_probe(struct of_device *op,
......
......@@ -24,7 +24,7 @@
#include <linux/spinlock.h>
#include <linux/uaccess.h>
#include <linux/io.h>
#include <mach/hardware.h>
#include <linux/device.h>
#define MODULE_NAME "DAVINCI-WDT: "
......@@ -75,9 +75,9 @@ static void wdt_service(void)
spin_lock(&io_lock);
/* put watchdog in service state */
davinci_writel(WDKEY_SEQ0, wdt_base + WDTCR);
iowrite32(WDKEY_SEQ0, wdt_base + WDTCR);
/* put watchdog in active state */
davinci_writel(WDKEY_SEQ1, wdt_base + WDTCR);
iowrite32(WDKEY_SEQ1, wdt_base + WDTCR);
spin_unlock(&io_lock);
}
......@@ -90,29 +90,29 @@ static void wdt_enable(void)
spin_lock(&io_lock);
/* disable, internal clock source */
davinci_writel(0, wdt_base + TCR);
iowrite32(0, wdt_base + TCR);
/* reset timer, set mode to 64-bit watchdog, and unreset */
davinci_writel(0, wdt_base + TGCR);
iowrite32(0, wdt_base + TGCR);
tgcr = TIMMODE_64BIT_WDOG | TIM12RS_UNRESET | TIM34RS_UNRESET;
davinci_writel(tgcr, wdt_base + TGCR);
iowrite32(tgcr, wdt_base + TGCR);
/* clear counter regs */
davinci_writel(0, wdt_base + TIM12);
davinci_writel(0, wdt_base + TIM34);
iowrite32(0, wdt_base + TIM12);
iowrite32(0, wdt_base + TIM34);
/* set timeout period */
timer_margin = (((u64)heartbeat * CLOCK_TICK_RATE) & 0xffffffff);
davinci_writel(timer_margin, wdt_base + PRD12);
iowrite32(timer_margin, wdt_base + PRD12);
timer_margin = (((u64)heartbeat * CLOCK_TICK_RATE) >> 32);
davinci_writel(timer_margin, wdt_base + PRD34);
iowrite32(timer_margin, wdt_base + PRD34);
/* enable run continuously */
davinci_writel(ENAMODE12_PERIODIC, wdt_base + TCR);
iowrite32(ENAMODE12_PERIODIC, wdt_base + TCR);
/* Once the WDT is in pre-active state write to
* TIM12, TIM34, PRD12, PRD34, TCR, TGCR, WDTCR are
* write protected (except for the WDKEY field)
*/
/* put watchdog in pre-active state */
davinci_writel(WDKEY_SEQ0 | WDEN, wdt_base + WDTCR);
iowrite32(WDKEY_SEQ0 | WDEN, wdt_base + WDTCR);
/* put watchdog in active state */
davinci_writel(WDKEY_SEQ1 | WDEN, wdt_base + WDTCR);
iowrite32(WDKEY_SEQ1 | WDEN, wdt_base + WDTCR);
spin_unlock(&io_lock);
}
......@@ -197,17 +197,16 @@ static int davinci_wdt_probe(struct platform_device *pdev)
{
int ret = 0, size;
struct resource *res;
struct device *dev = &pdev->dev;
if (heartbeat < 1 || heartbeat > MAX_HEARTBEAT)
heartbeat = DEFAULT_HEARTBEAT;
printk(KERN_INFO MODULE_NAME
"DaVinci Watchdog Timer: heartbeat %d sec\n", heartbeat);
dev_info(dev, "heartbeat %d sec\n", heartbeat);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res == NULL) {
printk(KERN_INFO MODULE_NAME
"failed to get memory region resource\n");
dev_err(dev, "failed to get memory region resource\n");
return -ENOENT;
}
......@@ -215,20 +214,26 @@ static int davinci_wdt_probe(struct platform_device *pdev)
wdt_mem = request_mem_region(res->start, size, pdev->name);
if (wdt_mem == NULL) {
printk(KERN_INFO MODULE_NAME "failed to get memory region\n");
dev_err(dev, "failed to get memory region\n");
return -ENOENT;
}
wdt_base = (void __iomem *)(res->start);
wdt_base = ioremap(res->start, size);
if (!wdt_base) {
dev_err(dev, "failed to map memory region\n");
return -ENOMEM;
}
ret = misc_register(&davinci_wdt_miscdev);
if (ret < 0) {
printk(KERN_ERR MODULE_NAME "cannot register misc device\n");
dev_err(dev, "cannot register misc device\n");
release_resource(wdt_mem);
kfree(wdt_mem);
} else {
set_bit(WDT_DEVICE_INITED, &wdt_status);
}
iounmap(wdt_base);
return ret;
}
......
......@@ -8,19 +8,19 @@
* Based on wdt.c.
* Original copyright messages:
*
* (c) Copyright 1996-1997 Alan Cox <alan@lxorguk.ukuu.org.uk>,
* (c) Copyright 1996-1997 Alan Cox <alan@lxorguk.ukuu.org.uk>,
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* Neither Alan Cox nor CymruNet Ltd. admit liability nor provide
* warranty for any of this software. This material is provided
* "AS-IS" and at no charge.
* Neither Alan Cox nor CymruNet Ltd. admit liability nor provide
* warranty for any of this software. This material is provided
* "AS-IS" and at no charge.
*
* (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk>*
* (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk>*
*/
/* Changelog:
......@@ -37,7 +37,7 @@
* add expect_close support
*
* 2002.05.30 - Joel Becker <joel.becker@oracle.com>
* Added Matt Domsch's nowayout module option.
* Added Matt Domsch's nowayout module option.
*/
/*
......@@ -151,7 +151,7 @@ static void eurwdt_activate_timer(void)
if (irq == 0)
printk(KERN_INFO ": interrupt disabled\n");
eurwdt_write_reg(WDT_TIMER_CFG, irq<<4);
eurwdt_write_reg(WDT_TIMER_CFG, irq << 4);
eurwdt_write_reg(WDT_UNIT_SEL, WDT_UNIT_SECS); /* we use seconds */
eurwdt_set_timeout(0); /* the default timeout */
......
......@@ -34,11 +34,15 @@
static int timeout = WATCHDOG_TIMEOUT;
module_param(timeout, int, 0);
MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=131, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ".");
MODULE_PARM_DESC(timeout,
"Watchdog timeout in seconds. 1<= timeout <=131, default="
__MODULE_STRING(WATCHDOG_TIMEOUT) ".");
static int nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, int, 0);
MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
MODULE_PARM_DESC(nowayout,
"Watchdog cannot be stopped once started (default="
__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
static struct platform_device *geodewdt_platform_device;
static unsigned long wdt_flags;
......@@ -269,7 +273,8 @@ static int __init geodewdt_init(void)
if (ret)
return ret;
geodewdt_platform_device = platform_device_register_simple(DRV_NAME, -1, NULL, 0);
geodewdt_platform_device = platform_device_register_simple(DRV_NAME,
-1, NULL, 0);
if (IS_ERR(geodewdt_platform_device)) {
ret = PTR_ERR(geodewdt_platform_device);
goto err;
......
......@@ -47,6 +47,7 @@
#define PCI_BIOS32_PARAGRAPH_LEN 16
#define PCI_ROM_BASE1 0x000F0000
#define ROM_SIZE 0x10000
#define HPWDT_VERSION "1.01"
struct bios32_service_dir {
u32 signature;
......@@ -130,17 +131,14 @@ static void *cru_rom_addr;
static struct cmn_registers cmn_regs;
static struct pci_device_id hpwdt_devices[] = {
{
.vendor = PCI_VENDOR_ID_COMPAQ,
.device = 0xB203,
.subvendor = PCI_ANY_ID,
.subdevice = PCI_ANY_ID,
},
{ PCI_DEVICE(PCI_VENDOR_ID_COMPAQ, 0xB203) },
{ PCI_DEVICE(PCI_VENDOR_ID_HP, 0x3306) },
{0}, /* terminate list */
};
MODULE_DEVICE_TABLE(pci, hpwdt_devices);
extern asmlinkage void asminline_call(struct cmn_registers *pi86Regs, unsigned long *pRomEntry);
extern asmlinkage void asminline_call(struct cmn_registers *pi86Regs,
unsigned long *pRomEntry);
#ifndef CONFIG_X86_64
/* --32 Bit Bios------------------------------------------------------------ */
......@@ -605,7 +603,7 @@ static long hpwdt_ioctl(struct file *file, unsigned int cmd,
/*
* Kernel interfaces
*/
static struct file_operations hpwdt_fops = {
static const struct file_operations hpwdt_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.write = hpwdt_write,
......@@ -704,10 +702,11 @@ static int __devinit hpwdt_init_one(struct pci_dev *dev,
}
printk(KERN_INFO
"hp Watchdog Timer Driver: 1.00"
"hp Watchdog Timer Driver: %s"
", timer margin: %d seconds (nowayout=%d)"
", allow kernel dump: %s (default = 0/OFF).\n",
soft_margin, nowayout, (allow_kdump == 0) ? "OFF" : "ON");
HPWDT_VERSION, soft_margin, nowayout,
(allow_kdump == 0) ? "OFF" : "ON");
return 0;
......@@ -757,6 +756,7 @@ static int __init hpwdt_init(void)
MODULE_AUTHOR("Tom Mingarelli");
MODULE_DESCRIPTION("hp watchdog driver");
MODULE_LICENSE("GPL");
MODULE_VERSION(HPWDT_VERSION);
MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
module_param(soft_margin, int, 0);
......
......@@ -13,7 +13,7 @@
*
* The timer is implemented in the following I/O controller hubs:
* (See the intel documentation on http://developer.intel.com.)
* 6300ESB chip : document number 300641-003
* 6300ESB chip : document number 300641-004
*
* 2004YYZZ Ross Biro
* Initial version 0.01
......@@ -34,7 +34,7 @@
#include <linux/mm.h>
#include <linux/miscdevice.h>
#include <linux/watchdog.h>
#include <linux/reboot.h>
#include <linux/platform_device.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/ioport.h>
......@@ -42,7 +42,7 @@
#include <linux/io.h>
/* Module and version information */
#define ESB_VERSION "0.03"
#define ESB_VERSION "0.04"
#define ESB_MODULE_NAME "i6300ESB timer"
#define ESB_DRIVER_NAME ESB_MODULE_NAME ", v" ESB_VERSION
#define PFX ESB_MODULE_NAME ": "
......@@ -81,6 +81,7 @@ static unsigned long timer_alive;
static struct pci_dev *esb_pci;
static unsigned short triggered; /* The status of the watchdog upon boot */
static char esb_expect_close;
static struct platform_device *esb_platform_device;
/* module parameters */
/* 30 sec default heartbeat (1 < heartbeat < 2*1023) */
......@@ -114,13 +115,18 @@ static inline void esb_unlock_registers(void)
writeb(ESB_UNLOCK2, ESB_RELOAD_REG);
}
static void esb_timer_start(void)
static int esb_timer_start(void)
{
u8 val;
spin_lock(&esb_lock);
esb_unlock_registers();
writew(ESB_WDT_RELOAD, ESB_RELOAD_REG);
/* Enable or Enable + Lock? */
val = 0x02 | (nowayout ? 0x01 : 0x00);
pci_write_config_byte(esb_pci, ESB_LOCK_REG, val);
spin_unlock(&esb_lock);
return 0;
}
static int esb_timer_stop(void)
......@@ -207,7 +213,6 @@ static int esb_open(struct inode *inode, struct file *file)
return -EBUSY;
/* Reload and activate timer */
esb_timer_keepalive();
esb_timer_start();
return nonseekable_open(inode, file);
......@@ -240,7 +245,8 @@ static ssize_t esb_write(struct file *file, const char __user *data,
* five months ago... */
esb_expect_close = 0;
/* scan to see whether or not we got the magic character */
/* scan to see whether or not we got the
* magic character */
for (i = 0; i != len; i++) {
char c;
if (get_user(c, data + i))
......@@ -292,7 +298,6 @@ static long esb_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
}
if (new_options & WDIOS_ENABLECARD) {
esb_timer_keepalive();
esb_timer_start();
retval = 0;
}
......@@ -318,19 +323,6 @@ static long esb_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
}
}
/*
* Notify system
*/
static int esb_notify_sys(struct notifier_block *this,
unsigned long code, void *unused)
{
if (code == SYS_DOWN || code == SYS_HALT)
esb_timer_stop(); /* Turn the WDT off */
return NOTIFY_DONE;
}
/*
* Kernel Interfaces
*/
......@@ -350,10 +342,6 @@ static struct miscdevice esb_miscdev = {
.fops = &esb_fops,
};
static struct notifier_block esb_notifier = {
.notifier_call = esb_notify_sys,
};
/*
* Data for PCI driver interface
*
......@@ -372,7 +360,7 @@ MODULE_DEVICE_TABLE(pci, esb_pci_tbl);
* Init & exit routines
*/
static unsigned char __init esb_getdevice(void)
static unsigned char __devinit esb_getdevice(void)
{
u8 val1;
unsigned short val2;
......@@ -443,7 +431,7 @@ err_devput:
return 0;
}
static int __init watchdog_init(void)
static int __devinit esb_probe(struct platform_device *dev)
{
int ret;
......@@ -459,19 +447,13 @@ static int __init watchdog_init(void)
"heartbeat value must be 1<heartbeat<2046, using %d\n",
heartbeat);
}
ret = register_reboot_notifier(&esb_notifier);
if (ret != 0) {
printk(KERN_ERR PFX
"cannot register reboot notifier (err=%d)\n", ret);
goto err_unmap;
}
ret = misc_register(&esb_miscdev);
if (ret != 0) {
printk(KERN_ERR PFX
"cannot register miscdev on minor=%d (err=%d)\n",
WATCHDOG_MINOR, ret);
goto err_notifier;
goto err_unmap;
}
esb_timer_stop();
printk(KERN_INFO PFX
......@@ -479,8 +461,6 @@ static int __init watchdog_init(void)
BASEADDR, heartbeat, nowayout);
return 0;
err_notifier:
unregister_reboot_notifier(&esb_notifier);
err_unmap:
iounmap(BASEADDR);
/* err_release: */
......@@ -492,7 +472,7 @@ err_unmap:
return ret;
}
static void __exit watchdog_cleanup(void)
static int __devexit esb_remove(struct platform_device *dev)
{
/* Stop the timer before we leave */
if (!nowayout)
......@@ -500,11 +480,58 @@ static void __exit watchdog_cleanup(void)
/* Deregister */
misc_deregister(&esb_miscdev);
unregister_reboot_notifier(&esb_notifier);
iounmap(BASEADDR);
pci_release_region(esb_pci, 0);
pci_disable_device(esb_pci);
pci_dev_put(esb_pci);
return 0;
}
static void esb_shutdown(struct platform_device *dev)
{
esb_timer_stop();
}
static struct platform_driver esb_platform_driver = {
.probe = esb_probe,
.remove = __devexit_p(esb_remove),
.shutdown = esb_shutdown,
.driver = {
.owner = THIS_MODULE,
.name = ESB_MODULE_NAME,
},
};
static int __init watchdog_init(void)
{
int err;
printk(KERN_INFO PFX "Intel 6300ESB WatchDog Timer Driver v%s\n",
ESB_VERSION);
err = platform_driver_register(&esb_platform_driver);
if (err)
return err;
esb_platform_device = platform_device_register_simple(ESB_MODULE_NAME,
-1, NULL, 0);
if (IS_ERR(esb_platform_device)) {
err = PTR_ERR(esb_platform_device);
goto unreg_platform_driver;
}
return 0;
unreg_platform_driver:
platform_driver_unregister(&esb_platform_driver);
return err;
}
static void __exit watchdog_cleanup(void)
{
platform_device_unregister(esb_platform_device);
platform_driver_unregister(&esb_platform_driver);
printk(KERN_INFO PFX "Watchdog Module Unloaded.\n");
}
module_init(watchdog_init);
......
......@@ -47,7 +47,8 @@
static int vendorsupport;
module_param(vendorsupport, int, 0);
MODULE_PARM_DESC(vendorsupport, "iTCO vendor specific support mode, default=0 (none), 1=SuperMicro Pent3, 2=SuperMicro Pent4+");
MODULE_PARM_DESC(vendorsupport, "iTCO vendor specific support mode, default="
"0 (none), 1=SuperMicro Pent3, 2=SuperMicro Pent4+");
/*
* Vendor Specific Support
......@@ -305,7 +306,8 @@ static void __exit iTCO_vendor_exit_module(void)
module_init(iTCO_vendor_init_module);
module_exit(iTCO_vendor_exit_module);
MODULE_AUTHOR("Wim Van Sebroeck <wim@iguana.be>, R. Seretny <lkpatches@paypc.com>");
MODULE_AUTHOR("Wim Van Sebroeck <wim@iguana.be>, "
"R. Seretny <lkpatches@paypc.com>");
MODULE_DESCRIPTION("Intel TCO Vendor Specific WatchDog Timer Driver Support");
MODULE_VERSION(DRV_VERSION);
MODULE_LICENSE("GPL");
......
......@@ -273,7 +273,9 @@ static struct platform_device *iTCO_wdt_platform_device;
#define WATCHDOG_HEARTBEAT 30 /* 30 sec default heartbeat */
static int heartbeat = WATCHDOG_HEARTBEAT; /* in seconds */
module_param(heartbeat, int, 0);
MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (2<heartbeat<39 (TCO v1) or 613 (TCO v2), default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")");
MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. "
"(2<heartbeat<39 (TCO v1) or 613 (TCO v2), default="
__MODULE_STRING(WATCHDOG_HEARTBEAT) ")");
static int nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, int, 0);
......@@ -346,7 +348,8 @@ static int iTCO_wdt_start(void)
/* disable chipset's NO_REBOOT bit */
if (iTCO_wdt_unset_NO_REBOOT_bit()) {
spin_unlock(&iTCO_wdt_private.io_lock);
printk(KERN_ERR PFX "failed to reset NO_REBOOT flag, reboot disabled by hardware\n");
printk(KERN_ERR PFX "failed to reset NO_REBOOT flag, "
"reboot disabled by hardware\n");
return -EIO;
}
......@@ -669,7 +672,8 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev,
/* Check chipset's NO_REBOOT bit */
if (iTCO_wdt_unset_NO_REBOOT_bit() && iTCO_vendor_check_noreboot_on()) {
printk(KERN_ERR PFX "failed to reset NO_REBOOT flag, reboot disabled by hardware\n");
printk(KERN_ERR PFX "failed to reset NO_REBOOT flag, "
"reboot disabled by hardware\n");
ret = -ENODEV; /* Cannot reset NO_REBOOT bit */
goto out;
}
......@@ -716,8 +720,9 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev,
if not reset to the default */
if (iTCO_wdt_set_heartbeat(heartbeat)) {
iTCO_wdt_set_heartbeat(WATCHDOG_HEARTBEAT);
printk(KERN_INFO PFX "heartbeat value must be 2 < heartbeat < 39 (TCO v1) or 613 (TCO v2), using %d\n",
heartbeat);
printk(KERN_INFO PFX
"heartbeat value must be 2 < heartbeat < 39 (TCO v1) "
"or 613 (TCO v2), using %d\n", heartbeat);
}
ret = misc_register(&iTCO_wdt_miscdev);
......
......@@ -188,8 +188,8 @@ static inline int superio_inb(int reg)
static inline void superio_outb(int val, int reg)
{
outb(reg, REG);
outb(val, VAL);
outb(reg, REG);
outb(val, VAL);
}
static inline int superio_inw(int reg)
......@@ -204,10 +204,10 @@ static inline int superio_inw(int reg)
static inline void superio_outw(int val, int reg)
{
outb(reg++, REG);
outb(val >> 8, VAL);
outb(reg, REG);
outb(val, VAL);
outb(reg++, REG);
outb(val >> 8, VAL);
outb(reg, REG);
outb(val, VAL);
}
/* watchdog timer handling */
......
......@@ -9,8 +9,8 @@
#include <asm/mpc52xx.h>
#define GPT_MODE_WDT (1<<15)
#define GPT_MODE_CE (1<<12)
#define GPT_MODE_WDT (1 << 15)
#define GPT_MODE_CE (1 << 12)
#define GPT_MODE_MS_TIMER (0x4)
......
......@@ -5,7 +5,7 @@
*
* Based on the SoftDog driver:
* (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>,
* All Rights Reserved.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
......
......@@ -5,7 +5,7 @@
* All Rights Reserved.
* http://www.4g-systems.biz
*
* (C) Copyright 2007 OpenWrt.org, Florian Fainelli <florian@openwrt.org>
* (C) Copyright 2007 OpenWrt.org, Florian Fainelli <florian@openwrt.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment