aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog/sch311x_wdt.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-23 18:42:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-23 18:42:42 -0400
commit0b87da68a0f0a7bf7f7446cf64f92e672bd68ef8 (patch)
treecc5ddfd411bc9c5d6fb828b86eba92f50294805e /drivers/watchdog/sch311x_wdt.c
parent59d0952b43552570e0f1c3ff91ebb16d4caec171 (diff)
parentcad19fa66469d2a745fae0c168833d5d33d64489 (diff)
Merge git://www.linux-watchdog.org/linux-watchdog
Pull first set of watchdog updates from Wim Van Sebroeck: "This pull contains: - The removal of ixp2000_wdt - The addition of ie6xx_wdt - Some documentation fixes - Small fixes and improvements (Note: Part 2 will contain generic watchdog core changes + conversion of some more drivers)" * git://www.linux-watchdog.org/linux-watchdog: Documentation/watchdog: Fix the file descriptor leak when no cmdline arg given Documentation/watchdog: close the fd when cmdline arg given Documentation/watchdog: Fix a small typo watchdog: s3c2410_wdt: Set timeout to actually achieved timeout watchdog: wm831x: Convert to gpio_request_one() watchdog: via_wdt: depends on PCI watchdog: ie6xx_wdt needs io.h watchdog: ie6xx_wdt.c: fix printk format warning watchdog: Add watchdog driver for Intel Atom E6XX watchdog: it87_wdt: Add support for IT8728F watchdog. watchdog: i6300esb: don't depend on X86 watchdog: Use module_pci_driver watchdog: sch311x_wdt.c: Remove RESGEN watchdog: s3c2410-wdt: Use of_match_ptr(). watchdog: Device tree support for pnx4008-wdt watchdog: ar7_wdt.c: use devm_request_and_ioremap watchdog: remove ixp2000 driver watchdog: sp5100_tco.c: quiet sparse noise about using plain integer was NULL pointer
Diffstat (limited to 'drivers/watchdog/sch311x_wdt.c')
-rw-r--r--drivers/watchdog/sch311x_wdt.c39
1 files changed, 5 insertions, 34 deletions
diff --git a/drivers/watchdog/sch311x_wdt.c b/drivers/watchdog/sch311x_wdt.c
index bd86f32d63ab..f8477002b728 100644
--- a/drivers/watchdog/sch311x_wdt.c
+++ b/drivers/watchdog/sch311x_wdt.c
@@ -41,7 +41,6 @@
41#define DRV_NAME "sch311x_wdt" 41#define DRV_NAME "sch311x_wdt"
42 42
43/* Runtime registers */ 43/* Runtime registers */
44#define RESGEN 0x1d
45#define GP60 0x47 44#define GP60 0x47
46#define WDT_TIME_OUT 0x65 45#define WDT_TIME_OUT 0x65
47#define WDT_VAL 0x66 46#define WDT_VAL 0x66
@@ -69,10 +68,6 @@ static unsigned short force_id;
69module_param(force_id, ushort, 0); 68module_param(force_id, ushort, 0);
70MODULE_PARM_DESC(force_id, "Override the detected device ID"); 69MODULE_PARM_DESC(force_id, "Override the detected device ID");
71 70
72static unsigned short therm_trip;
73module_param(therm_trip, ushort, 0);
74MODULE_PARM_DESC(therm_trip, "Should a ThermTrip trigger the reset generator");
75
76#define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ 71#define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */
77static int timeout = WATCHDOG_TIMEOUT; /* in seconds */ 72static int timeout = WATCHDOG_TIMEOUT; /* in seconds */
78module_param(timeout, int, 0); 73module_param(timeout, int, 0);
@@ -358,26 +353,16 @@ static struct miscdevice sch311x_wdt_miscdev = {
358static int __devinit sch311x_wdt_probe(struct platform_device *pdev) 353static int __devinit sch311x_wdt_probe(struct platform_device *pdev)
359{ 354{
360 struct device *dev = &pdev->dev; 355 struct device *dev = &pdev->dev;
361 unsigned char val;
362 int err; 356 int err;
363 357
364 spin_lock_init(&sch311x_wdt_data.io_lock); 358 spin_lock_init(&sch311x_wdt_data.io_lock);
365 359
366 if (!request_region(sch311x_wdt_data.runtime_reg + RESGEN, 1,
367 DRV_NAME)) {
368 dev_err(dev, "Failed to request region 0x%04x-0x%04x.\n",
369 sch311x_wdt_data.runtime_reg + RESGEN,
370 sch311x_wdt_data.runtime_reg + RESGEN);
371 err = -EBUSY;
372 goto exit;
373 }
374
375 if (!request_region(sch311x_wdt_data.runtime_reg + GP60, 1, DRV_NAME)) { 360 if (!request_region(sch311x_wdt_data.runtime_reg + GP60, 1, DRV_NAME)) {
376 dev_err(dev, "Failed to request region 0x%04x-0x%04x.\n", 361 dev_err(dev, "Failed to request region 0x%04x-0x%04x.\n",
377 sch311x_wdt_data.runtime_reg + GP60, 362 sch311x_wdt_data.runtime_reg + GP60,
378 sch311x_wdt_data.runtime_reg + GP60); 363 sch311x_wdt_data.runtime_reg + GP60);
379 err = -EBUSY; 364 err = -EBUSY;
380 goto exit_release_region; 365 goto exit;
381 } 366 }
382 367
383 if (!request_region(sch311x_wdt_data.runtime_reg + WDT_TIME_OUT, 4, 368 if (!request_region(sch311x_wdt_data.runtime_reg + WDT_TIME_OUT, 4,
@@ -386,7 +371,7 @@ static int __devinit sch311x_wdt_probe(struct platform_device *pdev)
386 sch311x_wdt_data.runtime_reg + WDT_TIME_OUT, 371 sch311x_wdt_data.runtime_reg + WDT_TIME_OUT,
387 sch311x_wdt_data.runtime_reg + WDT_CTRL); 372 sch311x_wdt_data.runtime_reg + WDT_CTRL);
388 err = -EBUSY; 373 err = -EBUSY;
389 goto exit_release_region2; 374 goto exit_release_region;
390 } 375 }
391 376
392 /* Make sure that the watchdog is not running */ 377 /* Make sure that the watchdog is not running */
@@ -414,24 +399,13 @@ static int __devinit sch311x_wdt_probe(struct platform_device *pdev)
414 /* Get status at boot */ 399 /* Get status at boot */
415 sch311x_wdt_get_status(&sch311x_wdt_data.boot_status); 400 sch311x_wdt_get_status(&sch311x_wdt_data.boot_status);
416 401
417 /* enable watchdog */
418 /* -- Reset Generator --
419 * Bit 0 Enable Watchdog Timer Generation: 0* = Enabled, 1 = Disabled
420 * Bit 1 Thermtrip Source Select: O* = No Source, 1 = Source
421 * Bit 2 WDT2_CTL: WDT input bit
422 * Bit 3-7 Reserved
423 */
424 outb(0, sch311x_wdt_data.runtime_reg + RESGEN);
425 val = therm_trip ? 0x06 : 0x04;
426 outb(val, sch311x_wdt_data.runtime_reg + RESGEN);
427
428 sch311x_wdt_miscdev.parent = dev; 402 sch311x_wdt_miscdev.parent = dev;
429 403
430 err = misc_register(&sch311x_wdt_miscdev); 404 err = misc_register(&sch311x_wdt_miscdev);
431 if (err != 0) { 405 if (err != 0) {
432 dev_err(dev, "cannot register miscdev on minor=%d (err=%d)\n", 406 dev_err(dev, "cannot register miscdev on minor=%d (err=%d)\n",
433 WATCHDOG_MINOR, err); 407 WATCHDOG_MINOR, err);
434 goto exit_release_region3; 408 goto exit_release_region2;
435 } 409 }
436 410
437 dev_info(dev, 411 dev_info(dev,
@@ -440,12 +414,10 @@ static int __devinit sch311x_wdt_probe(struct platform_device *pdev)
440 414
441 return 0; 415 return 0;
442 416
443exit_release_region3:
444 release_region(sch311x_wdt_data.runtime_reg + WDT_TIME_OUT, 4);
445exit_release_region2: 417exit_release_region2:
446 release_region(sch311x_wdt_data.runtime_reg + GP60, 1); 418 release_region(sch311x_wdt_data.runtime_reg + WDT_TIME_OUT, 4);
447exit_release_region: 419exit_release_region:
448 release_region(sch311x_wdt_data.runtime_reg + RESGEN, 1); 420 release_region(sch311x_wdt_data.runtime_reg + GP60, 1);
449 sch311x_wdt_data.runtime_reg = 0; 421 sch311x_wdt_data.runtime_reg = 0;
450exit: 422exit:
451 return err; 423 return err;
@@ -461,7 +433,6 @@ static int __devexit sch311x_wdt_remove(struct platform_device *pdev)
461 misc_deregister(&sch311x_wdt_miscdev); 433 misc_deregister(&sch311x_wdt_miscdev);
462 release_region(sch311x_wdt_data.runtime_reg + WDT_TIME_OUT, 4); 434 release_region(sch311x_wdt_data.runtime_reg + WDT_TIME_OUT, 4);
463 release_region(sch311x_wdt_data.runtime_reg + GP60, 1); 435 release_region(sch311x_wdt_data.runtime_reg + GP60, 1);
464 release_region(sch311x_wdt_data.runtime_reg + RESGEN, 1);
465 sch311x_wdt_data.runtime_reg = 0; 436 sch311x_wdt_data.runtime_reg = 0;
466 return 0; 437 return 0;
467} 438}