Skip to content

Commit

Permalink
drivers: usb: stm32: add disconnect gpio support
Browse files Browse the repository at this point in the history
Add support for GPIO controlled disconnect pullups. This is used in F1
based devices, copied from the legacy driver.

Signed-off-by: Fabio Baltieri <[email protected]>
  • Loading branch information
fabiobaltieri committed Jun 11, 2024
1 parent 4d6c059 commit 4d2e464
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/usb/udc/udc_stm32.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,16 @@ void HAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
}
}

#if DT_INST_NODE_HAS_PROP(0, disconnect_gpios)
void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state)
{
struct gpio_dt_spec usb_disconnect = GPIO_DT_SPEC_INST_GET(0, disconnect_gpios);

gpio_pin_configure_dt(&usb_disconnect,
state ? GPIO_OUTPUT_ACTIVE : GPIO_OUTPUT_INACTIVE);
}
#endif

static void udc_stm32_irq(const struct device *dev)
{
const struct udc_stm32_data *priv = udc_get_private(dev);
Expand Down

0 comments on commit 4d2e464

Please sign in to comment.