diff options
author | David S. Miller <davem@davemloft.net> | 2009-08-12 20:44:53 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-08-12 20:44:53 -0400 |
commit | aa11d958d1a6572eda08214d7c6a735804fe48a5 (patch) | |
tree | d025b05270ad1e010660d17eeadc6ac3c1abbd7d /drivers/watchdog/coh901327_wdt.c | |
parent | 07f6642ee9418e962e54cbc07471cfe2e559c568 (diff) | |
parent | 9799218ae36910af50f002a5db1802d576fffb43 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
arch/microblaze/include/asm/socket.h
Diffstat (limited to 'drivers/watchdog/coh901327_wdt.c')
-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 */ |