diff options
author | Scott <scollyer@chromium.org> | 2015-03-04 17:18:27 -0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-04-09 01:45:38 +0000 |
commit | d98b588c985a6fb537e0ebc7c7e201761f39cbaa (patch) | |
tree | 65ebe350fbe1e0f81209fabcdb9c5224b3e8fa82 /chip/stm32/usb_pd_phy.c | |
parent | bd1f20911fcdcd74fa504a53aabc891ff9eeb112 (diff) | |
download | chrome-ec-d98b588c985a6fb537e0ebc7c7e201761f39cbaa.tar.gz |
pd: Modify BIST mode according to ECR#PD2.0.1.0.004
- Changed TX BIST mode so that it transmits for 50 msec instead
of transmitting forever.
- Added console command to initiate TX BIST mode.
- Fixed an issue with circular DMA mode which was causing watchdog.
- Modified RX BIST to account for shorter TX BIST duration.
BUG=chrome-os-partner:36335
TEST=Manual on Samus to Samus, manual on Zinger to Samus
BRANCH=Samus
Signed-off-by: Scott Collyer <scollyer@chromium.org>
Change-Id: I666347de47c81b5b7a1e82c2b99345ff3ebbb7d4
Reviewed-on: https://chromium-review.googlesource.com/256194
Tested-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Scott Collyer <scollyer@chromium.org>
Trybot-Ready: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'chip/stm32/usb_pd_phy.c')
-rw-r--r-- | chip/stm32/usb_pd_phy.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/chip/stm32/usb_pd_phy.c b/chip/stm32/usb_pd_phy.c index 6e7e85991a..36d6228938 100644 --- a/chip/stm32/usb_pd_phy.c +++ b/chip/stm32/usb_pd_phy.c @@ -282,11 +282,6 @@ void pd_tx_spi_init(int port) | STM32_SPI_CR1_BIDIOE | STM32_SPI_CR1_CPHA; } -void pd_tx_set_circular_mode(int port) -{ - pd_phy[port].dma_tx_option.flags |= STM32_DMA_CCR_CIRC; -} - static void tx_dma_done(void *data) { int port = (int)data; @@ -340,8 +335,12 @@ int pd_start_tx(int port, int polarity, int bit_len) dma_clear_isr(DMAC_SPI_TX(port)); #if defined(CONFIG_COMMON_RUNTIME) && defined(CONFIG_DMA_DEFAULT_HANDLERS) tx_dma_polarities[port] = polarity; - dma_enable_tc_interrupt_callback(DMAC_SPI_TX(port), &tx_dma_done, - (void *)port); + if (!(pd_phy[port].dma_tx_option.flags & STM32_DMA_CCR_CIRC)) { + /* Only enable interrupt if not in circular mode */ + dma_enable_tc_interrupt_callback(DMAC_SPI_TX(port), + &tx_dma_done, + (void *)port); + } #endif dma_go(tx); @@ -379,6 +378,22 @@ void pd_tx_done(int port, int polarity) pd_tx_spi_reset(port); } +void pd_tx_set_circular_mode(int port) +{ + pd_phy[port].dma_tx_option.flags |= STM32_DMA_CCR_CIRC; +} + +void pd_tx_clear_circular_mode(int port) +{ + /* clear the circular mode bit in flag variable */ + pd_phy[port].dma_tx_option.flags &= ~STM32_DMA_CCR_CIRC; + /* disable dma transaction underway */ + dma_disable(DMAC_SPI_TX(port)); +#if defined(CONFIG_COMMON_RUNTIME) && defined(CONFIG_DMA_DEFAULT_HANDLERS) + tx_dma_done((void *)port); +#endif +} + /* --- RX operation using comparator linked to timer --- */ void pd_rx_start(int port) |