diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/i2c/busses/i2c-pasemi.c | 2 | ||||
-rw-r--r-- | drivers/macintosh/via-pmu-led.c | 4 | ||||
-rw-r--r-- | drivers/watchdog/Kconfig | 22 | ||||
-rw-r--r-- | drivers/watchdog/booke_wdt.c | 47 |
4 files changed, 63 insertions, 12 deletions
diff --git a/drivers/i2c/busses/i2c-pasemi.c b/drivers/i2c/busses/i2c-pasemi.c index 4174101660c9..837b8c1aa02a 100644 --- a/drivers/i2c/busses/i2c-pasemi.c +++ b/drivers/i2c/busses/i2c-pasemi.c | |||
@@ -88,7 +88,7 @@ static void pasemi_smb_clear(struct pasemi_smbus *smbus) | |||
88 | reg_write(smbus, REG_SMSTA, status); | 88 | reg_write(smbus, REG_SMSTA, status); |
89 | } | 89 | } |
90 | 90 | ||
91 | static unsigned int pasemi_smb_waitready(struct pasemi_smbus *smbus) | 91 | static int pasemi_smb_waitready(struct pasemi_smbus *smbus) |
92 | { | 92 | { |
93 | int timeout = 10; | 93 | int timeout = 10; |
94 | unsigned int status; | 94 | unsigned int status; |
diff --git a/drivers/macintosh/via-pmu-led.c b/drivers/macintosh/via-pmu-led.c index d242976bcfe7..19c371809d77 100644 --- a/drivers/macintosh/via-pmu-led.c +++ b/drivers/macintosh/via-pmu-led.c | |||
@@ -92,8 +92,10 @@ static int __init via_pmu_led_init(void) | |||
92 | if (dt == NULL) | 92 | if (dt == NULL) |
93 | return -ENODEV; | 93 | return -ENODEV; |
94 | model = of_get_property(dt, "model", NULL); | 94 | model = of_get_property(dt, "model", NULL); |
95 | if (model == NULL) | 95 | if (model == NULL) { |
96 | of_node_put(dt); | ||
96 | return -ENODEV; | 97 | return -ENODEV; |
98 | } | ||
97 | if (strncmp(model, "PowerBook", strlen("PowerBook")) != 0 && | 99 | if (strncmp(model, "PowerBook", strlen("PowerBook")) != 0 && |
98 | strncmp(model, "iBook", strlen("iBook")) != 0 && | 100 | strncmp(model, "iBook", strlen("iBook")) != 0 && |
99 | strcmp(model, "PowerMac7,2") != 0 && | 101 | strcmp(model, "PowerMac7,2") != 0 && |
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 | ||
959 | config BOOKE_WDT | 959 | config 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 | ||
969 | config 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 | ||
968 | config WATCHDOG_RTAS | 988 | config 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 | |||
42 | u32 booke_wdt_enabled; | 36 | u32 booke_wdt_enabled; |
43 | u32 booke_wdt_period = WDT_PERIOD_DEFAULT; | 37 | u32 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 | */ | ||
119 | static 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 | |||
117 | static ssize_t booke_wdt_write(struct file *file, const char __user *buf, | 132 | static 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 | ||
211 | static 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 | |||
196 | static const struct file_operations booke_wdt_fops = { | 219 | static 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 | ||
204 | static struct miscdevice booke_wdt_miscdev = { | 228 | static 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 | } |
240 | device_initcall(booke_wdt_init); | 264 | |
265 | module_init(booke_wdt_init); | ||
266 | module_exit(booke_wdt_exit); | ||
267 | |||
268 | MODULE_DESCRIPTION("PowerPC Book-E watchdog driver"); | ||
269 | MODULE_LICENSE("GPL"); | ||