MLK-10490 usb: chipidea: otg_fsm: update b_sess_vld after changes to be b_idle
authorLi Jun <jun.li@freescale.com>
Fri, 27 Mar 2015 06:46:20 +0000 (14:46 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:47:05 +0000 (14:47 -0500)
In a corner case: system suspend with usb device connected on OTG port, then
remove usb device and connect OTG port to PC, and then resume the system,
OTG cannot be enumrated by PC. Reason is there is no BSV irq generated after
resume, so b_sess_vld cannot be updated and otg fsm state keeps in b_idle state
with vbus on, this patch force a update of b_sess_vld flag according to OTGSC
BSV status.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit 0c1a70a95e4f8ef069e4a9809a447a39f36d0628)

drivers/usb/chipidea/otg_fsm.c

index c683569..63701d1 100644 (file)
@@ -646,6 +646,7 @@ int ci_otg_fsm_work(struct ci_hdrc *ci)
                        if (ci->id_event)
                                ci->id_event = false;
                } else if (ci->fsm.otg->state == OTG_STATE_B_IDLE) {
+                       ci->fsm.b_sess_vld = hw_read_otgsc(ci, OTGSC_BSV);
                        if (ci->fsm.b_sess_vld) {
                                ci->fsm.power_up = 0;
                                /*