2016-09-23 21:21:48 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2016 Linaro Limited.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
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);
|