aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/watchdog/mpc8xx_wdt.c
diff options
context:
space:
mode:
authorMarcelo Tosatti <marcelo.tosatti@cyclades.com>2005-11-24 08:32:09 -0500
committerPaul Mackerras <paulus@samba.org>2006-01-08 22:50:51 -0500
commitfb64c2446b20bf0206a690e9e1df88b25ac421e6 (patch)
tree53d6e17957d29d881f8cff83ed952b4229d811bd /drivers/char/watchdog/mpc8xx_wdt.c
parent623703f620453c798b6fa3eb79ad8ea27bfd302a (diff)
[PATCH] ppc32: m8xx watchdog update
This updates m8xx_wdt as follows: 1) Remove now obsolete fpos check in the write() function. The driver is currently non functional due to this bug. 2) Use in/out macros for register access. 3) Allows m8xx_wdt to use a kernel timer instead of the builtin RTC/PIT for keep-alive trigger (which is responsible for servicing the watchdog until an userspace application takes over). For instance Cyclades PRxK boards (MPC 855T based) have a non-functional internal RTC/PIT unit. Behaviour for boards with RTC/PIT is unchaged. 4) The last change required moving the RTCSC register setting code to a weak function which can be overriden by board specific files. Otherwise the timer init code trashes the register making it impossible for m8xx_wdt to detect the situation. Signed-off-by: Marcelo Tosatti <marcelo.tosatti@cyclades.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers/char/watchdog/mpc8xx_wdt.c')
-rw-r--r--drivers/char/watchdog/mpc8xx_wdt.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/char/watchdog/mpc8xx_wdt.c b/drivers/char/watchdog/mpc8xx_wdt.c
index 56d62ba7c6ce..ac6fbace4724 100644
--- a/drivers/char/watchdog/mpc8xx_wdt.c
+++ b/drivers/char/watchdog/mpc8xx_wdt.c
@@ -27,7 +27,10 @@ static void mpc8xx_wdt_handler_disable(void)
27{ 27{
28 volatile immap_t *imap = (volatile immap_t *)IMAP_ADDR; 28 volatile immap_t *imap = (volatile immap_t *)IMAP_ADDR;
29 29
30 imap->im_sit.sit_piscr &= ~(PISCR_PIE | PISCR_PTE); 30 if (!m8xx_has_internal_rtc)
31 m8xx_wdt_stop_timer();
32 else
33 out_be32(imap->im_sit.sit_piscr, in_be32(&imap->im_sit.sit_piscr) & ~(PISCR_PIE | PISCR_PTE));
31 34
32 printk(KERN_NOTICE "mpc8xx_wdt: keep-alive handler deactivated\n"); 35 printk(KERN_NOTICE "mpc8xx_wdt: keep-alive handler deactivated\n");
33} 36}
@@ -36,7 +39,10 @@ static void mpc8xx_wdt_handler_enable(void)
36{ 39{
37 volatile immap_t *imap = (volatile immap_t *)IMAP_ADDR; 40 volatile immap_t *imap = (volatile immap_t *)IMAP_ADDR;
38 41
39 imap->im_sit.sit_piscr |= PISCR_PIE | PISCR_PTE; 42 if (!m8xx_has_internal_rtc)
43 m8xx_wdt_install_timer();
44 else
45 out_be32(&imap->im_sit.sit_piscr, in_be32(&imap->im_sit.sit_piscr) | PISCR_PIE | PISCR_PTE);
40 46
41 printk(KERN_NOTICE "mpc8xx_wdt: keep-alive handler activated\n"); 47 printk(KERN_NOTICE "mpc8xx_wdt: keep-alive handler activated\n");
42} 48}
@@ -68,9 +74,6 @@ static int mpc8xx_wdt_release(struct inode *inode, struct file *file)
68static ssize_t mpc8xx_wdt_write(struct file *file, const char *data, size_t len, 74static ssize_t mpc8xx_wdt_write(struct file *file, const char *data, size_t len,
69 loff_t * ppos) 75 loff_t * ppos)
70{ 76{
71 if (ppos != &file->f_pos)
72 return -ESPIPE;
73
74 if (len) 77 if (len)
75 m8xx_wdt_reset(); 78 m8xx_wdt_reset();
76 79