Skip to content

Commit 9ec7697

Browse files
FRASTMfabiobaltieri
authored andcommitted
drivers: usb: stm32 udc driver get the global otg interrupt
The global otg interrupt hs/fs is enabled by the udc_stm32 driver. Get it in the list of interrupts of the OTG node. Use UDC_STM32_IRQ naming. Signed-off-by: Francois Ramu <[email protected]>
1 parent 0f05f58 commit 9ec7697

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

drivers/usb/udc/udc_stm32.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,18 @@ LOG_MODULE_REGISTER(udc_stm32, CONFIG_UDC_DRIVER_LOG_LEVEL);
3131

3232
#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_otghs)
3333
#define DT_DRV_COMPAT st_stm32_otghs
34+
#define UDC_STM32_IRQ_NAME otghs
3435
#elif DT_HAS_COMPAT_STATUS_OKAY(st_stm32_otgfs)
3536
#define DT_DRV_COMPAT st_stm32_otgfs
37+
#define UDC_STM32_IRQ_NAME otgfs
3638
#elif DT_HAS_COMPAT_STATUS_OKAY(st_stm32_usb)
3739
#define DT_DRV_COMPAT st_stm32_usb
40+
#define UDC_STM32_IRQ_NAME usb
3841
#endif
3942

43+
#define UDC_STM32_IRQ DT_INST_IRQ_BY_NAME(0, UDC_STM32_IRQ_NAME, irq)
44+
#define UDC_STM32_IRQ_PRI DT_INST_IRQ_BY_NAME(0, UDC_STM32_IRQ_NAME, priority)
45+
4046
struct udc_stm32_data {
4147
PCD_HandleTypeDef pcd;
4248
const struct device *dev;
@@ -547,7 +553,7 @@ static int udc_stm32_disable(const struct device *dev)
547553
struct udc_stm32_data *priv = udc_get_private(dev);
548554
HAL_StatusTypeDef status;
549555

550-
irq_disable(DT_INST_IRQN(0));
556+
irq_disable(UDC_STM32_IRQ);
551557

552558
if (udc_ep_disable_internal(dev, USB_CONTROL_EP_OUT)) {
553559
LOG_ERR("Failed to disable control endpoint");
@@ -1124,12 +1130,12 @@ static int udc_stm32_driver_init0(const struct device *dev)
11241130
data->caps.mps0 = UDC_MPS0_64;
11251131

11261132
priv->dev = dev;
1127-
priv->irq = DT_INST_IRQN(0);
1133+
priv->irq = UDC_STM32_IRQ;
11281134
priv->clk_enable = priv_clock_enable;
11291135
priv->clk_disable = priv_clock_disable;
11301136
priv->pcd_prepare = priv_pcd_prepare;
11311137

1132-
IRQ_CONNECT(DT_INST_IRQN(0), DT_INST_IRQ(0, priority), udc_stm32_irq,
1138+
IRQ_CONNECT(UDC_STM32_IRQ, UDC_STM32_IRQ_PRI, udc_stm32_irq,
11331139
DEVICE_DT_INST_GET(0), 0);
11341140

11351141
err = pinctrl_apply_state(usb_pcfg, PINCTRL_STATE_DEFAULT);

0 commit comments

Comments
 (0)