From 364682a772af5c182f2d49a17a54f626020d34cd Mon Sep 17 00:00:00 2001 From: William Wu Date: Thu, 30 Nov 2017 10:30:16 +0800 Subject: [PATCH] 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 Signed-off-by: Frank Wang --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index 16537da2d7b8..ce46a9063f7d 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -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: