@@ -2162,11 +2162,12 @@ static int udc_dwc2_init_controller(const struct device *dev)
21622162	}
21632163
21642164	/* Unmask interrupts */ 
2165- 	sys_write32 (USB_DWC2_GINTSTS_OEPINT  | USB_DWC2_GINTSTS_IEPINT  |
2165+ 	sys_write32 (IF_ENABLED (CONFIG_UDC_ENABLE_SOF , (USB_DWC2_GINTSTS_SOF  |
2166+ 						       USB_DWC2_GINTSTS_INCOMPISOOUT  |
2167+ 						       USB_DWC2_GINTSTS_INCOMPISOIN  |
2168+ 		    USB_DWC2_GINTSTS_OEPINT  | USB_DWC2_GINTSTS_IEPINT  |
21662169		    USB_DWC2_GINTSTS_ENUMDONE  | USB_DWC2_GINTSTS_USBRST  |
2167- 		    USB_DWC2_GINTSTS_WKUPINT  | USB_DWC2_GINTSTS_USBSUSP  |
2168- 		    USB_DWC2_GINTSTS_INCOMPISOOUT  | USB_DWC2_GINTSTS_INCOMPISOIN  |
2169- 		    USB_DWC2_GINTSTS_SOF ,
2170+ 		    USB_DWC2_GINTSTS_WKUPINT  | USB_DWC2_GINTSTS_USBSUSP ,
21702171		    (mem_addr_t )& base -> gintmsk );
21712172
21722173	return  0 ;
@@ -2890,15 +2891,16 @@ static void udc_dwc2_isr_handler(const struct device *dev)
28902891
28912892		LOG_DBG ("GINTSTS 0x%x" , int_status );
28922893
2893- 		if  (int_status  &  USB_DWC2_GINTSTS_SOF ) {
2894+ 		if  (IS_ENABLED (CONFIG_UDC_ENABLE_SOF ) && 
2895+ 		    int_status  &  USB_DWC2_GINTSTS_SOF ) {
28942896			uint32_t  dsts ;
28952897
28962898			/* Clear USB SOF interrupt. */ 
28972899			sys_write32 (USB_DWC2_GINTSTS_SOF , gintsts_reg );
28982900
28992901			dsts  =  sys_read32 ((mem_addr_t )& base -> dsts );
29002902			priv -> sof_num  =  usb_dwc2_get_dsts_soffn (dsts );
2901- 			udc_submit_event (dev ,  UDC_EVT_SOF ,  0 );
2903+ 			udc_submit_sof_event (dev );
29022904		}
29032905
29042906		if  (int_status  &  USB_DWC2_GINTSTS_USBRST ) {
@@ -2941,11 +2943,13 @@ static void udc_dwc2_isr_handler(const struct device *dev)
29412943			dwc2_handle_oepint (dev );
29422944		}
29432945
2944- 		if  (int_status  &  USB_DWC2_GINTSTS_INCOMPISOIN ) {
2946+ 		if  (IS_ENABLED (CONFIG_UDC_ENABLE_SOF ) && 
2947+ 		    int_status  &  USB_DWC2_GINTSTS_INCOMPISOIN ) {
29452948			dwc2_handle_incompisoin (dev );
29462949		}
29472950
2948- 		if  (int_status  &  USB_DWC2_GINTSTS_INCOMPISOOUT ) {
2951+ 		if  (IS_ENABLED (CONFIG_UDC_ENABLE_SOF ) && 
2952+ 		    int_status  &  USB_DWC2_GINTSTS_INCOMPISOOUT ) {
29492953			dwc2_handle_incompisoout (dev );
29502954		}
29512955
0 commit comments