RT-AC56 3.0.0.4.374.37 core
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / arch / arm / plat-samsung / include / plat / watchdog-reset.h
blob54b762acb5a0f9624140ed16e650df1452bd9612
1 /* arch/arm/plat-s3c/include/plat/watchdog-reset.h
3 * Copyright (c) 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
6 * S3C2410 - System define for arch_reset() function
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include <plat/regs-watchdog.h>
14 #include <mach/map.h>
16 #include <linux/clk.h>
17 #include <linux/err.h>
18 #include <linux/io.h>
20 static inline void arch_wdt_reset(void)
22 struct clk *wdtclk;
24 printk("arch_reset: attempting watchdog reset\n");
26 __raw_writel(0, S3C2410_WTCON); /* disable watchdog, to be safe */
28 wdtclk = clk_get(NULL, "watchdog");
29 if (!IS_ERR(wdtclk)) {
30 clk_enable(wdtclk);
31 } else
32 printk(KERN_WARNING "%s: warning: cannot get watchdog clock\n", __func__);
34 /* put initial values into count and data */
35 __raw_writel(0x80, S3C2410_WTCNT);
36 __raw_writel(0x80, S3C2410_WTDAT);
38 /* set the watchdog to go and reset... */
39 __raw_writel(S3C2410_WTCON_ENABLE|S3C2410_WTCON_DIV16|S3C2410_WTCON_RSTEN |
40 S3C2410_WTCON_PRESCALE(0x20), S3C2410_WTCON);
42 /* wait for reset to assert... */
43 mdelay(500);
45 printk(KERN_ERR "Watchdog reset failed to assert reset\n");
47 /* delay to allow the serial port to show the message */
48 mdelay(50);