summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2015-06-12 15:16:27 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-06-13 02:53:24 +0000
commite22b900c6e3f477871a4b0535e23716e69e0d35a (patch)
tree244165f001a50cdfa68007297d35facc47d9ea4c
parent31171730a82ff379389f46147e8194e92a6f5369 (diff)
downloadchrome-ec-e22b900c6e3f477871a4b0535e23716e69e0d35a.tar.gz
tcpc: change pd_tx_done() to only wait for DMA done event
Change pd_tx_done() to wait specifically for the DMA complete event using task_wait_event_mask(). This fixes a potential bug where if we get another event, for example a TCPM event, while waiting for transmit to complete we restore the pending event after we are done. BUG=none BRANCH=smaug TEST=run on glados and make a bunch of contracts with zinger. Change-Id: Ie28d97eba3edcc7a98fe842e8b7eb6b9d7707047 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/277297 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--chip/stm32/usb_pd_phy.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/chip/stm32/usb_pd_phy.c b/chip/stm32/usb_pd_phy.c
index 18f8da9938..eeb9b61e34 100644
--- a/chip/stm32/usb_pd_phy.c
+++ b/chip/stm32/usb_pd_phy.c
@@ -366,12 +366,8 @@ int pd_start_tx(int port, int polarity, int bit_len)
void pd_tx_done(int port, int polarity)
{
#if defined(CONFIG_COMMON_RUNTIME) && defined(CONFIG_DMA_DEFAULT_HANDLERS)
- int rv;
-
/* wait for DMA, DMA interrupt will stop the SPI clock */
- do {
- rv = task_wait_event(DMA_TRANSFER_TIMEOUT_US);
- } while (!(rv & (TASK_EVENT_TIMER | TASK_EVENT_DMA_TC)));
+ task_wait_event_mask(TASK_EVENT_DMA_TC, DMA_TRANSFER_TIMEOUT_US);
dma_disable_tc_interrupt(DMAC_SPI_TX(port));
#else
tx_dma_polarities[port] = polarity;