diff --git a/arch/arm/soc/st_stm32/stm32f4/soc_pinmux.c b/arch/arm/soc/st_stm32/stm32f4/soc_pinmux.c index a17aba57287..5731526eb1d 100644 --- a/arch/arm/soc/st_stm32/stm32f4/soc_pinmux.c +++ b/arch/arm/soc/st_stm32/stm32f4/soc_pinmux.c @@ -27,6 +27,14 @@ #define PINMUX_PWM2(pin, chan) #define PINMUX_UART1(pin, dir) #define PINMUX_UART2(pin, dir) +#define PINMUX_UART3(pin, dir) +#define PINMUX_UART4(pin, dir) +#define PINMUX_UART5(pin, dir) +#define PINMUX_UART6(pin, dir) +#define PINMUX_UART7(pin, dir) +#define PINMUX_UART8(pin, dir) +#define PINMUX_UART9(pin, dir) +#define PINMUX_UART10(pin, dir) #ifdef CONFIG_PWM_STM32_2 #undef PINMUX_PWM2 @@ -43,11 +51,57 @@ #define PINMUX_UART2(pin, dir) _PINMUX_UART(pin, USART2, dir) #endif +#ifdef CONFIG_UART_STM32_PORT_3 + #undef PINMUX_UART3 + #define PINMUX_UART3(pin, dir) _PINMUX_UART(pin, USART3, dir) +#endif + +#ifdef CONFIG_UART_STM32_PORT_4 + #undef PINMUX_UART4 + #define PINMUX_UART4(pin, dir) _PINMUX_UART(pin, UART4, dir) +#endif + +#ifdef CONFIG_UART_STM32_PORT_5 + #undef PINMUX_UART5 + #define PINMUX_UART5(pin, dir) _PINMUX_UART(pin, UART5, dir) +#endif + +#ifdef CONFIG_UART_STM32_PORT_6 + #undef PINMUX_UART6 + #define PINMUX_UART6(pin, dir) _PINMUX_UART(pin, USART6, dir) +#endif + +#ifdef CONFIG_UART_STM32_PORT_7 + #undef PINMUX_UART7 + #define PINMUX_UART7(pin, dir) _PINMUX_UART(pin, UART7, dir) +#endif + +#ifdef CONFIG_UART_STM32_PORT_8 + #undef PINMUX_UART8 + #define PINMUX_UART8(pin, dir) _PINMUX_UART(pin, UART8, dir) +#endif + +#ifdef CONFIG_UART_STM32_PORT_9 + #undef PINMUX_UART9 + #define PINMUX_UART9(pin, dir) _PINMUX_UART(pin, UART9, dir) +#endif + +#ifdef CONFIG_UART_STM32_PORT_10 + #undef PINMUX_UART10 + #define PINMUX_UART10(pin, dir) _PINMUX_UART(pin, UART10, dir) +#endif + #define PINMUX_PWM(pin, pwm, chan) PINMUX_##pwm(pin, chan) #define PINMUX_UART(pin, port, dir) PINMUX_##port(pin, dir) +/* Port A */ static const stm32_pin_func_t pin_pa0_funcs[] = { PINMUX_PWM(PA0, PWM2, 1) + PINMUX_UART(PA0, UART4, TX) +}; + +static const stm32_pin_func_t pin_pa1_funcs[] = { + PINMUX_UART(PA1, UART4, RX) }; static const stm32_pin_func_t pin_pa2_funcs[] = { @@ -58,6 +112,10 @@ static const stm32_pin_func_t pin_pa3_funcs[] = { PINMUX_UART(PA3, UART2, RX) }; +static const stm32_pin_func_t pin_pa8_funcs[] = { + PINMUX_UART(PA8, UART7, RX) +}; + static const stm32_pin_func_t pin_pa9_funcs[] = { PINMUX_UART(PA9, UART1, TX) }; @@ -66,25 +124,267 @@ static const stm32_pin_func_t pin_pa10_funcs[] = { PINMUX_UART(PA10, UART1, RX) }; +static const stm32_pin_func_t pin_pa11_funcs[] = { + PINMUX_UART(PA11, UART6, TX) + PINMUX_UART(PA11, UART4, RX) +}; + +static const stm32_pin_func_t pin_pa12_funcs[] = { + PINMUX_UART(PA12, UART6, RX) + PINMUX_UART(PA12, UART4, TX) +}; + +static const stm32_pin_func_t pin_pa15_funcs[] = { + PINMUX_UART(PA15, UART1, TX) + PINMUX_UART(PA15, UART7, TX) +}; + +/* Port B */ +static const stm32_pin_func_t pin_pb3_funcs[] = { + PINMUX_UART(PB3, UART1, RX) + PINMUX_UART(PB3, UART7, RX) +}; + +static const stm32_pin_func_t pin_pb4_funcs[] = { + PINMUX_UART(PB4, UART7, TX) +}; + +static const stm32_pin_func_t pin_pb5_funcs[] = { + PINMUX_UART(PB5, UART5, RX) +}; + static const stm32_pin_func_t pin_pb6_funcs[] = { PINMUX_UART(PB6, UART1, TX) + PINMUX_UART(PB6, UART5, TX) }; static const stm32_pin_func_t pin_pb7_funcs[] = { PINMUX_UART(PB7, UART1, RX) }; +static const stm32_pin_func_t pin_pb8_funcs[] = { + PINMUX_UART(PB8, UART5, RX) +}; + +static const stm32_pin_func_t pin_pb9_funcs[] = { + PINMUX_UART(PB9, UART5, TX) +}; + +static const stm32_pin_func_t pin_pb10_funcs[] = { + PINMUX_UART(PB10, UART3, TX) +}; + +static const stm32_pin_func_t pin_pb11_funcs[] = { + PINMUX_UART(PB11, UART3, RX) +}; + +static const stm32_pin_func_t pin_pb12_funcs[] = { + PINMUX_UART(PB12, UART5, RX) +}; + +static const stm32_pin_func_t pin_pb13_funcs[] = { + PINMUX_UART(PB13, UART5, TX) +}; + +/* Port C */ +static const stm32_pin_func_t pin_pc5_funcs[] = { + PINMUX_UART(PC5, UART3, RX) +}; + +static const stm32_pin_func_t pin_pc6_funcs[] = { + PINMUX_UART(PC6, UART6, TX) +}; + +static const stm32_pin_func_t pin_pc7_funcs[] = { + PINMUX_UART(PC7, UART6, RX) +}; + +static const stm32_pin_func_t pin_pc10_funcs[] = { + PINMUX_UART(PC10, UART3, TX) +}; + +static const stm32_pin_func_t pin_pc11_funcs[] = { + PINMUX_UART(PC11, UART3, RX) + PINMUX_UART(PC11, UART4, RX) +}; + +static const stm32_pin_func_t pin_pc12_funcs[] = { + PINMUX_UART(PC12, UART5, TX) +}; + +/* Port D */ +static const stm32_pin_func_t pin_pd0_funcs[] = { + PINMUX_UART(PD0, UART4, RX) +}; + +static const stm32_pin_func_t pin_pd2_funcs[] = { + PINMUX_UART(PD2, UART5, RX) +}; + +static const stm32_pin_func_t pin_pd5_funcs[] = { + PINMUX_UART(PD5, UART2, TX) +}; + +static const stm32_pin_func_t pin_pd6_funcs[] = { + PINMUX_UART(PD6, UART2, RX) +}; + +static const stm32_pin_func_t pin_pd8_funcs[] = { + PINMUX_UART(PD8, UART3, TX) +}; + +static const stm32_pin_func_t pin_pd9_funcs[] = { + PINMUX_UART(PD9, UART3, RX) +}; + +static const stm32_pin_func_t pin_pd10_funcs[] = { + PINMUX_UART(PD10, UART4, TX) +}; + +static const stm32_pin_func_t pin_pd14_funcs[] = { + PINMUX_UART(PD14, UART9, RX) +}; + +static const stm32_pin_func_t pin_pd15_funcs[] = { + PINMUX_UART(PD15, UART9, TX) +}; + +/* Port E */ +static const stm32_pin_func_t pin_pe0_funcs[] = { + PINMUX_UART(PE0, UART8, RX) +}; + +static const stm32_pin_func_t pin_pe1_funcs[] = { + PINMUX_UART(PE1, UART8, TX) +}; + +static const stm32_pin_func_t pin_pe2_funcs[] = { + PINMUX_UART(PE2, UART10, RX) +}; + +static const stm32_pin_func_t pin_pe3_funcs[] = { + PINMUX_UART(PE3, UART10, TX) +}; + +static const stm32_pin_func_t pin_pe7_funcs[] = { + PINMUX_UART(PE7, UART7, RX) +}; + +static const stm32_pin_func_t pin_pe8_funcs[] = { + PINMUX_UART(PE8, UART7, TX) +}; + +/* Port F */ +static const stm32_pin_func_t pin_pf6_funcs[] = { + PINMUX_UART(PF6, UART7, RX) +}; + +static const stm32_pin_func_t pin_pf7_funcs[] = { + PINMUX_UART(PF7, UART7, TX) +}; + +static const stm32_pin_func_t pin_pf8_funcs[] = { + PINMUX_UART(PF8, UART8, RX) +}; + +static const stm32_pin_func_t pin_pf9_funcs[] = { + PINMUX_UART(PF9, UART8, TX) +}; + +/* Port G */ +static const stm32_pin_func_t pin_pg0_funcs[] = { + PINMUX_UART(PG0, UART9, RX) +}; + +static const stm32_pin_func_t pin_pg1_funcs[] = { + PINMUX_UART(PG1, UART9, TX) +}; + +static const stm32_pin_func_t pin_pg9_funcs[] = { + PINMUX_UART(PG9, UART6, RX) +}; + +static const stm32_pin_func_t pin_pg11_funcs[] = { + PINMUX_UART(PG11, UART10, RX) +}; + +static const stm32_pin_func_t pin_pg12_funcs[] = { + PINMUX_UART(PG12, UART10, TX) +}; + +static const stm32_pin_func_t pin_pg14_funcs[] = { + PINMUX_UART(PG14, UART6, TX) +}; + /** * @brief pin configuration */ static const struct stm32_pinmux_conf pins[] = { + /* Port A */ STM32_PIN_CONF(STM32_PIN_PA0, pin_pa0_funcs), + STM32_PIN_CONF(STM32_PIN_PA1, pin_pa1_funcs), STM32_PIN_CONF(STM32_PIN_PA2, pin_pa2_funcs), STM32_PIN_CONF(STM32_PIN_PA3, pin_pa3_funcs), + STM32_PIN_CONF(STM32_PIN_PA8, pin_pa8_funcs), STM32_PIN_CONF(STM32_PIN_PA9, pin_pa9_funcs), STM32_PIN_CONF(STM32_PIN_PA10, pin_pa10_funcs), + STM32_PIN_CONF(STM32_PIN_PA11, pin_pa11_funcs), + STM32_PIN_CONF(STM32_PIN_PA12, pin_pa12_funcs), + STM32_PIN_CONF(STM32_PIN_PA15, pin_pa15_funcs), + + /* Port B */ + STM32_PIN_CONF(STM32_PIN_PB3, pin_pb3_funcs), + STM32_PIN_CONF(STM32_PIN_PB4, pin_pb4_funcs), + STM32_PIN_CONF(STM32_PIN_PB5, pin_pb5_funcs), STM32_PIN_CONF(STM32_PIN_PB6, pin_pb6_funcs), STM32_PIN_CONF(STM32_PIN_PB7, pin_pb7_funcs), + STM32_PIN_CONF(STM32_PIN_PB8, pin_pb8_funcs), + STM32_PIN_CONF(STM32_PIN_PB9, pin_pb9_funcs), + STM32_PIN_CONF(STM32_PIN_PB10, pin_pb10_funcs), + STM32_PIN_CONF(STM32_PIN_PB11, pin_pb11_funcs), + STM32_PIN_CONF(STM32_PIN_PB12, pin_pb12_funcs), + STM32_PIN_CONF(STM32_PIN_PB13, pin_pb13_funcs), + + /* Port C */ + STM32_PIN_CONF(STM32_PIN_PC5, pin_pc5_funcs), + STM32_PIN_CONF(STM32_PIN_PC6, pin_pc6_funcs), + STM32_PIN_CONF(STM32_PIN_PC7, pin_pc7_funcs), + STM32_PIN_CONF(STM32_PIN_PC10, pin_pc10_funcs), + STM32_PIN_CONF(STM32_PIN_PC11, pin_pc11_funcs), + STM32_PIN_CONF(STM32_PIN_PC12, pin_pc12_funcs), + + /* Port D */ + STM32_PIN_CONF(STM32_PIN_PD0, pin_pd0_funcs), + STM32_PIN_CONF(STM32_PIN_PD2, pin_pd2_funcs), + STM32_PIN_CONF(STM32_PIN_PD5, pin_pd5_funcs), + STM32_PIN_CONF(STM32_PIN_PD6, pin_pd6_funcs), + STM32_PIN_CONF(STM32_PIN_PD8, pin_pd8_funcs), + STM32_PIN_CONF(STM32_PIN_PD9, pin_pd9_funcs), + STM32_PIN_CONF(STM32_PIN_PD10, pin_pd10_funcs), + STM32_PIN_CONF(STM32_PIN_PD14, pin_pd14_funcs), + STM32_PIN_CONF(STM32_PIN_PD15, pin_pd15_funcs), + + /* Port E */ + STM32_PIN_CONF(STM32_PIN_PE0, pin_pe0_funcs), + STM32_PIN_CONF(STM32_PIN_PE1, pin_pe1_funcs), + STM32_PIN_CONF(STM32_PIN_PE2, pin_pe2_funcs), + STM32_PIN_CONF(STM32_PIN_PE3, pin_pe3_funcs), + STM32_PIN_CONF(STM32_PIN_PE7, pin_pe7_funcs), + STM32_PIN_CONF(STM32_PIN_PE8, pin_pe8_funcs), + + /* Port F */ + STM32_PIN_CONF(STM32_PIN_PF6, pin_pf6_funcs), + STM32_PIN_CONF(STM32_PIN_PF7, pin_pf7_funcs), + STM32_PIN_CONF(STM32_PIN_PF8, pin_pf8_funcs), + STM32_PIN_CONF(STM32_PIN_PF9, pin_pf9_funcs), + + /* Port G */ + STM32_PIN_CONF(STM32_PIN_PG0, pin_pg0_funcs), + STM32_PIN_CONF(STM32_PIN_PG1, pin_pg1_funcs), + STM32_PIN_CONF(STM32_PIN_PG9, pin_pg9_funcs), + STM32_PIN_CONF(STM32_PIN_PG11, pin_pg11_funcs), + STM32_PIN_CONF(STM32_PIN_PG12, pin_pg12_funcs), + STM32_PIN_CONF(STM32_PIN_PG14, pin_pg14_funcs), }; int stm32_get_pin_config(int pin, int func) diff --git a/drivers/pinmux/stm32/pinmux_stm32f4.h b/drivers/pinmux/stm32/pinmux_stm32f4.h index 436c8656710..818b32aaedc 100644 --- a/drivers/pinmux/stm32/pinmux_stm32f4.h +++ b/drivers/pinmux/stm32/pinmux_stm32f4.h @@ -11,15 +11,122 @@ * @file Header for STM32F4 pin multiplexing helper */ +/* Port A */ #define STM32F4_PINMUX_FUNC_PA0_PWM2_CH1 STM32_PINMUX_FUNC_ALT_1 +#define STM32F4_PINMUX_FUNC_PA0_UART4_TX STM32_PINMUX_FUNC_ALT_8 + +#define STM32F4_PINMUX_FUNC_PA1_UART4_RX STM32_PINMUX_FUNC_ALT_8 #define STM32F4_PINMUX_FUNC_PA2_USART2_TX STM32_PINMUX_FUNC_ALT_7 + #define STM32F4_PINMUX_FUNC_PA3_USART2_RX STM32_PINMUX_FUNC_ALT_7 +#define STM32F4_PINMUX_FUNC_PA8_UART7_RX STM32_PINMUX_FUNC_ALT_8 + #define STM32F4_PINMUX_FUNC_PA9_USART1_TX STM32_PINMUX_FUNC_ALT_7 + #define STM32F4_PINMUX_FUNC_PA10_USART1_RX STM32_PINMUX_FUNC_ALT_7 +#define STM32F4_PINMUX_FUNC_PA11_USART6_TX STM32_PINMUX_FUNC_ALT_8 +#define STM32F4_PINMUX_FUNC_PA11_UART4_RX STM32_PINMUX_FUNC_ALT_11 + +#define STM32F4_PINMUX_FUNC_PA12_USART6_RX STM32_PINMUX_FUNC_ALT_8 +#define STM32F4_PINMUX_FUNC_PA12_UART4_TX STM32_PINMUX_FUNC_ALT_11 + +#define STM32F4_PINMUX_FUNC_PA15_USART1_TX STM32_PINMUX_FUNC_ALT_7 +#define STM32F4_PINMUX_FUNC_PA15_UART7_TX STM32_PINMUX_FUNC_ALT_8 + +/* Port B */ +#define STM32F4_PINMUX_FUNC_PB3_USART1_RX STM32_PINMUX_FUNC_ALT_7 +#define STM32F4_PINMUX_FUNC_PB3_UART7_RX STM32_PINMUX_FUNC_ALT_8 + +#define STM32F4_PINMUX_FUNC_PB4_UART7_TX STM32_PINMUX_FUNC_ALT_8 + +#define STM32F4_PINMUX_FUNC_PB5_UART5_RX STM32_PINMUX_FUNC_ALT_11 + #define STM32F4_PINMUX_FUNC_PB6_USART1_TX STM32_PINMUX_FUNC_ALT_7 +#define STM32F4_PINMUX_FUNC_PB6_UART5_TX STM32_PINMUX_FUNC_ALT_11 + #define STM32F4_PINMUX_FUNC_PB7_USART1_RX STM32_PINMUX_FUNC_ALT_7 +#define STM32F4_PINMUX_FUNC_PB8_UART5_RX STM32_PINMUX_FUNC_ALT_11 + +#define STM32F4_PINMUX_FUNC_PB9_UART5_TX STM32_PINMUX_FUNC_ALT_11 + +#define STM32F4_PINMUX_FUNC_PB10_USART3_TX STM32_PINMUX_FUNC_ALT_7 + +#define STM32F4_PINMUX_FUNC_PB11_USART3_RX STM32_PINMUX_FUNC_ALT_7 + +#define STM32F4_PINMUX_FUNC_PB12_UART5_RX STM32_PINMUX_FUNC_ALT_11 + +#define STM32F4_PINMUX_FUNC_PB13_UART5_TX STM32_PINMUX_FUNC_ALT_11 + +/* Port C */ +#define STM32F4_PINMUX_FUNC_PC5_USART3_RX STM32_PINMUX_FUNC_ALT_7 + +#define STM32F4_PINMUX_FUNC_PC6_USART6_TX STM32_PINMUX_FUNC_ALT_8 + +#define STM32F4_PINMUX_FUNC_PC7_USART6_RX STM32_PINMUX_FUNC_ALT_8 + +#define STM32F4_PINMUX_FUNC_PC10_USART3_TX STM32_PINMUX_FUNC_ALT_7 + +#define STM32F4_PINMUX_FUNC_PC11_USART3_RX STM32_PINMUX_FUNC_ALT_7 +#define STM32F4_PINMUX_FUNC_PC11_UART4_RX STM32_PINMUX_FUNC_ALT_8 + +#define STM32F4_PINMUX_FUNC_PC12_UART5_TX STM32_PINMUX_FUNC_ALT_8 + +/* Port D */ +#define STM32F4_PINMUX_FUNC_PD0_UART4_RX STM32_PINMUX_FUNC_ALT_11 + +#define STM32F4_PINMUX_FUNC_PD2_UART5_RX STM32_PINMUX_FUNC_ALT_8 + +#define STM32F4_PINMUX_FUNC_PD5_USART2_TX STM32_PINMUX_FUNC_ALT_7 + +#define STM32F4_PINMUX_FUNC_PD6_USART2_RX STM32_PINMUX_FUNC_ALT_7 + +#define STM32F4_PINMUX_FUNC_PD8_USART3_TX STM32_PINMUX_FUNC_ALT_7 + +#define STM32F4_PINMUX_FUNC_PD9_USART3_RX STM32_PINMUX_FUNC_ALT_7 + +#define STM32F4_PINMUX_FUNC_PD10_UART4_TX STM32_PINMUX_FUNC_ALT_8 + +#define STM32F4_PINMUX_FUNC_PD14_UART9_RX STM32_PINMUX_FUNC_ALT_11 + +#define STM32F4_PINMUX_FUNC_PD15_UART9_TX STM32_PINMUX_FUNC_ALT_11 + +/* Port E */ +#define STM32F4_PINMUX_FUNC_PE0_UART8_RX STM32_PINMUX_FUNC_ALT_8 + +#define STM32F4_PINMUX_FUNC_PE1_UART8_TX STM32_PINMUX_FUNC_ALT_8 + +#define STM32F4_PINMUX_FUNC_PE2_UART10_RX STM32_PINMUX_FUNC_ALT_11 + +#define STM32F4_PINMUX_FUNC_PE3_UART10_TX STM32_PINMUX_FUNC_ALT_11 + +#define STM32F4_PINMUX_FUNC_PE7_UART7_RX STM32_PINMUX_FUNC_ALT_8 + +#define STM32F4_PINMUX_FUNC_PE8_UART7_TX STM32_PINMUX_FUNC_ALT_8 + +/* Port F */ +#define STM32F4_PINMUX_FUNC_PF6_UART7_RX STM32_PINMUX_FUNC_ALT_8 + +#define STM32F4_PINMUX_FUNC_PF7_UART7_TX STM32_PINMUX_FUNC_ALT_8 + +#define STM32F4_PINMUX_FUNC_PF8_UART8_RX STM32_PINMUX_FUNC_ALT_8 + +#define STM32F4_PINMUX_FUNC_PF9_UART8_TX STM32_PINMUX_FUNC_ALT_8 + +/* Port G */ +#define STM32F4_PINMUX_FUNC_PG0_UART9_RX STM32_PINMUX_FUNC_ALT_11 + +#define STM32F4_PINMUX_FUNC_PG1_UART9_TX STM32_PINMUX_FUNC_ALT_11 + +#define STM32F4_PINMUX_FUNC_PG9_USART6_RX STM32_PINMUX_FUNC_ALT_8 + +#define STM32F4_PINMUX_FUNC_PG11_UART10_RX STM32_PINMUX_FUNC_ALT_11 + +#define STM32F4_PINMUX_FUNC_PG12_UART10_TX STM32_PINMUX_FUNC_ALT_11 + +#define STM32F4_PINMUX_FUNC_PG14_USART6_TX STM32_PINMUX_FUNC_ALT_8 + #endif /* _STM32F4_PINMUX_H_ */