summaryrefslogtreecommitdiffstats
path: root/drivers/watchdog
diff options
context:
space:
mode:
authorRobert Jarzmik <robert.jarzmik@free.fr>2016-09-19 15:12:14 -0400
committerRobert Jarzmik <robert.jarzmik@free.fr>2016-10-18 03:12:36 -0400
commit6924089c488e9deab2ecc43a263a09a2d8a3f4cb (patch)
tree1c67fd1e9f258d2e2998e358113287a36668d627 /drivers/watchdog
parentf4e14edf25661f32c9e7323d8a482b8632a6f47f (diff)
watchdog: sa11x0/pxa: get rid of get_clock_tick_rate
The OS timer rate used for the watchdog can now be fetched from the standard clock API. This will remove the last user of get_clock_tick_rate() in both pxa and sa11x0 architectures. Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Tested-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Russell King <rmk+kernel@armlinux.org.uk> Acked-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r--drivers/watchdog/sa1100_wdt.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/drivers/watchdog/sa1100_wdt.c b/drivers/watchdog/sa1100_wdt.c
index e1d39a1e9628..8965e3f536c3 100644
--- a/drivers/watchdog/sa1100_wdt.c
+++ b/drivers/watchdog/sa1100_wdt.c
@@ -22,6 +22,7 @@
22 22
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/moduleparam.h> 24#include <linux/moduleparam.h>
25#include <linux/clk.h>
25#include <linux/types.h> 26#include <linux/types.h>
26#include <linux/kernel.h> 27#include <linux/kernel.h>
27#include <linux/fs.h> 28#include <linux/fs.h>
@@ -155,12 +156,27 @@ static struct miscdevice sa1100dog_miscdev = {
155}; 156};
156 157
157static int margin __initdata = 60; /* (secs) Default is 1 minute */ 158static int margin __initdata = 60; /* (secs) Default is 1 minute */
159static struct clk *clk;
158 160
159static int __init sa1100dog_init(void) 161static int __init sa1100dog_init(void)
160{ 162{
161 int ret; 163 int ret;
162 164
163 oscr_freq = get_clock_tick_rate(); 165 clk = clk_get(NULL, "OSTIMER0");
166 if (IS_ERR(clk)) {
167 pr_err("SA1100/PXA2xx Watchdog Timer: clock not found: %d\n",
168 (int) PTR_ERR(clk));
169 return PTR_ERR(clk);
170 }
171
172 ret = clk_prepare_enable(clk);
173 if (ret) {
174 pr_err("SA1100/PXA2xx Watchdog Timer: clock failed to prepare+enable: %d\n",
175 ret);
176 goto err;
177 }
178
179 oscr_freq = clk_get_rate(clk);
164 180
165 /* 181 /*
166 * Read the reset status, and save it for later. If 182 * Read the reset status, and save it for later. If
@@ -176,11 +192,17 @@ static int __init sa1100dog_init(void)
176 pr_info("SA1100/PXA2xx Watchdog Timer: timer margin %d sec\n", 192 pr_info("SA1100/PXA2xx Watchdog Timer: timer margin %d sec\n",
177 margin); 193 margin);
178 return ret; 194 return ret;
195err:
196 clk_disable_unprepare(clk);
197 clk_put(clk);
198 return ret;
179} 199}
180 200
181static void __exit sa1100dog_exit(void) 201static void __exit sa1100dog_exit(void)
182{ 202{
183 misc_deregister(&sa1100dog_miscdev); 203 misc_deregister(&sa1100dog_miscdev);
204 clk_disable_unprepare(clk);
205 clk_put(clk);
184} 206}
185 207
186module_init(sa1100dog_init); 208module_init(sa1100dog_init);