Skip to content

Commit 00cc444

Browse files
kbidanikartben
authored andcommitted
drivers: usb: udc_stm32: Update UDC speed macros
Updated UDC speed definition macros for STM32 series to handle different speed configurations based on the SoC compatibility. Added conditional checks for full-speed definitions using DT_HAS_COMPAT_STATUS_OKAY for st_stm32_usb. Signed-off-by: Khaoula Bidani <khaoula.bidani-ext@st.com> Signed-off-by: IBEN EL HADJ MESSAOUD Marwa <marwa.ibenelhadjmessaoud-ext@st.com>
1 parent 5f3fce6 commit 00cc444

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

drivers/usb/udc/udc_stm32.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,16 @@ LOG_MODULE_REGISTER(udc_stm32, CONFIG_UDC_DRIVER_LOG_LEVEL);
4545
* DT property to the corresponding definition used by the STM32 HAL.
4646
*/
4747
#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(USB_OTG_HS_EMB_PHY)
48-
#define HIGH_SPEED USB_OTG_SPEED_HIGH_IN_FULL
48+
#define UDC_STM32_HIGH_SPEED USB_OTG_SPEED_HIGH_IN_FULL
4949
#else
50-
#define HIGH_SPEED USB_OTG_SPEED_HIGH
50+
#define UDC_STM32_HIGH_SPEED USB_OTG_SPEED_HIGH
5151
#endif
5252

53-
#define FULL_SPEED USB_OTG_SPEED_FULL
53+
#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_usb)
54+
#define UDC_STM32_FULL_SPEED PCD_SPEED_FULL
55+
#else
56+
#define UDC_STM32_FULL_SPEED USB_OTG_SPEED_FULL
57+
#endif
5458

5559
struct udc_stm32_data {
5660
PCD_HandleTypeDef pcd;
@@ -990,7 +994,7 @@ static void priv_pcd_prepare(const struct device *dev)
990994
/* Default values */
991995
priv->pcd.Init.dev_endpoints = cfg->num_endpoints;
992996
priv->pcd.Init.ep0_mps = cfg->ep0_mps;
993-
priv->pcd.Init.speed = DT_INST_STRING_UPPER_TOKEN(0, maximum_speed);
997+
priv->pcd.Init.speed = UTIL_CAT(UDC_STM32_, DT_INST_STRING_UPPER_TOKEN(0, maximum_speed));
994998

995999
/* Per controller/Phy values */
9961000
#if defined(USB)

0 commit comments

Comments
 (0)