Skip to content

Commit

Permalink
boards: stm32: Use dt API for peripheral configuration
Browse files Browse the repository at this point in the history
Replace use of Kconfig SPI_X symbols by calls to DT API.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
  • Loading branch information
erwango authored and galak committed Apr 18, 2020
1 parent addaa80 commit bfaa109
Show file tree
Hide file tree
Showing 97 changed files with 181 additions and 508 deletions.
13 changes: 0 additions & 13 deletions boards/arm/96b_argonkey/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,6 @@ config UART_1
default y
depends on UART_CONSOLE

if SPI

config SPI_1
default y

config SPI_2
default y

config SPI_STM32_INTERRUPT
default y

endif # SPI

if I2S

config I2S_STM32
Expand Down
8 changes: 4 additions & 4 deletions boards/arm/96b_argonkey/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PA8, STM32F4_PINMUX_FUNC_PA8_I2C3_SCL},
{STM32_PIN_PB4, STM32F4_PINMUX_FUNC_PB4_I2C3_SDA},
#endif
#ifdef CONFIG_SPI_1
#if DT_HAS_NODE(DT_NODELABEL(spi1))
#ifdef CONFIG_SPI_STM32_USE_HW_SS
{STM32_PIN_PA4, STM32F4_PINMUX_FUNC_PA4_SPI1_NSS |
STM32_OSPEEDR_VERY_HIGH_SPEED},
Expand All @@ -39,8 +39,8 @@ static const struct pin_config pinconf[] = {
STM32_OSPEEDR_VERY_HIGH_SPEED},
{STM32_PIN_PA6, STM32F4_PINMUX_FUNC_PA6_SPI1_MISO},
{STM32_PIN_PA7, STM32F4_PINMUX_FUNC_PA7_SPI1_MOSI},
#endif /* CONFIG_SPI_1 */
#ifdef CONFIG_SPI_2
#endif
#if DT_HAS_NODE(DT_NODELABEL(spi2))
#ifdef CONFIG_SPI_STM32_USE_HW_SS
{STM32_PIN_PB12, STM32F4_PINMUX_FUNC_PB12_SPI2_NSS |
STM32_OSPEEDR_VERY_HIGH_SPEED},
Expand All @@ -49,7 +49,7 @@ static const struct pin_config pinconf[] = {
STM32_OSPEEDR_VERY_HIGH_SPEED},
{STM32_PIN_PB14, STM32F4_PINMUX_FUNC_PB14_SPI2_MISO},
{STM32_PIN_PB15, STM32F4_PINMUX_FUNC_PB15_SPI2_MOSI},
#endif /* CONFIG_SPI_2 */
#endif
#ifdef CONFIG_I2S_5
{STM32_PIN_PB0, STM32F4_PINMUX_FUNC_PB0_I2S5_CK},
{STM32_PIN_PB8, STM32F4_PINMUX_FUNC_PB8_I2S5_SD},
Expand Down
11 changes: 1 addition & 10 deletions boards/arm/96b_carbon/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,9 @@ config UART_6

endif # SERIAL

if SPI

config SPI_1
default y

config SPI_2
default y

config SPI_STM32_INTERRUPT
default y

endif # SPI
depends on SPI

if BT

Expand Down
8 changes: 4 additions & 4 deletions boards/arm/96b_carbon/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,22 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PB10, STM32F4_PINMUX_FUNC_PB10_I2C2_SCL},
{STM32_PIN_PB3, STM32F4_PINMUX_FUNC_PB3_I2C2_SDA},
#endif
#ifdef CONFIG_SPI_1
#if DT_HAS_NODE(DT_NODELABEL(spi1))
#ifdef CONFIG_SPI_STM32_USE_HW_SS
{STM32_PIN_PA4, STM32F4_PINMUX_FUNC_PA4_SPI1_NSS},
#endif /* CONFIG_SPI_STM32_USE_HW_SS */
{STM32_PIN_PA5, STM32F4_PINMUX_FUNC_PA5_SPI1_SCK},
{STM32_PIN_PA6, STM32F4_PINMUX_FUNC_PA6_SPI1_MISO},
{STM32_PIN_PA7, STM32F4_PINMUX_FUNC_PA7_SPI1_MOSI},
#endif /* CONFIG_SPI_1 */
#ifdef CONFIG_SPI_2
#endif
#if DT_HAS_NODE(DT_NODELABEL(spi2))
#ifdef CONFIG_SPI_STM32_USE_HW_SS
{STM32_PIN_PB12, STM32F4_PINMUX_FUNC_PB12_SPI2_NSS},
#endif /* CONFIG_SPI_STM32_USE_HW_SS */
{STM32_PIN_PB13, STM32F4_PINMUX_FUNC_PB13_SPI2_SCK},
{STM32_PIN_PB14, STM32F4_PINMUX_FUNC_PB14_SPI2_MISO},
{STM32_PIN_PB15, STM32F4_PINMUX_FUNC_PB15_SPI2_MOSI},
#endif /* CONFIG_SPI_2 */
#endif
#ifdef CONFIG_USB_DC_STM32
{STM32_PIN_PA11, STM32F4_PINMUX_FUNC_PA11_OTG_FS_DM},
{STM32_PIN_PA12, STM32F4_PINMUX_FUNC_PA12_OTG_FS_DP},
Expand Down
8 changes: 1 addition & 7 deletions boards/arm/96b_neonkey/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,8 @@ config UART_1
default y
depends on UART_CONSOLE

if SPI

config SPI_1
default y

config SPI_STM32_INTERRUPT
default y

endif # SPI
depends on SPI

endif # BOARD_96B_NEONKEY
4 changes: 2 additions & 2 deletions boards/arm/96b_neonkey/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PA8, STM32F4_PINMUX_FUNC_PA8_I2C3_SCL},
{STM32_PIN_PB4, STM32F4_PINMUX_FUNC_PB4_I2C3_SDA},
#endif
#ifdef CONFIG_SPI_1
#if DT_HAS_NODE(DT_NODELABEL(spi1))
#ifdef CONFIG_SPI_STM32_USE_HW_SS
{STM32_PIN_PA4, STM32F4_PINMUX_FUNC_PA4_SPI1_NSS},
#endif /* CONFIG_SPI_STM32_USE_HW_SS */
{STM32_PIN_PA5, STM32F4_PINMUX_FUNC_PA5_SPI1_SCK},
{STM32_PIN_PA6, STM32F4_PINMUX_FUNC_PA6_SPI1_MISO},
{STM32_PIN_PA7, STM32F4_PINMUX_FUNC_PA7_SPI1_MOSI},
#endif /* CONFIG_SPI_1 */
#endif
};

static int pinmux_stm32_init(struct device *port)
Expand Down
15 changes: 1 addition & 14 deletions boards/arm/96b_stm32_sensor_mez/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ config UART_4
default y
depends on UART_CONSOLE


if I2S

config I2S_STM32
Expand All @@ -36,21 +35,9 @@ config I2S_2

endif # I2S

if SPI

config SPI_1
default y

config SPI_2
default y

config SPI_4
default y

config SPI_STM32_INTERRUPT
default y

endif # SPI
depends on SPI

if PWM

Expand Down
12 changes: 6 additions & 6 deletions boards/arm/96b_stm32_sensor_mez/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PB10, STM32F4_PINMUX_FUNC_PB10_I2C2_SCL},
{STM32_PIN_PC12, STM32F4_PINMUX_FUNC_PC12_I2C2_SDA},
#endif
#ifdef CONFIG_SPI_1
#if DT_HAS_NODE(DT_NODELABEL(spi1))
#ifdef CONFIG_SPI_STM32_USE_HW_SS
{STM32_PIN_PA4, STM32F4_PINMUX_FUNC_PA4_SPI1_NSS |
STM32_OSPEEDR_VERY_HIGH_SPEED},
Expand All @@ -47,8 +47,8 @@ static const struct pin_config pinconf[] = {
STM32_OSPEEDR_VERY_HIGH_SPEED},
{STM32_PIN_PA6, STM32F4_PINMUX_FUNC_PA6_SPI1_MISO},
{STM32_PIN_PA7, STM32F4_PINMUX_FUNC_PA7_SPI1_MOSI},
#endif /* CONFIG_SPI_1 */
#ifdef CONFIG_SPI_2
#endif
#if DT_HAS_NODE(DT_NODELABEL(spi2))
#ifdef CONFIG_SPI_STM32_USE_HW_SS
{STM32_PIN_PB9, STM32F4_PINMUX_FUNC_PB9_SPI2_NSS |
STM32_OSPEEDR_VERY_HIGH_SPEED},
Expand All @@ -57,8 +57,8 @@ static const struct pin_config pinconf[] = {
STM32_OSPEEDR_VERY_HIGH_SPEED},
{STM32_PIN_PB14, STM32F4_PINMUX_FUNC_PB14_SPI2_MISO},
{STM32_PIN_PB15, STM32F4_PINMUX_FUNC_PB15_SPI2_MOSI},
#endif /* CONFIG_SPI_2 */
#ifdef CONFIG_SPI_4
#endif
#if DT_HAS_NODE(DT_NODELABEL(spi4))
#ifdef CONFIG_SPI_STM32_USE_HW_SS
{STM32_PIN_PE11, STM32F4_PINMUX_FUNC_PE11_SPI4_NSS |
STM32_OSPEEDR_VERY_HIGH_SPEED},
Expand All @@ -67,7 +67,7 @@ static const struct pin_config pinconf[] = {
STM32_OSPEEDR_VERY_HIGH_SPEED},
{STM32_PIN_PE13, STM32F4_PINMUX_FUNC_PE13_SPI4_MISO},
{STM32_PIN_PE14, STM32F4_PINMUX_FUNC_PE14_SPI4_MOSI},
#endif /* CONFIG_SPI_4 */
#endif
#ifdef CONFIG_I2S_2
{STM32_PIN_PC7, STM32F4_PINMUX_FUNC_PC7_I2S2_CK},
{STM32_PIN_PC1, STM32F4_PINMUX_FUNC_PC1_I2S2_SD},
Expand Down
4 changes: 2 additions & 2 deletions boards/arm/96b_wistrio/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PB8, STM32L1X_PINMUX_FUNC_PB8_I2C1_SCL},
{STM32_PIN_PB9, STM32L1X_PINMUX_FUNC_PB9_I2C1_SDA},
#endif
#ifdef CONFIG_SPI_1
#if DT_HAS_NODE(DT_NODELABEL(spi1))
{STM32_PIN_PA5, STM32L1X_PINMUX_FUNC_PA5_SPI1_SCK |
STM32_OSPEEDR_VERY_HIGH_SPEED},
{STM32_PIN_PA6, STM32L1X_PINMUX_FUNC_PA6_SPI1_MISO},
{STM32_PIN_PA7, STM32L1X_PINMUX_FUNC_PA7_SPI1_MOSI},
#endif /* CONFIG_SPI_1 */
#endif
/* RF_CTX_PA */
{STM32_PIN_PA4, STM32_PUSHPULL_PULLUP},
/* RF_CRX_RX */
Expand Down
9 changes: 0 additions & 9 deletions boards/arm/adafruit_feather_stm32f405/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,4 @@ config UART_3
default y
depends on UART_CONSOLE


config SPI_1
default y
depends on SPI

config SPI_2
default y
depends on SPI

endif # BOARD_ADAFRUIT_FEATHER_STM32F405
8 changes: 4 additions & 4 deletions boards/arm/adafruit_feather_stm32f405/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PB6, STM32F4_PINMUX_FUNC_PB6_I2C1_SCL},
{STM32_PIN_PB7, STM32F4_PINMUX_FUNC_PB7_I2C1_SDA},
#endif
#ifdef CONFIG_SPI_1
#if DT_HAS_NODE(DT_NODELABEL(spi1))
#ifdef CONFIG_SPI_STM32_USE_HW_SS
{STM32_PIN_PA15, STM32F4_PINMUX_FUNC_PA15_SPI1_NSS |
STM32_OSPEEDR_VERY_HIGH_SPEED},
Expand All @@ -31,12 +31,12 @@ static const struct pin_config pinconf[] = {
STM32_OSPEEDR_VERY_HIGH_SPEED},
{STM32_PIN_PB4, STM32F4_PINMUX_FUNC_PA6_SPI1_MISO},
{STM32_PIN_PB5, STM32F4_PINMUX_FUNC_PA7_SPI1_MOSI},
#endif /* CONFIG_SPI_1 */
#ifdef CONFIG_SPI_2
#endif
#if DT_HAS_NODE(DT_NODELABEL(spi2))
{STM32_PIN_PB13, STM32F4_PINMUX_FUNC_PB13_SPI2_SCK},
{STM32_PIN_PB14, STM32F4_PINMUX_FUNC_PB14_SPI2_MISO},
{STM32_PIN_PB15, STM32F4_PINMUX_FUNC_PB15_SPI2_MOSI},
#endif /* CONFIG_SPI_2 */
#endif
#ifdef CONFIG_USB_DC_STM32
{STM32_PIN_PA11, STM32F4_PINMUX_FUNC_PA11_OTG_FS_DM},
{STM32_PIN_PA12, STM32F4_PINMUX_FUNC_PA12_OTG_FS_DP},
Expand Down
8 changes: 0 additions & 8 deletions boards/arm/b_l072z_lrwan1/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ config I2C_1
default y
depends on I2C

if SPI
config SPI_1
default y

config SPI_2
default y
endif # SPI

choice COUNTER_RTC_STM32_CLOCK_SRC
default COUNTER_RTC_STM32_CLOCK_LSE
depends on COUNTER
Expand Down
8 changes: 4 additions & 4 deletions boards/arm/b_l072z_lrwan1/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PA2, STM32L0_PINMUX_FUNC_PA2_USART2_TX},
{STM32_PIN_PA3, STM32L0_PINMUX_FUNC_PA3_USART2_RX},
#endif /* CONFIG_UART_2 */
#ifdef CONFIG_SPI_1
#if DT_HAS_NODE(DT_NODELABEL(spi1))
#ifdef CONFIG_SPI_STM32_USE_HW_SS
{STM32_PIN_PA4, STM32L0_PINMUX_FUNC_PA4_SPI1_NSS},
#endif /* CONFIG_SPI_STM32_USE_HW_SS */
{STM32_PIN_PA5, STM32L0_PINMUX_FUNC_PA5_SPI1_SCK},
{STM32_PIN_PA6, STM32L0_PINMUX_FUNC_PA6_SPI1_MISO},
{STM32_PIN_PA7, STM32L0_PINMUX_FUNC_PA7_SPI1_MOSI},
#endif /* CONFIG_SPI_1 */
#ifdef CONFIG_SPI_2
#endif
#if DT_HAS_NODE(DT_NODELABEL(spi2))
#ifdef CONFIG_SPI_STM32_USE_HW_SS
{STM32_PIN_PB12, STM32L0_PINMUX_FUNC_PB12_SPI2_NSS},
#endif /* CONFIG_SPI_STM32_USE_HW_SS */
{STM32_PIN_PB13, STM32L0_PINMUX_FUNC_PB13_SPI2_SCK},
{STM32_PIN_PB14, STM32L0_PINMUX_FUNC_PB14_SPI2_MISO},
{STM32_PIN_PB15, STM32L0_PINMUX_FUNC_PB15_SPI2_MOSI},
#endif /* CONFIG_SPI_2 */
#endif
#if DT_HAS_NODE(DT_NODELABEL(i2c1))
{STM32_PIN_PB8, STM32L0_PINMUX_FUNC_PB8_I2C1_SCL},
{STM32_PIN_PB9, STM32L0_PINMUX_FUNC_PB9_I2C1_SDA},
Expand Down
8 changes: 0 additions & 8 deletions boards/arm/black_f407_generic/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ config CAN_2
default y
depends on CAN

config SPI_1
default y
depends on SPI

config SPI_2
default y
depends on SPI

config SPI_STM32_INTERRUPT
default y
depends on SPI
Expand Down
8 changes: 4 additions & 4 deletions boards/arm/black_f407_generic/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PB12, STM32F4_PINMUX_FUNC_PB12_CAN2_RX},
{STM32_PIN_PB13, STM32F4_PINMUX_FUNC_PB13_CAN2_TX},
#endif /* CONFIG_CAN_2 */
#ifdef CONFIG_SPI_1
#if DT_HAS_NODE(DT_NODELABEL(spi1))
{STM32_PIN_PB3, STM32F4_PINMUX_FUNC_PB3_SPI1_SCK},
{STM32_PIN_PB4, STM32F4_PINMUX_FUNC_PB4_SPI1_MISO},
{STM32_PIN_PB5, STM32F4_PINMUX_FUNC_PB5_SPI1_MOSI},
#endif /* CONFIG_SPI_1 */
#ifdef CONFIG_SPI_2
#endif
#if DT_HAS_NODE(DT_NODELABEL(spi2))
{STM32_PIN_PB10, STM32F4_PINMUX_FUNC_PB10_SPI2_SCK},
{STM32_PIN_PC2, STM32F4_PINMUX_FUNC_PC2_SPI2_MISO},
{STM32_PIN_PC3, STM32F4_PINMUX_FUNC_PC3_SPI2_MOSI},
#endif /* CONFIG_SPI_2 */
#endif
};

static int pinmux_black_f407ve_init(struct device *port)
Expand Down
11 changes: 1 addition & 10 deletions boards/arm/disco_l475_iot1/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,9 @@ config UART_4
default y
depends on SERIAL

if SPI

config SPI_STM32_INTERRUPT
default y

config SPI_1
default y

config SPI_3
default y

endif # SPI
depends on SPI

config PWM_STM32_2
default y
Expand Down
8 changes: 4 additions & 4 deletions boards/arm/disco_l475_iot1/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PC0, STM32L4X_PINMUX_FUNC_PC0_I2C3_SCL},
{STM32_PIN_PC1, STM32L4X_PINMUX_FUNC_PC1_I2C3_SDA},
#endif
#ifdef CONFIG_SPI_1
#if DT_HAS_NODE(DT_NODELABEL(spi1))
{STM32_PIN_PA5, STM32L4X_PINMUX_FUNC_PA5_SPI1_SCK},
{STM32_PIN_PA6, STM32L4X_PINMUX_FUNC_PA6_SPI1_MISO},
{STM32_PIN_PA7, STM32L4X_PINMUX_FUNC_PA7_SPI1_MOSI},
#endif /* CONFIG_SPI_1 */
#ifdef CONFIG_SPI_3
#endif
#if DT_HAS_NODE(DT_NODELABEL(spi3))
/* SPI3 is used for BT/WIFI, Sub GHZ communication */
{STM32_PIN_PC10, STM32L4X_PINMUX_FUNC_PC10_SPI3_SCK},
{STM32_PIN_PC11, STM32L4X_PINMUX_FUNC_PC11_SPI3_MISO | \
STM32_OSPEEDR_VERY_HIGH_SPEED},
{STM32_PIN_PC12, STM32L4X_PINMUX_FUNC_PC12_SPI3_MOSI},
#endif /* CONFIG_SPI_3 */
#endif
#ifdef CONFIG_PWM_STM32_2
{STM32_PIN_PA15, STM32L4X_PINMUX_FUNC_PA15_PWM2_CH1},
#endif /* CONFIG_PWM_STM32_2 */
Expand Down
8 changes: 1 addition & 7 deletions boards/arm/mikroe_mini_m4_for_stm32/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,9 @@ config UART_2
default y
depends on UART_CONSOLE

if SPI

config SPI_1
default y

config SPI_STM32_INTERRUPT
default y

endif # SPI
depends on SPI

config PWM_STM32_3
default y
Expand Down
Loading

0 comments on commit bfaa109

Please sign in to comment.