usb: dwc3: gadget: add phy calibration during chirpk state

The USB2.0 OTG PHY of RV1126/1109 which is designed for lower power
consumption provides only 8.8mA current source on DM at chirpK state.
Multiplied by 45 Ohm host termination resistance, voltage is about 400mV.
If the threshold voltage of host is greater than 400mV, the high speed
handshake will fail and SoC communicate at full speed. So swing
calibration is necessary.

Because we use this interface for swing calibration. This patch also
disable phy calibration in setting host mode for rockchip platform.

Change-Id: Ic1c8bb6aac95b3d0d61d99becb4facea1bbecb25
Signed-off-by: Jianing Ren <jianing.ren@rock-chips.com>
This commit is contained in:
Jianing Ren
2020-06-05 15:02:03 +08:00
committed by Tao Huang
parent bbd4383092
commit 913d3c8e4f
2 changed files with 14 additions and 3 deletions

View File

@@ -171,7 +171,9 @@ static void __dwc3_set_mode(struct work_struct *work)
otg_set_vbus(dwc->usb2_phy->otg, true);
phy_set_mode(dwc->usb2_generic_phy, PHY_MODE_USB_HOST);
phy_set_mode(dwc->usb3_generic_phy, PHY_MODE_USB_HOST);
phy_calibrate(dwc->usb2_generic_phy);
if (!of_device_is_compatible(dwc->dev->parent->of_node,
"rockchip,rk3399-dwc3"))
phy_calibrate(dwc->usb2_generic_phy);
}
break;
case DWC3_GCTL_PRTCAP_DEVICE:
@@ -242,7 +244,10 @@ runtime:
PHY_MODE_USB_HOST);
phy_set_mode(dwc->usb3_generic_phy,
PHY_MODE_USB_HOST);
phy_calibrate(dwc->usb2_generic_phy);
if (!of_device_is_compatible(
dwc->dev->parent->of_node,
"rockchip,rk3399-dwc3"))
phy_calibrate(dwc->usb2_generic_phy);
}
break;
case DWC3_GCTL_PRTCAP_DEVICE:
@@ -1276,7 +1281,9 @@ static int dwc3_core_init_mode(struct dwc3 *dwc)
dev_err(dev, "failed to initialize host\n");
return ret;
}
phy_calibrate(dwc->usb2_generic_phy);
if (!of_device_is_compatible(dwc->dev->parent->of_node,
"rockchip,rk3399-dwc3"))
phy_calibrate(dwc->usb2_generic_phy);
break;
case USB_DR_MODE_OTG:
INIT_WORK(&dwc->drd_work, __dwc3_set_mode);

View File

@@ -2894,6 +2894,10 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc)
{
u32 reg;
if (of_device_is_compatible(dwc->dev->parent->of_node,
"rockchip,rk3399-dwc3"))
phy_calibrate(dwc->usb2_generic_phy);
/*
* WORKAROUND: DWC3 revisions <1.88a have an issue which
* would cause a missing Disconnect Event if there's a