diff options
author | Shenwei Wang <shenwei.wang@nxp.com> | 2017-04-24 13:24:32 -0500 |
---|---|---|
committer | Leonard Crestez <leonard.crestez@nxp.com> | 2018-08-24 12:41:33 +0300 |
commit | 8e918daf523f6aa38a5b390eda36b3b17acbd351 (patch) | |
tree | df275a93039f28c617089112921fe70d183fc93b /drivers/clocksource | |
parent | c443fdcaf9e352a58347a914ad63a34815a4e488 (diff) |
MLK-14748 clocksource: imx-tpm: Increase the min_delta
The current min_delta for TPM clock event is 2 ticks which
is too small. As the TPM is running at 3MHz, 2 ticks equal
2/3 us. According to our testing, the interrupt latency will
be longer than this min_delta, especially when GPU is running.
This patch changed the min_delta to 300 which give the system
around 100us for interrupt handling in case the "set_next_event"
call is interrupted by other signals.
Also a simple validation code is added before the function returns.
Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
Signed-off-by: Bai Ping <ping.bai@nxp.com>
(cherry picked from commit 4f882165cc31672f3c98de74ab02b757cb96ad26)
Diffstat (limited to 'drivers/clocksource')
-rw-r--r-- | drivers/clocksource/timer-imx-tpm.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/clocksource/timer-imx-tpm.c b/drivers/clocksource/timer-imx-tpm.c index 608dca163ee9..f7d0d68f35b1 100644 --- a/drivers/clocksource/timer-imx-tpm.c +++ b/drivers/clocksource/timer-imx-tpm.c @@ -1,5 +1,6 @@ /* * Copyright 2016 Freescale Semiconductor, Inc. + * Copyright 2017 NXP * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -81,12 +82,15 @@ static int __init tpm_clocksource_init(unsigned long rate) static int tpm_set_next_event(unsigned long delta, struct clock_event_device *evt) { - unsigned long tmp; + unsigned long next, now, ret; - tmp = __raw_readl(timer_base + TPM_CNT) + delta; - __raw_writel(tmp, timer_base + TPM_C0V); + now = __raw_readl(timer_base + TPM_CNT); + next = now + delta; + __raw_writel(next, timer_base + TPM_C0V); + now = __raw_readl(timer_base + TPM_CNT); - return 0; + ret = next - now; + return (ret > delta) ? -ETIME : 0; } static int tpm_set_state_oneshot(struct clock_event_device *evt) @@ -140,7 +144,7 @@ static int __init tpm_clockevent_init(unsigned long rate, int irq) clockevent_tpm.cpumask = cpumask_of(0); clockevent_tpm.irq = irq; clockevents_config_and_register(&clockevent_tpm, - rate, 2, 0xfffffffe); + rate, 300, 0xfffffffe); return 0; } |