mirror of
https://github.com/hardkernel/linux.git
synced 2026-04-11 15:38:07 +09:00
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>