Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 41415
b: refs/heads/master
c: 414a675
h: refs/heads/master
i:
  41413: 979a77a
  41411: 8ad7209
  41407: 6b9b73b
v: v3
  • Loading branch information
Wim Van Sebroeck committed Nov 17, 2006
1 parent ec44853 commit 0aa4f62
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 28 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 97846e3ccbcbcc966e23a91b0d190efd1f889c9b
refs/heads/master: 414a675964e5636b53b37827b646138f166507d3
56 changes: 29 additions & 27 deletions trunk/drivers/char/watchdog/rm9k_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,30 @@ static irqreturn_t wdt_gpi_irqhdl(int irq, void *ctxt, struct pt_regs *regs)


/* Watchdog functions */
static void wdt_gpi_start(void)
{
u32 reg;

lock_titan_regs();
reg = titan_readl(CPGIG1ER);
titan_writel(reg | (0x100 << wd_ctr), CPGIG1ER);
iob();
unlock_titan_regs();
}

static void wdt_gpi_stop(void)
{
u32 reg;

lock_titan_regs();
reg = titan_readl(CPCCR) & ~(0xf << (wd_ctr * 4));
titan_writel(reg, CPCCR);
reg = titan_readl(CPGIG1ER);
titan_writel(reg & ~(0x100 << wd_ctr), CPGIG1ER);
iob();
unlock_titan_regs();
}

static void wdt_gpi_set_timeout(unsigned int to)
{
u32 reg;
Expand All @@ -134,7 +158,6 @@ static void wdt_gpi_set_timeout(unsigned int to)
static int wdt_gpi_open(struct inode *i, struct file *f)
{
int res;
u32 reg;

if (unlikely(0 > atomic_dec_if_positive(&opencnt)))
return -EBUSY;
Expand All @@ -152,12 +175,7 @@ static int wdt_gpi_open(struct inode *i, struct file *f)
return res;

wdt_gpi_set_timeout(timeout);

lock_titan_regs();
reg = titan_readl(CPGIG1ER);
titan_writel(reg | (0x100 << wd_ctr), CPGIG1ER);
iob();
unlock_titan_regs();
wdt_gpi_start();

printk(KERN_INFO "%s: watchdog started, timeout = %u seconds\n",
wdt_gpi_name, timeout);
Expand All @@ -173,15 +191,7 @@ static int wdt_gpi_release(struct inode *i, struct file *f)
locked = 1;
} else {
if (expect_close) {
u32 reg;

lock_titan_regs();
reg = titan_readl(CPCCR) & ~(0xf << (wd_ctr * 4));
titan_writel(reg, CPCCR);
reg = titan_readl(CPGIG1ER);
titan_writel(reg & ~(0x100 << wd_ctr), CPGIG1ER);
iob();
unlock_titan_regs();
wdt_gpi_stop();
free_irq(wd_irq, &miscdev);
printk(KERN_INFO "%s: watchdog stopped\n", wdt_gpi_name);
} else {
Expand Down Expand Up @@ -293,17 +303,9 @@ wdt_gpi_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
static int
wdt_gpi_notify(struct notifier_block *this, unsigned long code, void *unused)
{
if(code == SYS_DOWN || code == SYS_HALT) {
u32 reg;

lock_titan_regs();
reg = titan_readl(CPCCR) & ~(0xf << (wd_ctr * 4));
titan_writel(reg, CPCCR);
reg = titan_readl(CPGIG1ER);
titan_writel(reg & ~(0x100 << wd_ctr), CPGIG1ER);
iob();
unlock_titan_regs();
}
if (code == SYS_DOWN || code == SYS_HALT)
wdt_gpi_stop();

return NOTIFY_DONE;
}

Expand Down

0 comments on commit 0aa4f62

Please sign in to comment.