#include <linux/clk.h>\r
#include <linux/uaccess.h>\r
#include <linux/io.h>\r
-\r
#include <asm/mach/map.h>\r
\r
\r
/* timeout unit second */\r
int rk29_wdt_set_heartbeat(int timeout)\r
{\r
+ unsigned int count = 0;\r
+ unsigned int torr = 0, acc = 1, maxtime = 0; \r
unsigned int freq = clk_get_rate(wdt_clock);\r
- unsigned int long count;\r
- unsigned int torr = 0;\r
- unsigned int acc = 1;\r
\r
if (timeout < 1)\r
return -EINVAL;\r
-\r
+ //0x80000000 is the max count of watch dog\r
+ maxtime = 0x80000000 / freq + 1;\r
+ if(timeout > maxtime)\r
+ timeout = maxtime;\r
+ \r
count = timeout * freq;\r
count /= 0x10000;\r
\r
if(torr > 15){\r
torr = 15;\r
}\r
- DBG("%s:%d\n", __func__, torr);\r
+ DBG("%s:torr:%d, count:%d, maxtime:%d s\n", __func__, torr, count, maxtime);\r
wdt_writel(torr, RK29_WDT_TORR);\r
return 0;\r
}\r