Thanks to Yousaf, the latest dwc2 code from latest testing/next works well for both gadget and host. When remove the usb, it will switch to host mode by default. However, at this time, I found too much sof generating in our platform, if no device attached. 1, usb gadget, 2, remove usb, 3, cat /proc/interrupt, then too much usb interrupt generated quickly. Same phenomenon if setting usb host to low speed and attach usb disk or keyboard. 1, usb gadget, 2, remove usb, 3. attach usb keyboard 4, cat /proc/interrupt, then too much usb interrupt generated quickly. usb_hcd_submit_urb { if (is_root_hub(urb->dev)) { status = rh_urb_enqueue(hcd, urb); } else { status = hcd->driver->urb_enqueue(hcd, urb, mem_flags); } } dwc2_hcd_qh_add { if (!hsotg->periodic_qh_count) { intr_mask = readl(hsotg->regs + GINTMSK); intr_mask |= GINTSTS_SOF; writel(intr_mask, hsotg->regs + GINTMSK); } } When usb is removed, urb->dev->parent will be generated after usb 1-1: new full-speed USB device number 2 using dwc2 Then the next USB_ENDPOINT_XFER_INT will set GINTSTS_SOF, and will cause sof since then. I am wandering is it expected behavior or abnormal behavior, the sof interrupt is generated too quickly. Besides, the dwc2 controller is 2.93a, 0xf72c0040 = 0x4F54300A Thanks -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html