Hi, Taking a simplistic approach this time. We don't use the OTG controller block at all. Instead we just rely on ID events via extcon framework. I tried to get rid of workqueue but unfortunately it causes too much pain when the UDC is unregistered. https://hastebin.com/upugaqogol.xml https://hastebin.com/yayaduqodo.xml So I've still kept the workqueue around. We also have debugfs role switching, but I don't yet see how we can use this for real testing as I still need to manually plug/unplug the USB cables (host vs device) to test switching :). v3: - restructure and simplify. Remove OTG controller code, only rely on extcon. cheers, -roger Roger Quadros (3): usb: udc: allow adding and removing the same gadget device usb: dwc3: make role-switching work with debugfs/mode usb: dwc3: Add dual-role support drivers/usb/dwc3/Makefile | 4 + drivers/usb/dwc3/core.c | 18 ++--- drivers/usb/dwc3/core.h | 22 ++++++ drivers/usb/dwc3/debugfs.c | 49 +++++++++++-- drivers/usb/dwc3/drd.c | 167 ++++++++++++++++++++++++++++++++++++++++++ drivers/usb/gadget/udc/core.c | 1 + 6 files changed, 242 insertions(+), 19 deletions(-) create mode 100644 drivers/usb/dwc3/drd.c -- 2.7.4 -- 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