diff options
author | Alexander Shiyan <shc_work@mail.ru> | 2014-05-27 13:04:46 +0400 |
---|---|---|
committer | Shawn Guo <shawn.guo@freescale.com> | 2014-07-18 16:10:11 +0800 |
commit | f4696752b1e966ea5b3a53ec088a237780612fc0 (patch) | |
tree | 40d70b9eeabc908497092fb97d8fc1ae6a6df8c3 /arch/arm/mach-imx/time.c | |
parent | 186d28c1e057295e75bdac19562096620624f4c3 (diff) |
ARM: i.MX: Use of_clk_get_by_name() for timer clocks for DT case.
Use of_clk_get_by_name() for timer clocks for DT case.
This patch eliminates a lot of unneeded clk_register_clkdev()
calls for GPT.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
Diffstat (limited to 'arch/arm/mach-imx/time.c')
-rw-r--r-- | arch/arm/mach-imx/time.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/arch/arm/mach-imx/time.c b/arch/arm/mach-imx/time.c index bed081e58262..2d96051de938 100644 --- a/arch/arm/mach-imx/time.c +++ b/arch/arm/mach-imx/time.c @@ -290,23 +290,20 @@ static int __init mxc_clockevent_init(struct clk *timer_clk) return 0; } -void __init mxc_timer_init(void __iomem *base, int irq) +static void __init _mxc_timer_init(void __iomem *base, int irq, + struct clk *clk_per, struct clk *clk_ipg) { uint32_t tctl_val; - struct clk *timer_clk; - struct clk *timer_ipg_clk; - timer_clk = clk_get_sys("imx-gpt.0", "per"); - if (IS_ERR(timer_clk)) { + if (IS_ERR(clk_per)) { pr_err("i.MX timer: unable to get clk\n"); return; } - timer_ipg_clk = clk_get_sys("imx-gpt.0", "ipg"); - if (!IS_ERR(timer_ipg_clk)) - clk_prepare_enable(timer_ipg_clk); + if (!IS_ERR(clk_ipg)) + clk_prepare_enable(clk_ipg); - clk_prepare_enable(timer_clk); + clk_prepare_enable(clk_per); timer_base = base; @@ -325,15 +322,24 @@ void __init mxc_timer_init(void __iomem *base, int irq) __raw_writel(tctl_val, timer_base + MXC_TCTL); /* init and register the timer to the framework */ - mxc_clocksource_init(timer_clk); - mxc_clockevent_init(timer_clk); + mxc_clocksource_init(clk_per); + mxc_clockevent_init(clk_per); /* Make irqs happen */ setup_irq(irq, &mxc_timer_irq); } +void __init mxc_timer_init(void __iomem *base, int irq) +{ + struct clk *clk_per = clk_get_sys("imx-gpt.0", "per"); + struct clk *clk_ipg = clk_get_sys("imx-gpt.0", "ipg"); + + _mxc_timer_init(base, irq, clk_per, clk_ipg); +} + void __init mxc_timer_init_dt(struct device_node *np) { + struct clk *clk_per, *clk_ipg; void __iomem *base; int irq; @@ -341,5 +347,8 @@ void __init mxc_timer_init_dt(struct device_node *np) WARN_ON(!base); irq = irq_of_parse_and_map(np, 0); - mxc_timer_init(base, irq); + clk_per = of_clk_get_by_name(np, "per"); + clk_ipg = of_clk_get_by_name(np, "ipg"); + + _mxc_timer_init(base, irq, clk_per, clk_ipg); } |