Commit 1732050f authored by Lubomir Rintel's avatar Lubomir Rintel

ARM: mmp: DT: convert timer driver to use TIMER_OF_DECLARE

This makes things just a tiny bit simpler.
Signed-off-by: default avatarLubomir Rintel <lkundrak@v3.sk>
parent e69fd509
...@@ -9,14 +9,13 @@ ...@@ -9,14 +9,13 @@
#include <linux/irqchip.h> #include <linux/irqchip.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/clk-provider.h> #include <linux/clk-provider.h>
#include <linux/clocksource.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/time.h> #include <asm/mach/time.h>
#include <asm/hardware/cache-tauros2.h> #include <asm/hardware/cache-tauros2.h>
#include "common.h" #include "common.h"
extern void __init mmp_dt_init_timer(void);
static const char *const pxa168_dt_board_compat[] __initconst = { static const char *const pxa168_dt_board_compat[] __initconst = {
"mrvl,pxa168-aspenite", "mrvl,pxa168-aspenite",
NULL, NULL,
...@@ -32,8 +31,8 @@ static void __init mmp_init_time(void) ...@@ -32,8 +31,8 @@ static void __init mmp_init_time(void)
#ifdef CONFIG_CACHE_TAUROS2 #ifdef CONFIG_CACHE_TAUROS2
tauros2_init(0); tauros2_init(0);
#endif #endif
mmp_dt_init_timer();
of_clk_init(NULL); of_clk_init(NULL);
timer_probe();
} }
DT_MACHINE_START(PXA168_DT, "Marvell PXA168 (Device Tree Support)") DT_MACHINE_START(PXA168_DT, "Marvell PXA168 (Device Tree Support)")
......
...@@ -10,21 +10,20 @@ ...@@ -10,21 +10,20 @@
#include <linux/irqchip.h> #include <linux/irqchip.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/clk-provider.h> #include <linux/clk-provider.h>
#include <linux/clocksource.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/time.h> #include <asm/mach/time.h>
#include <asm/hardware/cache-tauros2.h> #include <asm/hardware/cache-tauros2.h>
#include "common.h" #include "common.h"
extern void __init mmp_dt_init_timer(void);
static void __init mmp_init_time(void) static void __init mmp_init_time(void)
{ {
#ifdef CONFIG_CACHE_TAUROS2 #ifdef CONFIG_CACHE_TAUROS2
tauros2_init(0); tauros2_init(0);
#endif #endif
of_clk_init(NULL); of_clk_init(NULL);
mmp_dt_init_timer(); timer_probe();
} }
static const char *const mmp2_dt_board_compat[] __initconst = { static const char *const mmp2_dt_board_compat[] __initconst = {
......
...@@ -195,30 +195,17 @@ void __init mmp_timer_init(int irq, unsigned long rate) ...@@ -195,30 +195,17 @@ void __init mmp_timer_init(int irq, unsigned long rate)
clockevents_config_and_register(&ckevt, rate, MIN_DELTA, MAX_DELTA); clockevents_config_and_register(&ckevt, rate, MIN_DELTA, MAX_DELTA);
} }
#ifdef CONFIG_OF static int __init mmp_dt_init_timer(struct device_node *np)
static const struct of_device_id mmp_timer_dt_ids[] = {
{ .compatible = "mrvl,mmp-timer", },
{}
};
void __init mmp_dt_init_timer(void)
{ {
struct device_node *np;
struct clk *clk; struct clk *clk;
int irq, ret; int irq, ret;
unsigned long rate; unsigned long rate;
np = of_find_matching_node(NULL, mmp_timer_dt_ids);
if (!np) {
ret = -ENODEV;
goto out;
}
clk = of_clk_get(np, 0); clk = of_clk_get(np, 0);
if (!IS_ERR(clk)) { if (!IS_ERR(clk)) {
ret = clk_prepare_enable(clk); ret = clk_prepare_enable(clk);
if (ret) if (ret)
goto out; return ret;
rate = clk_get_rate(clk) / 2; rate = clk_get_rate(clk) / 2;
} else if (cpu_is_pj4()) { } else if (cpu_is_pj4()) {
rate = 6500000; rate = 6500000;
...@@ -227,18 +214,15 @@ void __init mmp_dt_init_timer(void) ...@@ -227,18 +214,15 @@ void __init mmp_dt_init_timer(void)
} }
irq = irq_of_parse_and_map(np, 0); irq = irq_of_parse_and_map(np, 0);
if (!irq) { if (!irq)
ret = -EINVAL; return -EINVAL;
goto out;
}
mmp_timer_base = of_iomap(np, 0); mmp_timer_base = of_iomap(np, 0);
if (!mmp_timer_base) { if (!mmp_timer_base)
ret = -ENOMEM; return -ENOMEM;
goto out;
}
mmp_timer_init(irq, rate); mmp_timer_init(irq, rate);
return; return 0;
out:
pr_err("Failed to get timer from device tree with error:%d\n", ret);
} }
#endif
TIMER_OF_DECLARE(mmp_timer, "mrvl,mmp-timer", mmp_dt_init_timer);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment