From ce84c782dcd3cee6fad6ac7ec7642accdaa42d1f Mon Sep 17 00:00:00 2001 From: Chris Collins Date: Thu, 19 May 2022 15:13:31 +1000 Subject: [PATCH] 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 --- boards/arm/olimexino_stm32/Kconfig.board | 1 - drivers/usb/device/Kconfig | 7 ------- drivers/usb/device/usb_dc_stm32.c | 4 ++-- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/boards/arm/olimexino_stm32/Kconfig.board b/boards/arm/olimexino_stm32/Kconfig.board index 163bba9fe43..902efe68813 100644 --- a/boards/arm/olimexino_stm32/Kconfig.board +++ b/boards/arm/olimexino_stm32/Kconfig.board @@ -6,4 +6,3 @@ config BOARD_OLIMEXINO_STM32 bool "OLIMEXINO-STM32 Development Board" depends on SOC_STM32F103XB - select USB_DC_STM32_DISCONN_ENABLE if USB_DEVICE_DRIVER diff --git a/drivers/usb/device/Kconfig b/drivers/usb/device/Kconfig index 4b32ff08aa1..ba11aeb820d 100644 --- a/drivers/usb/device/Kconfig +++ b/drivers/usb/device/Kconfig @@ -50,13 +50,6 @@ config USB_DC_STM32 Enable USB support on the STM32 F0, F1, F2, F3, F4, F7, L0, L4, G4, U5 family of processors. -config USB_DC_STM32_DISCONN_ENABLE - bool - depends on USB_DC_STM32 - help - Say Y if your board uses USB DISCONNECT pin to enable the - pull-up resistor on USB DP. - config USB_DC_SAM0 bool "SAM0 series USB Device Controller driver" default y diff --git a/drivers/usb/device/usb_dc_stm32.c b/drivers/usb/device/usb_dc_stm32.c index 6854dc803cc..21f451619eb 100644 --- a/drivers/usb/device/usb_dc_stm32.c +++ b/drivers/usb/device/usb_dc_stm32.c @@ -1099,7 +1099,7 @@ void HAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum) } } -#if (defined(USB) || defined(USB_DRD_FS)) && defined(CONFIG_USB_DC_STM32_DISCONN_ENABLE) +#if (defined(USB) || defined(USB_DRD_FS)) && DT_INST_NODE_HAS_PROP(0, disconnect_gpios) void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state) { const struct device *usb_disconnect; @@ -1112,4 +1112,4 @@ void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state) DT_GPIO_FLAGS(DT_INST(0, st_stm32_usb), disconnect_gpios) | (state ? GPIO_OUTPUT_ACTIVE : GPIO_OUTPUT_INACTIVE)); } -#endif /* USB && CONFIG_USB_DC_STM32_DISCONN_ENABLE */ +#endif /* USB && DT_INST_NODE_HAS_PROP(0, disconnect_gpios) */