MLK-9606-5 usb: chipidea: otg: test: end test session if otg_vbus_off is set
authorLi Jun <B47624@freescale.com>
Wed, 24 Sep 2014 06:46:00 +0000 (14:46 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:47:11 +0000 (14:47 -0500)
When the connected otg test device disconnects before test maintain timer
expires, A device should end the session if otg_vbus_off is set; and do
a_wait_bcon if otg_vbus_off is not set.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit 204fa72fe4e2be468fe61f1ede555e072610c932)
(cherry picked from commit 202ce199bd29093d20506a950748acd5323e76fa)

drivers/usb/chipidea/otg_fsm.c

index 7e2fca1..94dc741 100644 (file)
@@ -754,6 +754,15 @@ static void ci_otg_fsm_event(struct ci_hdrc *ci)
        case OTG_STATE_A_HOST:
                if ((intr_sts & USBi_PCI) && !port_conn) {
                        fsm->b_conn = 0;
+                       if (fsm->tst_maint) {
+                               ci_otg_del_timer(ci, A_TST_MAINT);
+                               if (fsm->otg_vbus_off) {
+                                       fsm->a_bus_req = 0;
+                                       fsm->a_bus_drop = 1;
+                                       fsm->otg_vbus_off = 0;
+                               }
+                               fsm->tst_maint = 0;
+                       }
                        ci_otg_queue_work(ci);
                }
                break;