davinci: add platform support for watchdog timer
authorKevin Hilman <khilman@deeprootsystems.com>
Wed, 29 Apr 2009 23:23:59 +0000 (16:23 -0700)
committerKevin Hilman <khilman@deeprootsystems.com>
Tue, 26 May 2009 14:18:15 +0000 (07:18 -0700)
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
arch/arm/mach-davinci/clock.h
arch/arm/mach-davinci/devices.c
arch/arm/mach-davinci/time.c

index 35736ec202f82ec7bdb570c13ea2bf931c7aa55e..584494a32070464d49450eafd79e78fa2889f56a 100644 (file)
@@ -93,4 +93,7 @@ struct davinci_clk {
        }
 
 int davinci_clk_init(struct davinci_clk *clocks);
+
+extern struct platform_device davinci_wdt_device;
+
 #endif
index a31370b93dd287c91b3b70068b6866add80a5cf3..7fdc408105b245bb904d05c667d9a2915d7d6edf 100644 (file)
@@ -54,3 +54,38 @@ void __init davinci_init_i2c(struct davinci_i2c_platform_data *pdata)
        (void) platform_device_register(&davinci_i2c_device);
 }
 
+/*-------------------------------------------------------------------------*/
+
+static struct resource wdt_resources[] = {
+       {
+               .start  = 0x01c21c00,
+               .end    = 0x01c21fff,
+               .flags  = IORESOURCE_MEM,
+       },
+};
+
+struct platform_device davinci_wdt_device = {
+       .name           = "watchdog",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(wdt_resources),
+       .resource       = wdt_resources,
+};
+
+static void davinci_init_wdt(void)
+{
+       platform_device_register(&davinci_wdt_device);
+}
+
+/*-------------------------------------------------------------------------*/
+
+static int __init davinci_init_devices(void)
+{
+       /* please keep these calls, and their implementations above,
+        * in alphabetical order so they're easier to sort through.
+        */
+       davinci_init_wdt();
+
+       return 0;
+}
+arch_initcall(davinci_init_devices);
+
index 494e01bff5c3ad6d4bd8e82ce357a746f8e70ca9..efbbc2ac63b4f82e1cf7e40fc17a530b4629c98c 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/device.h>
+#include <linux/platform_device.h>
 
 #include <mach/hardware.h>
 #include <asm/system.h>
@@ -349,15 +350,13 @@ struct sys_timer davinci_timer = {
 
 
 /* reset board using watchdog timer */
-void davinci_watchdog_reset(void) {
+void davinci_watchdog_reset(void)
+{
        u32 tgcr, wdtcr;
        void __iomem *base = IO_ADDRESS(DAVINCI_WDOG_BASE);
-       struct device dev;
        struct clk *wd_clk;
-       char *name = "watchdog";
 
-       dev_set_name(&dev, name);
-       wd_clk = clk_get(&dev, NULL);
+       wd_clk = clk_get(&davinci_wdt_device.dev, NULL);
        if (WARN_ON(IS_ERR(wd_clk)))
                return;
        clk_enable(wd_clk);