Commit graph

16 commits

Author SHA1 Message Date
Shawn Guo c74512bf83 ARM: mxs: move timer driver into drivers/clocksource
Move mxs timer driver into drivers/clocksource as mxs_timer.c.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2013-04-01 16:30:03 +08:00
Shawn Guo 7a9c39f787 ARM: mxs: select STMP_DEVICE and use it for timer code
Select STMP_DEVICE and in timer code replace mxs_reset_block() with
stmp_reset_block(), use STMP_OFFSET_REG_SET/CLR to replace
__mxs_setl/clrl.

As the result, <mach/mxs.h> and <mach/common.h> includsion can be
removed from timer.c now.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2013-04-01 16:30:02 +08:00
Shawn Guo 220d2f269a ARM: mxs: remove cpu_is_mx23() call from timer code
Remove cpu_is_mx23() call from timer code by using
of_device_is_compatible() instead.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2013-04-01 16:30:02 +08:00
Shawn Guo be35bd2bcd ARM: mxs: get timrot base address from device tree
Instead of using static defines, it gets timrot base address with
mapping from device tree.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2013-04-01 16:30:02 +08:00
Shawn Guo 2efb950465 ARM: mxs: look up timrot clock from device tree
Change call clk_get_sys() to of_clk_get() to look up timrot clock from
device tree, so that the clk_register_clkdev() call for timrot can be
saved in clock driver.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2013-04-01 16:30:02 +08:00
Shawn Guo 633ef4c7d1 ARM: mxs: use CLKSRC_OF helper to initialize timer
Select CLKSRC_OF and use clocksource_of_init() to initialize timer, so
that the call to mxs_timer_init() in clock driver can be removed.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2013-04-01 16:30:01 +08:00
Torben Hohn 93044fa152 ARM: mxs: decrease mxs_clockevent_device.min_delta_ns to 2 clock cycles
Signed-off-by: Torben Hohn <torbenh@linutronix.de>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2013-02-05 11:27:49 +08:00
Torben Hohn 2fb318ff75 ARM: mxs: use apbx bus clock to drive the timers on timrotv2
timer resolution of ~32us is pretty low.
v2 has 32bits resolution, so we have quite some headroom, and
can use the 24MHz clock.
v1 has only 16bits, so we only increase v2.

So we just exchange the timrot clock in imx28.
On imx23 we have timrotv1 and everything stays the same.

Signed-off-by: Torben Hohn <torbenh@linutronix.de>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2013-02-05 11:19:46 +08:00
Shawn Guo 838a2ae80a ARM: use clockevents_config_and_register() where possible
The clockevent core is able to figure out the best mult and shift,
calculate min_delta_ns and max_delta_ns, with the necessary info passed
into clockevents_config_and_register().  Use this combined configure
and register function where possible to make the codes less error prone
and gain some positive diff stat.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Reviewed-by: Anton Vorontsov <cbouatmailru@gmail.com>
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Jason Cooper <jason@lakedaemon.net>
Tested-by: Roland Stigge <stigge@antcom.de>
Acked-by: Eric Miao <eric.y.miao@gmail.com>
Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
Cc: David Brown <davidb@codeaurora.org>
Tested-by: Tony Lindgren <tony@atomide.com>
Acked-by: Barry Song <baohua.song@csr.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Tony Prisk <linux@prisktech.co.nz>
Cc: Lennert Buytenhek <buytenh@wantstofly.org>
Cc: Wan ZongShun <mcuos.com@gmail.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Olof Johansson <olof@lixom.net>
2013-01-14 10:12:42 -08:00
Stanislav Meduna 67948adad1 ARM: mxs: Setup scheduler clock
Setup scheduler clock on ARM MXS platforms with a 32-bit timrot
such as i.MX28. This allows the scheduler to use sub-jiffy resolution.

The corresponding change for 16-bit v1 timrots is not possible
at the moment due to rounding issues with clock values wrapping
faster than once per several seconds in the common ARM platform code.

Signed-off-by: Stanislav Meduna <stano@meduna.org>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2012-11-12 09:27:30 +08:00
Shawn Guo eeca6e6040 ARM: mxs: retrieve timer irq from device tree
Rather than using the static timer irq definition, we should retrieve
timer irq from device tree for better.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2012-09-03 09:31:50 +08:00
Shawn Guo 50260924af ARM: mxs: remove now unused timer_clk argument from mxs_timer_init
With old mxs clock support removed, the timer_clk argument of
mxs_timer_init is unused now, so remove it.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2012-05-09 00:02:43 +08:00
Shawn Guo 39d1367e11 ARM: mxs: request clock for timer
When mxs_timer_init() does not have a timer_clk passed in, it should
try to request clock from clkdev system.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2012-05-09 00:02:39 +08:00
Shawn Guo ae68f7af05 ARM: mxs: convert platform code to clk_prepare/clk_unprepare
The patch converts mxs platform code to clk_prepare/clk_unprepare
by using helper functions clk_prepare_enable/clk_disable_unprepare.

Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2011-12-28 21:26:07 +08:00
Russell King 5c61ddcfaf clocksource: convert MXS timrotv2 to 32-bit down counting clocksource
Convert the MXS timrotv2 32-bit down counting clocksource to the
generic clocksource infrastructure.

Cc: Sascha Hauer <kernel@pengutronix.de>
Acked-by: Shawn Guo <shawn.guo@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2011-05-23 18:04:52 +01:00
Shawn Guo 4e472096fa ARM: mxs: Add timer support
There are 2 versions of the timrot on Freescale MXS-based SoCs.
The v1 on MX23 only gets 16 bits counter, while v2 on MX28
extends the counter to 32 bits.

The implementation uses two timers, one for clock_event and
another for clocksource. MX28 uses timrot 0 and 1, while MX23
uses 0 and 2.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
2010-12-20 17:29:50 +01:00