Skip to content

Commit bd9d7a7

Browse files
committed
drivers: udc: stm32: set the hs capability if high speed is available
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]>
1 parent 700e9fb commit bd9d7a7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/usb/udc/udc_stm32.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ struct udc_stm32_config {
5858
uint32_t dram_size;
5959
uint16_t ep0_mps;
6060
uint16_t ep_mps;
61+
int speed_idx;
6162
};
6263

6364
enum udc_stm32_msg_type {
@@ -960,6 +961,7 @@ static const struct udc_stm32_config udc0_cfg = {
960961
.pma_offset = USB_BTABLE_SIZE,
961962
.ep0_mps = EP0_MPS,
962963
.ep_mps = EP_MPS,
964+
.speed_idx = DT_ENUM_IDX_OR(DT_DRV_INST(0), maximum_speed, 1),
963965
};
964966

965967
#if defined(USB_OTG_FS) || defined(USB_OTG_HS)
@@ -1255,6 +1257,9 @@ static int udc_stm32_driver_init0(const struct device *dev)
12551257
data->caps.rwup = true;
12561258
data->caps.out_ack = false;
12571259
data->caps.mps0 = UDC_MPS0_64;
1260+
if (cfg->speed_idx == 2) {
1261+
data->caps.hs = true;
1262+
}
12581263

12591264
priv->dev = dev;
12601265
priv->irq = UDC_STM32_IRQ;

0 commit comments

Comments
 (0)