Skip to content

Commit

Permalink
drivers: usb: stm32 udc driver get the global otg interrupt
Browse files Browse the repository at this point in the history
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 <francois.ramu@st.com>
  • Loading branch information
FRASTM authored and fabiobaltieri committed Jul 30, 2024
1 parent 0f05f58 commit 9ec7697
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions drivers/usb/udc/udc_stm32.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,18 @@ LOG_MODULE_REGISTER(udc_stm32, CONFIG_UDC_DRIVER_LOG_LEVEL);

#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_otghs)
#define DT_DRV_COMPAT st_stm32_otghs
#define UDC_STM32_IRQ_NAME otghs
#elif DT_HAS_COMPAT_STATUS_OKAY(st_stm32_otgfs)
#define DT_DRV_COMPAT st_stm32_otgfs
#define UDC_STM32_IRQ_NAME otgfs
#elif DT_HAS_COMPAT_STATUS_OKAY(st_stm32_usb)
#define DT_DRV_COMPAT st_stm32_usb
#define UDC_STM32_IRQ_NAME usb
#endif

#define UDC_STM32_IRQ DT_INST_IRQ_BY_NAME(0, UDC_STM32_IRQ_NAME, irq)
#define UDC_STM32_IRQ_PRI DT_INST_IRQ_BY_NAME(0, UDC_STM32_IRQ_NAME, priority)

struct udc_stm32_data {
PCD_HandleTypeDef pcd;
const struct device *dev;
Expand Down Expand Up @@ -547,7 +553,7 @@ static int udc_stm32_disable(const struct device *dev)
struct udc_stm32_data *priv = udc_get_private(dev);
HAL_StatusTypeDef status;

irq_disable(DT_INST_IRQN(0));
irq_disable(UDC_STM32_IRQ);

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

priv->dev = dev;
priv->irq = DT_INST_IRQN(0);
priv->irq = UDC_STM32_IRQ;
priv->clk_enable = priv_clock_enable;
priv->clk_disable = priv_clock_disable;
priv->pcd_prepare = priv_pcd_prepare;

IRQ_CONNECT(DT_INST_IRQN(0), DT_INST_IRQ(0, priority), udc_stm32_irq,
IRQ_CONNECT(UDC_STM32_IRQ, UDC_STM32_IRQ_PRI, udc_stm32_irq,
DEVICE_DT_INST_GET(0), 0);

err = pinctrl_apply_state(usb_pcfg, PINCTRL_STATE_DEFAULT);
Expand Down

0 comments on commit 9ec7697

Please sign in to comment.