summaryrefslogtreecommitdiff
path: root/drivers/clocksource/timer-of.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/clocksource/timer-of.c')
-rw-r--r--drivers/clocksource/timer-of.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/clocksource/timer-of.c b/drivers/clocksource/timer-of.c
index ad5565404e25..c1045b9a787c 100644
--- a/drivers/clocksource/timer-of.c
+++ b/drivers/clocksource/timer-of.c
@@ -24,6 +24,12 @@
#include "timer-of.h"
+/**
+ * timer_of_irq_exit - Release the interrupt
+ * @of_irq: an of_timer_irq structure pointer
+ *
+ * Free the irq resource
+ */
static __init void timer_of_irq_exit(struct of_timer_irq *of_irq)
{
struct timer_of *to = container_of(of_irq, struct timer_of, of_irq);
@@ -34,6 +40,22 @@ static __init void timer_of_irq_exit(struct of_timer_irq *of_irq)
free_irq(of_irq->irq, clkevt);
}
+/**
+ * timer_of_irq_init - Request the interrupt
+ * @np: a device tree node pointer
+ * @of_irq: an of_timer_irq structure pointer
+ *
+ * Get the interrupt number from the DT from its definition and
+ * request it. The interrupt is gotten by falling back the following way:
+ *
+ * - Get interrupt number by name
+ * - Get interrupt number by index
+ *
+ * When the interrupt is per CPU, 'request_percpu_irq()' is called,
+ * otherwise 'request_irq()' is used.
+ *
+ * Returns 0 on success, < 0 otherwise
+ */
static __init int timer_of_irq_init(struct device_node *np,
struct of_timer_irq *of_irq)
{
@@ -72,6 +94,12 @@ static __init int timer_of_irq_init(struct device_node *np,
return 0;
}
+/**
+ * timer_of_clk_exit - Release the clock resources
+ * @of_clk: a of_timer_clk structure pointer
+ *
+ * Disables and releases the refcount on the clk
+ */
static __init void timer_of_clk_exit(struct of_timer_clk *of_clk)
{
of_clk->rate = 0;
@@ -79,6 +107,15 @@ static __init void timer_of_clk_exit(struct of_timer_clk *of_clk)
clk_put(of_clk->clk);
}
+/**
+ * timer_of_clk_init - Initialize the clock resources
+ * @np: a device tree node pointer
+ * @of_clk: a of_timer_clk structure pointer
+ *
+ * Get the clock by name or by index, enable it and get the rate
+ *
+ * Returns 0 on success, < 0 otherwise
+ */
static __init int timer_of_clk_init(struct device_node *np,
struct of_timer_clk *of_clk)
{