aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-22 00:19:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-22 00:19:54 -0400
commitd4429f608abde89e8bc1e24b43cd503feb95c496 (patch)
tree4c11afa193593a5e3949391bf35022b4f87ba375 /drivers/watchdog
parente10117d36ef758da0690c95ecffc09d5dd7da479 (diff)
parent6a1c9dfe4186f18fed38421b35b40fb9260cbfe1 (diff)
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (71 commits) powerpc/44x: Update ppc44x_defconfig powerpc/watchdog: Make default timeout for Book-E watchdog a Kconfig option fsl_rio: Add comments for sRIO registers. powerpc/fsl-booke: Add e55xx (64-bit) smp defconfig powerpc/fsl-booke: Add p5020 DS board support powerpc/fsl-booke64: Use TLB CAMs to cover linear mapping on FSL 64-bit chips powerpc/fsl-booke: Add support for FSL Arch v1.0 MMU in setup_page_sizes powerpc/fsl-booke: Add support for FSL 64-bit e5500 core powerpc/85xx: add cache-sram support powerpc/85xx: add ngPIXIS FPGA device tree node to the P1022DS board powerpc: Fix compile error with paca code on ppc64e powerpc/fsl-booke: Add p3041 DS board support oprofile/fsl emb: Don't set MSR[PMM] until after clearing the interrupt. powerpc/fsl-booke: Add PCI device ids for P2040/P3041/P5010/P5020 QoirQ chips powerpc/mpc8xxx_gpio: Add support for 'qoriq-gpio' controllers powerpc/fsl_booke: Add support to boot from core other than 0 powerpc/p1022: Add probing for individual DMA channels powerpc/fsl_soc: Search all global-utilities nodes for rstccr powerpc: Fix invalid page flags in create TLB CAM path for PTE_64BIT powerpc/mpc83xx: Support for MPC8308 P1M board ... Fix up conflict with the generic irq_work changes in arch/powerpc/kernel/time.c
Diffstat (limited to 'drivers/watchdog')
-rw-r--r--drivers/watchdog/Kconfig22
-rw-r--r--drivers/watchdog/booke_wdt.c47
2 files changed, 59 insertions, 10 deletions
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 24efd8ea41bb..c356146bd712 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -957,12 +957,32 @@ config PIKA_WDT
957 the Warp platform. 957 the Warp platform.
958 958
959config BOOKE_WDT 959config BOOKE_WDT
960 bool "PowerPC Book-E Watchdog Timer" 960 tristate "PowerPC Book-E Watchdog Timer"
961 depends on BOOKE || 4xx 961 depends on BOOKE || 4xx
962 ---help--- 962 ---help---
963 Watchdog driver for PowerPC Book-E chips, such as the Freescale
964 MPC85xx SOCs and the IBM PowerPC 440.
965
963 Please see Documentation/watchdog/watchdog-api.txt for 966 Please see Documentation/watchdog/watchdog-api.txt for
964 more information. 967 more information.
965 968
969config BOOKE_WDT_DEFAULT_TIMEOUT
970 int "PowerPC Book-E Watchdog Timer Default Timeout"
971 depends on BOOKE_WDT
972 default 38 if FSL_BOOKE
973 range 0 63 if FSL_BOOKE
974 default 3 if !FSL_BOOKE
975 range 0 3 if !FSL_BOOKE
976 help
977 Select the default watchdog timer period to be used by the PowerPC
978 Book-E watchdog driver. A watchdog "event" occurs when the bit
979 position represented by this number transitions from zero to one.
980
981 For Freescale Book-E processors, this is a number between 0 and 63.
982 For other Book-E processors, this is a number between 0 and 3.
983
984 The value can be overidden by the wdt_period command-line parameter.
985
966# PPC64 Architecture 986# PPC64 Architecture
967 987
968config WATCHDOG_RTAS 988config WATCHDOG_RTAS
diff --git a/drivers/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c
index 3d49671cdf5a..d11ffb091b0d 100644
--- a/drivers/watchdog/booke_wdt.c
+++ b/drivers/watchdog/booke_wdt.c
@@ -4,7 +4,7 @@
4 * Author: Matthew McClintock 4 * Author: Matthew McClintock
5 * Maintainer: Kumar Gala <galak@kernel.crashing.org> 5 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
6 * 6 *
7 * Copyright 2005, 2008 Freescale Semiconductor Inc. 7 * Copyright 2005, 2008, 2010 Freescale Semiconductor Inc.
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -33,14 +33,8 @@
33 * occur, and the final time the board will reset. 33 * occur, and the final time the board will reset.
34 */ 34 */
35 35
36#ifdef CONFIG_FSL_BOOKE
37#define WDT_PERIOD_DEFAULT 38 /* Ex. wdt_period=28 bus=333Mhz,reset=~40sec */
38#else
39#define WDT_PERIOD_DEFAULT 3 /* Refer to the PPC40x and PPC4xx manuals */
40#endif /* for timing information */
41
42u32 booke_wdt_enabled; 36u32 booke_wdt_enabled;
43u32 booke_wdt_period = WDT_PERIOD_DEFAULT; 37u32 booke_wdt_period = CONFIG_BOOKE_WDT_DEFAULT_TIMEOUT;
44 38
45#ifdef CONFIG_FSL_BOOKE 39#ifdef CONFIG_FSL_BOOKE
46#define WDTP(x) ((((x)&0x3)<<30)|(((x)&0x3c)<<15)) 40#define WDTP(x) ((((x)&0x3)<<30)|(((x)&0x3c)<<15))
@@ -114,6 +108,27 @@ static void __booke_wdt_enable(void *data)
114 mtspr(SPRN_TCR, val); 108 mtspr(SPRN_TCR, val);
115} 109}
116 110
111/**
112 * booke_wdt_disable - disable the watchdog on the given CPU
113 *
114 * This function is called on each CPU. It disables the watchdog on that CPU.
115 *
116 * TCR[WRC] cannot be changed once it has been set to non-zero, but we can
117 * effectively disable the watchdog by setting its period to the maximum value.
118 */
119static void __booke_wdt_disable(void *data)
120{
121 u32 val;
122
123 val = mfspr(SPRN_TCR);
124 val &= ~(TCR_WIE | WDTP_MASK);
125 mtspr(SPRN_TCR, val);
126
127 /* clear status to make sure nothing is pending */
128 __booke_wdt_ping(NULL);
129
130}
131
117static ssize_t booke_wdt_write(struct file *file, const char __user *buf, 132static ssize_t booke_wdt_write(struct file *file, const char __user *buf,
118 size_t count, loff_t *ppos) 133 size_t count, loff_t *ppos)
119{ 134{
@@ -193,12 +208,21 @@ static int booke_wdt_open(struct inode *inode, struct file *file)
193 return nonseekable_open(inode, file); 208 return nonseekable_open(inode, file);
194} 209}
195 210
211static int booke_wdt_release(struct inode *inode, struct file *file)
212{
213 on_each_cpu(__booke_wdt_disable, NULL, 0);
214 booke_wdt_enabled = 0;
215
216 return 0;
217}
218
196static const struct file_operations booke_wdt_fops = { 219static const struct file_operations booke_wdt_fops = {
197 .owner = THIS_MODULE, 220 .owner = THIS_MODULE,
198 .llseek = no_llseek, 221 .llseek = no_llseek,
199 .write = booke_wdt_write, 222 .write = booke_wdt_write,
200 .unlocked_ioctl = booke_wdt_ioctl, 223 .unlocked_ioctl = booke_wdt_ioctl,
201 .open = booke_wdt_open, 224 .open = booke_wdt_open,
225 .release = booke_wdt_release,
202}; 226};
203 227
204static struct miscdevice booke_wdt_miscdev = { 228static struct miscdevice booke_wdt_miscdev = {
@@ -237,4 +261,9 @@ static int __init booke_wdt_init(void)
237 261
238 return ret; 262 return ret;
239} 263}
240device_initcall(booke_wdt_init); 264
265module_init(booke_wdt_init);
266module_exit(booke_wdt_exit);
267
268MODULE_DESCRIPTION("PowerPC Book-E watchdog driver");
269MODULE_LICENSE("GPL");