.. | .. |
---|
1767 | 1767 | if (property_enabled(rphy->grf, &rport->port_cfg->idfall_det_st)) { |
---|
1768 | 1768 | property_enable(rphy->grf, &rport->port_cfg->idfall_det_clr, |
---|
1769 | 1769 | true); |
---|
1770 | | - /* switch to host if id fall det and iddig status is low */ |
---|
1771 | | - if (!property_enabled(rphy->grf, &rport->port_cfg->utmi_iddig)) |
---|
| 1770 | + /* |
---|
| 1771 | + * if id fall det, switch to host if ID Detector pin is floating |
---|
| 1772 | + * or iddig status is low. |
---|
| 1773 | + */ |
---|
| 1774 | + if (!rport->port_cfg->utmi_iddig.enable || |
---|
| 1775 | + !property_enabled(rphy->grf, &rport->port_cfg->utmi_iddig)) |
---|
1772 | 1776 | cable_vbus_state = true; |
---|
1773 | 1777 | } else if (property_enabled(rphy->grf, &rport->port_cfg->idrise_det_st)) { |
---|
1774 | 1778 | property_enable(rphy->grf, &rport->port_cfg->idrise_det_clr, |
---|
.. | .. |
---|
3123 | 3127 | } |
---|
3124 | 3128 | } |
---|
3125 | 3129 | |
---|
| 3130 | + /* Enable bvalid detect irq */ |
---|
| 3131 | + if (rport->port_id == USB2PHY_PORT_OTG && |
---|
| 3132 | + (rport->mode == USB_DR_MODE_PERIPHERAL || |
---|
| 3133 | + rport->mode == USB_DR_MODE_OTG) && |
---|
| 3134 | + (rport->bvalid_irq > 0 || rport->otg_mux_irq > 0 || rphy->irq > 0) && |
---|
| 3135 | + !rport->vbus_always_on) { |
---|
| 3136 | + ret = rockchip_usb2phy_enable_vbus_irq(rphy, rport, |
---|
| 3137 | + true); |
---|
| 3138 | + if (ret) { |
---|
| 3139 | + dev_err(rphy->dev, |
---|
| 3140 | + "failed to enable bvalid irq\n"); |
---|
| 3141 | + return ret; |
---|
| 3142 | + } |
---|
| 3143 | + |
---|
| 3144 | + if (property_enabled(rphy->grf, &rport->port_cfg->utmi_bvalid)) |
---|
| 3145 | + schedule_delayed_work(&rport->otg_sm_work, |
---|
| 3146 | + OTG_SCHEDULE_DELAY); |
---|
| 3147 | + |
---|
| 3148 | + } |
---|
| 3149 | + |
---|
3126 | 3150 | if (rport->port_id == USB2PHY_PORT_OTG && wakeup_enable && |
---|
3127 | 3151 | rport->bvalid_irq > 0) |
---|
3128 | 3152 | disable_irq_wake(rport->bvalid_irq); |
---|
.. | .. |
---|
3408 | 3432 | .ls_det_clr = { 0x0118, 0, 0, 0, 1 }, |
---|
3409 | 3433 | .utmi_avalid = { 0x0120, 10, 10, 0, 1 }, |
---|
3410 | 3434 | .utmi_bvalid = { 0x0120, 9, 9, 0, 1 }, |
---|
3411 | | - .utmi_iddig = { 0x0120, 6, 6, 0, 1 }, |
---|
3412 | 3435 | .utmi_ls = { 0x0120, 5, 4, 0, 1 }, |
---|
3413 | 3436 | .vbus_det_en = { 0x001c, 15, 15, 1, 0 }, |
---|
3414 | 3437 | }, |
---|