aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/watchdog')
-rw-r--r--drivers/watchdog/Kconfig10
-rw-r--r--drivers/watchdog/Makefile2
-rw-r--r--drivers/watchdog/orion_wdt.c (renamed from drivers/watchdog/orion5x_wdt.c)120
3 files changed, 66 insertions, 66 deletions
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 5eb8f21da82e..5744cac4864b 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -231,14 +231,14 @@ config DAVINCI_WATCHDOG
231 NOTE: once enabled, this timer cannot be disabled. 231 NOTE: once enabled, this timer cannot be disabled.
232 Say N if you are unsure. 232 Say N if you are unsure.
233 233
234config ORION5X_WATCHDOG 234config ORION_WATCHDOG
235 tristate "Orion5x watchdog" 235 tristate "Orion watchdog"
236 depends on ARCH_ORION5X 236 depends on ARCH_ORION5X || ARCH_KIRKWOOD
237 help 237 help
238 Say Y here if to include support for the watchdog timer 238 Say Y here if to include support for the watchdog timer
239 in the Orion5x ARM SoCs. 239 in the Marvell Orion5x and Kirkwood ARM SoCs.
240 To compile this driver as a module, choose M here: the 240 To compile this driver as a module, choose M here: the
241 module will be called orion5x_wdt. 241 module will be called orion_wdt.
242 242
243# AVR32 Architecture 243# AVR32 Architecture
244 244
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index 7f8c56b14f58..c3afa14d5be1 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -40,7 +40,7 @@ obj-$(CONFIG_EP93XX_WATCHDOG) += ep93xx_wdt.o
40obj-$(CONFIG_PNX4008_WATCHDOG) += pnx4008_wdt.o 40obj-$(CONFIG_PNX4008_WATCHDOG) += pnx4008_wdt.o
41obj-$(CONFIG_IOP_WATCHDOG) += iop_wdt.o 41obj-$(CONFIG_IOP_WATCHDOG) += iop_wdt.o
42obj-$(CONFIG_DAVINCI_WATCHDOG) += davinci_wdt.o 42obj-$(CONFIG_DAVINCI_WATCHDOG) += davinci_wdt.o
43obj-$(CONFIG_ORION5X_WATCHDOG) += orion5x_wdt.o 43obj-$(CONFIG_ORION_WATCHDOG) += orion_wdt.o
44 44
45# AVR32 Architecture 45# AVR32 Architecture
46obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o 46obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o
diff --git a/drivers/watchdog/orion5x_wdt.c b/drivers/watchdog/orion_wdt.c
index 2cde568e4fb0..2d9fb96a9ee9 100644
--- a/drivers/watchdog/orion5x_wdt.c
+++ b/drivers/watchdog/orion_wdt.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * drivers/watchdog/orion5x_wdt.c 2 * drivers/watchdog/orion_wdt.c
3 * 3 *
4 * Watchdog driver for Orion5x processors 4 * Watchdog driver for Orion/Kirkwood processors
5 * 5 *
6 * Author: Sylver Bruneau <sylver.bruneau@googlemail.com> 6 * Author: Sylver Bruneau <sylver.bruneau@googlemail.com>
7 * 7 *
@@ -23,7 +23,7 @@
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/spinlock.h> 24#include <linux/spinlock.h>
25#include <mach/bridge-regs.h> 25#include <mach/bridge-regs.h>
26#include <plat/orion5x_wdt.h> 26#include <plat/orion_wdt.h>
27 27
28/* 28/*
29 * Watchdog timer block registers. 29 * Watchdog timer block registers.
@@ -43,7 +43,7 @@ static unsigned int wdt_tclk;
43static unsigned long wdt_status; 43static unsigned long wdt_status;
44static spinlock_t wdt_lock; 44static spinlock_t wdt_lock;
45 45
46static void orion5x_wdt_ping(void) 46static void orion_wdt_ping(void)
47{ 47{
48 spin_lock(&wdt_lock); 48 spin_lock(&wdt_lock);
49 49
@@ -53,7 +53,7 @@ static void orion5x_wdt_ping(void)
53 spin_unlock(&wdt_lock); 53 spin_unlock(&wdt_lock);
54} 54}
55 55
56static void orion5x_wdt_enable(void) 56static void orion_wdt_enable(void)
57{ 57{
58 u32 reg; 58 u32 reg;
59 59
@@ -73,23 +73,23 @@ static void orion5x_wdt_enable(void)
73 writel(reg, TIMER_CTRL); 73 writel(reg, TIMER_CTRL);
74 74
75 /* Enable reset on watchdog */ 75 /* Enable reset on watchdog */
76 reg = readl(CPU_RESET_MASK); 76 reg = readl(RSTOUTn_MASK);
77 reg |= WDT_RESET; 77 reg |= WDT_RESET_OUT_EN;
78 writel(reg, CPU_RESET_MASK); 78 writel(reg, RSTOUTn_MASK);
79 79
80 spin_unlock(&wdt_lock); 80 spin_unlock(&wdt_lock);
81} 81}
82 82
83static void orion5x_wdt_disable(void) 83static void orion_wdt_disable(void)
84{ 84{
85 u32 reg; 85 u32 reg;
86 86
87 spin_lock(&wdt_lock); 87 spin_lock(&wdt_lock);
88 88
89 /* Disable reset on watchdog */ 89 /* Disable reset on watchdog */
90 reg = readl(CPU_RESET_MASK); 90 reg = readl(RSTOUTn_MASK);
91 reg &= ~WDT_RESET; 91 reg &= ~WDT_RESET_OUT_EN;
92 writel(reg, CPU_RESET_MASK); 92 writel(reg, RSTOUTn_MASK);
93 93
94 /* Disable watchdog timer */ 94 /* Disable watchdog timer */
95 reg = readl(TIMER_CTRL); 95 reg = readl(TIMER_CTRL);
@@ -99,7 +99,7 @@ static void orion5x_wdt_disable(void)
99 spin_unlock(&wdt_lock); 99 spin_unlock(&wdt_lock);
100} 100}
101 101
102static int orion5x_wdt_get_timeleft(int *time_left) 102static int orion_wdt_get_timeleft(int *time_left)
103{ 103{
104 spin_lock(&wdt_lock); 104 spin_lock(&wdt_lock);
105 *time_left = readl(WDT_VAL) / wdt_tclk; 105 *time_left = readl(WDT_VAL) / wdt_tclk;
@@ -107,16 +107,16 @@ static int orion5x_wdt_get_timeleft(int *time_left)
107 return 0; 107 return 0;
108} 108}
109 109
110static int orion5x_wdt_open(struct inode *inode, struct file *file) 110static int orion_wdt_open(struct inode *inode, struct file *file)
111{ 111{
112 if (test_and_set_bit(WDT_IN_USE, &wdt_status)) 112 if (test_and_set_bit(WDT_IN_USE, &wdt_status))
113 return -EBUSY; 113 return -EBUSY;
114 clear_bit(WDT_OK_TO_CLOSE, &wdt_status); 114 clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
115 orion5x_wdt_enable(); 115 orion_wdt_enable();
116 return nonseekable_open(inode, file); 116 return nonseekable_open(inode, file);
117} 117}
118 118
119static ssize_t orion5x_wdt_write(struct file *file, const char *data, 119static ssize_t orion_wdt_write(struct file *file, const char *data,
120 size_t len, loff_t *ppos) 120 size_t len, loff_t *ppos)
121{ 121{
122 if (len) { 122 if (len) {
@@ -133,18 +133,18 @@ static ssize_t orion5x_wdt_write(struct file *file, const char *data,
133 set_bit(WDT_OK_TO_CLOSE, &wdt_status); 133 set_bit(WDT_OK_TO_CLOSE, &wdt_status);
134 } 134 }
135 } 135 }
136 orion5x_wdt_ping(); 136 orion_wdt_ping();
137 } 137 }
138 return len; 138 return len;
139} 139}
140 140
141static int orion5x_wdt_settimeout(int new_time) 141static int orion_wdt_settimeout(int new_time)
142{ 142{
143 if ((new_time <= 0) || (new_time > wdt_max_duration)) 143 if ((new_time <= 0) || (new_time > wdt_max_duration))
144 return -EINVAL; 144 return -EINVAL;
145 145
146 /* Set new watchdog time to be used when 146 /* Set new watchdog time to be used when
147 * orion5x_wdt_enable() or orion5x_wdt_ping() is called. */ 147 * orion_wdt_enable() or orion_wdt_ping() is called. */
148 heartbeat = new_time; 148 heartbeat = new_time;
149 return 0; 149 return 0;
150} 150}
@@ -152,10 +152,10 @@ static int orion5x_wdt_settimeout(int new_time)
152static const struct watchdog_info ident = { 152static const struct watchdog_info ident = {
153 .options = WDIOF_MAGICCLOSE | WDIOF_SETTIMEOUT | 153 .options = WDIOF_MAGICCLOSE | WDIOF_SETTIMEOUT |
154 WDIOF_KEEPALIVEPING, 154 WDIOF_KEEPALIVEPING,
155 .identity = "Orion5x Watchdog", 155 .identity = "Orion Watchdog",
156}; 156};
157 157
158static long orion5x_wdt_ioctl(struct file *file, unsigned int cmd, 158static long orion_wdt_ioctl(struct file *file, unsigned int cmd,
159 unsigned long arg) 159 unsigned long arg)
160{ 160{
161 int ret = -ENOTTY; 161 int ret = -ENOTTY;
@@ -173,7 +173,7 @@ static long orion5x_wdt_ioctl(struct file *file, unsigned int cmd,
173 break; 173 break;
174 174
175 case WDIOC_KEEPALIVE: 175 case WDIOC_KEEPALIVE:
176 orion5x_wdt_ping(); 176 orion_wdt_ping();
177 ret = 0; 177 ret = 0;
178 break; 178 break;
179 179
@@ -182,11 +182,11 @@ static long orion5x_wdt_ioctl(struct file *file, unsigned int cmd,
182 if (ret) 182 if (ret)
183 break; 183 break;
184 184
185 if (orion5x_wdt_settimeout(time)) { 185 if (orion_wdt_settimeout(time)) {
186 ret = -EINVAL; 186 ret = -EINVAL;
187 break; 187 break;
188 } 188 }
189 orion5x_wdt_ping(); 189 orion_wdt_ping();
190 /* Fall through */ 190 /* Fall through */
191 191
192 case WDIOC_GETTIMEOUT: 192 case WDIOC_GETTIMEOUT:
@@ -194,7 +194,7 @@ static long orion5x_wdt_ioctl(struct file *file, unsigned int cmd,
194 break; 194 break;
195 195
196 case WDIOC_GETTIMELEFT: 196 case WDIOC_GETTIMELEFT:
197 if (orion5x_wdt_get_timeleft(&time)) { 197 if (orion_wdt_get_timeleft(&time)) {
198 ret = -EINVAL; 198 ret = -EINVAL;
199 break; 199 break;
200 } 200 }
@@ -204,10 +204,10 @@ static long orion5x_wdt_ioctl(struct file *file, unsigned int cmd,
204 return ret; 204 return ret;
205} 205}
206 206
207static int orion5x_wdt_release(struct inode *inode, struct file *file) 207static int orion_wdt_release(struct inode *inode, struct file *file)
208{ 208{
209 if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) 209 if (test_bit(WDT_OK_TO_CLOSE, &wdt_status))
210 orion5x_wdt_disable(); 210 orion_wdt_disable();
211 else 211 else
212 printk(KERN_CRIT "WATCHDOG: Device closed unexpectedly - " 212 printk(KERN_CRIT "WATCHDOG: Device closed unexpectedly - "
213 "timer will not stop\n"); 213 "timer will not stop\n");
@@ -218,98 +218,98 @@ static int orion5x_wdt_release(struct inode *inode, struct file *file)
218} 218}
219 219
220 220
221static const struct file_operations orion5x_wdt_fops = { 221static const struct file_operations orion_wdt_fops = {
222 .owner = THIS_MODULE, 222 .owner = THIS_MODULE,
223 .llseek = no_llseek, 223 .llseek = no_llseek,
224 .write = orion5x_wdt_write, 224 .write = orion_wdt_write,
225 .unlocked_ioctl = orion5x_wdt_ioctl, 225 .unlocked_ioctl = orion_wdt_ioctl,
226 .open = orion5x_wdt_open, 226 .open = orion_wdt_open,
227 .release = orion5x_wdt_release, 227 .release = orion_wdt_release,
228}; 228};
229 229
230static struct miscdevice orion5x_wdt_miscdev = { 230static struct miscdevice orion_wdt_miscdev = {
231 .minor = WATCHDOG_MINOR, 231 .minor = WATCHDOG_MINOR,
232 .name = "watchdog", 232 .name = "watchdog",
233 .fops = &orion5x_wdt_fops, 233 .fops = &orion_wdt_fops,
234}; 234};
235 235
236static int __devinit orion5x_wdt_probe(struct platform_device *pdev) 236static int __devinit orion_wdt_probe(struct platform_device *pdev)
237{ 237{
238 struct orion5x_wdt_platform_data *pdata = pdev->dev.platform_data; 238 struct orion_wdt_platform_data *pdata = pdev->dev.platform_data;
239 int ret; 239 int ret;
240 240
241 if (pdata) { 241 if (pdata) {
242 wdt_tclk = pdata->tclk; 242 wdt_tclk = pdata->tclk;
243 } else { 243 } else {
244 printk(KERN_ERR "Orion5x Watchdog misses platform data\n"); 244 printk(KERN_ERR "Orion Watchdog misses platform data\n");
245 return -ENODEV; 245 return -ENODEV;
246 } 246 }
247 247
248 if (orion5x_wdt_miscdev.parent) 248 if (orion_wdt_miscdev.parent)
249 return -EBUSY; 249 return -EBUSY;
250 orion5x_wdt_miscdev.parent = &pdev->dev; 250 orion_wdt_miscdev.parent = &pdev->dev;
251 251
252 wdt_max_duration = WDT_MAX_CYCLE_COUNT / wdt_tclk; 252 wdt_max_duration = WDT_MAX_CYCLE_COUNT / wdt_tclk;
253 if (orion5x_wdt_settimeout(heartbeat)) 253 if (orion_wdt_settimeout(heartbeat))
254 heartbeat = wdt_max_duration; 254 heartbeat = wdt_max_duration;
255 255
256 ret = misc_register(&orion5x_wdt_miscdev); 256 ret = misc_register(&orion_wdt_miscdev);
257 if (ret) 257 if (ret)
258 return ret; 258 return ret;
259 259
260 printk(KERN_INFO "Orion5x Watchdog Timer: Initial timeout %d sec%s\n", 260 printk(KERN_INFO "Orion Watchdog Timer: Initial timeout %d sec%s\n",
261 heartbeat, nowayout ? ", nowayout" : ""); 261 heartbeat, nowayout ? ", nowayout" : "");
262 return 0; 262 return 0;
263} 263}
264 264
265static int __devexit orion5x_wdt_remove(struct platform_device *pdev) 265static int __devexit orion_wdt_remove(struct platform_device *pdev)
266{ 266{
267 int ret; 267 int ret;
268 268
269 if (test_bit(WDT_IN_USE, &wdt_status)) { 269 if (test_bit(WDT_IN_USE, &wdt_status)) {
270 orion5x_wdt_disable(); 270 orion_wdt_disable();
271 clear_bit(WDT_IN_USE, &wdt_status); 271 clear_bit(WDT_IN_USE, &wdt_status);
272 } 272 }
273 273
274 ret = misc_deregister(&orion5x_wdt_miscdev); 274 ret = misc_deregister(&orion_wdt_miscdev);
275 if (!ret) 275 if (!ret)
276 orion5x_wdt_miscdev.parent = NULL; 276 orion_wdt_miscdev.parent = NULL;
277 277
278 return ret; 278 return ret;
279} 279}
280 280
281static void orion5x_wdt_shutdown(struct platform_device *pdev) 281static void orion_wdt_shutdown(struct platform_device *pdev)
282{ 282{
283 if (test_bit(WDT_IN_USE, &wdt_status)) 283 if (test_bit(WDT_IN_USE, &wdt_status))
284 orion5x_wdt_disable(); 284 orion_wdt_disable();
285} 285}
286 286
287static struct platform_driver orion5x_wdt_driver = { 287static struct platform_driver orion_wdt_driver = {
288 .probe = orion5x_wdt_probe, 288 .probe = orion_wdt_probe,
289 .remove = __devexit_p(orion5x_wdt_remove), 289 .remove = __devexit_p(orion_wdt_remove),
290 .shutdown = orion5x_wdt_shutdown, 290 .shutdown = orion_wdt_shutdown,
291 .driver = { 291 .driver = {
292 .owner = THIS_MODULE, 292 .owner = THIS_MODULE,
293 .name = "orion5x_wdt", 293 .name = "orion_wdt",
294 }, 294 },
295}; 295};
296 296
297static int __init orion5x_wdt_init(void) 297static int __init orion_wdt_init(void)
298{ 298{
299 spin_lock_init(&wdt_lock); 299 spin_lock_init(&wdt_lock);
300 return platform_driver_register(&orion5x_wdt_driver); 300 return platform_driver_register(&orion_wdt_driver);
301} 301}
302 302
303static void __exit orion5x_wdt_exit(void) 303static void __exit orion_wdt_exit(void)
304{ 304{
305 platform_driver_unregister(&orion5x_wdt_driver); 305 platform_driver_unregister(&orion_wdt_driver);
306} 306}
307 307
308module_init(orion5x_wdt_init); 308module_init(orion_wdt_init);
309module_exit(orion5x_wdt_exit); 309module_exit(orion_wdt_exit);
310 310
311MODULE_AUTHOR("Sylver Bruneau <sylver.bruneau@googlemail.com>"); 311MODULE_AUTHOR("Sylver Bruneau <sylver.bruneau@googlemail.com>");
312MODULE_DESCRIPTION("Orion5x Processor Watchdog"); 312MODULE_DESCRIPTION("Orion Processor Watchdog");
313 313
314module_param(heartbeat, int, 0); 314module_param(heartbeat, int, 0);
315MODULE_PARM_DESC(heartbeat, "Initial watchdog heartbeat in seconds"); 315MODULE_PARM_DESC(heartbeat, "Initial watchdog heartbeat in seconds");