phy: rockchip: inno-usb2: fix miss line irq for rk3588

RK3588 platform may miss line irq if the line state is not in
SE0(D+ low, D- low) before usb controller call phy init function
and enable line irq.

To resolve this, when usb controller call phy init function, we
can clear host_disconnect state if the line state is not in SE0
which means there is an usb device connected to the port.

Signed-off-by: Jianwei Zheng <jianwei.zheng@rock-chips.com>
Change-Id: Icb3f1abd790f16ddd66bbc098e0c06cc5d922d86
This commit is contained in:
Jianwei Zheng
2022-09-07 10:06:00 +08:00
committed by Tao Huang
parent 1a5d2a8da4
commit adc69507ac

View File

@@ -746,6 +746,7 @@ static int rockchip_usb2phy_init(struct phy *phy)
struct rockchip_usb2phy_port *rport = phy_get_drvdata(phy);
struct rockchip_usb2phy *rphy = dev_get_drvdata(phy->dev.parent);
int ret = 0;
unsigned int ul, ul_mask;
mutex_lock(&rport->mutex);
@@ -779,7 +780,12 @@ static int rockchip_usb2phy_init(struct phy *phy)
}
} else if (rport->port_id == USB2PHY_PORT_HOST) {
if (rport->port_cfg->disfall_en.offset) {
rport->host_disconnect = true;
ret = regmap_read(rphy->grf, rport->port_cfg->utmi_ls.offset, &ul);
if (ret < 0)
goto out;
ul_mask = GENMASK(rport->port_cfg->utmi_ls.bitend,
rport->port_cfg->utmi_ls.bitstart);
rport->host_disconnect = (ul & ul_mask) == 0 ? true : false;
ret = rockchip_usb2phy_enable_host_disc_irq(rphy, rport, true);
if (ret) {
dev_err(rphy->dev, "failed to enable disconnect irq\n");