| 
 | 1 | +/*  | 
 | 2 | + * Copyright (c) 2016 Open-RnD Sp. z o.o.  | 
 | 3 | + * Copyright (c) 2016 BayLibre, SAS  | 
 | 4 | + *  | 
 | 5 | + * SPDX-License-Identifier: Apache-2.0  | 
 | 6 | + */  | 
 | 7 | + | 
 | 8 | +#include <kernel.h>  | 
 | 9 | +#include <device.h>  | 
 | 10 | +#include <init.h>  | 
 | 11 | +#include <pinmux.h>  | 
 | 12 | +#include <sys_io.h>  | 
 | 13 | +#include "pinmux/pinmux.h"  | 
 | 14 | + | 
 | 15 | +#include "pinmux_stm32.h"  | 
 | 16 | + | 
 | 17 | +/* pin assignments for NUCLEO-L432KC board */  | 
 | 18 | +static const struct pin_config pinconf[] = {  | 
 | 19 | +#ifdef CONFIG_UART_STM32_PORT_1  | 
 | 20 | +	{STM32_PIN_PA9,  STM32L4X_PINMUX_FUNC_PA9_USART1_TX},  | 
 | 21 | +	{STM32_PIN_PA10, STM32L4X_PINMUX_FUNC_PA10_USART1_RX},  | 
 | 22 | +#endif	/* CONFIG_UART_STM32_PORT_1 */  | 
 | 23 | +#ifdef CONFIG_UART_STM32_PORT_2  | 
 | 24 | +	{STM32_PIN_PA2, STM32L4X_PINMUX_FUNC_PA2_USART2_TX},  | 
 | 25 | +	{STM32_PIN_PA3, STM32L4X_PINMUX_FUNC_PA3_USART2_RX},  | 
 | 26 | +#endif	/* CONFIG_UART_STM32_PORT_2 */  | 
 | 27 | +#ifdef CONFIG_I2C_1  | 
 | 28 | +	{STM32_PIN_PB6, STM32L4X_PINMUX_FUNC_PB6_I2C1_SCL},  | 
 | 29 | +	{STM32_PIN_PB7, STM32L4X_PINMUX_FUNC_PB7_I2C1_SDA},  | 
 | 30 | +#endif /* CONFIG_I2C_1 */  | 
 | 31 | +#ifdef CONFIG_PWM_STM32_2  | 
 | 32 | +	{STM32_PIN_PA0, STM32L4X_PINMUX_FUNC_PA0_PWM2_CH1},  | 
 | 33 | +#endif /* CONFIG_PWM_STM32_2 */  | 
 | 34 | +};  | 
 | 35 | + | 
 | 36 | +static int pinmux_stm32_init(struct device *port)  | 
 | 37 | +{  | 
 | 38 | +	ARG_UNUSED(port);  | 
 | 39 | + | 
 | 40 | +	stm32_setup_pins(pinconf, ARRAY_SIZE(pinconf));  | 
 | 41 | + | 
 | 42 | +	return 0;  | 
 | 43 | +}  | 
 | 44 | + | 
 | 45 | +SYS_INIT(pinmux_stm32_init, PRE_KERNEL_1,  | 
 | 46 | +	 CONFIG_PINMUX_STM32_DEVICE_INITIALIZATION_PRIORITY);  | 
0 commit comments