dwc2: calls disconnect instead of reset on port reset

From: Andrey Konovalov
Date: Sat Aug 19 2023 - 20:31:21 EST


Hi Minas,

I have been testing Raw Gadget with the dwc2 UDC driver and stumbled
upon an issue related to how dwc2 behaves during USB port reset.

The problem is that dwc2 calls the gadget driver's ->disconnect()
callback when the port to which the device is connected gets reset by
the host (via SET_FEATURE/PORT_RESET). My expectation was that the
->reset() callback should be called instead.

I grepped the source code of dwc2, and it looks like dwc2 never calls
the ->reset() callback of the gadget driver, not via
usb_gadget_udc_reset() nor via call_gadget(..., reset).

I was wondering if it would be possible to add proper reset handling to dwc2?

This would make it possible to write UDC-agnostic gadgets with Raw
Gadget without adding special handing for this dwc2 behavior.

Thank you!