Skip to content

Commit ce84c78

Browse files
kuronekombolivar-nordic
authored andcommitted
drivers: usb: device: stm32: fix disconnect-gpios configuration.
For some reason, rather than testing for the presence of disconnect-gpios in the devicetree, the STM32 USB Device driver was relying on a hidden Kconfig flag to be set. This patch removes the Kconfig option completely and simply tests for the DT property - if it's set, you obviously know what you're doing and obviously need the pull-up GPIO behaviour. Signed-off-by: Chris Collins <[email protected]>
1 parent 2d8c45c commit ce84c78

File tree

3 files changed

+2
-10
lines changed

3 files changed

+2
-10
lines changed

boards/arm/olimexino_stm32/Kconfig.board

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@
66
config BOARD_OLIMEXINO_STM32
77
bool "OLIMEXINO-STM32 Development Board"
88
depends on SOC_STM32F103XB
9-
select USB_DC_STM32_DISCONN_ENABLE if USB_DEVICE_DRIVER

drivers/usb/device/Kconfig

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,6 @@ config USB_DC_STM32
5050
Enable USB support on the STM32 F0, F1, F2, F3, F4, F7, L0, L4, G4, U5 family of
5151
processors.
5252

53-
config USB_DC_STM32_DISCONN_ENABLE
54-
bool
55-
depends on USB_DC_STM32
56-
help
57-
Say Y if your board uses USB DISCONNECT pin to enable the
58-
pull-up resistor on USB DP.
59-
6053
config USB_DC_SAM0
6154
bool "SAM0 series USB Device Controller driver"
6255
default y

drivers/usb/device/usb_dc_stm32.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,7 @@ void HAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
10991099
}
11001100
}
11011101

1102-
#if (defined(USB) || defined(USB_DRD_FS)) && defined(CONFIG_USB_DC_STM32_DISCONN_ENABLE)
1102+
#if (defined(USB) || defined(USB_DRD_FS)) && DT_INST_NODE_HAS_PROP(0, disconnect_gpios)
11031103
void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state)
11041104
{
11051105
const struct device *usb_disconnect;
@@ -1112,4 +1112,4 @@ void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state)
11121112
DT_GPIO_FLAGS(DT_INST(0, st_stm32_usb), disconnect_gpios) |
11131113
(state ? GPIO_OUTPUT_ACTIVE : GPIO_OUTPUT_INACTIVE));
11141114
}
1115-
#endif /* USB && CONFIG_USB_DC_STM32_DISCONN_ENABLE */
1115+
#endif /* USB && DT_INST_NODE_HAS_PROP(0, disconnect_gpios) */

0 commit comments

Comments
 (0)