Skip to content

Commit

Permalink
drivers: udc: stm32: set the hs capability if high speed is available
Browse files Browse the repository at this point in the history
This fixes usbd_caps_speed(), which is used in sample_usbd_init, and the
documentation. Without it, no high speed configuration would be added.

Signed-off-by: Tobias Pisani <[email protected]>
  • Loading branch information
topisani committed Dec 7, 2024
1 parent 89c3a74 commit a383276
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/usb/udc/udc_stm32.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ struct udc_stm32_config {
uint32_t dram_size;
uint16_t ep0_mps;
uint16_t ep_mps;
int speed_idx;
};

enum udc_stm32_msg_kind {
Expand Down Expand Up @@ -911,6 +912,7 @@ static const struct udc_stm32_config udc0_cfg = {
.pma_offset = USB_BTABLE_SIZE,
.ep0_mps = EP0_MPS,
.ep_mps = EP_MPS,
.speed_idx = DT_ENUM_IDX_OR(DT_DRV_INST(0), maximum_speed, 1),
};

#if defined(USB_OTG_FS) || defined(USB_OTG_HS)
Expand Down Expand Up @@ -1203,6 +1205,9 @@ static int udc_stm32_driver_init0(const struct device *dev)
data->caps.rwup = true;
data->caps.out_ack = false;
data->caps.mps0 = UDC_MPS0_64;
if (cfg->speed_idx == 2) {
data->caps.hs = true;
}

priv->dev = dev;
priv->irq = UDC_STM32_IRQ;
Expand Down

0 comments on commit a383276

Please sign in to comment.