* Improve timer Resolution on imx28 @ 2012-12-21 14:06 Torben Hohn 2012-12-21 14:06 ` [PATCH 1/2] mxs timer: use ahbx bus clock to drive the timers on timrotv2 Torben Hohn ` (2 more replies) 0 siblings, 3 replies; 5+ messages in thread From: Torben Hohn @ 2012-12-21 14:06 UTC (permalink / raw) To: linux-arm-kernel Hi, this Series increases the timer frequency and decreases min_delta_ns. I saw pretty high max latencies with cyclictest: ~600us. The cause was the min_delta_ns value of 0xf 32kHz clockcycles. But with the 32kHz Clock, the period is still around 30us. So we just increase the clock freqeuncy driving the timers here. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] mxs timer: use ahbx bus clock to drive the timers on timrotv2 2012-12-21 14:06 Improve timer Resolution on imx28 Torben Hohn @ 2012-12-21 14:06 ` Torben Hohn 2012-12-25 14:10 ` Shawn Guo 2012-12-21 14:06 ` [PATCH 2/2] mxs timer: decrease mxs_clockevent_device.min_delta_ns to 2 clock cycles Torben Hohn 2012-12-21 14:52 ` Improve timer Resolution on imx28 Marek Vasut 2 siblings, 1 reply; 5+ messages in thread From: Torben Hohn @ 2012-12-21 14:06 UTC (permalink / raw) To: linux-arm-kernel 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> --- arch/arm/mach-mxs/timer.c | 9 +++++---- drivers/clk/mxs/clk-imx28.c | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-mxs/timer.c b/arch/arm/mach-mxs/timer.c index 856f4c7..689a2b5 100644 --- a/arch/arm/mach-mxs/timer.c +++ b/arch/arm/mach-mxs/timer.c @@ -72,8 +72,9 @@ #define BM_TIMROT_TIMCTRLn_IRQ_EN (1 << 14) #define BM_TIMROT_TIMCTRLn_IRQ (1 << 15) #define BP_TIMROT_TIMCTRLn_SELECT 0 -#define BV_TIMROTv1_TIMCTRLn_SELECT__32KHZ_XTAL 0x8 -#define BV_TIMROTv2_TIMCTRLn_SELECT__32KHZ_XTAL 0xb +#define BV_TIMROTv1_TIMCTRLn_SELECT__32KHZ_XTAL 0x8 +#define BV_TIMROTv2_TIMCTRLn_SELECT__32KHZ_XTAL 0xb +#define BV_TIMROTv2_TIMCTRLn_SELECT__TICK_ALWAYS 0xf static struct clock_event_device mxs_clockevent_device; static enum clock_event_mode mxs_clockevent_mode = CLOCK_EVT_MODE_UNUSED; @@ -288,7 +289,7 @@ void __init mxs_timer_init(void) /* one for clock_event */ __raw_writel((timrot_is_v1() ? BV_TIMROTv1_TIMCTRLn_SELECT__32KHZ_XTAL : - BV_TIMROTv2_TIMCTRLn_SELECT__32KHZ_XTAL) | + BV_TIMROTv2_TIMCTRLn_SELECT__TICK_ALWAYS) | BM_TIMROT_TIMCTRLn_UPDATE | BM_TIMROT_TIMCTRLn_IRQ_EN, mxs_timrot_base + HW_TIMROT_TIMCTRLn(0)); @@ -296,7 +297,7 @@ void __init mxs_timer_init(void) /* another for clocksource */ __raw_writel((timrot_is_v1() ? BV_TIMROTv1_TIMCTRLn_SELECT__32KHZ_XTAL : - BV_TIMROTv2_TIMCTRLn_SELECT__32KHZ_XTAL) | + BV_TIMROTv2_TIMCTRLn_SELECT__TICK_ALWAYS) | BM_TIMROT_TIMCTRLn_RELOAD, mxs_timrot_base + HW_TIMROT_TIMCTRLn(1)); diff --git a/drivers/clk/mxs/clk-imx28.c b/drivers/clk/mxs/clk-imx28.c index db3af08..0174270 100644 --- a/drivers/clk/mxs/clk-imx28.c +++ b/drivers/clk/mxs/clk-imx28.c @@ -238,7 +238,7 @@ int __init mx28_clocks_init(void) of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); } - clk_register_clkdev(clks[clk32k], NULL, "timrot"); + clk_register_clkdev(clks[xbus], NULL, "timrot"); clk_register_clkdev(clks[enet_out], NULL, "enet_out"); for (i = 0; i < ARRAY_SIZE(clks_init_on); i++) -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 1/2] mxs timer: use ahbx bus clock to drive the timers on timrotv2 2012-12-21 14:06 ` [PATCH 1/2] mxs timer: use ahbx bus clock to drive the timers on timrotv2 Torben Hohn @ 2012-12-25 14:10 ` Shawn Guo 0 siblings, 0 replies; 5+ messages in thread From: Shawn Guo @ 2012-12-25 14:10 UTC (permalink / raw) To: linux-arm-kernel On Fri, Dec 21, 2012 at 03:06:15PM +0100, Torben Hohn wrote: > 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> 1) s/ahbx/apbx on patch subject. 2) The patch prefix should look like "ARM: mxs: ..." Fixed them and applied both patches. Thanks. Shawn ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] mxs timer: decrease mxs_clockevent_device.min_delta_ns to 2 clock cycles 2012-12-21 14:06 Improve timer Resolution on imx28 Torben Hohn 2012-12-21 14:06 ` [PATCH 1/2] mxs timer: use ahbx bus clock to drive the timers on timrotv2 Torben Hohn @ 2012-12-21 14:06 ` Torben Hohn 2012-12-21 14:52 ` Improve timer Resolution on imx28 Marek Vasut 2 siblings, 0 replies; 5+ messages in thread From: Torben Hohn @ 2012-12-21 14:06 UTC (permalink / raw) To: linux-arm-kernel Signed-off-by: Torben Hohn <torbenh@linutronix.de> --- arch/arm/mach-mxs/timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-mxs/timer.c b/arch/arm/mach-mxs/timer.c index 689a2b5..cf45e0a 100644 --- a/arch/arm/mach-mxs/timer.c +++ b/arch/arm/mach-mxs/timer.c @@ -219,7 +219,7 @@ static int __init mxs_clockevent_init(struct clk *timer_clk) mxs_clockevent_device.max_delta_ns = clockevent_delta2ns(0xfffffffe, &mxs_clockevent_device); mxs_clockevent_device.min_delta_ns = - clockevent_delta2ns(0xf, &mxs_clockevent_device); + clockevent_delta2ns(0x2, &mxs_clockevent_device); } clockevents_register_device(&mxs_clockevent_device); -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Improve timer Resolution on imx28 2012-12-21 14:06 Improve timer Resolution on imx28 Torben Hohn 2012-12-21 14:06 ` [PATCH 1/2] mxs timer: use ahbx bus clock to drive the timers on timrotv2 Torben Hohn 2012-12-21 14:06 ` [PATCH 2/2] mxs timer: decrease mxs_clockevent_device.min_delta_ns to 2 clock cycles Torben Hohn @ 2012-12-21 14:52 ` Marek Vasut 2 siblings, 0 replies; 5+ messages in thread From: Marek Vasut @ 2012-12-21 14:52 UTC (permalink / raw) To: linux-arm-kernel Dear Torben Hohn, > Hi, > > this Series increases the timer frequency and decreases min_delta_ns. > I saw pretty high max latencies with cyclictest: ~600us. > > The cause was the min_delta_ns value of 0xf 32kHz clockcycles. > But with the 32kHz Clock, the period is still around 30us. > So we just increase the clock freqeuncy driving the timers > here. Thanks for the set. Just a really quick question -- won't this under no circumstance cause interrupt storm? Best regards, Marek Vasut ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-12-25 14:10 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-12-21 14:06 Improve timer Resolution on imx28 Torben Hohn 2012-12-21 14:06 ` [PATCH 1/2] mxs timer: use ahbx bus clock to drive the timers on timrotv2 Torben Hohn 2012-12-25 14:10 ` Shawn Guo 2012-12-21 14:06 ` [PATCH 2/2] mxs timer: decrease mxs_clockevent_device.min_delta_ns to 2 clock cycles Torben Hohn 2012-12-21 14:52 ` Improve timer Resolution on imx28 Marek Vasut
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).