Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge watchdog driver updates

Automated merge from

master.kernel.org:/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog

failed due to duplicate different changes to Kconfig file. Manually fixed
up. Hopefully.

+121 -62
+48 -23
drivers/char/watchdog/Makefile
··· 2 2 # Makefile for the WatchDog device drivers. 3 3 # 4 4 5 + # Only one watchdog can succeed. We probe the ISA/PCI/USB based 6 + # watchdog-cards first, then the architecture specific watchdog 7 + # drivers and then the architecture independant "softdog" driver. 8 + # This means that if your ISA/PCI/USB card isn't detected that 9 + # you can fall back to an architecture specific driver and if 10 + # that also fails then you can fall back to the software watchdog 11 + # to give you some cover. 12 + 13 + # ISA-based Watchdog Cards 5 14 obj-$(CONFIG_PCWATCHDOG) += pcwd.o 6 - obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o 7 - obj-$(CONFIG_ADVANTECH_WDT) += advantechwdt.o 8 - obj-$(CONFIG_IB700_WDT) += ib700wdt.o 9 15 obj-$(CONFIG_MIXCOMWD) += mixcomwd.o 10 - obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o 11 - obj-$(CONFIG_60XX_WDT) += sbc60xxwdt.o 12 16 obj-$(CONFIG_WDT) += wdt.o 17 + 18 + # PCI-based Watchdog Cards 19 + obj-$(CONFIG_PCIPCWATCHDOG) += pcwd_pci.o 13 20 obj-$(CONFIG_WDTPCI) += wdt_pci.o 21 + 22 + # USB-based Watchdog Cards 23 + obj-$(CONFIG_USBPCWATCHDOG) += pcwd_usb.o 24 + 25 + # ARM Architecture 14 26 obj-$(CONFIG_21285_WATCHDOG) += wdt285.o 15 27 obj-$(CONFIG_977_WATCHDOG) += wdt977.o 16 - obj-$(CONFIG_I8XX_TCO) += i8xx_tco.o 17 - obj-$(CONFIG_MACHZ_WDT) += machzwd.o 18 - obj-$(CONFIG_SH_WDT) += shwdt.o 28 + obj-$(CONFIG_IXP2000_WATCHDOG) += ixp2000_wdt.o 29 + obj-$(CONFIG_IXP4XX_WATCHDOG) += ixp4xx_wdt.o 19 30 obj-$(CONFIG_S3C2410_WATCHDOG) += s3c2410_wdt.o 20 31 obj-$(CONFIG_SA1100_WATCHDOG) += sa1100_wdt.o 21 - obj-$(CONFIG_EUROTECH_WDT) += eurotechwdt.o 22 - obj-$(CONFIG_W83877F_WDT) += w83877f_wdt.o 23 - obj-$(CONFIG_W83627HF_WDT) += w83627hf_wdt.o 24 - obj-$(CONFIG_SC520_WDT) += sc520_wdt.o 25 - obj-$(CONFIG_ALIM7101_WDT) += alim7101_wdt.o 32 + 33 + # X86 (i386 + ia64 + x86_64) Architecture 34 + obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o 35 + obj-$(CONFIG_ADVANTECH_WDT) += advantechwdt.o 26 36 obj-$(CONFIG_ALIM1535_WDT) += alim1535_wdt.o 27 - obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o 37 + obj-$(CONFIG_ALIM7101_WDT) += alim7101_wdt.o 38 + obj-$(CONFIG_SC520_WDT) += sc520_wdt.o 39 + obj-$(CONFIG_EUROTECH_WDT) += eurotechwdt.o 40 + obj-$(CONFIG_IB700_WDT) += ib700wdt.o 28 41 obj-$(CONFIG_WAFER_WDT) += wafer5823wdt.o 42 + obj-$(CONFIG_I8XX_TCO) += i8xx_tco.o 43 + obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o 44 + obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o 45 + obj-$(CONFIG_60XX_WDT) += sbc60xxwdt.o 29 46 obj-$(CONFIG_CPU5_WDT) += cpu5wdt.o 30 - obj-$(CONFIG_INDYDOG) += indydog.o 31 - obj-$(CONFIG_PCIPCWATCHDOG) += pcwd_pci.o 32 - obj-$(CONFIG_USBPCWATCHDOG) += pcwd_usb.o 33 - obj-$(CONFIG_IXP4XX_WATCHDOG) += ixp4xx_wdt.o 34 - obj-$(CONFIG_IXP2000_WATCHDOG) += ixp2000_wdt.o 47 + obj-$(CONFIG_W83627HF_WDT) += w83627hf_wdt.o 48 + obj-$(CONFIG_W83877F_WDT) += w83877f_wdt.o 49 + obj-$(CONFIG_MACHZ_WDT) += machzwd.o 50 + 51 + # PowerPC Architecture 35 52 obj-$(CONFIG_8xx_WDT) += mpc8xx_wdt.o 53 + 54 + # PPC64 Architecture 36 55 obj-$(CONFIG_WATCHDOG_RTAS) += wdrtas.o 37 56 obj-$(CONFIG_BOOKE_WDT) += booke_wdt.o 38 57 39 - # Only one watchdog can succeed. We probe the hardware watchdog 40 - # drivers first, then the softdog driver. This means if your hardware 41 - # watchdog dies or is 'borrowed' for some reason the software watchdog 42 - # still gives you some cover. 58 + # MIPS Architecture 59 + obj-$(CONFIG_INDYDOG) += indydog.o 43 60 61 + # S390 Architecture 62 + 63 + # SUPERH Architecture 64 + obj-$(CONFIG_SH_WDT) += shwdt.o 65 + 66 + # SPARC64 Architecture 67 + 68 + # Architecture Independant 44 69 obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o
+1 -1
drivers/char/watchdog/ixp2000_wdt.c
··· 182 182 static struct miscdevice ixp2000_wdt_miscdev = 183 183 { 184 184 .minor = WATCHDOG_MINOR, 185 - .name = "IXP2000 Watchdog", 185 + .name = "watchdog", 186 186 .fops = &ixp2000_wdt_fops, 187 187 }; 188 188
+1 -1
drivers/char/watchdog/ixp4xx_wdt.c
··· 176 176 static struct miscdevice ixp4xx_wdt_miscdev = 177 177 { 178 178 .minor = WATCHDOG_MINOR, 179 - .name = "IXP4xx Watchdog", 179 + .name = "watchdog", 180 180 .fops = &ixp4xx_wdt_fops, 181 181 }; 182 182
+55 -32
drivers/char/watchdog/s3c2410_wdt.c
··· 27 27 * Fixed tmr_count / wdt_count confusion 28 28 * Added configurable debug 29 29 * 30 - * 11-Jan-2004 BJD Fixed divide-by-2 in timeout code 30 + * 11-Jan-2005 BJD Fixed divide-by-2 in timeout code 31 + * 32 + * 25-Jan-2005 DA Added suspend/resume support 33 + * Replaced reboot notifier with .shutdown method 31 34 * 32 35 * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA 33 36 */ ··· 43 40 #include <linux/miscdevice.h> 44 41 #include <linux/watchdog.h> 45 42 #include <linux/fs.h> 46 - #include <linux/notifier.h> 47 - #include <linux/reboot.h> 48 43 #include <linux/init.h> 49 44 #include <linux/device.h> 50 45 #include <linux/interrupt.h> ··· 318 317 } 319 318 } 320 319 321 - /* 322 - * Notifier for system down 323 - */ 324 - 325 - static int s3c2410wdt_notify_sys(struct notifier_block *this, unsigned long code, 326 - void *unused) 327 - { 328 - if(code==SYS_DOWN || code==SYS_HALT) { 329 - /* Turn the WDT off */ 330 - s3c2410wdt_stop(); 331 - } 332 - return NOTIFY_DONE; 333 - } 334 - 335 320 /* kernel interface */ 336 321 337 322 static struct file_operations s3c2410wdt_fops = { ··· 333 346 .minor = WATCHDOG_MINOR, 334 347 .name = "watchdog", 335 348 .fops = &s3c2410wdt_fops, 336 - }; 337 - 338 - static struct notifier_block s3c2410wdt_notifier = { 339 - .notifier_call = s3c2410wdt_notify_sys, 340 349 }; 341 350 342 351 /* interrupt handler code */ ··· 415 432 } 416 433 } 417 434 418 - ret = register_reboot_notifier(&s3c2410wdt_notifier); 419 - if (ret) { 420 - printk (KERN_ERR PFX "cannot register reboot notifier (%d)\n", 421 - ret); 422 - return ret; 423 - } 424 - 425 435 ret = misc_register(&s3c2410wdt_miscdev); 426 436 if (ret) { 427 437 printk (KERN_ERR PFX "cannot register miscdev on minor=%d (%d)\n", 428 438 WATCHDOG_MINOR, ret); 429 - unregister_reboot_notifier(&s3c2410wdt_notifier); 430 439 return ret; 431 440 } 432 441 ··· 454 479 return 0; 455 480 } 456 481 482 + static void s3c2410wdt_shutdown(struct device *dev) 483 + { 484 + s3c2410wdt_stop(); 485 + } 486 + 487 + #ifdef CONFIG_PM 488 + 489 + static unsigned long wtcon_save; 490 + static unsigned long wtdat_save; 491 + 492 + static int s3c2410wdt_suspend(struct device *dev, u32 state, u32 level) 493 + { 494 + if (level == SUSPEND_POWER_DOWN) { 495 + /* Save watchdog state, and turn it off. */ 496 + wtcon_save = readl(wdt_base + S3C2410_WTCON); 497 + wtdat_save = readl(wdt_base + S3C2410_WTDAT); 498 + 499 + /* Note that WTCNT doesn't need to be saved. */ 500 + s3c2410wdt_stop(); 501 + } 502 + 503 + return 0; 504 + } 505 + 506 + static int s3c2410wdt_resume(struct device *dev, u32 level) 507 + { 508 + if (level == RESUME_POWER_ON) { 509 + /* Restore watchdog state. */ 510 + 511 + writel(wtdat_save, wdt_base + S3C2410_WTDAT); 512 + writel(wtdat_save, wdt_base + S3C2410_WTCNT); /* Reset count */ 513 + writel(wtcon_save, wdt_base + S3C2410_WTCON); 514 + 515 + printk(KERN_INFO PFX "watchdog %sabled\n", 516 + (wtcon_save & S3C2410_WTCON_ENABLE) ? "en" : "dis"); 517 + } 518 + 519 + return 0; 520 + } 521 + 522 + #else 523 + #define s3c2410wdt_suspend NULL 524 + #define s3c2410wdt_resume NULL 525 + #endif /* CONFIG_PM */ 526 + 527 + 457 528 static struct device_driver s3c2410wdt_driver = { 458 529 .name = "s3c2410-wdt", 459 530 .bus = &platform_bus_type, 460 531 .probe = s3c2410wdt_probe, 461 532 .remove = s3c2410wdt_remove, 533 + .shutdown = s3c2410wdt_shutdown, 534 + .suspend = s3c2410wdt_suspend, 535 + .resume = s3c2410wdt_resume, 462 536 }; 463 - 464 537 465 538 466 539 static char banner[] __initdata = KERN_INFO "S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics\n"; ··· 522 499 static void __exit watchdog_exit(void) 523 500 { 524 501 driver_unregister(&s3c2410wdt_driver); 525 - unregister_reboot_notifier(&s3c2410wdt_notifier); 526 502 } 527 503 528 504 module_init(watchdog_init); 529 505 module_exit(watchdog_exit); 530 506 531 - MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); 507 + MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>, " 508 + "Dimitry Andric <dimitry.andric@tomtom.com>"); 532 509 MODULE_DESCRIPTION("S3C2410 Watchdog Device Driver"); 533 510 MODULE_LICENSE("GPL"); 534 511 MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
+1 -1
drivers/char/watchdog/scx200_wdt.c
··· 206 206 207 207 static struct miscdevice scx200_wdt_miscdev = { 208 208 .minor = WATCHDOG_MINOR, 209 - .name = NAME, 209 + .name = "watchdog", 210 210 .fops = &scx200_wdt_fops, 211 211 }; 212 212
+9 -4
drivers/char/watchdog/softdog.c
··· 77 77 78 78 static struct timer_list watchdog_ticktock = 79 79 TIMER_INITIALIZER(watchdog_fire, 0, 0); 80 - static unsigned long timer_alive; 80 + static unsigned long driver_open, orphan_timer; 81 81 static char expect_close; 82 82 83 83 ··· 87 87 88 88 static void watchdog_fire(unsigned long data) 89 89 { 90 + if (test_and_clear_bit(0, &orphan_timer)) 91 + module_put(THIS_MODULE); 92 + 90 93 if (soft_noboot) 91 94 printk(KERN_CRIT PFX "Triggered - Reboot ignored.\n"); 92 95 else ··· 131 128 132 129 static int softdog_open(struct inode *inode, struct file *file) 133 130 { 134 - if(test_and_set_bit(0, &timer_alive)) 131 + if (test_and_set_bit(0, &driver_open)) 135 132 return -EBUSY; 136 - if (nowayout) 133 + if (!test_and_clear_bit(0, &orphan_timer)) 137 134 __module_get(THIS_MODULE); 138 135 /* 139 136 * Activate timer ··· 150 147 */ 151 148 if (expect_close == 42) { 152 149 softdog_stop(); 150 + module_put(THIS_MODULE); 153 151 } else { 154 152 printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n"); 153 + set_bit(0, &orphan_timer); 155 154 softdog_keepalive(); 156 155 } 157 - clear_bit(0, &timer_alive); 156 + clear_bit(0, &driver_open); 158 157 expect_close = 0; 159 158 return 0; 160 159 }
+6
drivers/char/watchdog/w83627hf_wdt.c
··· 93 93 94 94 w83627hf_select_wd_register(); 95 95 96 + outb_p(0xF6, WDT_EFER); /* Select CRF6 */ 97 + t=inb_p(WDT_EFDR); /* read CRF6 */ 98 + if (t != 0) { 99 + printk (KERN_INFO PFX "Watchdog already running. Resetting timeout to %d sec\n", timeout); 100 + outb_p(timeout, WDT_EFDR); /* Write back to CRF6 */ 101 + } 96 102 outb_p(0xF5, WDT_EFER); /* Select CRF5 */ 97 103 t=inb_p(WDT_EFDR); /* read CRF5 */ 98 104 t&=~0x0C; /* set second mode & disable keyboard turning off watchdog */