Lines Matching refs:otg
57 static int mv_otg_set_vbus(struct usb_otg *otg, bool on) in mv_otg_set_vbus() argument
59 struct mv_otg *mvotg = container_of(otg->usb_phy, struct mv_otg, phy); in mv_otg_set_vbus()
66 static int mv_otg_set_host(struct usb_otg *otg, in mv_otg_set_host() argument
69 otg->host = host; in mv_otg_set_host()
74 static int mv_otg_set_peripheral(struct usb_otg *otg, in mv_otg_set_peripheral() argument
77 otg->gadget = gadget; in mv_otg_set_peripheral()
205 struct usb_otg *otg = mvotg->phy.otg; in mv_otg_start_host() local
208 if (!otg->host) in mv_otg_start_host()
213 hcd = bus_to_hcd(otg->host); in mv_otg_start_host()
226 struct usb_otg *otg = mvotg->phy.otg; in mv_otg_start_periphrals() local
228 if (!otg->gadget) in mv_otg_start_periphrals()
234 usb_gadget_vbus_connect(otg->gadget); in mv_otg_start_periphrals()
236 usb_gadget_vbus_disconnect(otg->gadget); in mv_otg_start_periphrals()
341 int old_state = mvotg->phy.otg->state; in mv_otg_update_state()
345 mvotg->phy.otg->state = OTG_STATE_B_IDLE; in mv_otg_update_state()
349 mvotg->phy.otg->state = OTG_STATE_A_IDLE; in mv_otg_update_state()
351 mvotg->phy.otg->state = OTG_STATE_B_PERIPHERAL; in mv_otg_update_state()
355 mvotg->phy.otg->state = OTG_STATE_B_IDLE; in mv_otg_update_state()
359 mvotg->phy.otg->state = OTG_STATE_B_IDLE; in mv_otg_update_state()
362 mvotg->phy.otg->state = OTG_STATE_A_WAIT_VRISE; in mv_otg_update_state()
366 mvotg->phy.otg->state = OTG_STATE_A_WAIT_BCON; in mv_otg_update_state()
373 mvotg->phy.otg->state = OTG_STATE_A_WAIT_VFALL; in mv_otg_update_state()
378 mvotg->phy.otg->state = OTG_STATE_A_VBUS_ERR; in mv_otg_update_state()
382 mvotg->phy.otg->state = OTG_STATE_A_HOST; in mv_otg_update_state()
388 mvotg->phy.otg->state = OTG_STATE_A_WAIT_BCON; in mv_otg_update_state()
390 mvotg->phy.otg->state = OTG_STATE_A_VBUS_ERR; in mv_otg_update_state()
396 mvotg->phy.otg->state = OTG_STATE_A_IDLE; in mv_otg_update_state()
402 mvotg->phy.otg->state = OTG_STATE_A_WAIT_VFALL; in mv_otg_update_state()
414 struct usb_otg *otg; in mv_otg_work() local
422 otg = mvotg->phy.otg; in mv_otg_work()
423 old_state = otg->state; in mv_otg_work()
431 if (old_state != mvotg->phy.otg->state) { in mv_otg_work()
434 state_string[mvotg->phy.otg->state]); in mv_otg_work()
436 switch (mvotg->phy.otg->state) { in mv_otg_work()
438 otg->default_a = 0; in mv_otg_work()
451 otg->default_a = 1; in mv_otg_work()
458 mv_otg_set_vbus(otg, 1); in mv_otg_work()
480 mv_otg_set_vbus(otg, 0); in mv_otg_work()
549 if (mvotg->phy.otg->state != OTG_STATE_B_IDLE in set_a_bus_req()
550 && mvotg->phy.otg->state != OTG_STATE_A_IDLE) in set_a_bus_req()
580 if (!mvotg->phy.otg->default_a) in set_a_clr_err()
616 if (!mvotg->phy.otg->default_a) in set_a_bus_drop()
680 struct usb_otg *otg; in mv_otg_probe() local
693 otg = devm_kzalloc(&pdev->dev, sizeof(*otg), GFP_KERNEL); in mv_otg_probe()
694 if (!otg) in mv_otg_probe()
717 mvotg->phy.otg = otg; in mv_otg_probe()
720 otg->state = OTG_STATE_UNDEFINED; in mv_otg_probe()
721 otg->usb_phy = &mvotg->phy; in mv_otg_probe()
722 otg->set_host = mv_otg_set_host; in mv_otg_probe()
723 otg->set_peripheral = mv_otg_set_peripheral; in mv_otg_probe()
724 otg->set_vbus = mv_otg_set_vbus; in mv_otg_probe()
860 if (mvotg->phy.otg->state != OTG_STATE_B_IDLE) { in mv_otg_suspend()
863 mvotg->phy.otg->state); in mv_otg_suspend()