usb: dwc_otg_310: fix usb devices reconnect failed

Sometimes we found the usb device could not connect to the HUBs when
the cable plug in and out constantly, the root cause is "USB RESET"
was missed from these HUBs, and we only try 2 times to reconnect.

This patch as one workaround to increase reconnect times to 6, and
add the delay time (3.5ms-4ms) after DCTL.SftDiscon bit was clear.

Change-Id: I57cfe5dc68e6d3d67c20771423dae29542ed047d
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
This commit is contained in:
Frank Wang
2017-07-10 09:22:35 +08:00
committed by Tao Huang
parent 02ac9b28b5
commit 4b72b4c39f

View File

@@ -61,6 +61,9 @@
#include "dwc_otg_attr.h"
#include "usbdev_rk.h"
#define MAX_RECONNECT 6
static struct gadget_wrapper {
dwc_otg_pcd_t *pcd;
@@ -1532,6 +1535,7 @@ static void dwc_phy_reconnect(struct work_struct *work)
dctl.b.sftdiscon = 0;
DWC_WRITE_REG32(&core_if->dev_if->dev_global_regs->dctl,
dctl.d32);
usleep_range(3500, 4000);
printk
("*******************soft connect!!!*******************\n");
}
@@ -1661,11 +1665,11 @@ static void dwc_otg_pcd_check_vbus_work(struct work_struct *work)
udelay(3);
pldata->clock_enable(pldata, 0);
}
} else if ((_pcd->conn_en) && (_pcd->conn_status >= 0)
&& (_pcd->conn_status < 2)) {
} else if ((_pcd->conn_en) && (_pcd->conn_status >= 0) &&
(_pcd->conn_status < MAX_RECONNECT)) {
printk("**************soft reconnect**************\n");
goto connect;
} else if (_pcd->conn_status == 2) {
} else if (_pcd->conn_status == MAX_RECONNECT) {
_pcd->conn_status++;
if (pldata->bc_detect_cb && iddig) {