summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2014-08-21 08:32:37 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-08-22 00:52:43 +0000
commit3e844ec271fa69e2153408cf17aabfacf9723db1 (patch)
treedb3bc3667a3a7560f489ba674e989a73573cb0b2
parent7b1a0dc7959e83d202fefb1a4c3079ec2edd35e5 (diff)
downloadchrome-ec-3e844ec271fa69e2153408cf17aabfacf9723db1.tar.gz
zinger: keyborg: fix runtime bug with task_wait_event()
Fix zinger and keyborg to use correct event mask when timing out from task_wait_event(): TASK_EVENT_TIMER. On zinger, move storing the last event to after enabling interrupts. This gives an opportunity to interrupt handler to set the wake event. BUG=chrome-os-partner:30135 BRANCH=none TEST=load on zinger, and test PD communication with samus. notably tested sending rw_hash vdm from samus, which is known to cause zinger to retry the following ping transmit. The retry on the ping transmit uses task_wait_event(), and without this fix we were getting false wake events that had been stored up from the last rx received event. with this fix, the retry mechanism works. Change-Id: I9a6902ceaab49a00d3660f9813ca7761cf38f190 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/213560 Reviewed-by: Todd Broch <tbroch@chromium.org>
-rw-r--r--board/keyborg/runtime.c2
-rw-r--r--board/zinger/runtime.c8
2 files changed, 6 insertions, 4 deletions
diff --git a/board/keyborg/runtime.c b/board/keyborg/runtime.c
index e3a8021ef1..e86d591172 100644
--- a/board/keyborg/runtime.c
+++ b/board/keyborg/runtime.c
@@ -68,7 +68,7 @@ void tim2_interrupt(void)
if (STM32_TIM_CNT(3) == last_deadline >> 16) {
STM32_TIM_DIER(2) = 0;
task_clear_pending_irq(STM32_IRQ_TIM2);
- last_event = 1 << 29 /* task event wake */;
+ last_event = TASK_EVENT_TIMER;
need_wfi = 0;
} else {
need_wfi = 1;
diff --git a/board/zinger/runtime.c b/board/zinger/runtime.c
index 775afdccec..deaa87d6ab 100644
--- a/board/zinger/runtime.c
+++ b/board/zinger/runtime.c
@@ -56,7 +56,7 @@ void tim2_interrupt(void)
{
STM32_TIM_DIER(2) = 0; /* disable match interrupt */
task_clear_pending_irq(STM32_IRQ_TIM2);
- last_event = 1 << 29 /* task event wake */;
+ last_event = TASK_EVENT_TIMER;
}
DECLARE_IRQ(STM32_IRQ_TIM2, tim2_interrupt, 1);
@@ -85,10 +85,12 @@ uint32_t task_wait_event(int timeout_us)
asm volatile("wfi");
STM32_TIM_DIER(2) = 0; /* disable match interrupt */
- evt = last_event;
- last_event = 0;
asm volatile("cpsie i ; isb");
+ /* note: interrupt that woke us up will run here */
+
+ evt = last_event;
+ last_event = 0;
return evt;
}