summaryrefslogtreecommitdiff
path: root/include/dma.h
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2015-01-07 12:40:24 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-01-09 05:40:18 +0000
commit49d2682b724aa49f53344dcc2768f8ac1af41dda (patch)
tree47979b64f10ebc20cb43c9c8b8fbeca6f260d683 /include/dma.h
parenta2720a0f68bbadfabdacfad3411175733c0c4098 (diff)
downloadchrome-ec-49d2682b724aa49f53344dcc2768f8ac1af41dda.tar.gz
samus: pd: fix potential junk at end of tx transmissionstabilize-6670.B
Fix potential junk at end of PD TX transmit by adding to the DMA transmit complete interrupt a blocking wait for SPI to finish and then immediately disable SPI clock. This means we block in an interrupt function for approximately 45us at the end of every transmit. But, this is the highest priority thing going on anyway. Note, there is still a potential for junk if both ports are transmitting at the same time and finish very close to the same time. BUG=chrome-os-partner:34600 BRANCH=samus TEST=load onto samus and test communications with zinger. tested specifically with an old zinger CL, https://chromium-review.googlesource.com/#/c/226118/11, which watchdogs when samus has junk at end of transmit. Tested without this CL and verified we could never successfully flash zinger over PD due to this watchdog and verified on scope presence of junk. Then tested with this change and was able to successfully flash zinger using ectool on both ports in both polarities. Change-Id: If0cd9ab0551d36a7d7dc10232b6476dd56735972 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/239244 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'include/dma.h')
-rw-r--r--include/dma.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/include/dma.h b/include/dma.h
index 5e5553a794..3ecef70361 100644
--- a/include/dma.h
+++ b/include/dma.h
@@ -118,13 +118,27 @@ void dma_test(void);
void dma_clear_isr(enum dma_channel channel);
/**
- * Enable "Transfer Complete" interrupt for a DMA channel
+ * Enable "Transfer Complete" interrupt for a DMA channel.
+ * Will Wake up calling task when complete.
*
* @param channel Which channel's interrupts to change
*/
void dma_enable_tc_interrupt(enum dma_channel channel);
/**
+ * Enable "Transfer Complete" interrupt for a DMA channel with callback
+ * NOTE: The callback is run at highest interrupt priority so should be
+ * fast and not depend on get_time().
+ *
+ * @param channel Which channel's interrupts to change
+ * @param callback Pointer to callback function to call on interrupt
+ * @param callback_data Data to pass through to callback function
+ */
+void dma_enable_tc_interrupt_callback(enum dma_channel channel,
+ void (*callback)(void *),
+ void *callback_data);
+
+/**
* Disable "Transfer Complete" interrupt for a DMA channel
*
* @param channel Which channel's interrupts to change