[Sound-open-firmware] [PATCH 1/2] xtensa: arch: fix 64bit timer.

Liam Girdwood liam.r.girdwood at linux.intel.com
Fri Mar 23 15:22:05 CET 2018


Timer would miss overflow condition, now logic same as BYT 64 bit timer.

Signed-off-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>
---
 src/arch/xtensa/timer.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/arch/xtensa/timer.c b/src/arch/xtensa/timer.c
index ee01d083..1da503fd 100644
--- a/src/arch/xtensa/timer.c
+++ b/src/arch/xtensa/timer.c
@@ -80,7 +80,7 @@ void timer_64_handler(void *arg)
 	}
 
 	/* get next timeout value */
-	if (timer->hitimeout > 0 && timer->hitimeout == timer->hitime) {
+	if (timer->hitimeout == timer->hitime) {
 		/* timeout is in this 32 bit period */
 		ccompare = timer->lowtimeout;
 	} else {
@@ -185,17 +185,13 @@ int arch_timer_set(struct timer *timer, uint64_t ticks)
 	flags = arch_interrupt_global_disable();
 
 	/* same hi 64 bit context as ticks ? */
-	if (hitimeout == timer->hitime) {
-		/* yes, then set the value for next timeout */
-		time = ticks;
-		timer->lowtimeout = 0;
-		timer->hitimeout = 0;
-	} else if (hitimeout < timer->hitime) {
+	if (hitimeout < timer->hitime) {
 		/* cant be in the past */
 		arch_interrupt_global_enable(flags);
 		return -EINVAL;
 	} else {
 		/* set for checking at next timeout */
+		time = ticks;
 		timer->hitimeout = hitimeout;
 		timer->lowtimeout = ticks;
 	}
-- 
2.14.1



More information about the Sound-open-firmware mailing list