MLK-9638-6 usb: common: otg: test: clear otg_hnp_reqd flag when it's invalid
authorLi Jun <B47624@freescale.com>
Sat, 27 Sep 2014 13:33:29 +0000 (21:33 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:47:12 +0000 (14:47 -0500)
This patch clears otg_hnp_reqd feature related flags when the HNP test ends.
There are two otg fsm paths to end this feature request:
- b_peripheral --> b_wait_acon --> b_idle: we clear them when entering b_idle;
- b_peripheral --> b_wait_acon --> b_host --> b_peripheral : we clear them
  when leaving b_host.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit 39d25f04ed047e15f23b44e8465ce46257547df7)
(cherry picked from commit f92c4e5794a278946d3f4e7c8bc30e3e43a80c28)

drivers/usb/common/usb-otg-fsm.c

index 3478b16..279cb8f 100644 (file)
@@ -85,6 +85,10 @@ static void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state)
                fsm->b_ase0_brst_tmout = 0;
                break;
        case OTG_STATE_B_HOST:
+               if (fsm->otg_hnp_reqd) {
+                       fsm->otg_hnp_reqd = 0;
+                       fsm->b_bus_req = 0;
+               }
                break;
        case OTG_STATE_A_IDLE:
                fsm->adp_prb = 0;
@@ -229,6 +233,10 @@ static int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state)
                otg_start_adp_sns(fsm);
                otg_set_protocol(fsm, PROTO_UNDEF);
                otg_add_timer(fsm, B_SE0_SRP);
+               if (fsm->otg_hnp_reqd) {
+                       fsm->otg_hnp_reqd = 0;
+                       fsm->b_bus_req = 0;
+               }
                break;
        case OTG_STATE_B_SRP_INIT:
                otg_start_pulse(fsm);