summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Chen <philipchen@google.com>2017-08-10 13:52:25 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-08-15 18:29:22 -0700
commitabd446b806d4f4367d4649db0a84df56a47ed0b5 (patch)
treef420cf09bb2880650020d0553c51e04ca57ac05f
parentf747f70816ca825a4ff4f9c6234f97e93611dbaa (diff)
downloadchrome-ec-abd446b806d4f4367d4649db0a84df56a47ed0b5.tar.gz
scarlet: Remap DMA channels for USART1
To enable console with DMA, we need to specifically remap DMA channels for USART1. ch2/3 and ch6/7 are already used by SPI1/2 modules. So we have to remap USART1_TX to ch4 and USART1_RX to ch5. BUG=b:64575809 BRANCH=none TEST=confirm ec console works on scarlet rev1 Change-Id: Ie2bb141c72252aee98e4cd4a284a01b4d57605f4 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/611147 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--board/scarlet/board.c10
-rw-r--r--board/scarlet/board.h1
-rw-r--r--chip/stm32/registers.h3
3 files changed, 13 insertions, 1 deletions
diff --git a/board/scarlet/board.c b/board/scarlet/board.c
index 0366778a9f..7ae9598490 100644
--- a/board/scarlet/board.c
+++ b/board/scarlet/board.c
@@ -297,6 +297,16 @@ static void board_init(void)
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
+void board_config_pre_init(void)
+{
+ STM32_RCC_AHBENR |= STM32_RCC_HB_DMA1;
+ /*
+ * Remap USART1 DMA:
+ * Ch4 : USART1_TX / Ch5 : USART1_RX
+ */
+ STM32_DMA_CSELR(STM32_DMAC_CH4) = (1 << 15) | (1 << 19);
+}
+
void board_hibernate(void)
{
int rv;
diff --git a/board/scarlet/board.h b/board/scarlet/board.h
index dafe40a5de..b8e3db549c 100644
--- a/board/scarlet/board.h
+++ b/board/scarlet/board.h
@@ -44,6 +44,7 @@
#define CONFIG_BUTTON_COUNT 2
#define CONFIG_BUTTON_RECOVERY
#define CONFIG_HOST_COMMAND_STATUS
+#define CONFIG_BOARD_PRE_INIT
/* By default, set hcdebug to off */
#undef CONFIG_HOSTCMD_DEBUG_MODE
#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
diff --git a/chip/stm32/registers.h b/chip/stm32/registers.h
index 3e1bf1df14..918afaf974 100644
--- a/chip/stm32/registers.h
+++ b/chip/stm32/registers.h
@@ -2144,7 +2144,8 @@ typedef volatile struct stm32_dma_regs stm32_dma_regs_t;
#else /* !CHIP_FAMILY_STM32F4 */
#define STM32_DMA_CCR_CHANNEL(channel) (0)
-#if defined(CHIP_FAMILY_STM32F3) || defined(CHIP_FAMILY_STM32L4)
+#if defined(CHIP_FAMILY_STM32F3) || defined(CHIP_FAMILY_STM32L4) || \
+ defined(CHIP_VARIANT_STM32F09X)
#define STM32_DMA2_REGS ((stm32_dma_regs_t *)STM32_DMA2_BASE)
#define STM32_DMA_REGS(channel) \
((channel) < STM32_DMAC_PER_CTLR ? STM32_DMA1_REGS : STM32_DMA2_REGS)