{
struct rockchip_usb2phy_port *rport = phy_get_drvdata(phy);
struct rockchip_usb2phy *rphy = dev_get_drvdata(phy->dev.parent);
- int ret;
+ int ret = 0;
mutex_lock(&rport->mutex);
- if (rport->port_id == USB2PHY_PORT_OTG &&
- rport->mode != USB_DR_MODE_HOST) {
- /* clear bvalid status and enable bvalid detect irq */
- ret = property_enable(rphy,
- &rport->port_cfg->bvalid_det_clr, true);
- if (ret)
- goto err;
-
- ret = property_enable(rphy,
- &rport->port_cfg->bvalid_det_en, true);
- if (ret)
- goto err;
+ if (rport->port_id == USB2PHY_PORT_OTG) {
+ if (rport->mode != USB_DR_MODE_HOST) {
+ /* clear bvalid status and enable bvalid detect irq */
+ ret = property_enable(rphy,
+ &rport->port_cfg->bvalid_det_clr,
+ true);
+ if (ret)
+ goto out;
- mutex_unlock(&rport->mutex);
- schedule_delayed_work(&rport->otg_sm_work, OTG_SCHEDULE_DELAY);
+ ret = property_enable(rphy,
+ &rport->port_cfg->bvalid_det_en,
+ true);
+ if (ret)
+ goto out;
+ schedule_delayed_work(&rport->otg_sm_work,
+ OTG_SCHEDULE_DELAY);
+ } else {
+ /* If OTG works in host only mode, do nothing. */
+ dev_dbg(&rport->phy->dev, "mode %d\n", rport->mode);
+ }
} else if (rport->port_id == USB2PHY_PORT_HOST) {
/* clear linestate and enable linestate detect irq */
ret = property_enable(rphy, &rport->port_cfg->ls_det_clr, true);
if (ret)
- goto err;
+ goto out;
ret = property_enable(rphy, &rport->port_cfg->ls_det_en, true);
if (ret)
- goto err;
+ goto out;
- mutex_unlock(&rport->mutex);
schedule_delayed_work(&rport->sm_work, SCHEDULE_DELAY);
}
- return 0;
-
-err:
+out:
mutex_unlock(&rport->mutex);
return ret;
}