* [GIT PULL] clocksource fixes for 4.19-rc
@ 2018-09-24 5:49 Daniel Lezcano
2018-09-24 5:50 ` [PATCH 1/2] clocksource/drivers/ti-32k: Add CLOCK_SOURCE_SUSPEND_NONSTOP flag for non-am43 SoCs Daniel Lezcano
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Lezcano @ 2018-09-24 5:49 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Linux Kernel Mailing List; +Cc: Tao Ren, Keerthy
Thomas, Ingo,
This pull request for clockevents / clocksource contains two fixes and
is based on tip/timers/urgent:
- Add the CLOCK_SOURCE_SUSPEND_NONSTOP for non-am43 SoCs (Keerthy)
- Fix set_next_event handler for the fttmr010 (Tao Ren)
Thanks !
-- Daniel
The following changes since commit e2c631ba75a7e727e8db0a9d30a06bfd434adb3a:
clocksource: Revert "Remove kthread" (2018-09-06 23:38:35 +0200)
are available in the git repository at:
https://git.linaro.org/people/daniel.lezcano/linux.git
clockevents/4.19-fixes
for you to fetch changes up to 4451d3f59f2a6f95e5d205c2d04ea072955d080d:
clocksource/drivers/fttmr010: Fix set_next_event handler (2018-09-24
06:13:31 +0200)
----------------------------------------------------------------
Keerthy (1):
clocksource/drivers/ti-32k: Add CLOCK_SOURCE_SUSPEND_NONSTOP flag
for non-am43 SoCs
Tao Ren (1):
clocksource/drivers/fttmr010: Fix set_next_event handler
drivers/clocksource/timer-fttmr010.c | 18 +++++++++++-------
drivers/clocksource/timer-ti-32k.c | 3 +++
2 files changed, 14 insertions(+), 7 deletions(-)
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] clocksource/drivers/ti-32k: Add CLOCK_SOURCE_SUSPEND_NONSTOP flag for non-am43 SoCs
2018-09-24 5:49 [GIT PULL] clocksource fixes for 4.19-rc Daniel Lezcano
@ 2018-09-24 5:50 ` Daniel Lezcano
2018-09-24 5:50 ` [PATCH 2/2] clocksource/drivers/fttmr010: Fix set_next_event handler Daniel Lezcano
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Lezcano @ 2018-09-24 5:50 UTC (permalink / raw)
To: tglx
Cc: mingo, Keerthy, Tony Lindgren, open list:CLOCKSOURCE, CLOCKEVENT DRIVERS
From: Keerthy <j-keerthy@ti.com>
The 32k clocksource is NONSTOP for non-am43 SoCs. Hence
add the flag for all the other SoCs.
Reported-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Keerthy <j-keerthy@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
drivers/clocksource/timer-ti-32k.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/clocksource/timer-ti-32k.c b/drivers/clocksource/timer-ti-32k.c
index 29e2e1a..6949a91 100644
--- a/drivers/clocksource/timer-ti-32k.c
+++ b/drivers/clocksource/timer-ti-32k.c
@@ -97,6 +97,9 @@ static int __init ti_32k_timer_init(struct device_node *np)
return -ENXIO;
}
+ if (!of_machine_is_compatible("ti,am43"))
+ ti_32k_timer.cs.flags |= CLOCK_SOURCE_SUSPEND_NONSTOP;
+
ti_32k_timer.counter = ti_32k_timer.base;
/*
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] clocksource/drivers/fttmr010: Fix set_next_event handler
2018-09-24 5:50 ` [PATCH 1/2] clocksource/drivers/ti-32k: Add CLOCK_SOURCE_SUSPEND_NONSTOP flag for non-am43 SoCs Daniel Lezcano
@ 2018-09-24 5:50 ` Daniel Lezcano
0 siblings, 0 replies; 3+ messages in thread
From: Daniel Lezcano @ 2018-09-24 5:50 UTC (permalink / raw)
To: tglx; +Cc: mingo, Tao Ren, Lei YU, open list:CLOCKSOURCE, CLOCKEVENT DRIVERS
From: Tao Ren <taoren@fb.com>
Currently, the aspeed MATCH1 register is updated to <current_count -
cycles> in set_next_event handler, with the assumption that COUNT
register value is preserved when the timer is disabled and it continues
decrementing after the timer is enabled. But the assumption is wrong:
RELOAD register is loaded into COUNT register when the aspeed timer is
enabled, which means the next event may be delayed because timer
interrupt won't be generated until <0xFFFFFFFF - current_count +
cycles>.
The problem can be fixed by updating RELOAD register to <cycles>, and
COUNT register will be re-loaded when the timer is enabled and interrupt
is generated when COUNT register overflows.
The test result on Facebook Backpack-CMM BMC hardware (AST2500) shows
the issue is fixed: without the patch, usleep(100) suspends the process
for several milliseconds (and sometimes even over 40 milliseconds);
after applying the fix, usleep(100) takes averagely 240 microseconds to
return under the same workload level.
Signed-off-by: Tao Ren <taoren@fb.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Lei YU <mine260309@gmail.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
drivers/clocksource/timer-fttmr010.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/drivers/clocksource/timer-fttmr010.c b/drivers/clocksource/timer-fttmr010.c
index c020038..cf93f64 100644
--- a/drivers/clocksource/timer-fttmr010.c
+++ b/drivers/clocksource/timer-fttmr010.c
@@ -130,13 +130,17 @@ static int fttmr010_timer_set_next_event(unsigned long cycles,
cr &= ~fttmr010->t1_enable_val;
writel(cr, fttmr010->base + TIMER_CR);
- /* Setup the match register forward/backward in time */
- cr = readl(fttmr010->base + TIMER1_COUNT);
- if (fttmr010->count_down)
- cr -= cycles;
- else
- cr += cycles;
- writel(cr, fttmr010->base + TIMER1_MATCH1);
+ if (fttmr010->count_down) {
+ /*
+ * ASPEED Timer Controller will load TIMER1_LOAD register
+ * into TIMER1_COUNT register when the timer is re-enabled.
+ */
+ writel(cycles, fttmr010->base + TIMER1_LOAD);
+ } else {
+ /* Setup the match register forward in time */
+ cr = readl(fttmr010->base + TIMER1_COUNT);
+ writel(cr + cycles, fttmr010->base + TIMER1_MATCH1);
+ }
/* Start */
cr = readl(fttmr010->base + TIMER_CR);
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-09-24 5:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-24 5:49 [GIT PULL] clocksource fixes for 4.19-rc Daniel Lezcano
2018-09-24 5:50 ` [PATCH 1/2] clocksource/drivers/ti-32k: Add CLOCK_SOURCE_SUSPEND_NONSTOP flag for non-am43 SoCs Daniel Lezcano
2018-09-24 5:50 ` [PATCH 2/2] clocksource/drivers/fttmr010: Fix set_next_event handler Daniel Lezcano
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).