diff options
author | Kevin Hilman <khilman@deeprootsystems.com> | 2009-04-29 19:23:59 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2009-05-26 10:18:15 -0400 |
commit | fb6313879caa46831d71a316b97b51d37d100269 (patch) | |
tree | 17441fc3ff71bfda33af952f4ff7d4e1f1ea7403 | |
parent | 0521444d497ee1f8a31314d2ce3c6b9edab25b51 (diff) |
davinci: add platform support for watchdog timer
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
-rw-r--r-- | arch/arm/mach-davinci/clock.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-davinci/devices.c | 35 | ||||
-rw-r--r-- | arch/arm/mach-davinci/time.c | 9 |
3 files changed, 42 insertions, 5 deletions
diff --git a/arch/arm/mach-davinci/clock.h b/arch/arm/mach-davinci/clock.h index 35736ec202f8..584494a32070 100644 --- a/arch/arm/mach-davinci/clock.h +++ b/arch/arm/mach-davinci/clock.h | |||
@@ -93,4 +93,7 @@ struct davinci_clk { | |||
93 | } | 93 | } |
94 | 94 | ||
95 | int davinci_clk_init(struct davinci_clk *clocks); | 95 | int davinci_clk_init(struct davinci_clk *clocks); |
96 | |||
97 | extern struct platform_device davinci_wdt_device; | ||
98 | |||
96 | #endif | 99 | #endif |
diff --git a/arch/arm/mach-davinci/devices.c b/arch/arm/mach-davinci/devices.c index a31370b93dd2..7fdc408105b2 100644 --- a/arch/arm/mach-davinci/devices.c +++ b/arch/arm/mach-davinci/devices.c | |||
@@ -54,3 +54,38 @@ void __init davinci_init_i2c(struct davinci_i2c_platform_data *pdata) | |||
54 | (void) platform_device_register(&davinci_i2c_device); | 54 | (void) platform_device_register(&davinci_i2c_device); |
55 | } | 55 | } |
56 | 56 | ||
57 | /*-------------------------------------------------------------------------*/ | ||
58 | |||
59 | static struct resource wdt_resources[] = { | ||
60 | { | ||
61 | .start = 0x01c21c00, | ||
62 | .end = 0x01c21fff, | ||
63 | .flags = IORESOURCE_MEM, | ||
64 | }, | ||
65 | }; | ||
66 | |||
67 | struct platform_device davinci_wdt_device = { | ||
68 | .name = "watchdog", | ||
69 | .id = -1, | ||
70 | .num_resources = ARRAY_SIZE(wdt_resources), | ||
71 | .resource = wdt_resources, | ||
72 | }; | ||
73 | |||
74 | static void davinci_init_wdt(void) | ||
75 | { | ||
76 | platform_device_register(&davinci_wdt_device); | ||
77 | } | ||
78 | |||
79 | /*-------------------------------------------------------------------------*/ | ||
80 | |||
81 | static int __init davinci_init_devices(void) | ||
82 | { | ||
83 | /* please keep these calls, and their implementations above, | ||
84 | * in alphabetical order so they're easier to sort through. | ||
85 | */ | ||
86 | davinci_init_wdt(); | ||
87 | |||
88 | return 0; | ||
89 | } | ||
90 | arch_initcall(davinci_init_devices); | ||
91 | |||
diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c index 494e01bff5c3..efbbc2ac63b4 100644 --- a/arch/arm/mach-davinci/time.c +++ b/arch/arm/mach-davinci/time.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/clk.h> | 19 | #include <linux/clk.h> |
20 | #include <linux/err.h> | 20 | #include <linux/err.h> |
21 | #include <linux/device.h> | 21 | #include <linux/device.h> |
22 | #include <linux/platform_device.h> | ||
22 | 23 | ||
23 | #include <mach/hardware.h> | 24 | #include <mach/hardware.h> |
24 | #include <asm/system.h> | 25 | #include <asm/system.h> |
@@ -349,15 +350,13 @@ struct sys_timer davinci_timer = { | |||
349 | 350 | ||
350 | 351 | ||
351 | /* reset board using watchdog timer */ | 352 | /* reset board using watchdog timer */ |
352 | void davinci_watchdog_reset(void) { | 353 | void davinci_watchdog_reset(void) |
354 | { | ||
353 | u32 tgcr, wdtcr; | 355 | u32 tgcr, wdtcr; |
354 | void __iomem *base = IO_ADDRESS(DAVINCI_WDOG_BASE); | 356 | void __iomem *base = IO_ADDRESS(DAVINCI_WDOG_BASE); |
355 | struct device dev; | ||
356 | struct clk *wd_clk; | 357 | struct clk *wd_clk; |
357 | char *name = "watchdog"; | ||
358 | 358 | ||
359 | dev_set_name(&dev, name); | 359 | wd_clk = clk_get(&davinci_wdt_device.dev, NULL); |
360 | wd_clk = clk_get(&dev, NULL); | ||
361 | if (WARN_ON(IS_ERR(wd_clk))) | 360 | if (WARN_ON(IS_ERR(wd_clk))) |
362 | return; | 361 | return; |
363 | clk_enable(wd_clk); | 362 | clk_enable(wd_clk); |