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>
This commit is contained in:
Chris Collins 2022-05-19 15:13:31 +10:00 committed by Marti Bolivar
commit ce84c782dc
3 changed files with 2 additions and 10 deletions

View file

@ -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

View file

@ -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) */