diff options
Diffstat (limited to 'arch/arm/mach-omap2/wd_timer.c')
-rw-r--r-- | arch/arm/mach-omap2/wd_timer.c | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/arch/arm/mach-omap2/wd_timer.c b/arch/arm/mach-omap2/wd_timer.c index f6b6c37ac3f4..7c2b4ed38f02 100644 --- a/arch/arm/mach-omap2/wd_timer.c +++ b/arch/arm/mach-omap2/wd_timer.c | |||
@@ -1,6 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * OMAP2+ MPU WD_TIMER-specific code | 2 | * OMAP2+ MPU WD_TIMER-specific code |
3 | * | 3 | * |
4 | * Copyright (C) 2012 Texas Instruments, Inc. | ||
5 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
6 | * the Free Software Foundation; either version 2 of the License, or | 8 | * the Free Software Foundation; either version 2 of the License, or |
@@ -11,10 +13,14 @@ | |||
11 | #include <linux/io.h> | 13 | #include <linux/io.h> |
12 | #include <linux/err.h> | 14 | #include <linux/err.h> |
13 | 15 | ||
14 | #include "omap_hwmod.h" | 16 | #include <linux/platform_data/omap-wd-timer.h> |
15 | 17 | ||
18 | #include "omap_hwmod.h" | ||
19 | #include "omap_device.h" | ||
16 | #include "wd_timer.h" | 20 | #include "wd_timer.h" |
17 | #include "common.h" | 21 | #include "common.h" |
22 | #include "prm.h" | ||
23 | #include "soc.h" | ||
18 | 24 | ||
19 | /* | 25 | /* |
20 | * In order to avoid any assumptions from bootloader regarding WDT | 26 | * In order to avoid any assumptions from bootloader regarding WDT |
@@ -26,9 +32,6 @@ | |||
26 | #define OMAP_WDT_WPS 0x34 | 32 | #define OMAP_WDT_WPS 0x34 |
27 | #define OMAP_WDT_SPR 0x48 | 33 | #define OMAP_WDT_SPR 0x48 |
28 | 34 | ||
29 | /* Maximum microseconds to wait for OMAP module to softreset */ | ||
30 | #define MAX_MODULE_SOFTRESET_WAIT 10000 | ||
31 | |||
32 | int omap2_wd_timer_disable(struct omap_hwmod *oh) | 35 | int omap2_wd_timer_disable(struct omap_hwmod *oh) |
33 | { | 36 | { |
34 | void __iomem *base; | 37 | void __iomem *base; |
@@ -99,3 +102,32 @@ int omap2_wd_timer_reset(struct omap_hwmod *oh) | |||
99 | return (c == MAX_MODULE_SOFTRESET_WAIT) ? -ETIMEDOUT : | 102 | return (c == MAX_MODULE_SOFTRESET_WAIT) ? -ETIMEDOUT : |
100 | omap2_wd_timer_disable(oh); | 103 | omap2_wd_timer_disable(oh); |
101 | } | 104 | } |
105 | |||
106 | static int __init omap_init_wdt(void) | ||
107 | { | ||
108 | int id = -1; | ||
109 | struct platform_device *pdev; | ||
110 | struct omap_hwmod *oh; | ||
111 | char *oh_name = "wd_timer2"; | ||
112 | char *dev_name = "omap_wdt"; | ||
113 | struct omap_wd_timer_platform_data pdata; | ||
114 | |||
115 | if (!cpu_class_is_omap2() || of_have_populated_dt()) | ||
116 | return 0; | ||
117 | |||
118 | oh = omap_hwmod_lookup(oh_name); | ||
119 | if (!oh) { | ||
120 | pr_err("Could not look up wd_timer%d hwmod\n", id); | ||
121 | return -EINVAL; | ||
122 | } | ||
123 | |||
124 | pdata.read_reset_sources = prm_read_reset_sources; | ||
125 | |||
126 | pdev = omap_device_build(dev_name, id, oh, &pdata, | ||
127 | sizeof(struct omap_wd_timer_platform_data), | ||
128 | NULL, 0, 0); | ||
129 | WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n", | ||
130 | dev_name, oh->name); | ||
131 | return 0; | ||
132 | } | ||
133 | subsys_initcall(omap_init_wdt); | ||