Hello, This patchset introduces OTG feature in DWC3 DRD driver. This allows to change dynamically between host and peripheral mode depending on detected USB cable type. DWC3 driver behaviour is changed only in situation when selected operation mode (dr_mode) is "otg", and hardware OTG support is available or extended OTG operations are supplied for given platform. It such conditions are fulfilled, none of modes is enabled by default and dwc3 core Best regards, Robert Baldygais being uninitialized. After USB cable detection relevant mode is selected and dwc3 core is initialized. Cable disconnection causes deinitialization of dwc3 core. File otg.c is inspired by code of DWC3 driver from Hardkernel linux sources [1]. I have never tested it on DWC3 version equipped with hardware OTG support, but I belive that this code have chance to work or at least it's easy to fix. I have tested this on OdroidXU3 board which has USB cable detection mechanism based on two gpio pins. I used extcon driver for those feature, which is also attached to following patchset. I consider if ext_otg_ops it the right solution. Current solution is based on Hardkernel sources, but it's very likely that adding extcon support directly to otg.c would be generic enough, as most of cable detection mechanisms can be simply represented by extcon devices. Thanks in advance for your comments. Best regards, Robert Baldyga [1] https://github.com/hardkernel/linux Robert Baldyga (19): extcon: add extcon-odroid-usbotg driver dt-bindings: extcon: Add doc for extcon-odroid-usbotg ARM: dts: exynos5422-odroidxu3: add odroid-usbotg extcon support dwc3: gadget: add VBUS session handling dwc3: gadget: enable/disable ep0 in dwc3_gadget_run_stop() dwc3: gadget: check returned value in suspend/resume dwc3: core: cleanup suspend/resume code dwc3: core: handle event buffers in core_init/exit dwc3: core: make dwc3_core_init/exit non-static dwc3: add missing OTG register definitions dwc3: add OTG handling code dwc3: otg: add ext_otg_ops support dwc3: gadget: register gadget in OTG core dwc3: host: don't add XHCI device only if in OTG mode dwc3: core: initialize OTG in DWC3 core dwc3: exynos: add software role switching code ARM: dts: exynos5420: set usb3_lpm_capable in dwc3 controllers ARM: dts: exynos5420: add snps,dis_u3_susphy_quirk to dwc3 controllers ARM: dts: exynos5422-odroidxu3: make usbdrd3 extcon client .../bindings/extcon/extcon-odroid-usbotg.txt | 16 + .../devicetree/bindings/usb/exynos-usb.txt | 4 + arch/arm/boot/dts/exynos5420.dtsi | 6 + arch/arm/boot/dts/exynos5422-odroidxu3.dts | 24 + drivers/extcon/Kconfig | 4 + drivers/extcon/Makefile | 1 + drivers/extcon/extcon-odroid-usbotg.c | 257 +++++++++ drivers/usb/dwc3/Kconfig | 1 + drivers/usb/dwc3/Makefile | 4 + drivers/usb/dwc3/core.c | 66 ++- drivers/usb/dwc3/core.h | 22 + drivers/usb/dwc3/dwc3-exynos.c | 162 ++++++ drivers/usb/dwc3/gadget.c | 106 ++-- drivers/usb/dwc3/host.c | 10 +- drivers/usb/dwc3/otg.c | 577 +++++++++++++++++++++ drivers/usb/dwc3/otg.h | 113 ++++ 16 files changed, 1320 insertions(+), 53 deletions(-) create mode 100644 Documentation/devicetree/bindings/extcon/extcon-odroid-usbotg.txt create mode 100644 drivers/extcon/extcon-odroid-usbotg.c create mode 100644 drivers/usb/dwc3/otg.c create mode 100644 drivers/usb/dwc3/otg.h -- 1.9.1 -- 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