summaryrefslogtreecommitdiff
path: root/drivers/clocksource/timer-atmel-st.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2016-07-07 13:41:13 (GMT)
committerThomas Gleixner <tglx@linutronix.de>2016-07-07 13:41:13 (GMT)
commit3d93f42d449ace8e2dd8e2ec9790fdce31a14c9c (patch)
tree16abfc89c51a2cf0116eb692a591faf897e04297 /drivers/clocksource/timer-atmel-st.c
parent4b4b20852d1009c5e8bc357b22353b62e3a241c7 (diff)
parent34c720a915857f168b98ab03f97b33784286e4ad (diff)
downloadlinux-3d93f42d449ace8e2dd8e2ec9790fdce31a14c9c.tar.xz
Merge branch 'clockevents/4.8' of http://git.linaro.org/people/daniel.lezcano/linux into timers/core
Pull the clockevents/clocksource tree from Daniel Lezcano: - Convert the clocksource-probe init functions to return a value in order to prepare the consolidation of the drivers using the DT. It is a big patchset but went through 01.org (kbuild bot), linux next and kernel-ci (continuous integration) (Daniel Lezcano) - Fix a bad error handling by returning the right value for cadence_ttc (Christophe Jaillet) - Fix typo in the Kconfig for the Samsung pwm (Alexandre Belloni) - Change functions to static for armada-370-xp and digicolor (Ben Dooks) - Add support for the rk3399 SoC timer by adding bindings and a slight change in the base address. Take the opportunity to add the DYNIRQ flag (Huang Tao) - Fix endian accessors for the Samsung pwm timer (Matthew Leach) - Add Oxford Semiconductor RPS Dual Timer driver (Neil Armstrong) - Add a kernel parameter to swich on/off the event stream feature of the arch arm timer (Will Deacon)
Diffstat (limited to 'drivers/clocksource/timer-atmel-st.c')
-rw-r--r--drivers/clocksource/timer-atmel-st.c42
1 files changed, 27 insertions, 15 deletions
diff --git a/drivers/clocksource/timer-atmel-st.c b/drivers/clocksource/timer-atmel-st.c
index 29d21d6..e90ab5b 100644
--- a/drivers/clocksource/timer-atmel-st.c
+++ b/drivers/clocksource/timer-atmel-st.c
@@ -194,15 +194,17 @@ static struct clock_event_device clkevt = {
/*
* ST (system timer) module supports both clockevents and clocksource.
*/
-static void __init atmel_st_timer_init(struct device_node *node)
+static int __init atmel_st_timer_init(struct device_node *node)
{
struct clk *sclk;
unsigned int sclk_rate, val;
int irq, ret;
regmap_st = syscon_node_to_regmap(node);
- if (IS_ERR(regmap_st))
- panic(pr_fmt("Unable to get regmap\n"));
+ if (IS_ERR(regmap_st)) {
+ pr_err("Unable to get regmap\n");
+ return PTR_ERR(regmap_st);
+ }
/* Disable all timer interrupts, and clear any pending ones */
regmap_write(regmap_st, AT91_ST_IDR,
@@ -211,27 +213,37 @@ static void __init atmel_st_timer_init(struct device_node *node)
/* Get the interrupts property */
irq = irq_of_parse_and_map(node, 0);
- if (!irq)
- panic(pr_fmt("Unable to get IRQ from DT\n"));
+ if (!irq) {
+ pr_err("Unable to get IRQ from DT\n");
+ return -EINVAL;
+ }
/* Make IRQs happen for the system timer */
ret = request_irq(irq, at91rm9200_timer_interrupt,
IRQF_SHARED | IRQF_TIMER | IRQF_IRQPOLL,
"at91_tick", regmap_st);
- if (ret)
- panic(pr_fmt("Unable to setup IRQ\n"));
+ if (ret) {
+ pr_err("Unable to setup IRQ\n");
+ return ret;
+ }
sclk = of_clk_get(node, 0);
- if (IS_ERR(sclk))
- panic(pr_fmt("Unable to get slow clock\n"));
+ if (IS_ERR(sclk)) {
+ pr_err("Unable to get slow clock\n");
+ return PTR_ERR(sclk);
+ }
- clk_prepare_enable(sclk);
- if (ret)
- panic(pr_fmt("Could not enable slow clock\n"));
+ ret = clk_prepare_enable(sclk);
+ if (ret) {
+ pr_err("Could not enable slow clock\n");
+ return ret;
+ }
sclk_rate = clk_get_rate(sclk);
- if (!sclk_rate)
- panic(pr_fmt("Invalid slow clock rate\n"));
+ if (!sclk_rate) {
+ pr_err("Invalid slow clock rate\n");
+ return -EINVAL;
+ }
timer_latch = (sclk_rate + HZ / 2) / HZ;
/* The 32KiHz "Slow Clock" (tick every 30517.58 nanoseconds) is used
@@ -246,7 +258,7 @@ static void __init atmel_st_timer_init(struct device_node *node)
2, AT91_ST_ALMV);
/* register clocksource */
- clocksource_register_hz(&clk32k, sclk_rate);
+ return clocksource_register_hz(&clk32k, sclk_rate);
}
CLOCKSOURCE_OF_DECLARE(atmel_st_timer, "atmel,at91rm9200-st",
atmel_st_timer_init);