summaryrefslogtreecommitdiffstats
path: root/drivers/clocksource/sunxi_timer.c
diff options
context:
space:
mode:
authorMaxime Ripard <maxime.ripard@free-electrons.com>2013-03-24 00:01:48 +0100
committerMaxime Ripard <maxime.ripard@free-electrons.com>2013-04-08 21:41:54 +0200
commitea71d9a600e769ca669f4ba3e25ffdecdeede240 (patch)
treebb5bb6a4a2695a86f90d942e36e25f3cac6b6a80 /drivers/clocksource/sunxi_timer.c
parentclocksource: sunxi: Cleanup the timer code (diff)
downloadlinux-ea71d9a600e769ca669f4ba3e25ffdecdeede240.tar.xz
linux-ea71d9a600e769ca669f4ba3e25ffdecdeede240.zip
clocksource: sunxi: make use of CLKSRC_OF
Using CLKSRC_OF allows to remove the SoC specific sunxi_timer.h header, and instead of using a custom init function in the machine definition use the standard clocksource_of_init function. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Diffstat (limited to 'drivers/clocksource/sunxi_timer.c')
-rw-r--r--drivers/clocksource/sunxi_timer.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/drivers/clocksource/sunxi_timer.c b/drivers/clocksource/sunxi_timer.c
index 7a3ea236be52..308bbe328318 100644
--- a/drivers/clocksource/sunxi_timer.c
+++ b/drivers/clocksource/sunxi_timer.c
@@ -22,8 +22,6 @@
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
-#include <linux/sunxi_timer.h>
-#include <linux/clk/sunxi.h>
#define TIMER_IRQ_EN_REG 0x00
#define TIMER_IRQ_EN(val) (1 << val)
@@ -98,23 +96,13 @@ static struct irqaction sunxi_timer_irq = {
.dev_id = &sunxi_clockevent,
};
-static struct of_device_id sunxi_timer_dt_ids[] = {
- { .compatible = "allwinner,sunxi-timer" },
- { }
-};
-
-void __init sunxi_timer_init(void)
+static void __init sunxi_timer_init(struct device_node *node)
{
- struct device_node *node;
unsigned long rate = 0;
struct clk *clk;
int ret, irq;
u32 val;
- node = of_find_matching_node(NULL, sunxi_timer_dt_ids);
- if (!node)
- panic("No sunxi timer node");
-
timer_base = of_iomap(node, 0);
if (!timer_base)
panic("Can't map registers");
@@ -123,8 +111,6 @@ void __init sunxi_timer_init(void)
if (irq <= 0)
panic("Can't parse IRQ");
- sunxi_init_clocks();
-
clk = of_clk_get(node, 0);
if (IS_ERR(clk))
panic("Can't get timer clock");
@@ -158,3 +144,5 @@ void __init sunxi_timer_init(void)
clockevents_config_and_register(&sunxi_clockevent, rate / TIMER_SCAL,
0x1, 0xff);
}
+CLOCKSOURCE_OF_DECLARE(sunxi, "allwinner,sunxi-timer",
+ sunxi_timer_init);