dra7 OTG core limits the host controller to USB2.0 (high-speed) mode
when we're operating in dual-role.
We work around that by bypassing the OTG core and reading the
extcon framework directly for ID/VBUS events.
Signed-off-by: Roger Quadros <rogerq@xxxxxx>
---
Documentation/devicetree/bindings/usb/dwc3.txt | 2 +
drivers/usb/dwc3/core.c | 169 ++++++++++++++++++++++++-
drivers/usb/dwc3/core.h | 5 +
3 files changed, 170 insertions(+), 6 deletions(-)
diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt
index e3e6983..9955c0d 100644
--- a/Documentation/devicetree/bindings/usb/dwc3.txt
+++ b/Documentation/devicetree/bindings/usb/dwc3.txt
@@ -53,6 +53,8 @@ Optional properties:
- snps,quirk-frame-length-adjustment: Value for GFLADJ_30MHZ field of GFLADJ
register for post-silicon frame length adjustment when the
fladj_30mhz_sdbnd signal is invalid or incorrect.
+ - extcon: phandle to the USB connector extcon device. If present, extcon
+ device will be used to get USB cable events instead of OTG controller.
- <DEPRECATED> tx-fifo-resize: determines if the FIFO *has* to be reallocated.
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 619fa7c..b02d911 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -1587,6 +1727,14 @@ static int dwc3_probe(struct platform_device *pdev)
dwc3_get_properties(dwc);
+ if (dev->of_node) {
+ if (of_property_read_bool(dev->of_node, "extcon"))
+ dwc->edev = extcon_get_edev_by_phandle(dev, 0);
+
+ if (IS_ERR(dwc->edev))
+ return PTR_ERR(dwc->edev);