2016-09-23 21:21:48 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2016 Linaro Limited.
|
|
|
|
*
|
2017-01-19 09:01:01 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2016-09-23 21:21:48 +08:00
|
|
|
*/
|
|
|
|
|
2016-12-05 04:59:37 +08:00
|
|
|
#include <kernel.h>
|
2016-09-23 21:21:48 +08:00
|
|
|
#include <device.h>
|
|
|
|
#include <init.h>
|
|
|
|
#include <pinmux.h>
|
|
|
|
#include <sys_io.h>
|
|
|
|
#include "pinmux/pinmux.h"
|
|
|
|
|
|
|
|
#include "pinmux_stm32.h"
|
|
|
|
|
|
|
|
/* pin assignments for 96boards Carbon board */
|
|
|
|
static const struct pin_config pinconf[] = {
|
2016-11-14 18:59:45 +08:00
|
|
|
#ifdef CONFIG_UART_STM32_PORT_1
|
2016-09-23 21:21:48 +08:00
|
|
|
{STM32_PIN_PA9, STM32F4_PINMUX_FUNC_PA9_USART1_TX},
|
|
|
|
{STM32_PIN_PA10, STM32F4_PINMUX_FUNC_PA10_USART1_RX},
|
2016-11-14 18:59:45 +08:00
|
|
|
#endif /* CONFIG_UART_STM32_PORT_1 */
|
|
|
|
#ifdef CONFIG_UART_STM32_PORT_2
|
2016-09-23 21:21:48 +08:00
|
|
|
{STM32_PIN_PA2, STM32F4_PINMUX_FUNC_PA2_USART2_TX},
|
|
|
|
{STM32_PIN_PA3, STM32F4_PINMUX_FUNC_PA3_USART2_RX},
|
2016-11-14 18:59:45 +08:00
|
|
|
#endif /* CONFIG_UART_STM32_PORT_2 */
|
2016-09-23 21:21:48 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static int pinmux_stm32_init(struct device *port)
|
|
|
|
{
|
|
|
|
ARG_UNUSED(port);
|
|
|
|
|
|
|
|
stm32_setup_pins(pinconf, ARRAY_SIZE(pinconf));
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-11-09 03:06:55 +08:00
|
|
|
SYS_INIT(pinmux_stm32_init, PRE_KERNEL_1,
|
2016-09-23 21:21:48 +08:00
|
|
|
CONFIG_PINMUX_STM32_DEVICE_INITIALIZATION_PRIORITY);
|