Merge "usb: dwc3-msm: Try core reset and reinit if PHY PLL lock fails"

This commit is contained in:
Linux Build Service Account 2019-09-23 15:28:27 -07:00 committed by Gerrit - the friendly Code Review server
commit c932d4ad3d
2 changed files with 23 additions and 2 deletions

View file

@ -276,6 +276,8 @@ struct dwc3_msm {
struct mutex suspend_resume_mutex;
enum usb_device_speed override_usb_speed;
bool core_init_failed;
};
#define USB_HSPHY_3P3_VOL_MIN 3050000 /* uV */
@ -1953,12 +1955,20 @@ static void dwc3_msm_power_collapse_por(struct dwc3_msm *mdwc)
ret = dwc3_core_pre_init(dwc);
if (ret) {
dev_err(mdwc->dev, "dwc3_core_pre_init failed\n");
mdwc->core_init_failed = true;
return;
}
mdwc->init = true;
}
dwc3_core_init(dwc);
ret = dwc3_core_init(dwc);
if (ret) {
dev_err(mdwc->dev, "dwc3_core_init failed\n");
mdwc->core_init_failed = true;
return;
}
mdwc->core_init_failed = false;
/* Re-configure event buffers */
dwc3_event_buffers_setup(dwc);
@ -3602,6 +3612,12 @@ static int dwc3_otg_start_host(struct dwc3_msm *mdwc, int on)
dev_dbg(mdwc->dev, "%s: turn on host\n", __func__);
pm_runtime_get_sync(mdwc->dev);
if (mdwc->core_init_failed) {
dev_err(mdwc->dev, "%s: Core init failed\n", __func__);
pm_runtime_put_sync_suspend(mdwc->dev);
return -EAGAIN;
}
mdwc->hs_phy->flags |= PHY_HOST_MODE;
if (dwc->maximum_speed == USB_SPEED_SUPER) {
mdwc->ss_phy->flags |= PHY_HOST_MODE;
@ -4075,6 +4091,10 @@ static void dwc3_otg_sm_work(struct work_struct *w)
delay = VBUS_REG_CHECK_DELAY;
work = 1;
mdwc->vbus_retry_count++;
} else if (ret == -EAGAIN) {
mdwc->drd_state = DRD_STATE_HOST_IDLE;
dev_dbg(mdwc->dev, "Core init failed. Retrying...\n");
work = 1;
} else if (ret) {
dev_err(mdwc->dev, "unable to start host\n");
mdwc->drd_state = DRD_STATE_HOST_IDLE;

View file

@ -862,7 +862,7 @@ static int qusb_phy_init(struct usb_phy *phy)
wmb();
/* Required to get PHY PLL lock successfully */
usleep_range(100, 110);
usleep_range(50000, 51000);
}
if (qphy->major_rev < 2) {
@ -881,6 +881,7 @@ static int qusb_phy_init(struct usb_phy *phy)
if (pll_lock_fail) {
dev_err(phy->dev, "QUSB PHY PLL LOCK fails:%x\n", reg);
WARN_ON(1);
return -ETIMEDOUT;
}
return 0;