aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/chipidea/otg_fsm.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c
index ba90dc66703d..cb28e763f0b8 100644
--- a/drivers/usb/chipidea/otg_fsm.c
+++ b/drivers/usb/chipidea/otg_fsm.c
@@ -66,6 +66,11 @@ set_a_bus_req(struct device *dev, struct device_attribute *attr,
66 return count; 66 return count;
67 } 67 }
68 ci->fsm.a_bus_req = 1; 68 ci->fsm.a_bus_req = 1;
69 if (ci->fsm.otg->state == OTG_STATE_A_PERIPHERAL) {
70 ci->gadget.host_request_flag = 1;
71 mutex_unlock(&ci->fsm.lock);
72 return count;
73 }
69 } 74 }
70 75
71 ci_otg_queue_work(ci); 76 ci_otg_queue_work(ci);
@@ -144,8 +149,14 @@ set_b_bus_req(struct device *dev, struct device_attribute *attr,
144 mutex_lock(&ci->fsm.lock); 149 mutex_lock(&ci->fsm.lock);
145 if (buf[0] == '0') 150 if (buf[0] == '0')
146 ci->fsm.b_bus_req = 0; 151 ci->fsm.b_bus_req = 0;
147 else if (buf[0] == '1') 152 else if (buf[0] == '1') {
148 ci->fsm.b_bus_req = 1; 153 ci->fsm.b_bus_req = 1;
154 if (ci->fsm.otg->state == OTG_STATE_B_PERIPHERAL) {
155 ci->gadget.host_request_flag = 1;
156 mutex_unlock(&ci->fsm.lock);
157 return count;
158 }
159 }
149 160
150 ci_otg_queue_work(ci); 161 ci_otg_queue_work(ci);
151 mutex_unlock(&ci->fsm.lock); 162 mutex_unlock(&ci->fsm.lock);