Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1486786
| From | Robert Jarzmik <robert.jarzmik@free.fr> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 3/4] watchdog: sa11x0/pxa: get rid of get_clock_tick_rate |
| Date | 2016-09-19 21:30 +0200 |
| Message-ID | <sjcqm-149-39@gated-at.bofh.it> (permalink) |
| References | <sjcgF-10E-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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>
---
drivers/watchdog/sa1100_wdt.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
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 @@
#include <linux/module.h>
#include <linux/moduleparam.h>
+#include <linux/clk.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/fs.h>
@@ -155,12 +156,27 @@ static struct miscdevice sa1100dog_miscdev = {
};
static int margin __initdata = 60; /* (secs) Default is 1 minute */
+static struct clk *clk;
static int __init sa1100dog_init(void)
{
int ret;
- oscr_freq = get_clock_tick_rate();
+ clk = clk_get(NULL, "OSTIMER0");
+ if (IS_ERR(clk)) {
+ pr_err("SA1100/PXA2xx Watchdog Timer: clock not found: %d\n",
+ (int) PTR_ERR(clk));
+ return PTR_ERR(clk);
+ }
+
+ ret = clk_prepare_enable(clk);
+ if (ret) {
+ pr_err("SA1100/PXA2xx Watchdog Timer: clock failed to prepare+enable: %d\n",
+ ret);
+ goto err;
+ }
+
+ oscr_freq = clk_get_rate(clk);
/*
* Read the reset status, and save it for later. If
@@ -176,11 +192,17 @@ static int __init sa1100dog_init(void)
pr_info("SA1100/PXA2xx Watchdog Timer: timer margin %d sec\n",
margin);
return ret;
+err:
+ clk_disable_unprepare(clk);
+ clk_put(clk);
+ return ret;
}
static void __exit sa1100dog_exit(void)
{
misc_deregister(&sa1100dog_miscdev);
+ clk_disable_unprepare(clk);
+ clk_put(clk);
}
module_init(sa1100dog_init);
--
2.1.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/4] kill get_clock_tick_rate() Robert Jarzmik <robert.jarzmik@free.fr> - 2016-09-19 21:20 +0200
[PATCH 2/4] ARM: sa11x0/pxa: acquire timer rate from the clock rate Robert Jarzmik <robert.jarzmik@free.fr> - 2016-09-19 21:20 +0200
Re: [PATCH 2/4] ARM: sa11x0/pxa: acquire timer rate from the clock rate Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-09-19 21:50 +0200
[PATCH 1/4] clk: pxa25x: OSTIMER0 clocks from the main oscillator Robert Jarzmik <robert.jarzmik@free.fr> - 2016-09-19 21:20 +0200
Re: [PATCH 1/4] clk: pxa25x: OSTIMER0 clocks from the main oscillator Stephen Boyd <sboyd@codeaurora.org> - 2016-09-19 21:30 +0200
[PATCH 3/4] watchdog: sa11x0/pxa: get rid of get_clock_tick_rate Robert Jarzmik <robert.jarzmik@free.fr> - 2016-09-19 21:30 +0200
Re: [PATCH 3/4] watchdog: sa11x0/pxa: get rid of get_clock_tick_rate Guenter Roeck <linux@roeck-us.net> - 2016-09-19 22:10 +0200
Re: [PATCH 3/4] watchdog: sa11x0/pxa: get rid of get_clock_tick_rate Russell King - ARM Linux <linux@armlinux.org.uk> - 2016-09-20 00:40 +0200
Re: [PATCH 3/4] watchdog: sa11x0/pxa: get rid of get_clock_tick_rate Guenter Roeck <linux@roeck-us.net> - 2016-09-20 06:40 +0200
Re: [PATCH 3/4] watchdog: sa11x0/pxa: get rid of get_clock_tick_rate Robert Jarzmik <robert.jarzmik@free.fr> - 2016-09-20 08:20 +0200
Re: [PATCH 3/4] watchdog: sa11x0/pxa: get rid of get_clock_tick_rate Guenter Roeck <linux@roeck-us.net> - 2016-09-20 06:40 +0200
[PATCH 4/4] ARM: sa11x0/pxa: get rid of get_clock_tick_rate Robert Jarzmik <robert.jarzmik@free.fr> - 2016-09-19 21:30 +0200
Re: [PATCH 4/4] ARM: sa11x0/pxa: get rid of get_clock_tick_rate Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-09-19 22:00 +0200
csiph-web