usb: dwc3: fix slow connection in gadget mode

This patch fix the bug that if the property maximum-speed of dwc3 is
configured to high-speed in DTS, gadget connection will be slow.

Before gadget connection, it is necessary to write register DCFG to set
maximum speed, if you don't, dwc3 will generate Erratic Error Event many
times and results to slow connection. Actually, maximum speed will be
set when Android layer call udc_bind_to_driver but it will fail when
dwc3 runtime-suspended. For Rockchip SoCs, dwc3 will be suspended as long
as USB cable is unplugged, so we add udc_set_speed before dwc3 runtime
resume.

Change-Id: I261c2cf9a36179a8d600f223fc8fd4757c7f622d
Signed-off-by: Jianing Ren <jianing.ren@rock-chips.com>
This commit is contained in:
Jianing Ren
2020-03-20 17:50:30 +08:00
committed by Tao Huang
parent cb3db5f6a5
commit cd60d2b861

View File

@@ -252,6 +252,8 @@ runtime:
PHY_MODE_USB_DEVICE);
phy_set_mode(dwc->usb3_generic_phy,
PHY_MODE_USB_DEVICE);
dwc->gadget.ops->udc_set_speed(&dwc->gadget,
dwc->maximum_speed);
break;
case DWC3_GCTL_PRTCAP_OTG:
break;