phy: rockchip: inno-usb2: delay power off phy when unplug otg host

If the OTG work in Host mode, delay power off phy in OTG_STATE_B_IDLE
state when unplug OTG cable, this can fix the xHCI deregistered error
with the following log on RK356x platforms:

[   16.856295] xhci-hcd xhci-hcd.5.auto: remove, state 4
[   16.856340] usb usb8: USB disconnect, device number 1
[   16.857778] xhci-hcd xhci-hcd.5.auto: USB bus 8 deregistered
[   16.858108] xhci-hcd xhci-hcd.5.auto: remove, state 4
[   16.858146] usb usb7: USB disconnect, device number 1
[   16.878109] xhci-hcd xhci-hcd.5.auto: Host halt failed, -110
[   16.878151] xhci-hcd xhci-hcd.5.auto: Host controller not halted, aborting reset.
[   16.878853] xhci-hcd xhci-hcd.5.auto: USB bus 7 deregistered

Change-Id: I4467afdd3fe20839a9ec967624868ce3773e048c
Signed-off-by: William Wu <william.wu@rock-chips.com>
This commit is contained in:
William Wu
2021-02-01 20:30:59 +08:00
committed by Tao Huang
parent bc2fd405a7
commit 02a2f92e90

View File

@@ -1114,9 +1114,6 @@ static void rockchip_usb2phy_otg_sm_work(struct work_struct *work)
if (extcon_get_state(rphy->edev, EXTCON_USB_HOST) == 0) {
dev_dbg(&rport->phy->dev, "usb otg host disconnect\n");
rport->state = OTG_STATE_B_IDLE;
mutex_unlock(&rport->mutex);
rockchip_usb2phy_power_off(rport->phy);
mutex_lock(&rport->mutex);
sch_work = true;
} else {
mutex_unlock(&rport->mutex);