From 5d37296663b00448f0d554d34186745f97c6f3be Mon Sep 17 00:00:00 2001 From: Li Jun Date: Thu, 18 Sep 2014 22:59:40 +0800 Subject: [PATCH] MLK-9618-2 usb: chipidea: otg: update is_b_host flag when setup&stop host This patch sets and clear is_b_host flag of usb_bus when start and stop host in chipidea host driver. Acked-by: Peter Chen Signed-off-by: Li Jun (cherry picked from commit c164e65922235efcacc3743a9719adc7a9ef7413) (cherry picked from commit f21e960aba9618c527650cfe3a69cc3ea583ac2a) --- drivers/usb/chipidea/host.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c index a4af6a4b6db5..e244e9b8229e 100644 --- a/drivers/usb/chipidea/host.c +++ b/drivers/usb/chipidea/host.c @@ -294,6 +294,13 @@ static int host_start(struct ci_hdrc *ci) } } + if (ci_otg_is_fsm_mode(ci)) { + if (ci->fsm.id && ci->fsm.otg->state <= OTG_STATE_B_HOST) + hcd->self.is_b_host = 1; + else + hcd->self.is_b_host = 0; + } + ret = usb_add_hcd(hcd, 0, 0); if (ret) { goto disable_reg; @@ -338,6 +345,8 @@ static void host_stop(struct ci_hdrc *ci) if (ci->platdata->reg_vbus && !ci_otg_is_fsm_mode(ci) && (ci->platdata->flags & CI_HDRC_TURN_VBUS_EARLY_ON)) regulator_disable(ci->platdata->reg_vbus); + if (hcd->self.is_b_host) + hcd->self.is_b_host = 0; } ci->hcd = NULL; ci->otg.host = NULL; -- 2.17.1