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>
This commit is contained in:
Philip Chen
2017-08-10 13:52:25 -07:00
committed by chrome-bot
parent f747f70816
commit abd446b806
3 changed files with 13 additions and 1 deletions

View File

@@ -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;

View File

@@ -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

View File

@@ -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)