Skip to content

Commit

Permalink
drivers: udc_dwc2: enable SOF interrupts and SOF events
Browse files Browse the repository at this point in the history
Enable SOF interrupts and SOF events.

Signed-off-by: Johann Fischer <[email protected]>
  • Loading branch information
jfischer-no committed Feb 6, 2024
1 parent f6ecad2 commit 81317ce
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions drivers/usb/common/usb_dwc2_hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ USB_DWC2_SET_FIELD_DEFINE(grstctl_txfnum, GRSTCTL_TXFNUM)
#define USB_DWC2_GINTSTS_USBSUSP BIT(USB_DWC2_GINTSTS_USBSUSP_POS)
#define USB_DWC2_GINTSTS_RXFLVL_POS 4UL
#define USB_DWC2_GINTSTS_RXFLVL BIT(USB_DWC2_GINTSTS_RXFLVL_POS)
#define USB_DWC2_GINTSTS_SOF_POS 3UL
#define USB_DWC2_GINTSTS_SOF BIT(USB_DWC2_GINTSTS_SOF_POS)
#define USB_DWC2_GINTSTS_OTGINT_POS 2UL
#define USB_DWC2_GINTSTS_OTGINT BIT(USB_DWC2_GINTSTS_OTGINT_POS)

Expand Down
9 changes: 8 additions & 1 deletion drivers/usb/udc/udc_dwc2.c
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,12 @@ static void udc_dwc2_isr_handler(const struct device *dev)

LOG_DBG("GINTSTS 0x%x", int_status);

if (int_status & USB_DWC2_GINTSTS_SOF) {
/* Clear USB SOF interrupt. */
sys_write32(USB_DWC2_GINTSTS_SOF, gintsts_reg);
udc_submit_event(dev, UDC_EVT_SOF, 0);
}

if (int_status & USB_DWC2_GINTSTS_USBRST) {
/* Clear and handle USB Reset interrupt. */
sys_write32(USB_DWC2_GINTSTS_USBRST, gintsts_reg);
Expand Down Expand Up @@ -1541,7 +1547,8 @@ static int udc_dwc2_init(const struct device *dev)
/* Unmask interrupts */
sys_write32(USB_DWC2_GINTSTS_OEPINT | USB_DWC2_GINTSTS_IEPINT |
USB_DWC2_GINTSTS_ENUMDONE | USB_DWC2_GINTSTS_USBRST |
USB_DWC2_GINTSTS_WKUPINT | USB_DWC2_GINTSTS_USBSUSP,
USB_DWC2_GINTSTS_WKUPINT | USB_DWC2_GINTSTS_USBSUSP |
USB_DWC2_GINTSTS_SOF,
(mem_addr_t)&base->gintmsk);


Expand Down

0 comments on commit 81317ce

Please sign in to comment.