summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Jun <B47624@freescale.com>2014-11-04 20:12:31 +0800
committerLi Jun <jun.li@freescale.com>2015-01-21 22:11:11 +0800
commita857429fa53383df02314c5b72670e9c5cbe9bfc (patch)
tree1730afbad73858f99f0d6bfd3a1e7b890c930206
parent3a4d19586165d19975001caeb8697381379f666b (diff)
MLK-9794-2 usb: common: otg: clear host_request_flag when leaves peripheral
This patch clear host_request_flag when leaves peripheral state, instead of entering host state, this can make sure this flag can be cleared after try to do role switch, no matter the role switch succeeds or not. Acked-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Li Jun <b47624@freescale.com>
-rw-r--r--drivers/usb/common/usb-otg-fsm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c
index 0eb67580c756..296402b15cd0 100644
--- a/drivers/usb/common/usb-otg-fsm.c
+++ b/drivers/usb/common/usb-otg-fsm.c
@@ -78,6 +78,8 @@ static void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state)
fsm->b_srp_done = 0;
break;
case OTG_STATE_B_PERIPHERAL:
+ if (fsm->otg->gadget)
+ fsm->otg->gadget->host_request_flag = 0;
break;
case OTG_STATE_B_WAIT_ACON:
otg_del_timer(fsm, B_ASE0_BRST);
@@ -107,6 +109,8 @@ static void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state)
case OTG_STATE_A_PERIPHERAL:
otg_del_timer(fsm, A_BIDL_ADIS);
fsm->a_bidl_adis_tmout = 0;
+ if (fsm->otg->gadget)
+ fsm->otg->gadget->host_request_flag = 0;
break;
case OTG_STATE_A_WAIT_VFALL:
otg_del_timer(fsm, A_WAIT_VFALL);