phy: rockchip-inno-usb2: don't power off phy if connect to usb charger

The usb2 phy driver will power off phy if it detects
usb connecting with usb charger. And then it schedule
a delayed work to check the connection state until the
usb disconnect from usb charger.

On rockchip platform, the usb2 controller utmi clk and
480MHz clk come from usb2 phy, so if we power off the
usb2 phy, the usb2 controller should not be accessed.

However, it's difficult to synchronize the phy state
between the usb2 phy driver and usb2 controller. We
find one synchronization problem in the following
case:

1. Test on rk312x platform;
2. Connect otg port with usb charger, then do suspend/
   resume stress test.
3. We will find the following error log, and then the
   usb controller work abnormally.

   dwc2 10180000.usb: resuming usb gadget configfs-gadget
   dwc2 10180000.usb: dwc2_core_reset() HANG! Soft Reset GRSTCTL=80000001

This because in dwc2 driver, it will do dwc2 core reset
during resume, although it also power on usb2 phy before
do core reset, but the otg_sm_work in the usb2 phy driver
may power off the usb2 phy again asynchronously, this will
cause dwc2 core reset failure.

So we should not power off the usb2 phy if connect to
usb charger, this patch will increase the usb2 phy power
consumption in runtime, but it don't affect the power
consumption in system standby mode, because the usb
controller can power off phy by itself during suspend.

Change-Id: I3b05c06988b7939ebf949ced34b9a6bb37ffa42a
Signed-off-by: William Wu <william.wu@rock-chips.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
This commit is contained in:
William Wu
2017-11-30 10:30:16 +08:00
committed by Tao Huang
parent 4bffa7c5ea
commit 364682a772

View File

@@ -980,9 +980,6 @@ static void rockchip_usb2phy_otg_sm_work(struct work_struct *work)
case POWER_SUPPLY_TYPE_USB_DCP:
dev_dbg(&rport->phy->dev, "dcp cable is connected\n");
cable = EXTCON_CHG_USB_DCP;
mutex_unlock(&rport->mutex);
rockchip_usb2phy_power_off(rport->phy);
mutex_lock(&rport->mutex);
sch_work = true;
break;
case POWER_SUPPLY_TYPE_USB_CDP: