MLK-11132 usb: chipidea: otg: delay suspend for a_wait_vfall
authorLi Jun <jun.li@freescale.com>
Fri, 19 Jun 2015 09:18:48 +0000 (17:18 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:47:16 +0000 (14:47 -0500)
While A device as peripheral ends session by a_bus_drop, it will go
back to host role by transition to a_wait_vfall state, then ehci
host driver may access portsc status after controller enters suspend
, this will result in system hang since its clock is gated off.
This patch use existing autosuspend to delay the controller suspend
if it comes to a_wait_vfall state.

Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit b140fa6803ef6ececec17e435212a960a3169cc2)

drivers/usb/chipidea/otg_fsm.c

index 170faa4..cfbb82f 100644 (file)
@@ -711,7 +711,8 @@ int ci_otg_fsm_work(struct ci_hdrc *ci)
                                 */
                                ci_otg_queue_work(ci);
                        }
-               } else if (ci->fsm.otg->state == OTG_STATE_A_HOST) {
+               } else if (ci->fsm.otg->state == OTG_STATE_A_HOST ||
+                       ci->fsm.otg->state == OTG_STATE_A_WAIT_VFALL) {
                        pm_runtime_mark_last_busy(ci->dev);
                        pm_runtime_put_autosuspend(ci->dev);
                        return 0;