ARM: sa11x0/pxa: acquire timer rate from the clock rate

As both pxa and sa1100 provide a clock to the timer, the rate can be
inferred from the clock rather than hard encoded in a functional call.

This patch changes the pxa timer to have a mandatory clock which is used
as the timer rate.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
This commit is contained in:
Robert Jarzmik 2016-09-19 21:12:13 +02:00
parent a758c9b93f
commit f4e14edf25
4 changed files with 8 additions and 11 deletions

View file

@ -69,8 +69,7 @@ void __init pxa_timer_init(void)
pxa27x_clocks_init(); pxa27x_clocks_init();
if (cpu_is_pxa3xx()) if (cpu_is_pxa3xx())
pxa3xx_clocks_init(); pxa3xx_clocks_init();
pxa_timer_nodt_init(IRQ_OST0, io_p2v(0x40a00000), pxa_timer_nodt_init(IRQ_OST0, io_p2v(0x40a00000));
get_clock_tick_rate());
} }
/* /*

View file

@ -378,7 +378,7 @@ void __init sa1100_map_io(void)
void __init sa1100_timer_init(void) void __init sa1100_timer_init(void)
{ {
pxa_timer_nodt_init(IRQ_OST0, io_p2v(0x90000000), 3686400); pxa_timer_nodt_init(IRQ_OST0, io_p2v(0x90000000));
} }
static struct resource irq_resource = static struct resource irq_resource =

View file

@ -220,17 +220,16 @@ CLOCKSOURCE_OF_DECLARE(pxa_timer, "marvell,pxa-timer", pxa_timer_dt_init);
/* /*
* Legacy timer init for non device-tree boards. * Legacy timer init for non device-tree boards.
*/ */
void __init pxa_timer_nodt_init(int irq, void __iomem *base, void __init pxa_timer_nodt_init(int irq, void __iomem *base)
unsigned long clock_tick_rate)
{ {
struct clk *clk; struct clk *clk;
timer_base = base; timer_base = base;
clk = clk_get(NULL, "OSTIMER0"); clk = clk_get(NULL, "OSTIMER0");
if (clk && !IS_ERR(clk)) if (clk && !IS_ERR(clk)) {
clk_prepare_enable(clk); clk_prepare_enable(clk);
else pxa_timer_common_init(irq, clk_get_rate(clk));
} else {
pr_crit("%s: unable to get clk\n", __func__); pr_crit("%s: unable to get clk\n", __func__);
}
pxa_timer_common_init(irq, clock_tick_rate);
} }

View file

@ -12,7 +12,6 @@
#ifndef _CLOCKSOURCE_PXA_H #ifndef _CLOCKSOURCE_PXA_H
#define _CLOCKSOURCE_PXA_H #define _CLOCKSOURCE_PXA_H
extern void pxa_timer_nodt_init(int irq, void __iomem *base, extern void pxa_timer_nodt_init(int irq, void __iomem *base);
unsigned long clock_tick_rate);
#endif #endif