summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@libc.org>2016-10-07 12:53:17 -0400
committerRich Felker <dalias@libc.org>2016-10-07 12:53:17 -0400
commit33ef6411fa30f3af2f1c3ffb6147f515ca5be128 (patch)
treec32880bd4f6f8d654b687ffbe0f3b036bea3ef92
parent7d3ada8ec216aa557cba07d58acea8f5c553eaa8 (diff)
downloadlinux-sh-33ef6411fa30f3af2f1c3ffb6147f515ca5be128.tar.gz
clocksource/jcore: workaround pit counter hw bugdevel-20161007
Signed-off-by: Rich Felker <dalias@libc.org>
-rw-r--r--drivers/clocksource/jcore-pit.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/clocksource/jcore-pit.c b/drivers/clocksource/jcore-pit.c
index 4c512d7d8d52..ed5a12c3da45 100644
--- a/drivers/clocksource/jcore-pit.c
+++ b/drivers/clocksource/jcore-pit.c
@@ -74,6 +74,8 @@ static int jcore_pit_set(unsigned long delta, struct jcore_pit *pit)
{
jcore_pit_disable(pit);
writel(delta, pit->base + REG_THROT);
+ while (readl(pit->base + REG_COUNT) > 100)
+ writel(0, pit->base + REG_PITEN);
writel(pit->enable_val, pit->base + REG_PITEN);
return 0;
}
@@ -110,7 +112,7 @@ static int jcore_pit_set_next_event(unsigned long delta,
static int jcore_pit_local_init(unsigned cpu)
{
struct jcore_pit *pit = this_cpu_ptr(jcore_pit_percpu);
- unsigned buspd, freq, min_delta;
+ unsigned buspd, freq;
pr_info("Local J-Core PIT init on cpu %u\n", pit->cpu);
@@ -118,16 +120,7 @@ static int jcore_pit_local_init(unsigned cpu)
freq = DIV_ROUND_CLOSEST(NSEC_PER_SEC, buspd);
pit->periodic_delta = DIV_ROUND_CLOSEST(NSEC_PER_SEC, HZ * buspd);
- /*
- * This is a workaround. When the timer system schedules oneshot
- * events so soon that the interrupt occurs before the softirq
- * part of the timer handler runs, a feedback loop ensues and
- * results in long stalls that are broken up only by other
- * interrupt activity.
- */
- min_delta = DIV_ROUND_CLOSEST(5000000, buspd);
-
- clockevents_config_and_register(&pit->ced, freq, min_delta, ULONG_MAX);
+ clockevents_config_and_register(&pit->ced, freq, 1, ULONG_MAX);
return 0;
}