summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2014-10-17 15:23:55 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-10-22 00:30:39 +0000
commitfbefbbca1ef380d41478d7616d5b5d4b0b25c4b6 (patch)
tree2176c247c0b5bbc08a444f5a92bcc650e0236716
parent89feca3eb34d1f6ef2e2a8227a0603c182afa348 (diff)
downloadchrome-ec-fbefbbca1ef380d41478d7616d5b5d4b0b25c4b6.tar.gz
stm32: Support UART DMA on UART2
This adds the DMA channel definition for UART2 and allows selection of DMA channel for UART. BRANCH=None BUG=chrome-os-partner:32660 TEST=With the CLs to enable the new Ryu boards, check the console is working. Change-Id: I964c284899777dda67c264e622aea6aba752ea76 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/224176 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--chip/stm32/registers.h2
-rw-r--r--chip/stm32/uart.c12
-rw-r--r--include/config.h4
3 files changed, 16 insertions, 2 deletions
diff --git a/chip/stm32/registers.h b/chip/stm32/registers.h
index c5ac5a9852..24109454f1 100644
--- a/chip/stm32/registers.h
+++ b/chip/stm32/registers.h
@@ -1209,6 +1209,8 @@ enum dma_channel {
STM32_DMAC_I2C2_RX = STM32_DMAC_CH5,
STM32_DMAC_USART1_TX = STM32_DMAC_CH4,
STM32_DMAC_USART1_RX = STM32_DMAC_CH5,
+ STM32_DMAC_USART2_RX = STM32_DMAC_CH6,
+ STM32_DMAC_USART2_TX = STM32_DMAC_CH7,
STM32_DMAC_I2C1_TX = STM32_DMAC_CH6,
STM32_DMAC_I2C1_RX = STM32_DMAC_CH7,
STM32_DMAC_PMSE_ROW = STM32_DMAC_CH6,
diff --git a/chip/stm32/uart.c b/chip/stm32/uart.c
index 67b405fe65..f98b9138ff 100644
--- a/chip/stm32/uart.c
+++ b/chip/stm32/uart.c
@@ -23,9 +23,13 @@
#ifdef CONFIG_UART_TX_DMA
#define UART_TX_INT_ENABLE STM32_USART_CR1_TCIE
+#ifndef CONFIG_UART_TX_DMA_CH
+#define CONFIG_UART_TX_DMA_CH STM32_DMAC_USART1_TX
+#endif
+
/* DMA channel options; assumes UART1 */
static const struct dma_option dma_tx_option = {
- STM32_DMAC_USART1_TX, (void *)&STM32_USART_TDR(UARTN_BASE),
+ CONFIG_UART_TX_DMA_CH, (void *)&STM32_USART_TDR(UARTN_BASE),
STM32_DMA_CCR_MSIZE_8_BIT | STM32_DMA_CCR_PSIZE_8_BIT
};
@@ -34,9 +38,13 @@ static const struct dma_option dma_tx_option = {
#endif
#ifdef CONFIG_UART_RX_DMA
+
+#ifndef CONFIG_UART_RX_DMA_CH
+#define CONFIG_UART_RX_DMA_CH STM32_DMAC_USART1_RX
+#endif
/* DMA channel options; assumes UART1 */
static const struct dma_option dma_rx_option = {
- STM32_DMAC_USART1_RX, (void *)&STM32_USART_RDR(UARTN_BASE),
+ CONFIG_UART_RX_DMA_CH, (void *)&STM32_USART_RDR(UARTN_BASE),
STM32_DMA_CCR_MSIZE_8_BIT | STM32_DMA_CCR_PSIZE_8_BIT |
STM32_DMA_CCR_CIRC
};
diff --git a/include/config.h b/include/config.h
index ba9efeb4c7..23f799f8a6 100644
--- a/include/config.h
+++ b/include/config.h
@@ -1023,6 +1023,10 @@
/* Use DMA for UART output */
#undef CONFIG_UART_TX_DMA
+/* The DMA channel for UART. If not defined, default to UART1. */
+#undef CONFIG_UART_TX_DMA_CH
+#undef CONFIG_UART_RX_DMA_CH
+
/*****************************************************************************/
/* USB PD config */