diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2019-07-11 00:13:51 +0300 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2019-10-17 17:36:11 +0300 |
commit | 1732050f48a384fbe101b8586ed42caf874816eb (patch) | |
tree | 94031855708c9e9e96bef601273b1ed78d0510e5 /arch/arm/mach-mmp/time.c | |
parent | e69fd5090dbd640a12b61feef78eb07a17cec209 (diff) | |
download | linux-1732050f48a384fbe101b8586ed42caf874816eb.tar.xz |
ARM: mmp: DT: convert timer driver to use TIMER_OF_DECLARE
This makes things just a tiny bit simpler.
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Diffstat (limited to 'arch/arm/mach-mmp/time.c')
-rw-r--r-- | arch/arm/mach-mmp/time.c | 38 |
1 files changed, 11 insertions, 27 deletions
diff --git a/arch/arm/mach-mmp/time.c b/arch/arm/mach-mmp/time.c index 483df32583be..3f6fd0be0051 100644 --- a/arch/arm/mach-mmp/time.c +++ b/arch/arm/mach-mmp/time.c @@ -195,30 +195,17 @@ void __init mmp_timer_init(int irq, unsigned long rate) clockevents_config_and_register(&ckevt, rate, MIN_DELTA, MAX_DELTA); } -#ifdef CONFIG_OF -static const struct of_device_id mmp_timer_dt_ids[] = { - { .compatible = "mrvl,mmp-timer", }, - {} -}; - -void __init mmp_dt_init_timer(void) +static int __init mmp_dt_init_timer(struct device_node *np) { - struct device_node *np; struct clk *clk; int irq, ret; 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); if (!IS_ERR(clk)) { ret = clk_prepare_enable(clk); if (ret) - goto out; + return ret; rate = clk_get_rate(clk) / 2; } else if (cpu_is_pj4()) { rate = 6500000; @@ -227,18 +214,15 @@ void __init mmp_dt_init_timer(void) } irq = irq_of_parse_and_map(np, 0); - if (!irq) { - ret = -EINVAL; - goto out; - } + if (!irq) + return -EINVAL; + mmp_timer_base = of_iomap(np, 0); - if (!mmp_timer_base) { - ret = -ENOMEM; - goto out; - } + if (!mmp_timer_base) + return -ENOMEM; + mmp_timer_init(irq, rate); - return; -out: - pr_err("Failed to get timer from device tree with error:%d\n", ret); + return 0; } -#endif + +TIMER_OF_DECLARE(mmp_timer, "mrvl,mmp-timer", mmp_dt_init_timer); |