Skip to content

Commit

Permalink
drivers: pwm: stm32: remove remaining Kconfig instances
Browse files Browse the repository at this point in the history
Following other drivers, Kconfig based instances are now entirely
removed. In order to do this change, PWM nodes in board DT files have
been given a pwm{N} label so that both:

- DT API checks such as #if DT_HAS_NODE(DT_NODELABEL(pwmN)) can be
  used (N being PWM instance number).
- DT references can be written as pwms = <&pwmN x y>; instead of
  pwms = <&{/soc/timers@XXXXXXXX/pwm} x y>;

This approach is also used on the Linux Kernel.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
  • Loading branch information
gmarull authored and galak committed May 5, 2020
1 parent f90f5d8 commit c6b1375
Show file tree
Hide file tree
Showing 94 changed files with 115 additions and 467 deletions.
6 changes: 3 additions & 3 deletions boards/arm/96b_stm32_sensor_mez/96b_stm32_sensor_mez.dts
Original file line number Diff line number Diff line change
Expand Up @@ -107,23 +107,23 @@
&timers3 {
status = "okay";

pwm {
pwm3: pwm {
status = "okay";
};
};

&timers4 {
status = "okay";

pwm {
pwm4: pwm {
status = "okay";
};
};

&timers9 {
status = "okay";

pwm {
pwm9: pwm {
status = "okay";
};
};
Expand Down
13 changes: 0 additions & 13 deletions boards/arm/96b_stm32_sensor_mez/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,4 @@ config SPI_STM32_INTERRUPT
default y
depends on SPI

if PWM

config PWM_STM32_3
default y

config PWM_STM32_4
default y

config PWM_STM32_9
default y

endif # PWM

endif # BOARD_96B_STM32_SENSOR_MEZ
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 @@ -72,18 +72,18 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PC7, STM32F4_PINMUX_FUNC_PC7_I2S2_CK},
{STM32_PIN_PC1, STM32F4_PINMUX_FUNC_PC1_I2S2_SD},
#endif
#ifdef CONFIG_PWM_STM32_3
#if DT_HAS_NODE(DT_NODELABEL(pwm3))
{ STM32_PIN_PB4, STM32F4_PINMUX_FUNC_PB4_PWM3_CH1 },
{ STM32_PIN_PC8, STM32F4_PINMUX_FUNC_PC8_PWM3_CH3 },
#endif /* CONFIG_PWM_STM32_3 */
#ifdef CONFIG_PWM_STM32_4
#endif
#if DT_HAS_NODE(DT_NODELABEL(pwm4))
{ STM32_PIN_PD14, STM32F4_PINMUX_FUNC_PD14_PWM4_CH3 },
{ STM32_PIN_PD15, STM32F4_PINMUX_FUNC_PD15_PWM4_CH4 },
#endif /* CONFIG_PWM_STM32_4 */
#ifdef CONFIG_PWM_STM32_9
#endif
#if DT_HAS_NODE(DT_NODELABEL(pwm9))
{ STM32_PIN_PE5, STM32F4_PINMUX_FUNC_PE5_PWM9_CH1 },
{ STM32_PIN_PE6, STM32F4_PINMUX_FUNC_PE6_PWM9_CH2 },
#endif /* CONFIG_PWM_STM32_9 */
#endif
};

static int pinmux_stm32_init(struct device *port)
Expand Down
4 changes: 0 additions & 4 deletions boards/arm/black_f407ve/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ if BOARD_BLACK_F407VE
config BOARD
default "black_f407ve"

config PWM_STM32_2
default y
depends on PWM

config SPI_STM32_INTERRUPT
default y
depends on SPI
Expand Down
2 changes: 1 addition & 1 deletion boards/arm/black_f407ve/black_f407ve.dts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
&timers2 {
status = "okay";

pwm {
pwm2: pwm {
status = "okay";
};
};
Expand Down
4 changes: 2 additions & 2 deletions boards/arm/black_f407ve/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PA2, STM32F4_PINMUX_FUNC_PA2_USART2_TX},
{STM32_PIN_PA3, STM32F4_PINMUX_FUNC_PA3_USART2_RX},
#endif
#ifdef CONFIG_PWM_STM32_2
#if DT_HAS_NODE(DT_NODELABEL(pwm2))
{STM32_PIN_PA0, STM32F4_PINMUX_FUNC_PA0_PWM2_CH1},
#endif /* CONFIG_PWM_STM32_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
4 changes: 0 additions & 4 deletions boards/arm/black_f407zg_pro/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ if BOARD_BLACK_F407ZG_PRO
config BOARD
default "black_f407zg_pro"

config PWM_STM32_2
default y
depends on PWM

config SPI_STM32_INTERRUPT
default y
depends on SPI
Expand Down
2 changes: 1 addition & 1 deletion boards/arm/black_f407zg_pro/black_f407zg_pro.dts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
&timers2 {
status = "okay";

pwm {
pwm2: pwm {
status = "okay";
};
};
Expand Down
4 changes: 2 additions & 2 deletions boards/arm/black_f407zg_pro/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PA2, STM32F4_PINMUX_FUNC_PA2_USART2_TX},
{STM32_PIN_PA3, STM32F4_PINMUX_FUNC_PA3_USART2_RX},
#endif
#ifdef CONFIG_PWM_STM32_2
#if DT_HAS_NODE(DT_NODELABEL(pwm2))
{STM32_PIN_PA0, STM32F4_PINMUX_FUNC_PA0_PWM2_CH1},
#endif /* CONFIG_PWM_STM32_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
4 changes: 0 additions & 4 deletions boards/arm/disco_l475_iot1/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ config SPI_STM32_INTERRUPT
default y
depends on SPI

config PWM_STM32_2
default y
depends on PWM

choice LIS3MDL_TRIGGER_MODE
default LIS3MDL_TRIGGER_NONE
endchoice
Expand Down
2 changes: 1 addition & 1 deletion boards/arm/disco_l475_iot1/disco_l475_iot1.dts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
&timers2 {
status = "okay";

pwm {
pwm2: pwm {
status = "okay";
};
};
Expand Down
4 changes: 2 additions & 2 deletions boards/arm/disco_l475_iot1/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ static const struct pin_config pinconf[] = {
STM32_OSPEEDR_VERY_HIGH_SPEED},
{STM32_PIN_PC12, STM32L4X_PINMUX_FUNC_PC12_SPI3_MOSI},
#endif
#ifdef CONFIG_PWM_STM32_2
#if DT_HAS_NODE(DT_NODELABEL(pwm2))
{STM32_PIN_PA15, STM32L4X_PINMUX_FUNC_PA15_PWM2_CH1},
#endif /* CONFIG_PWM_STM32_2 */
#endif
#ifdef CONFIG_USB_DC_STM32
{STM32_PIN_PA10, STM32L4X_PINMUX_FUNC_PA10_OTG_FS_ID},
{STM32_PIN_PA11, STM32L4X_PINMUX_FUNC_PA11_OTG_FS_DM},
Expand Down
4 changes: 0 additions & 4 deletions boards/arm/mikroe_mini_m4_for_stm32/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ config SPI_STM32_INTERRUPT
default y
depends on SPI

config PWM_STM32_3
default y
depends on PWM

config USB_DC_STM32
default y
depends on USB
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
&timers3 {
status = "okay";

pwm {
pwm3: pwm {
status = "okay";
};
};
Expand Down
4 changes: 2 additions & 2 deletions boards/arm/mikroe_mini_m4_for_stm32/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PA6, STM32F4_PINMUX_FUNC_PA6_SPI1_MISO},
{STM32_PIN_PA7, STM32F4_PINMUX_FUNC_PA7_SPI1_MOSI},
#endif
#ifdef CONFIG_PWM_STM32_3
#if DT_HAS_NODE(DT_NODELABEL(pwm3))
{STM32_PIN_PB4, STM32F4_PINMUX_FUNC_PB4_PWM3_CH1},
#endif /* CONFIG_PWM_STM32_3 */
#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
4 changes: 0 additions & 4 deletions boards/arm/nucleo_f103rb/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,4 @@ if BOARD_NUCLEO_F103RB
config BOARD
default "nucleo_f103rb"

config PWM_STM32_1
default y
depends on PWM

endif # BOARD_NUCLEO_F103RB
2 changes: 1 addition & 1 deletion boards/arm/nucleo_f103rb/nucleo_f103rb.dts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
&timers1 {
status = "okay";

pwm {
pwm1: pwm {
status = "okay";
};
};
Expand Down
4 changes: 2 additions & 2 deletions boards/arm/nucleo_f103rb/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PB10, STM32F1_PINMUX_FUNC_PB10_USART3_TX},
{STM32_PIN_PB11, STM32F1_PINMUX_FUNC_PB11_USART3_RX},
#endif
#ifdef CONFIG_PWM_STM32_1
#if DT_HAS_NODE(DT_NODELABEL(pwm1))
{STM32_PIN_PA8, STM32F1_PINMUX_FUNC_PA8_PWM1_CH1},
#endif /* CONFIG_PWM_STM32_1 */
#endif
#if DT_HAS_NODE(DT_NODELABEL(spi1))
#ifdef CONFIG_SPI_STM32_USE_HW_SS
{STM32_PIN_PA4, STM32F1_PINMUX_FUNC_PA4_SPI1_MASTER_NSS},
Expand Down
5 changes: 0 additions & 5 deletions boards/arm/nucleo_f302r8/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,4 @@ if BOARD_NUCLEO_F302R8
config BOARD
default "nucleo_f302r8"


config PWM_STM32_2
default y
depends on PWM

endif # BOARD_NUCLEO_F302R8
2 changes: 1 addition & 1 deletion boards/arm/nucleo_f302r8/nucleo_f302r8.dts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
&timers2 {
status = "okay";

pwm {
pwm2: pwm {
status = "okay";
};
};
Expand Down
4 changes: 2 additions & 2 deletions boards/arm/nucleo_f302r8/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PB14, STM32F3_PINMUX_FUNC_PB14_SPI2_MISO},
{STM32_PIN_PB15, STM32F3_PINMUX_FUNC_PB15_SPI2_MOSI},
#endif
#ifdef CONFIG_PWM_STM32_2
#if DT_HAS_NODE(DT_NODELABEL(pwm2))
{STM32_PIN_PA0, STM32F3_PINMUX_FUNC_PA0_PWM2_CH1},
#endif /* CONFIG_PWM_STM32_2 */
#endif
#if DT_HAS_NODE(DT_NODELABEL(adc1))
{STM32_PIN_PA0, STM32F3_PINMUX_FUNC_PA0_ADC1_IN1},
#endif
Expand Down
2 changes: 1 addition & 1 deletion boards/arm/nucleo_f334r8/nucleo_f334r8.dts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
&timers1 {
status = "okay";

pwm {
pwm1: pwm {
status = "okay";
};
};
Expand Down
4 changes: 2 additions & 2 deletions boards/arm/nucleo_f334r8/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PA6, STM32F3_PINMUX_FUNC_PA6_SPI1_MISO},
{STM32_PIN_PA7, STM32F3_PINMUX_FUNC_PA7_SPI1_MOSI},
#endif
#ifdef CONFIG_PWM_STM32_1
#if DT_HAS_NODE(DT_NODELABEL(pwm1))
{STM32_PIN_PA8, STM32F3_PINMUX_FUNC_PA8_PWM1_CH1},
#endif /* CONFIG_PWM_STM32_1 */
#endif
};

static int pinmux_stm32_init(struct device *port)
Expand Down
4 changes: 0 additions & 4 deletions boards/arm/nucleo_f401re/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ config SPI_STM32_INTERRUPT
default y
depends on SPI

config PWM_STM32_2
default y
depends on PWM

if WATCHDOG

config WWDG_STM32
Expand Down
2 changes: 1 addition & 1 deletion boards/arm/nucleo_f401re/nucleo_f401re.dts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
&timers2 {
status = "okay";

pwm {
pwm2: pwm {
status = "okay";
};
};
Expand Down
4 changes: 2 additions & 2 deletions boards/arm/nucleo_f401re/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PA2, STM32F4_PINMUX_FUNC_PA2_USART2_TX},
{STM32_PIN_PA3, STM32F4_PINMUX_FUNC_PA3_USART2_RX},
#endif
#ifdef CONFIG_PWM_STM32_2
#if DT_HAS_NODE(DT_NODELABEL(pwm2))
{STM32_PIN_PA0, STM32F4_PINMUX_FUNC_PA0_PWM2_CH1},
#endif /* CONFIG_PWM_STM32_2 */
#endif
#if DT_HAS_NODE(DT_NODELABEL(i2c1))
{STM32_PIN_PB8, STM32F4_PINMUX_FUNC_PB8_I2C1_SCL},
{STM32_PIN_PB9, STM32F4_PINMUX_FUNC_PB9_I2C1_SDA},
Expand Down
4 changes: 0 additions & 4 deletions boards/arm/nucleo_f412zg/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,4 @@ config USB_DEVICE_NETWORK_ECM

endif # NETWORKING

config PWM_STM32_2
default y
depends on PWM

endif # BOARD_NUCLEO_F412ZG
2 changes: 1 addition & 1 deletion boards/arm/nucleo_f412zg/nucleo_f412zg.dts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
&timers2 {
status = "okay";

pwm {
pwm2: pwm {
status = "okay";
};
};
Expand Down
4 changes: 2 additions & 2 deletions boards/arm/nucleo_f412zg/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PG14, STM32F4_PINMUX_FUNC_PG14_USART6_TX},
{STM32_PIN_PG9, STM32F4_PINMUX_FUNC_PG9_USART6_RX},
#endif
#ifdef CONFIG_PWM_STM32_2
#if DT_HAS_NODE(DT_NODELABEL(pwm2))
{STM32_PIN_PA0, STM32F4_PINMUX_FUNC_PA0_PWM2_CH1},
#endif /* CONFIG_PWM_STM32_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
4 changes: 0 additions & 4 deletions boards/arm/nucleo_f413zh/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,4 @@ config USB_DEVICE_NETWORK_ECM

endif # NETWORKING

config PWM_STM32_2
default y
depends on PWM

endif # BOARD_NUCLEO_F413ZH
2 changes: 1 addition & 1 deletion boards/arm/nucleo_f413zh/nucleo_f413zh.dts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
&timers2 {
status = "okay";

pwm {
pwm2: pwm {
status = "okay";
};
};
Expand Down
4 changes: 2 additions & 2 deletions boards/arm/nucleo_f413zh/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PG14, STM32F4_PINMUX_FUNC_PG14_USART6_TX},
{STM32_PIN_PG9, STM32F4_PINMUX_FUNC_PG9_USART6_RX},
#endif
#ifdef CONFIG_PWM_STM32_2
#if DT_HAS_NODE(DT_NODELABEL(pwm2))
{STM32_PIN_PA0, STM32F4_PINMUX_FUNC_PA0_PWM2_CH1},
#endif /* CONFIG_PWM_STM32_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
5 changes: 0 additions & 5 deletions boards/arm/nucleo_f429zi/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,4 @@ config ETH_STM32_HAL

endif # NETWORKING


config PWM_STM32_1
default y
depends on PWM

endif # BOARD_NUCLEO_F429ZI
2 changes: 1 addition & 1 deletion boards/arm/nucleo_f429zi/nucleo_f429zi.dts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
&timers1 {
status = "okay";

pwm {
pwm1: pwm {
status = "okay";
};
};
Expand Down
Loading

0 comments on commit c6b1375

Please sign in to comment.