Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 37980
b: refs/heads/master
c: 99d2853
h: refs/heads/master
v: v3
  • Loading branch information
Wim Van Sebroeck committed Oct 2, 2006
1 parent c10da1b commit d0e941c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f676449785d333078acb60ccf2046d0d3c59548f
refs/heads/master: 99d2853ac953900962d8191788060e80766eb214
12 changes: 12 additions & 0 deletions trunk/drivers/char/watchdog/pnx4008_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/clk.h>
#include <linux/spinlock.h>

#include <asm/hardware.h>
#include <asm/uaccess.h>
Expand Down Expand Up @@ -80,6 +81,7 @@
static int nowayout = WATCHDOG_NOWAYOUT;
static int heartbeat = DEFAULT_HEARTBEAT;

static spinlock_t io_lock;
static unsigned long wdt_status;
#define WDT_IN_USE 0
#define WDT_OK_TO_CLOSE 1
Expand All @@ -94,6 +96,8 @@ struct clk *wdt_clk;

static void wdt_enable(void)
{
spin_lock(&io_lock);

if (wdt_clk)
clk_set_rate(wdt_clk, 1);

Expand All @@ -113,13 +117,19 @@ static void wdt_enable(void)
__raw_writel(heartbeat * WDOG_COUNTER_RATE, WDTIM_MATCH0(wdt_base));
/*enable counter, stop when debugger active */
__raw_writel(COUNT_ENAB | DEBUG_EN, WDTIM_CTRL(wdt_base));

spin_unlock(&io_lock);
}

static void wdt_disable(void)
{
spin_lock(&io_lock);

__raw_writel(0, WDTIM_CTRL(wdt_base)); /*stop counter */
if (wdt_clk)
clk_set_rate(wdt_clk, 0);

spin_unlock(&io_lock);
}

static int pnx4008_wdt_open(struct inode *inode, struct file *file)
Expand Down Expand Up @@ -248,6 +258,8 @@ static int pnx4008_wdt_probe(struct platform_device *pdev)
int ret = 0, size;
struct resource *res;

spin_lock_init(&io_lock);

if (heartbeat < 1 || heartbeat > MAX_HEARTBEAT)
heartbeat = DEFAULT_HEARTBEAT;

Expand Down

0 comments on commit d0e941c

Please sign in to comment.