diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-08-02 17:15:46 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-08-02 17:15:46 -0400 |
| commit | 4905f92ed752d49ebe9cce4fe78a4bc39e710523 (patch) | |
| tree | 533cdb174d61a92033083b027e0b34981fc42130 | |
| parent | 0ce166b7b46122bf91a4766e20c85a6485448765 (diff) | |
| parent | 5973bee46fe66db94fab198979dec87f263fc2a8 (diff) | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog
* git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog:
[WATCHDOG] Fix COH 901 327 watchdog enablement
| -rw-r--r-- | drivers/watchdog/coh901327_wdt.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/watchdog/coh901327_wdt.c b/drivers/watchdog/coh901327_wdt.c index fecb307d28e9..aec7cefdef21 100644 --- a/drivers/watchdog/coh901327_wdt.c +++ b/drivers/watchdog/coh901327_wdt.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <linux/bitops.h> | 18 | #include <linux/bitops.h> |
| 19 | #include <linux/uaccess.h> | 19 | #include <linux/uaccess.h> |
| 20 | #include <linux/clk.h> | 20 | #include <linux/clk.h> |
| 21 | #include <linux/delay.h> | ||
| 21 | 22 | ||
| 22 | #define DRV_NAME "WDOG COH 901 327" | 23 | #define DRV_NAME "WDOG COH 901 327" |
| 23 | 24 | ||
| @@ -92,6 +93,8 @@ static struct clk *clk; | |||
| 92 | static void coh901327_enable(u16 timeout) | 93 | static void coh901327_enable(u16 timeout) |
| 93 | { | 94 | { |
| 94 | u16 val; | 95 | u16 val; |
| 96 | unsigned long freq; | ||
| 97 | unsigned long delay_ns; | ||
| 95 | 98 | ||
| 96 | clk_enable(clk); | 99 | clk_enable(clk); |
| 97 | /* Restart timer if it is disabled */ | 100 | /* Restart timer if it is disabled */ |
| @@ -102,6 +105,14 @@ static void coh901327_enable(u16 timeout) | |||
| 102 | /* Acknowledge any pending interrupt so it doesn't just fire off */ | 105 | /* Acknowledge any pending interrupt so it doesn't just fire off */ |
| 103 | writew(U300_WDOG_IER_WILL_BARK_IRQ_ACK_ENABLE, | 106 | writew(U300_WDOG_IER_WILL_BARK_IRQ_ACK_ENABLE, |
| 104 | virtbase + U300_WDOG_IER); | 107 | virtbase + U300_WDOG_IER); |
| 108 | /* | ||
| 109 | * The interrupt is cleared in the 32 kHz clock domain. | ||
| 110 | * Wait 3 32 kHz cycles for it to take effect | ||
| 111 | */ | ||
| 112 | freq = clk_get_rate(clk); | ||
| 113 | delay_ns = (1000000000 + freq - 1) / freq; /* Freq to ns and round up */ | ||
| 114 | delay_ns = 3 * delay_ns; /* Wait 3 cycles */ | ||
| 115 | ndelay(delay_ns); | ||
| 105 | /* Enable the watchdog interrupt */ | 116 | /* Enable the watchdog interrupt */ |
| 106 | writew(U300_WDOG_IMR_WILL_BARK_IRQ_ENABLE, virtbase + U300_WDOG_IMR); | 117 | writew(U300_WDOG_IMR_WILL_BARK_IRQ_ENABLE, virtbase + U300_WDOG_IMR); |
| 107 | /* Activate the watchdog timer */ | 118 | /* Activate the watchdog timer */ |
