Lines Matching +full:otg +full:- +full:id
1 // SPDX-License-Identifier: GPL-2.0+
21 #include <linux/usb/otg.h>
26 #include "phy-mv-usb.h"
28 #define DRIVER_DESC "Marvell USB OTG transceiver driver"
33 static const char driver_name[] = "mv-otg";
52 static int mv_otg_set_vbus(struct usb_otg *otg, bool on) in mv_otg_set_vbus() argument
54 struct mv_otg *mvotg = container_of(otg->usb_phy, struct mv_otg, phy); in mv_otg_set_vbus()
55 if (mvotg->pdata->set_vbus == NULL) in mv_otg_set_vbus()
56 return -ENODEV; in mv_otg_set_vbus()
58 return mvotg->pdata->set_vbus(on); in mv_otg_set_vbus()
61 static int mv_otg_set_host(struct usb_otg *otg, in mv_otg_set_host() argument
64 otg->host = host; in mv_otg_set_host()
69 static int mv_otg_set_peripheral(struct usb_otg *otg, in mv_otg_set_peripheral() argument
72 otg->gadget = gadget; in mv_otg_set_peripheral()
80 dev_dbg(&mvotg->pdev->dev, "transceiver is updated\n"); in mv_otg_run_state_machine()
81 if (!mvotg->qwork) in mv_otg_run_state_machine()
84 queue_delayed_work(mvotg->qwork, &mvotg->work, delay); in mv_otg_run_state_machine()
92 mvotg->otg_ctrl.a_wait_bcon_timeout = 1; in mv_otg_timer_await_bcon()
94 dev_info(&mvotg->pdev->dev, "B Device No Response!\n"); in mv_otg_timer_await_bcon()
96 if (spin_trylock(&mvotg->wq_lock)) { in mv_otg_timer_await_bcon()
98 spin_unlock(&mvotg->wq_lock); in mv_otg_timer_await_bcon()
102 static int mv_otg_cancel_timer(struct mv_otg *mvotg, unsigned int id) in mv_otg_cancel_timer() argument
106 if (id >= OTG_TIMER_NUM) in mv_otg_cancel_timer()
107 return -EINVAL; in mv_otg_cancel_timer()
109 timer = &mvotg->otg_ctrl.timer[id]; in mv_otg_cancel_timer()
117 static int mv_otg_set_timer(struct mv_otg *mvotg, unsigned int id, in mv_otg_set_timer() argument
122 if (id >= OTG_TIMER_NUM) in mv_otg_set_timer()
123 return -EINVAL; in mv_otg_set_timer()
125 timer = &mvotg->otg_ctrl.timer[id]; in mv_otg_set_timer()
127 dev_err(&mvotg->pdev->dev, "Timer%d is already running\n", id); in mv_otg_set_timer()
128 return -EBUSY; in mv_otg_set_timer()
131 timer->expires = jiffies + interval; in mv_otg_set_timer()
143 tmp = readl(&mvotg->op_regs->usbcmd); in mv_otg_reset()
145 writel(tmp, &mvotg->op_regs->usbcmd); in mv_otg_reset()
148 writel(USBCMD_CTRL_RESET, &mvotg->op_regs->usbcmd); in mv_otg_reset()
150 ret = readl_poll_timeout_atomic(&mvotg->op_regs->usbcmd, tmp, in mv_otg_reset()
153 dev_err(&mvotg->pdev->dev, in mv_otg_reset()
158 writel(0x0, &mvotg->op_regs->usbintr); in mv_otg_reset()
159 tmp = readl(&mvotg->op_regs->usbsts); in mv_otg_reset()
160 writel(tmp, &mvotg->op_regs->usbsts); in mv_otg_reset()
169 mvotg->irq_en = OTGSC_INTR_A_SESSION_VALID in mv_otg_init_irq()
171 mvotg->irq_status = OTGSC_INTSTS_A_SESSION_VALID in mv_otg_init_irq()
174 if (mvotg->pdata->vbus == NULL) { in mv_otg_init_irq()
175 mvotg->irq_en |= OTGSC_INTR_B_SESSION_VALID in mv_otg_init_irq()
177 mvotg->irq_status |= OTGSC_INTSTS_B_SESSION_VALID in mv_otg_init_irq()
181 if (mvotg->pdata->id == NULL) { in mv_otg_init_irq()
182 mvotg->irq_en |= OTGSC_INTR_USB_ID; in mv_otg_init_irq()
183 mvotg->irq_status |= OTGSC_INTSTS_USB_ID; in mv_otg_init_irq()
186 otgsc = readl(&mvotg->op_regs->otgsc); in mv_otg_init_irq()
187 otgsc |= mvotg->irq_en; in mv_otg_init_irq()
188 writel(otgsc, &mvotg->op_regs->otgsc); in mv_otg_init_irq()
194 struct usb_otg *otg = mvotg->phy.otg; in mv_otg_start_host() local
197 if (!otg->host) in mv_otg_start_host()
200 dev_info(&mvotg->pdev->dev, "%s host\n", on ? "start" : "stop"); in mv_otg_start_host()
202 hcd = bus_to_hcd(otg->host); in mv_otg_start_host()
205 usb_add_hcd(hcd, hcd->irq, IRQF_SHARED); in mv_otg_start_host()
206 device_wakeup_enable(hcd->self.controller); in mv_otg_start_host()
215 struct usb_otg *otg = mvotg->phy.otg; in mv_otg_start_periphrals() local
217 if (!otg->gadget) in mv_otg_start_periphrals()
220 dev_info(mvotg->phy.dev, "gadget %s\n", on ? "on" : "off"); in mv_otg_start_periphrals()
223 usb_gadget_vbus_connect(otg->gadget); in mv_otg_start_periphrals()
225 usb_gadget_vbus_disconnect(otg->gadget); in mv_otg_start_periphrals()
230 clk_prepare_enable(mvotg->clk); in otg_clock_enable()
235 clk_disable_unprepare(mvotg->clk); in otg_clock_disable()
242 if (mvotg->active) in mv_otg_enable_internal()
245 dev_dbg(&mvotg->pdev->dev, "otg enabled\n"); in mv_otg_enable_internal()
248 if (mvotg->pdata->phy_init) { in mv_otg_enable_internal()
249 retval = mvotg->pdata->phy_init(mvotg->phy_regs); in mv_otg_enable_internal()
251 dev_err(&mvotg->pdev->dev, in mv_otg_enable_internal()
257 mvotg->active = 1; in mv_otg_enable_internal()
265 if (mvotg->clock_gating) in mv_otg_enable()
273 if (mvotg->active) { in mv_otg_disable_internal()
274 dev_dbg(&mvotg->pdev->dev, "otg disabled\n"); in mv_otg_disable_internal()
275 if (mvotg->pdata->phy_deinit) in mv_otg_disable_internal()
276 mvotg->pdata->phy_deinit(mvotg->phy_regs); in mv_otg_disable_internal()
278 mvotg->active = 0; in mv_otg_disable_internal()
284 if (mvotg->clock_gating) in mv_otg_disable()
290 struct mv_otg_ctrl *otg_ctrl = &mvotg->otg_ctrl; in mv_otg_update_inputs()
293 otgsc = readl(&mvotg->op_regs->otgsc); in mv_otg_update_inputs()
295 if (mvotg->pdata->vbus) { in mv_otg_update_inputs()
296 if (mvotg->pdata->vbus->poll() == VBUS_HIGH) { in mv_otg_update_inputs()
297 otg_ctrl->b_sess_vld = 1; in mv_otg_update_inputs()
298 otg_ctrl->b_sess_end = 0; in mv_otg_update_inputs()
300 otg_ctrl->b_sess_vld = 0; in mv_otg_update_inputs()
301 otg_ctrl->b_sess_end = 1; in mv_otg_update_inputs()
304 otg_ctrl->b_sess_vld = !!(otgsc & OTGSC_STS_B_SESSION_VALID); in mv_otg_update_inputs()
305 otg_ctrl->b_sess_end = !!(otgsc & OTGSC_STS_B_SESSION_END); in mv_otg_update_inputs()
308 if (mvotg->pdata->id) in mv_otg_update_inputs()
309 otg_ctrl->id = !!mvotg->pdata->id->poll(); in mv_otg_update_inputs()
311 otg_ctrl->id = !!(otgsc & OTGSC_STS_USB_ID); in mv_otg_update_inputs()
313 if (mvotg->pdata->otg_force_a_bus_req && !otg_ctrl->id) in mv_otg_update_inputs()
314 otg_ctrl->a_bus_req = 1; in mv_otg_update_inputs()
316 otg_ctrl->a_sess_vld = !!(otgsc & OTGSC_STS_A_SESSION_VALID); in mv_otg_update_inputs()
317 otg_ctrl->a_vbus_vld = !!(otgsc & OTGSC_STS_A_VBUS_VALID); in mv_otg_update_inputs()
319 dev_dbg(&mvotg->pdev->dev, "%s: ", __func__); in mv_otg_update_inputs()
320 dev_dbg(&mvotg->pdev->dev, "id %d\n", otg_ctrl->id); in mv_otg_update_inputs()
321 dev_dbg(&mvotg->pdev->dev, "b_sess_vld %d\n", otg_ctrl->b_sess_vld); in mv_otg_update_inputs()
322 dev_dbg(&mvotg->pdev->dev, "b_sess_end %d\n", otg_ctrl->b_sess_end); in mv_otg_update_inputs()
323 dev_dbg(&mvotg->pdev->dev, "a_vbus_vld %d\n", otg_ctrl->a_vbus_vld); in mv_otg_update_inputs()
324 dev_dbg(&mvotg->pdev->dev, "a_sess_vld %d\n", otg_ctrl->a_sess_vld); in mv_otg_update_inputs()
329 struct mv_otg_ctrl *otg_ctrl = &mvotg->otg_ctrl; in mv_otg_update_state()
330 int old_state = mvotg->phy.otg->state; in mv_otg_update_state()
334 mvotg->phy.otg->state = OTG_STATE_B_IDLE; in mv_otg_update_state()
337 if (otg_ctrl->id == 0) in mv_otg_update_state()
338 mvotg->phy.otg->state = OTG_STATE_A_IDLE; in mv_otg_update_state()
339 else if (otg_ctrl->b_sess_vld) in mv_otg_update_state()
340 mvotg->phy.otg->state = OTG_STATE_B_PERIPHERAL; in mv_otg_update_state()
343 if (!otg_ctrl->b_sess_vld || otg_ctrl->id == 0) in mv_otg_update_state()
344 mvotg->phy.otg->state = OTG_STATE_B_IDLE; in mv_otg_update_state()
347 if (otg_ctrl->id) in mv_otg_update_state()
348 mvotg->phy.otg->state = OTG_STATE_B_IDLE; in mv_otg_update_state()
349 else if (!(otg_ctrl->a_bus_drop) && in mv_otg_update_state()
350 (otg_ctrl->a_bus_req || otg_ctrl->a_srp_det)) in mv_otg_update_state()
351 mvotg->phy.otg->state = OTG_STATE_A_WAIT_VRISE; in mv_otg_update_state()
354 if (otg_ctrl->a_vbus_vld) in mv_otg_update_state()
355 mvotg->phy.otg->state = OTG_STATE_A_WAIT_BCON; in mv_otg_update_state()
358 if (otg_ctrl->id || otg_ctrl->a_bus_drop in mv_otg_update_state()
359 || otg_ctrl->a_wait_bcon_timeout) { in mv_otg_update_state()
361 mvotg->otg_ctrl.a_wait_bcon_timeout = 0; in mv_otg_update_state()
362 mvotg->phy.otg->state = OTG_STATE_A_WAIT_VFALL; in mv_otg_update_state()
363 otg_ctrl->a_bus_req = 0; in mv_otg_update_state()
364 } else if (!otg_ctrl->a_vbus_vld) { in mv_otg_update_state()
366 mvotg->otg_ctrl.a_wait_bcon_timeout = 0; in mv_otg_update_state()
367 mvotg->phy.otg->state = OTG_STATE_A_VBUS_ERR; in mv_otg_update_state()
368 } else if (otg_ctrl->b_conn) { in mv_otg_update_state()
370 mvotg->otg_ctrl.a_wait_bcon_timeout = 0; in mv_otg_update_state()
371 mvotg->phy.otg->state = OTG_STATE_A_HOST; in mv_otg_update_state()
375 if (otg_ctrl->id || !otg_ctrl->b_conn in mv_otg_update_state()
376 || otg_ctrl->a_bus_drop) in mv_otg_update_state()
377 mvotg->phy.otg->state = OTG_STATE_A_WAIT_BCON; in mv_otg_update_state()
378 else if (!otg_ctrl->a_vbus_vld) in mv_otg_update_state()
379 mvotg->phy.otg->state = OTG_STATE_A_VBUS_ERR; in mv_otg_update_state()
382 if (otg_ctrl->id in mv_otg_update_state()
383 || (!otg_ctrl->b_conn && otg_ctrl->a_sess_vld) in mv_otg_update_state()
384 || otg_ctrl->a_bus_req) in mv_otg_update_state()
385 mvotg->phy.otg->state = OTG_STATE_A_IDLE; in mv_otg_update_state()
388 if (otg_ctrl->id || otg_ctrl->a_clr_err in mv_otg_update_state()
389 || otg_ctrl->a_bus_drop) { in mv_otg_update_state()
390 otg_ctrl->a_clr_err = 0; in mv_otg_update_state()
391 mvotg->phy.otg->state = OTG_STATE_A_WAIT_VFALL; in mv_otg_update_state()
402 struct usb_otg *otg; in mv_otg_work() local
409 otg = mvotg->phy.otg; in mv_otg_work()
410 old_state = otg->state; in mv_otg_work()
412 if (!mvotg->active) in mv_otg_work()
418 if (old_state != mvotg->phy.otg->state) { in mv_otg_work()
419 dev_info(&mvotg->pdev->dev, "change from state %s to %s\n", in mv_otg_work()
421 state_string[mvotg->phy.otg->state]); in mv_otg_work()
423 switch (mvotg->phy.otg->state) { in mv_otg_work()
425 otg->default_a = 0; in mv_otg_work()
430 usb_phy_set_event(&mvotg->phy, USB_EVENT_NONE); in mv_otg_work()
435 usb_phy_set_event(&mvotg->phy, USB_EVENT_ENUMERATED); in mv_otg_work()
438 otg->default_a = 1; in mv_otg_work()
445 mv_otg_set_vbus(otg, 1); in mv_otg_work()
456 mvotg->otg_ctrl.b_conn = 1; in mv_otg_work()
465 mvotg->otg_ctrl.b_conn = 0; in mv_otg_work()
466 mv_otg_set_vbus(otg, 0); in mv_otg_work()
482 otgsc = readl(&mvotg->op_regs->otgsc); in mv_otg_irq()
483 writel(otgsc, &mvotg->op_regs->otgsc); in mv_otg_irq()
486 * if we have vbus, then the vbus detection for B-device in mv_otg_irq()
489 if (mvotg->pdata->vbus) in mv_otg_irq()
494 if ((otgsc & mvotg->irq_status) == 0) in mv_otg_irq()
507 if (!mvotg->active) { in mv_otg_inputs_irq()
522 mvotg->otg_ctrl.a_bus_req); in a_bus_req_show()
532 return -1; in a_bus_req_store()
535 if (mvotg->phy.otg->state != OTG_STATE_B_IDLE in a_bus_req_store()
536 && mvotg->phy.otg->state != OTG_STATE_A_IDLE) in a_bus_req_store()
537 return -1; in a_bus_req_store()
539 /* The clock may disabled and we need to set irq for ID detected */ in a_bus_req_store()
544 mvotg->otg_ctrl.a_bus_req = 1; in a_bus_req_store()
545 mvotg->otg_ctrl.a_bus_drop = 0; in a_bus_req_store()
546 dev_dbg(&mvotg->pdev->dev, in a_bus_req_store()
549 if (spin_trylock(&mvotg->wq_lock)) { in a_bus_req_store()
551 spin_unlock(&mvotg->wq_lock); in a_bus_req_store()
565 if (!mvotg->phy.otg->default_a) in a_clr_err_store()
566 return -1; in a_clr_err_store()
569 return -1; in a_clr_err_store()
572 mvotg->otg_ctrl.a_clr_err = 1; in a_clr_err_store()
573 dev_dbg(&mvotg->pdev->dev, in a_clr_err_store()
577 if (spin_trylock(&mvotg->wq_lock)) { in a_clr_err_store()
579 spin_unlock(&mvotg->wq_lock); in a_clr_err_store()
593 mvotg->otg_ctrl.a_bus_drop); in a_bus_drop_show()
601 if (!mvotg->phy.otg->default_a) in a_bus_drop_store()
602 return -1; in a_bus_drop_store()
605 return -1; in a_bus_drop_store()
608 mvotg->otg_ctrl.a_bus_drop = 0; in a_bus_drop_store()
609 dev_dbg(&mvotg->pdev->dev, in a_bus_drop_store()
612 mvotg->otg_ctrl.a_bus_drop = 1; in a_bus_drop_store()
613 mvotg->otg_ctrl.a_bus_req = 0; in a_bus_drop_store()
614 dev_dbg(&mvotg->pdev->dev, in a_bus_drop_store()
616 dev_dbg(&mvotg->pdev->dev, in a_bus_drop_store()
620 if (spin_trylock(&mvotg->wq_lock)) { in a_bus_drop_store()
622 spin_unlock(&mvotg->wq_lock); in a_bus_drop_store()
651 if (mvotg->qwork) in mv_otg_remove()
652 destroy_workqueue(mvotg->qwork); in mv_otg_remove()
656 usb_remove_phy(&mvotg->phy); in mv_otg_remove()
661 struct mv_usb_platform_data *pdata = dev_get_platdata(&pdev->dev); in mv_otg_probe()
663 struct usb_otg *otg; in mv_otg_probe() local
668 dev_err(&pdev->dev, "failed to get platform data\n"); in mv_otg_probe()
669 return -ENODEV; in mv_otg_probe()
672 mvotg = devm_kzalloc(&pdev->dev, sizeof(*mvotg), GFP_KERNEL); in mv_otg_probe()
674 return -ENOMEM; in mv_otg_probe()
676 otg = devm_kzalloc(&pdev->dev, sizeof(*otg), GFP_KERNEL); in mv_otg_probe()
677 if (!otg) in mv_otg_probe()
678 return -ENOMEM; in mv_otg_probe()
682 mvotg->pdev = pdev; in mv_otg_probe()
683 mvotg->pdata = pdata; in mv_otg_probe()
685 mvotg->clk = devm_clk_get(&pdev->dev, NULL); in mv_otg_probe()
686 if (IS_ERR(mvotg->clk)) in mv_otg_probe()
687 return PTR_ERR(mvotg->clk); in mv_otg_probe()
689 mvotg->qwork = create_singlethread_workqueue("mv_otg_queue"); in mv_otg_probe()
690 if (!mvotg->qwork) { in mv_otg_probe()
691 dev_dbg(&pdev->dev, "cannot create workqueue for OTG\n"); in mv_otg_probe()
692 return -ENOMEM; in mv_otg_probe()
695 INIT_DELAYED_WORK(&mvotg->work, mv_otg_work); in mv_otg_probe()
697 /* OTG common part */ in mv_otg_probe()
698 mvotg->pdev = pdev; in mv_otg_probe()
699 mvotg->phy.dev = &pdev->dev; in mv_otg_probe()
700 mvotg->phy.otg = otg; in mv_otg_probe()
701 mvotg->phy.label = driver_name; in mv_otg_probe()
703 otg->state = OTG_STATE_UNDEFINED; in mv_otg_probe()
704 otg->usb_phy = &mvotg->phy; in mv_otg_probe()
705 otg->set_host = mv_otg_set_host; in mv_otg_probe()
706 otg->set_peripheral = mv_otg_set_peripheral; in mv_otg_probe()
707 otg->set_vbus = mv_otg_set_vbus; in mv_otg_probe()
710 timer_setup(&mvotg->otg_ctrl.timer[i], in mv_otg_probe()
713 r = platform_get_resource_byname(mvotg->pdev, in mv_otg_probe()
716 dev_err(&pdev->dev, "no phy I/O memory resource defined\n"); in mv_otg_probe()
717 retval = -ENODEV; in mv_otg_probe()
721 mvotg->phy_regs = devm_ioremap(&pdev->dev, r->start, resource_size(r)); in mv_otg_probe()
722 if (mvotg->phy_regs == NULL) { in mv_otg_probe()
723 dev_err(&pdev->dev, "failed to map phy I/O memory\n"); in mv_otg_probe()
724 retval = -EFAULT; in mv_otg_probe()
728 r = platform_get_resource_byname(mvotg->pdev, in mv_otg_probe()
731 dev_err(&pdev->dev, "no I/O memory resource defined\n"); in mv_otg_probe()
732 retval = -ENODEV; in mv_otg_probe()
736 mvotg->cap_regs = devm_ioremap(&pdev->dev, r->start, resource_size(r)); in mv_otg_probe()
737 if (mvotg->cap_regs == NULL) { in mv_otg_probe()
738 dev_err(&pdev->dev, "failed to map I/O memory\n"); in mv_otg_probe()
739 retval = -EFAULT; in mv_otg_probe()
746 dev_err(&pdev->dev, "mv otg enable error %d\n", retval); in mv_otg_probe()
750 mvotg->op_regs = in mv_otg_probe()
751 (struct mv_otg_regs __iomem *) ((unsigned long) mvotg->cap_regs in mv_otg_probe()
752 + (readl(mvotg->cap_regs) & CAPLENGTH_MASK)); in mv_otg_probe()
754 if (pdata->id) { in mv_otg_probe()
755 retval = devm_request_threaded_irq(&pdev->dev, pdata->id->irq, in mv_otg_probe()
757 IRQF_ONESHOT, "id", mvotg); in mv_otg_probe()
759 dev_info(&pdev->dev, in mv_otg_probe()
760 "Failed to request irq for ID\n"); in mv_otg_probe()
761 pdata->id = NULL; in mv_otg_probe()
765 if (pdata->vbus) { in mv_otg_probe()
766 mvotg->clock_gating = 1; in mv_otg_probe()
767 retval = devm_request_threaded_irq(&pdev->dev, pdata->vbus->irq, in mv_otg_probe()
771 dev_info(&pdev->dev, in mv_otg_probe()
774 mvotg->clock_gating = 0; in mv_otg_probe()
775 pdata->vbus = NULL; in mv_otg_probe()
779 if (pdata->disable_otg_clock_gating) in mv_otg_probe()
780 mvotg->clock_gating = 0; in mv_otg_probe()
785 r = platform_get_resource(mvotg->pdev, IORESOURCE_IRQ, 0); in mv_otg_probe()
787 dev_err(&pdev->dev, "no IRQ resource defined\n"); in mv_otg_probe()
788 retval = -ENODEV; in mv_otg_probe()
792 mvotg->irq = r->start; in mv_otg_probe()
793 if (devm_request_irq(&pdev->dev, mvotg->irq, mv_otg_irq, IRQF_SHARED, in mv_otg_probe()
795 dev_err(&pdev->dev, "Request irq %d for OTG failed\n", in mv_otg_probe()
796 mvotg->irq); in mv_otg_probe()
797 mvotg->irq = 0; in mv_otg_probe()
798 retval = -ENODEV; in mv_otg_probe()
802 retval = usb_add_phy(&mvotg->phy, USB_PHY_TYPE_USB2); in mv_otg_probe()
804 dev_err(&pdev->dev, "can't register transceiver, %d\n", in mv_otg_probe()
809 spin_lock_init(&mvotg->wq_lock); in mv_otg_probe()
810 if (spin_trylock(&mvotg->wq_lock)) { in mv_otg_probe()
812 spin_unlock(&mvotg->wq_lock); in mv_otg_probe()
815 dev_info(&pdev->dev, in mv_otg_probe()
816 "successful probe OTG device %s clock gating.\n", in mv_otg_probe()
817 mvotg->clock_gating ? "with" : "without"); in mv_otg_probe()
824 destroy_workqueue(mvotg->qwork); in mv_otg_probe()
834 if (mvotg->phy.otg->state != OTG_STATE_B_IDLE) { in mv_otg_suspend()
835 dev_info(&pdev->dev, in mv_otg_suspend()
836 "OTG state is not B_IDLE, it is %d!\n", in mv_otg_suspend()
837 mvotg->phy.otg->state); in mv_otg_suspend()
838 return -EAGAIN; in mv_otg_suspend()
841 if (!mvotg->clock_gating) in mv_otg_suspend()
852 if (!mvotg->clock_gating) { in mv_otg_resume()
855 otgsc = readl(&mvotg->op_regs->otgsc); in mv_otg_resume()
856 otgsc |= mvotg->irq_en; in mv_otg_resume()
857 writel(otgsc, &mvotg->op_regs->otgsc); in mv_otg_resume()
859 if (spin_trylock(&mvotg->wq_lock)) { in mv_otg_resume()
861 spin_unlock(&mvotg->wq_lock); in mv_otg_resume()