phy: rockchip: inno-usb2: enable bvalid detect irq upon resume

The voltage domain of the usb2 phy grf interrupt mask
register usually belongs to the VD_LOGIC in most of
Rockchip SoCs. So if the VD_LOGIC is power off after
system suspend, the configuration of the usb2 phy grf
interrupt mask may lost when resume.

Test on RK3588 platform with micro usb2.0 interface,
if this case happened, the usb device failed to connect
to host, because the usb device depends on the bvalid
irq to start the enumeration.

This patch enable the bvalid detect irq upon resume
for otg port, and schedule the otg sm delayed work
if the bvalid is high which means that usb device has
connected to Host.

Change-Id: I29245ec4fc812e45eb3f52cc5c2c270b659a0cc6
Signed-off-by: William Wu <william.wu@rock-chips.com>
This commit is contained in:
William Wu
2023-07-10 11:16:06 +08:00
committed by Tao Huang
parent 01947f7dfd
commit bea83cc7bc

View File

@@ -3123,6 +3123,26 @@ static int rockchip_usb2phy_pm_resume(struct device *dev)
}
}
/* Enable bvalid detect irq */
if (rport->port_id == USB2PHY_PORT_OTG &&
(rport->mode == USB_DR_MODE_PERIPHERAL ||
rport->mode == USB_DR_MODE_OTG) &&
(rport->bvalid_irq > 0 || rport->otg_mux_irq > 0 || rphy->irq > 0) &&
!rport->vbus_always_on) {
ret = rockchip_usb2phy_enable_vbus_irq(rphy, rport,
true);
if (ret) {
dev_err(rphy->dev,
"failed to enable bvalid irq\n");
return ret;
}
if (property_enabled(rphy->grf, &rport->port_cfg->utmi_bvalid))
schedule_delayed_work(&rport->otg_sm_work,
OTG_SCHEDULE_DELAY);
}
if (rport->port_id == USB2PHY_PORT_OTG && wakeup_enable &&
rport->bvalid_irq > 0)
disable_irq_wake(rport->bvalid_irq);