diff options
Diffstat (limited to 'drivers/watchdog/mpc5200_wdt.c')
-rw-r--r-- | drivers/watchdog/mpc5200_wdt.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/watchdog/mpc5200_wdt.c b/drivers/watchdog/mpc5200_wdt.c index 77c1c2ae2cc2..db91892558f2 100644 --- a/drivers/watchdog/mpc5200_wdt.c +++ b/drivers/watchdog/mpc5200_wdt.c | |||
@@ -5,7 +5,7 @@ | |||
5 | #include <linux/io.h> | 5 | #include <linux/io.h> |
6 | #include <linux/spinlock.h> | 6 | #include <linux/spinlock.h> |
7 | #include <linux/of_platform.h> | 7 | #include <linux/of_platform.h> |
8 | #include <asm/uaccess.h> | 8 | #include <linux/uaccess.h> |
9 | #include <asm/mpc52xx.h> | 9 | #include <asm/mpc52xx.h> |
10 | 10 | ||
11 | 11 | ||
@@ -57,7 +57,8 @@ static int mpc5200_wdt_start(struct mpc5200_wdt *wdt) | |||
57 | /* set timeout, with maximum prescaler */ | 57 | /* set timeout, with maximum prescaler */ |
58 | out_be32(&wdt->regs->count, 0x0 | wdt->count); | 58 | out_be32(&wdt->regs->count, 0x0 | wdt->count); |
59 | /* enable watchdog */ | 59 | /* enable watchdog */ |
60 | out_be32(&wdt->regs->mode, GPT_MODE_CE | GPT_MODE_WDT | GPT_MODE_MS_TIMER); | 60 | out_be32(&wdt->regs->mode, GPT_MODE_CE | GPT_MODE_WDT | |
61 | GPT_MODE_MS_TIMER); | ||
61 | spin_unlock(&wdt->io_lock); | 62 | spin_unlock(&wdt->io_lock); |
62 | 63 | ||
63 | return 0; | 64 | return 0; |
@@ -66,7 +67,8 @@ static int mpc5200_wdt_ping(struct mpc5200_wdt *wdt) | |||
66 | { | 67 | { |
67 | spin_lock(&wdt->io_lock); | 68 | spin_lock(&wdt->io_lock); |
68 | /* writing A5 to OCPW resets the watchdog */ | 69 | /* writing A5 to OCPW resets the watchdog */ |
69 | out_be32(&wdt->regs->mode, 0xA5000000 | (0xffffff & in_be32(&wdt->regs->mode))); | 70 | out_be32(&wdt->regs->mode, 0xA5000000 | |
71 | (0xffffff & in_be32(&wdt->regs->mode))); | ||
70 | spin_unlock(&wdt->io_lock); | 72 | spin_unlock(&wdt->io_lock); |
71 | return 0; | 73 | return 0; |
72 | } | 74 | } |
@@ -92,8 +94,8 @@ static struct watchdog_info mpc5200_wdt_info = { | |||
92 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, | 94 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, |
93 | .identity = "mpc5200 watchdog on GPT0", | 95 | .identity = "mpc5200 watchdog on GPT0", |
94 | }; | 96 | }; |
95 | static int mpc5200_wdt_ioctl(struct inode *inode, struct file *file, | 97 | static long mpc5200_wdt_ioctl(struct file *file, unsigned int cmd, |
96 | unsigned int cmd, unsigned long arg) | 98 | unsigned long arg) |
97 | { | 99 | { |
98 | struct mpc5200_wdt *wdt = file->private_data; | 100 | struct mpc5200_wdt *wdt = file->private_data; |
99 | int __user *data = (int __user *)arg; | 101 | int __user *data = (int __user *)arg; |
@@ -103,7 +105,7 @@ static int mpc5200_wdt_ioctl(struct inode *inode, struct file *file, | |||
103 | switch (cmd) { | 105 | switch (cmd) { |
104 | case WDIOC_GETSUPPORT: | 106 | case WDIOC_GETSUPPORT: |
105 | ret = copy_to_user(data, &mpc5200_wdt_info, | 107 | ret = copy_to_user(data, &mpc5200_wdt_info, |
106 | sizeof(mpc5200_wdt_info)); | 108 | sizeof(mpc5200_wdt_info)); |
107 | if (ret) | 109 | if (ret) |
108 | ret = -EFAULT; | 110 | ret = -EFAULT; |
109 | break; | 111 | break; |
@@ -135,6 +137,7 @@ static int mpc5200_wdt_ioctl(struct inode *inode, struct file *file, | |||
135 | } | 137 | } |
136 | return ret; | 138 | return ret; |
137 | } | 139 | } |
140 | |||
138 | static int mpc5200_wdt_open(struct inode *inode, struct file *file) | 141 | static int mpc5200_wdt_open(struct inode *inode, struct file *file) |
139 | { | 142 | { |
140 | /* /dev/watchdog can only be opened once */ | 143 | /* /dev/watchdog can only be opened once */ |
@@ -161,13 +164,14 @@ static int mpc5200_wdt_release(struct inode *inode, struct file *file) | |||
161 | static const struct file_operations mpc5200_wdt_fops = { | 164 | static const struct file_operations mpc5200_wdt_fops = { |
162 | .owner = THIS_MODULE, | 165 | .owner = THIS_MODULE, |
163 | .write = mpc5200_wdt_write, | 166 | .write = mpc5200_wdt_write, |
164 | .ioctl = mpc5200_wdt_ioctl, | 167 | .unlocked_ioctl = mpc5200_wdt_ioctl, |
165 | .open = mpc5200_wdt_open, | 168 | .open = mpc5200_wdt_open, |
166 | .release = mpc5200_wdt_release, | 169 | .release = mpc5200_wdt_release, |
167 | }; | 170 | }; |
168 | 171 | ||
169 | /* module operations */ | 172 | /* module operations */ |
170 | static int mpc5200_wdt_probe(struct of_device *op, const struct of_device_id *match) | 173 | static int mpc5200_wdt_probe(struct of_device *op, |
174 | const struct of_device_id *match) | ||
171 | { | 175 | { |
172 | struct mpc5200_wdt *wdt; | 176 | struct mpc5200_wdt *wdt; |
173 | int err; | 177 | int err; |
@@ -215,9 +219,9 @@ static int mpc5200_wdt_probe(struct of_device *op, const struct of_device_id *ma | |||
215 | return 0; | 219 | return 0; |
216 | 220 | ||
217 | iounmap(wdt->regs); | 221 | iounmap(wdt->regs); |
218 | out_release: | 222 | out_release: |
219 | release_mem_region(wdt->mem.start, size); | 223 | release_mem_region(wdt->mem.start, size); |
220 | out_free: | 224 | out_free: |
221 | kfree(wdt); | 225 | kfree(wdt); |
222 | return err; | 226 | return err; |
223 | } | 227 | } |