Lines Matching full:otg

22 #include <linux/usb/otg.h>
29 #define DRIVER_DESC "Marvell USB OTG transceiver driver"
34 static const char driver_name[] = "mv-otg";
53 static int mv_otg_set_vbus(struct usb_otg *otg, bool on) in mv_otg_set_vbus() argument
55 struct mv_otg *mvotg = container_of(otg->usb_phy, struct mv_otg, phy); in mv_otg_set_vbus()
62 static int mv_otg_set_host(struct usb_otg *otg, in mv_otg_set_host() argument
65 otg->host = host; in mv_otg_set_host()
70 static int mv_otg_set_peripheral(struct usb_otg *otg, in mv_otg_set_peripheral() argument
73 otg->gadget = gadget; in mv_otg_set_peripheral()
195 struct usb_otg *otg = mvotg->phy.otg; in mv_otg_start_host() local
198 if (!otg->host) in mv_otg_start_host()
203 hcd = bus_to_hcd(otg->host); in mv_otg_start_host()
216 struct usb_otg *otg = mvotg->phy.otg; in mv_otg_start_periphrals() local
218 if (!otg->gadget) in mv_otg_start_periphrals()
224 usb_gadget_vbus_connect(otg->gadget); in mv_otg_start_periphrals()
226 usb_gadget_vbus_disconnect(otg->gadget); in mv_otg_start_periphrals()
246 dev_dbg(&mvotg->pdev->dev, "otg enabled\n"); in mv_otg_enable_internal()
275 dev_dbg(&mvotg->pdev->dev, "otg disabled\n"); in mv_otg_disable_internal()
331 int old_state = mvotg->phy.otg->state; in mv_otg_update_state()
335 mvotg->phy.otg->state = OTG_STATE_B_IDLE; in mv_otg_update_state()
339 mvotg->phy.otg->state = OTG_STATE_A_IDLE; in mv_otg_update_state()
341 mvotg->phy.otg->state = OTG_STATE_B_PERIPHERAL; 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_B_IDLE; in mv_otg_update_state()
352 mvotg->phy.otg->state = OTG_STATE_A_WAIT_VRISE; in mv_otg_update_state()
356 mvotg->phy.otg->state = OTG_STATE_A_WAIT_BCON; in mv_otg_update_state()
363 mvotg->phy.otg->state = OTG_STATE_A_WAIT_VFALL; in mv_otg_update_state()
368 mvotg->phy.otg->state = OTG_STATE_A_VBUS_ERR; in mv_otg_update_state()
372 mvotg->phy.otg->state = OTG_STATE_A_HOST; in mv_otg_update_state()
378 mvotg->phy.otg->state = OTG_STATE_A_WAIT_BCON; in mv_otg_update_state()
380 mvotg->phy.otg->state = OTG_STATE_A_VBUS_ERR; in mv_otg_update_state()
386 mvotg->phy.otg->state = OTG_STATE_A_IDLE; in mv_otg_update_state()
392 mvotg->phy.otg->state = OTG_STATE_A_WAIT_VFALL; in mv_otg_update_state()
403 struct usb_otg *otg; in mv_otg_work() local
410 otg = mvotg->phy.otg; in mv_otg_work()
411 old_state = otg->state; in mv_otg_work()
419 if (old_state != mvotg->phy.otg->state) { in mv_otg_work()
422 state_string[mvotg->phy.otg->state]); in mv_otg_work()
424 switch (mvotg->phy.otg->state) { in mv_otg_work()
426 otg->default_a = 0; in mv_otg_work()
439 otg->default_a = 1; in mv_otg_work()
446 mv_otg_set_vbus(otg, 1); in mv_otg_work()
467 mv_otg_set_vbus(otg, 0); in mv_otg_work()
536 if (mvotg->phy.otg->state != OTG_STATE_B_IDLE in a_bus_req_store()
537 && mvotg->phy.otg->state != OTG_STATE_A_IDLE) in a_bus_req_store()
566 if (!mvotg->phy.otg->default_a) in a_clr_err_store()
602 if (!mvotg->phy.otg->default_a) in a_bus_drop_store()
664 struct usb_otg *otg; in mv_otg_probe() local
677 otg = devm_kzalloc(&pdev->dev, sizeof(*otg), GFP_KERNEL); in mv_otg_probe()
678 if (!otg) in mv_otg_probe()
692 dev_dbg(&pdev->dev, "cannot create workqueue for OTG\n"); in mv_otg_probe()
698 /* OTG common part */ in mv_otg_probe()
701 mvotg->phy.otg = otg; in mv_otg_probe()
704 otg->state = OTG_STATE_UNDEFINED; in mv_otg_probe()
705 otg->usb_phy = &mvotg->phy; in mv_otg_probe()
706 otg->set_host = mv_otg_set_host; in mv_otg_probe()
707 otg->set_peripheral = mv_otg_set_peripheral; in mv_otg_probe()
708 otg->set_vbus = mv_otg_set_vbus; in mv_otg_probe()
747 dev_err(&pdev->dev, "mv otg enable error %d\n", retval); in mv_otg_probe()
796 dev_err(&pdev->dev, "Request irq %d for OTG failed\n", in mv_otg_probe()
817 "successful probe OTG device %s clock gating.\n", in mv_otg_probe()
835 if (mvotg->phy.otg->state != OTG_STATE_B_IDLE) { in mv_otg_suspend()
837 "OTG state is not B_IDLE, it is %d!\n", in mv_otg_suspend()
838 mvotg->phy.otg->state); in mv_otg_suspend()