diff options
author | Alec Berg <alecaberg@chromium.org> | 2015-01-07 12:40:24 -0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-01-09 05:40:18 +0000 |
commit | 49d2682b724aa49f53344dcc2768f8ac1af41dda (patch) | |
tree | 47979b64f10ebc20cb43c9c8b8fbeca6f260d683 /include | |
parent | a2720a0f68bbadfabdacfad3411175733c0c4098 (diff) | |
download | chrome-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')
-rw-r--r-- | include/config.h | 3 | ||||
-rw-r--r-- | include/dma.h | 16 | ||||
-rw-r--r-- | include/task.h | 4 |
3 files changed, 18 insertions, 5 deletions
diff --git a/include/config.h b/include/config.h index e1ae4750d4..2270277265 100644 --- a/include/config.h +++ b/include/config.h @@ -1174,9 +1174,6 @@ /* Use comparator module for PD RX interrupt */ #define CONFIG_USB_PD_RX_COMP_IRQ -/* USB PD transmit uses SPI master */ -#undef CONFIG_USB_PD_TX_USES_SPI_MASTER - /* Support for USB type-c superspeed mux */ #undef CONFIG_USBC_SS_MUX 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 diff --git a/include/task.h b/include/task.h index 1ec546fdb1..0c71e804ba 100644 --- a/include/task.h +++ b/include/task.h @@ -13,7 +13,9 @@ /* Task event bitmasks */ /* Tasks may use the bits in TASK_EVENT_CUSTOM for their own events */ -#define TASK_EVENT_CUSTOM(x) (x & 0x07ffffff) +#define TASK_EVENT_CUSTOM(x) (x & 0x03ffffff) +/* DMA transmit complete event */ +#define TASK_EVENT_DMA_TC (1 << 26) /* ADC interrupt handler event */ #define TASK_EVENT_ADC_DONE (1 << 27) /* I2C interrupt handler event */ |