From be886266950701bf3e44d2bf9912f7e0abdada44 Mon Sep 17 00:00:00 2001 From: Erwin Rol Date: Fri, 23 Jun 2017 12:11:36 +0200 Subject: [PATCH] pinmux: stm32: add ethernet controller pins Signed-off-by: Erwin Rol --- arch/arm/soc/st_stm32/stm32f4/soc_pinmux.c | 35 ++++++++++++++++++++++ drivers/pinmux/stm32/pinmux_stm32f4.h | 17 ++++++++++- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/arch/arm/soc/st_stm32/stm32f4/soc_pinmux.c b/arch/arm/soc/st_stm32/stm32f4/soc_pinmux.c index f9b396b9364..e8d8afd87ca 100644 --- a/arch/arm/soc/st_stm32/stm32f4/soc_pinmux.c +++ b/arch/arm/soc/st_stm32/stm32f4/soc_pinmux.c @@ -27,7 +27,12 @@ PAD(STM32F4_PINMUX_FUNC_##pin##_I2C##port##_##line, \ STM32F4X_PIN_CONFIG_AF_OPEN_UP), +#define _PINMUX_ETH(pin) \ + PAD(STM32F4_PINMUX_FUNC_##pin##_ETH, \ + STM32F4X_PIN_CONFIG_AF_PUSH_UP), + /* Blank pinmux by default */ +#define PINMUX_ETH(pin) #define PINMUX_I2C1(pin, line) #define PINMUX_I2C2(pin, line) #define PINMUX_I2C3(pin, line) @@ -43,6 +48,11 @@ #define PINMUX_UART9(pin, dir) #define PINMUX_UART10(pin, dir) +#ifdef CONFIG_ETH_STM32_HAL + #undef PINMUX_ETH + #define PINMUX_ETH(pin) _PINMUX_ETH(pin) +#endif + #ifdef CONFIG_I2C_1 #undef PINMUX_I2C1 #define PINMUX_I2C1(pin, line) _PINMUX_I2C(pin, 1, line) @@ -125,14 +135,17 @@ static const stm32_pin_func_t pin_pa0_funcs[] = { static const stm32_pin_func_t pin_pa1_funcs[] = { PINMUX_UART(PA1, UART4, RX) + PINMUX_ETH(PA1) }; static const stm32_pin_func_t pin_pa2_funcs[] = { PINMUX_UART(PA2, UART2, TX) + PINMUX_ETH(PA2) }; static const stm32_pin_func_t pin_pa3_funcs[] = { PINMUX_UART(PA3, UART2, RX) + PINMUX_ETH(PA3) }; static const stm32_pin_func_t pin_pa4_funcs[] = { @@ -151,6 +164,7 @@ static const stm32_pin_func_t pin_pa6_funcs[] = { }; static const stm32_pin_func_t pin_pa7_funcs[] = { + PINMUX_ETH(PA7) [STM32F4_PINMUX_FUNC_PA7_SPI1_MOSI - 1] = STM32F4X_PIN_CONFIG_AF_PUSH_PULL, }; @@ -228,16 +242,19 @@ static const stm32_pin_func_t pin_pb10_funcs[] = { static const stm32_pin_func_t pin_pb11_funcs[] = { PINMUX_UART(PB11, UART3, RX) PINMUX_I2C(PB11, I2C2, SDA) + PINMUX_ETH(PB11) }; static const stm32_pin_func_t pin_pb12_funcs[] = { PINMUX_UART(PB12, UART5, RX) + PINMUX_ETH(PB12) [STM32F4_PINMUX_FUNC_PB12_SPI2_NSS - 1] = STM32F4X_PIN_CONFIG_AF_PUSH_PULL, }; static const stm32_pin_func_t pin_pb13_funcs[] = { PINMUX_UART(PB13, UART5, TX) + PINMUX_ETH(PB13) [STM32F4_PINMUX_FUNC_PB13_SPI2_SCK - 1] = STM32F4X_PIN_CONFIG_AF_PUSH_PULL, }; @@ -253,8 +270,17 @@ static const stm32_pin_func_t pin_pb15_funcs[] = { }; /* Port C */ +static const stm32_pin_func_t pin_pc1_funcs[] = { + PINMUX_ETH(PC1) +}; + +static const stm32_pin_func_t pin_pc4_funcs[] = { + PINMUX_ETH(PC4) +}; + static const stm32_pin_func_t pin_pc5_funcs[] = { PINMUX_UART(PC5, UART3, RX) + PINMUX_ETH(PC5) }; static const stm32_pin_func_t pin_pc6_funcs[] = { @@ -387,14 +413,20 @@ static const stm32_pin_func_t pin_pg9_funcs[] = { static const stm32_pin_func_t pin_pg11_funcs[] = { PINMUX_UART(PG11, UART10, RX) + PINMUX_ETH(PG11) }; static const stm32_pin_func_t pin_pg12_funcs[] = { PINMUX_UART(PG12, UART10, TX) }; +static const stm32_pin_func_t pin_pg13_funcs[] = { + PINMUX_ETH(PG13) +}; + static const stm32_pin_func_t pin_pg14_funcs[] = { PINMUX_UART(PG14, UART6, TX) + PINMUX_ETH(PG14) }; #endif @@ -450,6 +482,8 @@ static const struct stm32_pinmux_conf pins[] = { STM32_PIN_CONF(STM32_PIN_PB15, pin_pb15_funcs), /* Port C */ + STM32_PIN_CONF(STM32_PIN_PC1, pin_pc1_funcs), + STM32_PIN_CONF(STM32_PIN_PC4, pin_pc4_funcs), 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), @@ -494,6 +528,7 @@ static const struct stm32_pinmux_conf pins[] = { 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_PG13, pin_pg13_funcs), STM32_PIN_CONF(STM32_PIN_PG14, pin_pg14_funcs), #endif diff --git a/drivers/pinmux/stm32/pinmux_stm32f4.h b/drivers/pinmux/stm32/pinmux_stm32f4.h index c1c193a0ca0..411b632e4d8 100644 --- a/drivers/pinmux/stm32/pinmux_stm32f4.h +++ b/drivers/pinmux/stm32/pinmux_stm32f4.h @@ -16,10 +16,13 @@ #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_PA1_ETH STM32_PINMUX_FUNC_ALT_11 #define STM32F4_PINMUX_FUNC_PA2_USART2_TX STM32_PINMUX_FUNC_ALT_7 +#define STM32F4_PINMUX_FUNC_PA2_ETH STM32_PINMUX_FUNC_ALT_11 #define STM32F4_PINMUX_FUNC_PA3_USART2_RX STM32_PINMUX_FUNC_ALT_7 +#define STM32F4_PINMUX_FUNC_PA3_ETH STM32_PINMUX_FUNC_ALT_11 #define STM32F4_PINMUX_FUNC_PA4_SPI1_NSS STM32_PINMUX_FUNC_ALT_5 @@ -28,6 +31,7 @@ #define STM32F4_PINMUX_FUNC_PA6_SPI1_MISO STM32_PINMUX_FUNC_ALT_5 #define STM32F4_PINMUX_FUNC_PA7_SPI1_MOSI STM32_PINMUX_FUNC_ALT_5 +#define STM32F4_PINMUX_FUNC_PA7_ETH STM32_PINMUX_FUNC_ALT_11 #define STM32F4_PINMUX_FUNC_PA8_I2C3_SCL STM32_PINMUX_FUNC_ALT_4 #define STM32F4_PINMUX_FUNC_PA8_UART7_RX STM32_PINMUX_FUNC_ALT_8 @@ -73,19 +77,27 @@ #define STM32F4_PINMUX_FUNC_PB11_I2C2_SDA STM32_PINMUX_FUNC_ALT_4 #define STM32F4_PINMUX_FUNC_PB11_USART3_RX STM32_PINMUX_FUNC_ALT_7 +#define STM32F4_PINMUX_FUNC_PB11_ETH STM32_PINMUX_FUNC_ALT_11 #define STM32F4_PINMUX_FUNC_PB12_SPI2_NSS STM32_PINMUX_FUNC_ALT_5 #define STM32F4_PINMUX_FUNC_PB12_UART5_RX STM32_PINMUX_FUNC_ALT_11 +#define STM32F4_PINMUX_FUNC_PB12_ETH STM32_PINMUX_FUNC_ALT_11 #define STM32F4_PINMUX_FUNC_PB13_SPI2_SCK STM32_PINMUX_FUNC_ALT_5 #define STM32F4_PINMUX_FUNC_PB13_UART5_TX STM32_PINMUX_FUNC_ALT_11 +#define STM32F4_PINMUX_FUNC_PB13_ETH STM32_PINMUX_FUNC_ALT_11 #define STM32F4_PINMUX_FUNC_PB14_SPI2_MISO STM32_PINMUX_FUNC_ALT_5 #define STM32F4_PINMUX_FUNC_PB15_SPI2_MOSI STM32_PINMUX_FUNC_ALT_5 /* Port C */ +#define STM32F4_PINMUX_FUNC_PC1_ETH STM32_PINMUX_FUNC_ALT_11 + +#define STM32F4_PINMUX_FUNC_PC4_ETH STM32_PINMUX_FUNC_ALT_11 + #define STM32F4_PINMUX_FUNC_PC5_USART3_RX STM32_PINMUX_FUNC_ALT_7 +#define STM32F4_PINMUX_FUNC_PC5_ETH STM32_PINMUX_FUNC_ALT_11 #define STM32F4_PINMUX_FUNC_PC6_USART6_TX STM32_PINMUX_FUNC_ALT_8 @@ -153,13 +165,16 @@ #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_PG11_ETH STM32_PINMUX_FUNC_ALT_11 #define STM32F4_PINMUX_FUNC_PG12_UART10_TX STM32_PINMUX_FUNC_ALT_11 +#define STM32F4_PINMUX_FUNC_PG13_ETH STM32_PINMUX_FUNC_ALT_11 + #define STM32F4_PINMUX_FUNC_PG14_USART6_TX STM32_PINMUX_FUNC_ALT_8 +#define STM32F4_PINMUX_FUNC_PG14_ETH STM32_PINMUX_FUNC_ALT_11 /* Port H */ - #define STM32F4_PINMUX_FUNC_PH4_I2C2_SCL STM32_PINMUX_FUNC_ALT_4 #define STM32F4_PINMUX_FUNC_PH5_I2C2_SDA STM32_PINMUX_FUNC_ALT_4