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 <chris@realsimgear.com>
diff --git a/boards/arm/olimexino_stm32/Kconfig.board b/boards/arm/olimexino_stm32/Kconfig.board
index 163bba9..902efe6 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 4b32ff0..ba11aeb 100644
--- a/drivers/usb/device/Kconfig
+++ b/drivers/usb/device/Kconfig
@@ -50,13 +50,6 @@
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 6854dc8..21f4516 100644
--- a/drivers/usb/device/usb_dc_stm32.c
+++ b/drivers/usb/device/usb_dc_stm32.c
@@ -1099,7 +1099,7 @@
}
}
-#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 @@
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) */